2013-02-27 19:14:55 +08:00
|
|
|
// Test sanitizers ld flags.
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux -fsanitize=address \
|
2013-03-23 08:30:08 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-LINUX: libclang_rt.asan-i386.a"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-LINUX-NOT: "-export-dynamic"
|
|
|
|
// CHECK-ASAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan-i386.a.syms"
|
|
|
|
// CHECK-ASAN-LINUX-NOT: "-export-dynamic"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX: "-lpthread"
|
2013-05-24 22:28:03 +08:00
|
|
|
// CHECK-ASAN-LINUX: "-lrt"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX: "-ldl"
|
|
|
|
|
2014-04-01 21:31:10 +08:00
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
|
|
|
|
//
|
|
|
|
// CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
|
2014-08-27 17:46:54 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-preinit-i386.a" "-no-whole-archive"
|
2014-04-01 21:31:10 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
|
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
|
|
|
|
//
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
|
2014-08-27 17:46:54 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
|
2014-04-01 21:31:10 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit-i386.a"
|
2014-08-27 17:46:54 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
|
2014-04-01 21:31:10 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
|
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2014-03-18 17:36:50 +08:00
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-freebsd -fsanitize=address \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-FREEBSD-NOT: "-lc"
|
2014-05-13 02:39:51 +08:00
|
|
|
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
|
2014-03-18 18:47:10 +08:00
|
|
|
// CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan-i386.a"
|
2014-05-13 02:39:51 +08:00
|
|
|
// CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
|
|
|
|
// CHECK-ASAN-FREEBSD: "-export-dynamic"
|
2014-03-18 17:36:50 +08:00
|
|
|
// CHECK-ASAN-FREEBSD: "-lpthread"
|
|
|
|
// CHECK-ASAN-FREEBSD: "-lrt"
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-freebsd -fsanitize=address \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
|
|
|
|
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target i386-unknown-linux -stdlib=platform -fsanitize=address \
|
2013-03-23 08:30:08 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/empty_resource_dir \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "-no-whole-archive"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
|
|
|
|
// CHECK-ASAN-LINUX-CXX: "-export-dynamic"
|
|
|
|
// CHECK-ASAN-LINUX-CXX: stdc++
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "-lpthread"
|
2013-05-24 22:28:03 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "-lrt"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "-ldl"
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target i386-unknown-linux -stdlib=platform \
|
2016-02-12 15:48:28 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
|
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
|
|
|
|
|
2014-01-31 20:21:55 +08:00
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target arm-linux-gnueabi -fsanitize=address \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ARM-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-ARM: libclang_rt.asan-arm.a"
|
|
|
|
//
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target armv7l-linux-gnueabi -fsanitize=address \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ARMv7-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a"
|
|
|
|
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target arm-linux-androideabi -fsanitize=address \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lc"
|
2014-02-25 21:26:03 +08:00
|
|
|
// CHECK-ASAN-ANDROID: "-pie"
|
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so"
|
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
|
2013-02-27 19:14:55 +08:00
|
|
|
//
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
2014-06-05 19:14:00 +08:00
|
|
|
// RUN: -target arm-linux-androideabi -fsanitize=address \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -shared-libasan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libasan'
|
|
|
|
//
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: -target arm-linux-androideabi -fsanitize=address \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
|
|
|
|
//
|
|
|
|
// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
|
2014-08-27 17:46:54 +08:00
|
|
|
// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
|
|
|
|
|
|
|
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target x86_64-unknown-linux -stdlib=platform -lstdc++ \
|
2016-02-12 15:48:28 +08:00
|
|
|
// RUN: -fsanitize=thread \
|
2013-03-23 08:30:08 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s
|
|
|
|
//
|
|
|
|
// CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-TSAN-LINUX-CXX-NOT: stdc++
|
|
|
|
// CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive"
|
2013-03-23 08:30:08 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms"
|
2015-04-28 06:07:50 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "-no-whole-archive"
|
|
|
|
// CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: stdc++
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "-lpthread"
|
|
|
|
// CHECK-TSAN-LINUX-CXX: "-lrt"
|
|
|
|
// CHECK-TSAN-LINUX-CXX: "-ldl"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
|
|
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target x86_64-unknown-linux -stdlib=platform -lstdc++ \
|
2016-02-12 15:48:28 +08:00
|
|
|
// RUN: -fsanitize=memory \
|
2013-03-23 08:30:08 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s
|
|
|
|
//
|
|
|
|
// CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-MSAN-LINUX-CXX-NOT: stdc++
|
|
|
|
// CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive"
|
2013-03-23 08:30:08 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms"
|
2015-04-28 06:07:50 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "-no-whole-archive"
|
|
|
|
// CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: stdc++
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "-lpthread"
|
|
|
|
// CHECK-MSAN-LINUX-CXX: "-lrt"
|
|
|
|
// CHECK-MSAN-LINUX-CXX: "-ldl"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
|
|
|
|
// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2013-03-21 07:49:07 +08:00
|
|
|
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
|
|
|
|
// CHECK-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive"
|
2014-08-19 06:10:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
|
2013-03-21 07:49:07 +08:00
|
|
|
// CHECK-UBSAN-LINUX-NOT: "-lstdc++"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-UBSAN-LINUX: "-lpthread"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
2014-08-09 06:47:17 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
|
|
|
|
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-LINK-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive"
|
2014-08-09 06:47:17 +08:00
|
|
|
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
|
|
|
|
|
2013-03-21 07:49:07 +08:00
|
|
|
// RUN: %clangxx -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target i386-unknown-linux -stdlib=platform \
|
2014-06-05 07:28:46 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-03-21 07:49:07 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive"
|
2014-08-19 06:10:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive"
|
2014-08-19 06:10:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
|
2013-03-21 07:49:07 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX: "-lstdc++"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
|
|
|
|
// CHECK-UBSAN-LINUX-CXX: "-lpthread"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
2015-04-02 06:42:25 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan
|
2013-03-21 07:49:07 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX: "-lpthread"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
|
|
|
// RUN: %clangxx -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target i386-unknown-linux -stdlib=platform \
|
2013-03-21 07:49:07 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
2015-04-02 06:42:25 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "-no-whole-archive"
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
|
2013-03-21 07:49:07 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
|
Major rewrite of linking strategy for sanitizer runtimes on Linux.
Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.
Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.
Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.
llvm-svn: 217817
2014-09-16 03:58:40 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2015-04-28 08:56:36 +08:00
|
|
|
// RUN: %clangxx -fsanitize=memory,undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive"
|
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
|
|
|
|
|
|
|
|
// RUN: %clangxx -fsanitize=thread,undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive"
|
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
|
|
|
|
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i386-unknown-linux \
|
2014-06-05 07:28:46 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s
|
|
|
|
// CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
|
2014-06-05 07:28:46 +08:00
|
|
|
// CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic
|
|
|
|
// CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
|
2015-03-24 04:05:42 +08:00
|
|
|
// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
|
2013-05-27 19:17:01 +08:00
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux -fsanitize=leak \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
|
|
|
|
//
|
|
|
|
// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-LSAN-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a"
|
|
|
|
// CHECK-LSAN-LINUX: "-lpthread"
|
|
|
|
// CHECK-LSAN-LINUX: "-ldl"
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s
|
|
|
|
// CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
|
|
|
|
// CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64
|
|
|
|
// CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
|
2015-04-10 02:47:01 +08:00
|
|
|
|
2015-12-16 07:00:20 +08:00
|
|
|
// CFI by itself does not link runtime libraries.
|
|
|
|
// RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s
|
|
|
|
// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-CFI-LINUX-NOT: libclang_rt.
|
|
|
|
|
|
|
|
// CFI with diagnostics links the UBSan runtime.
|
|
|
|
// RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
|
|
|
|
// RUN: %s -### -o %t.o 2>&1\
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
|
|
|
|
// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2015-12-17 06:03:39 +08:00
|
|
|
// CHECK-CFI-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" "-no-whole-archive"
|
2015-12-16 07:00:20 +08:00
|
|
|
|
|
|
|
// Cross-DSO CFI links the CFI runtime.
|
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
|
|
|
|
// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2015-12-17 06:03:39 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "-no-whole-archive"
|
2015-12-16 07:00:20 +08:00
|
|
|
|
|
|
|
// Cross-DSO CFI with diagnostics links just the CFI runtime.
|
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
|
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2015-12-17 06:03:39 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "-no-whole-archive"
|
2015-12-16 07:00:20 +08:00
|
|
|
|
2015-04-10 15:43:19 +08:00
|
|
|
// RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \
|
2015-04-10 02:47:01 +08:00
|
|
|
// RUN: -mmacosx-version-min=10.6 \
|
2016-03-14 22:34:10 +08:00
|
|
|
// RUN: -target x86_64-apple-darwin13.4.0 -stdlib=platform \
|
2015-04-10 04:37:38 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
2015-04-10 02:47:01 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s
|
|
|
|
// CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
|
|
|
|
// CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
|
2015-10-13 07:50:19 +08:00
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux -fsanitize=safe-stack \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
|
|
|
|
//
|
|
|
|
// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a"
|
|
|
|
// CHECK-SAFESTACK-LINUX: "-lpthread"
|
|
|
|
// CHECK-SAFESTACK-LINUX: "-ldl"
|
|
|
|
|
2016-01-16 08:31:22 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-unknown-linux \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
|
|
|
|
// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-CFI-STATS-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.stats_client-x86_64.a" "-no-whole-archive"
|
|
|
|
// CHECK-CFI-STATS-LINUX-NOT: "-whole-archive"
|
|
|
|
// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats-x86_64.a"
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-apple-darwin \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
|
|
|
|
// CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_client_osx.a"
|
|
|
|
// CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_osx_dynamic.dylib"
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-pc-windows \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 %s
|
|
|
|
// CHECK-CFI-STATS-WIN64: "--dependent-lib={{[^"]*}}clang_rt.stats_client-x86_64.lib"
|
|
|
|
// CHECK-CFI-STATS-WIN64: "--dependent-lib={{[^"]*}}clang_rt.stats-x86_64.lib"
|
|
|
|
// CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target i686-pc-windows \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
|
|
|
|
// CHECK-CFI-STATS-WIN32: "--dependent-lib={{[^"]*}}clang_rt.stats_client-i386.lib"
|
|
|
|
// CHECK-CFI-STATS-WIN32: "--dependent-lib={{[^"]*}}clang_rt.stats-i386.lib"
|
|
|
|
// CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
|
|
|
|
|
2015-10-13 07:50:19 +08:00
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
|
|
|
|
//
|
|
|
|
// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
|
|
|
|
// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
|
|
|
|
//
|
|
|
|
// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
|
|
|
|
|
|
|
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target aarch64-linux-android -fsanitize=safe-stack \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
|
|
|
|
//
|
|
|
|
// CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
|
2015-10-16 23:08:01 +08:00
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-scei-ps4 \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
|
2015-12-17 04:18:12 +08:00
|
|
|
// CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
2015-10-16 23:08:01 +08:00
|
|
|
// CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=address %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-scei-ps4 \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
|
2015-12-17 04:18:12 +08:00
|
|
|
// CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
2015-10-16 23:08:01 +08:00
|
|
|
// CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak
|
|
|
|
|
|
|
|
// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
|
|
|
|
// RUN: -target x86_64-scei-ps4 \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
|
2015-12-17 04:18:12 +08:00
|
|
|
// CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
2015-10-16 23:08:01 +08:00
|
|
|
// CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak
|