1 | // Make sure ASan removes the runtime library from DYLD_INSERT_LIBRARIES before |
2 | // executing other programs. |
3 | |
4 | // RUN: %clangxx_asan %s -o %t |
5 | // RUN: %clangxx %p/../Helpers/echo-env.cpp -o %t-echo-env |
6 | // RUN: %clangxx -DSHARED_LIB %s \ |
7 | // RUN: -dynamiclib -o %t-darwin-dummy-shared-lib-so.dylib |
8 | |
9 | // Make sure DYLD_INSERT_LIBRARIES doesn't contain the runtime library before |
10 | // execl(). |
11 | |
12 | // RUN: %run %t %t-echo-env >/dev/null 2>&1 |
13 | // RUN: %env DYLD_INSERT_LIBRARIES=%t-darwin-dummy-shared-lib-so.dylib \ |
14 | // RUN: %run %t %t-echo-env 2>&1 | FileCheck %s || exit 1 |
15 | |
16 | // UNSUPPORTED: ios |
17 | |
18 | #if !defined(SHARED_LIB) |
19 | #include <unistd.h> |
20 | int main(int argc, char *argv[]) { |
21 | execl(path: argv[1], arg: argv[1], "DYLD_INSERT_LIBRARIES" , NULL); |
22 | // CHECK: {{DYLD_INSERT_LIBRARIES = .*darwin-dummy-shared-lib-so.dylib.*}} |
23 | return 0; |
24 | } |
25 | #else // SHARED_LIB |
26 | void foo() {} |
27 | #endif // SHARED_LIB |
28 | |