brintos

brintos / llvm-project-archived public Read only

0
0
Text · 878 B · a4fa047 Raw
28 lines · cpp
1// Make sure ASan removes the runtime library from DYLD_INSERT_LIBRARIES before2// executing other programs.3 4// RUN: %clangxx_asan %s -o %t5// RUN: %clangxx %p/../Helpers/echo-env.cpp -o %t-echo-env6// RUN: %clangxx -DSHARED_LIB %s \7// RUN:     -dynamiclib -o %t-darwin-dummy-shared-lib-so.dylib8 9// Make sure DYLD_INSERT_LIBRARIES doesn't contain the runtime library before10// execl().11 12// RUN: %run %t %t-echo-env >/dev/null 2>&113// RUN: %env DYLD_INSERT_LIBRARIES=%t-darwin-dummy-shared-lib-so.dylib \14// RUN:     %run %t %t-echo-env 2>&1 | FileCheck %s || exit 115 16// UNSUPPORTED: ios17 18#if !defined(SHARED_LIB)19#include <unistd.h>20int main(int argc, char *argv[]) {21  execl(argv[1], argv[1], "DYLD_INSERT_LIBRARIES", NULL);22  // CHECK:  {{DYLD_INSERT_LIBRARIES = .*darwin-dummy-shared-lib-so.dylib.*}}23  return 0;24}25#else  // SHARED_LIB26void foo() {}27#endif  // SHARED_LIB28