2013-02-27 19:14:55 +08:00
|
|
|
// Test sanitizers ld flags.
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-LINUX: libclang_rt.asan-i386.a"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-LINUX-NOT: "--export-dynamic"
|
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: "--dynamic-list={{.*}}libclang_rt.asan-i386.a.syms"
|
2018-02-06 08:50:18 +08:00
|
|
|
// 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-LINUX: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -fno-sanitize-link-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2019-08-05 06:24:14 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-01-06 01:14:40 +08:00
|
|
|
// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64
|
2019-08-05 06:24:14 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2022-01-26 08:57:40 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-EXECUTABLE-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-03-16 22:50:04 +08:00
|
|
|
// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan_static-x86_64
|
2022-01-26 08:57:40 +08:00
|
|
|
// CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan-x86_64
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -shared -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2022-01-26 08:57:40 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-03-16 22:50:04 +08:00
|
|
|
// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static-x86_64
|
2022-01-26 08:57:40 +08:00
|
|
|
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan-x86_64
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
|
2014-04-01 21:31:10 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: -shared-libsan -static-libsan -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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-04-01 21:31:10 +08:00
|
|
|
// 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"
|
2018-02-06 08:50:18 +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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "-lresolv"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
|
2014-04-01 21:31:10 +08:00
|
|
|
// CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -o %t.so -shared 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
|
2014-04-01 21:31:10 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-04-01 21:31:10 +08:00
|
|
|
// 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lresolv"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
|
2014-04-01 21:31:10 +08:00
|
|
|
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
|
2014-03-18 17:36:50 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-03-18 17:36:50 +08:00
|
|
|
// 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"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-FREEBSD: "--export-dynamic"
|
2014-03-18 17:36:50 +08:00
|
|
|
// CHECK-ASAN-FREEBSD: "-lpthread"
|
|
|
|
// CHECK-ASAN-FREEBSD: "-lrt"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
|
2014-03-18 17:36:50 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-03-18 17:36:50 +08:00
|
|
|
// CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-NOT: "-lc"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
|
|
|
|
// CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-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-NOT: "--dynamic-list"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "--export-dynamic"
|
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: 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -o /dev/null -fsanitize=address \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
|
2014-01-31 20:21:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-01-31 20:21:55 +08:00
|
|
|
// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ARM-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-ARM: libclang_rt.asan-arm.a"
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
|
2014-01-31 20:21:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2014-01-31 20:21:55 +08:00
|
|
|
// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ARMv7-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
2021-11-11 16:12:07 +08:00
|
|
|
// CHECK-ASAN-ANDROID: "-pie"
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lc"
|
2014-02-25 21:26:03 +08:00
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
|
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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-NOT: "-lresolv"
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -static-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
|
2018-06-27 00:14:35 +08:00
|
|
|
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
|
|
|
|
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
2021-11-11 16:12:07 +08:00
|
|
|
// CHECK-UBSAN-ANDROID: "-pie"
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-NOT: "-lc"
|
|
|
|
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone-arm-android.so"
|
|
|
|
// CHECK-UBSAN-ANDROID-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-NOT: "-lresolv"
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -static-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone-arm-android.a"
|
2018-06-27 00:14:35 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
|
|
|
|
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=i686-linux-android -fuse-ld=ld -fsanitize=address \
|
2017-08-30 06:12:31 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2017-08-30 06:12:31 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
2021-11-11 16:12:07 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86: "-pie"
|
2017-08-30 06:12:31 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
|
2017-08-30 06:12:31 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86: libclang_rt.asan-i686-android.so"
|
|
|
|
// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fsanitize=address \
|
2014-06-05 19:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: -shared-libsan \
|
2014-06-05 19:14:00 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2017-10-06 04:14:00 +08:00
|
|
|
// CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=sparcel-myriad-rtems-elf -fuse-ld=ld -fsanitize=address \
|
2016-09-10 02:20:49 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_myriad_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-MYRIAD %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2016-09-10 02:20:49 +08:00
|
|
|
// CHECK-ASAN-MYRIAD: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-ASAN-MYRIAD-NOT: "-lc"
|
|
|
|
// CHECK-ASAN-MYRIAD: libclang_rt.asan-sparcel.a"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-TSAN-LINUX-CXX-NOT: stdc++
|
2018-02-06 08:50:18 +08:00
|
|
|
// 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"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "--no-whole-archive"
|
2015-04-28 06:07:50 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms"
|
2018-02-06 08:50:18 +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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-TSAN-LINUX-CXX: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2019-08-05 06:24:14 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2019-08-05 06:24:14 +08:00
|
|
|
// CHECK-TSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.tsan
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -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
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-02-27 19:14:55 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-MSAN-LINUX-CXX-NOT: stdc++
|
2018-02-06 08:50:18 +08:00
|
|
|
// 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"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "--no-whole-archive"
|
2015-04-28 06:07:50 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms"
|
2018-02-06 08:50:18 +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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-MSAN-LINUX-CXX: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=memory -fno-sanitize-link-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2019-08-05 06:24:14 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-NO-LINK-RUNTIME-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2019-08-05 06:24:14 +08:00
|
|
|
// CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2021-07-16 03:52:25 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
|
2013-02-27 19:14:55 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
|
2019-07-10 08:30:02 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=float-divide-by-zero -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2021-07-16 03:52:25 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
|
2019-07-10 08:30:02 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
|
2017-10-06 04:14:00 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2021-07-16 03:52:25 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: -static-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
|
|
|
|
|
2013-02-27 19:14:55 +08:00
|
|
|
// 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
|
2021-07-16 03:52:25 +08:00
|
|
|
// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x32.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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-LINUX: "-lresolv"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2019-08-05 06:24:14 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2019-08-05 06:24:14 +08:00
|
|
|
// CHECK-UBSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.undefined
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: -shared-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: -static-libsan -shared-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-10-06 04:14:00 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: -shared -shared-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
|
|
|
|
|
|
|
|
// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone-i386.so{{.*}}"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2014-08-09 06:47:17 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
|
|
|
|
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
|
2018-02-06 08:50:18 +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++"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -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
|
2018-02-06 08:50:18 +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
|
2018-02-06 08:50:18 +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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-LINUX-CXX: "-lresolv"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-08-30 04:03:51 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
|
|
|
|
// CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal-i386.a" "--no-whole-archive"
|
2017-08-30 04:03:51 +08:00
|
|
|
// CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-MINIMAL-LINUX: "-lresolv"
|
2017-08-30 04:03:51 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
|
2017-09-12 05:37:06 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-DARWIN %s
|
|
|
|
// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
|
2017-10-07 09:42:09 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
|
|
|
|
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}libclang_rt.ubsan_osx.a"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +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-ASAN-UBSAN-LINUX %s
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX: "-lresolv"
|
2013-03-21 07:49:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
|
2021-04-27 17:15:37 +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-ASAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
|
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "--no-whole-archive"
|
2015-04-02 06:42:25 +08:00
|
|
|
// 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"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lresolv"
|
2013-02-27 19:14:55 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=memory,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-04-28 08:56:36 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
|
2015-04-28 08:56:36 +08:00
|
|
|
// CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=thread,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-04-28 08:56:36 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
|
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "--no-whole-archive"
|
2015-04-28 08:56:36 +08:00
|
|
|
// CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
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
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-05-27 19:17:01 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2013-05-27 19:17:01 +08:00
|
|
|
// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-LSAN-LINUX-NOT: "-lc"
|
2016-12-09 06:25:01 +08:00
|
|
|
// CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
|
2013-05-27 19:17:01 +08:00
|
|
|
// CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a"
|
|
|
|
// CHECK-LSAN-LINUX: "-lpthread"
|
|
|
|
// CHECK-LSAN-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-LSAN-LINUX: "-lresolv"
|
2013-05-27 19:17:01 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=leak -fno-sanitize-link-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2019-08-05 06:24:14 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-NO-LINK-RUNTIME-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2019-08-05 06:24:14 +08:00
|
|
|
// CHECK-LSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.lsan
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-12-09 06:25:01 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2016-12-09 06:25:01 +08:00
|
|
|
// CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-LSAN-COV-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
|
|
|
|
// CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a"
|
|
|
|
// CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
|
|
|
|
// CHECK-LSAN-COV-LINUX: "-lpthread"
|
|
|
|
// CHECK-LSAN-COV-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-LSAN-COV-LINUX: "-lresolv"
|
2016-12-09 06:25:01 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=leak,address -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2013-05-27 19:17:01 +08:00
|
|
|
// 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
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -fsanitize-coverage=func -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-06-16 07:05:21 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-COV-LINUX %s
|
|
|
|
// CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-ASAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-x86_64.a" "--no-whole-archive"
|
2016-06-16 07:05:21 +08:00
|
|
|
// CHECK-ASAN-COV-LINUX-NOT: libclang_rt.ubsan
|
|
|
|
// CHECK-ASAN-COV-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-ASAN-COV-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-ASAN-COV-LINUX: "-lresolv"
|
2016-06-16 07:05:21 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=memory -fsanitize-coverage=func -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-06-16 07:05:21 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-COV-LINUX %s
|
|
|
|
// CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-MSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
|
2016-06-16 07:05:21 +08:00
|
|
|
// CHECK-MSAN-COV-LINUX-NOT: libclang_rt.ubsan
|
|
|
|
// CHECK-MSAN-COV-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-MSAN-COV-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-MSAN-COV-LINUX: "-lresolv"
|
2016-06-16 07:05:21 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=dataflow -fsanitize-coverage=func -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-06-16 07:05:21 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
|
|
|
|
// CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan-x86_64.a" "--no-whole-archive"
|
2016-06-16 07:05:21 +08:00
|
|
|
// CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
|
|
|
|
// CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-DFSAN-COV-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-DFSAN-COV-LINUX: "-lresolv"
|
2016-06-16 07:05:21 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -fsanitize-coverage=func -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-06-16 07:05:21 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
|
|
|
|
// CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
|
2016-06-16 07:05:21 +08:00
|
|
|
// CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-UBSAN-COV-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-UBSAN-COV-LINUX: "-lresolv"
|
2016-06-16 07:05:21 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize-coverage=func -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-06-16 07:05:21 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
|
|
|
|
// CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
|
2016-06-16 07:05:21 +08:00
|
|
|
// CHECK-COV-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-COV-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-COV-LINUX: "-lresolv"
|
2016-06-16 07:05:21 +08:00
|
|
|
|
2015-12-16 07:00:20 +08:00
|
|
|
// CFI by itself does not link runtime libraries.
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-12-16 07:00:20 +08:00
|
|
|
// 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 \
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: -### %s 2>&1\
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-12-16 07:00:20 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
|
|
|
|
// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +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.
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-12-16 07:00:20 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
|
|
|
|
// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "--no-whole-archive"
|
2016-08-30 07:42:34 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
|
2015-12-16 07:00:20 +08:00
|
|
|
|
|
|
|
// Cross-DSO CFI with diagnostics links just the CFI runtime.
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
|
2015-12-16 07:00:20 +08:00
|
|
|
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-12-16 07:00:20 +08:00
|
|
|
// 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)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "--no-whole-archive"
|
2016-08-30 07:42:34 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
|
2015-12-16 07:00:20 +08:00
|
|
|
|
2017-10-17 02:02:57 +08:00
|
|
|
// Cross-DSO CFI on Android does not link runtime libraries.
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-10-17 02:02:57 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
|
|
|
|
// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
|
2018-03-20 08:56:08 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
|
2017-10-17 02:02:57 +08:00
|
|
|
|
|
|
|
// Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
|
2017-10-17 02:02:57 +08:00
|
|
|
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-10-17 02:02:57 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
|
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone-aarch64-android.so"
|
2020-05-24 06:46:28 +08:00
|
|
|
// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
|
2017-10-17 02:02:57 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=address -### %s 2>&1 \
|
2015-04-10 02:47:01 +08:00
|
|
|
// RUN: -mmacosx-version-min=10.6 \
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
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
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clangxx -fsanitize=leak -### %s 2>&1 \
|
2017-04-21 05:11:51 +08:00
|
|
|
// RUN: -mmacosx-version-min=10.6 \
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-04-21 05:11:51 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
|
|
|
|
// CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
|
|
|
|
// CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2015-10-13 07:50:19 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2015-10-13 07:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-LINUX-NOT: "-lc"
|
2017-02-07 11:21:57 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX-NOT: whole-archive
|
2015-10-13 07:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a"
|
2017-02-07 11:21:57 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
|
2015-10-13 07:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX: "-lpthread"
|
|
|
|
// CHECK-SAFESTACK-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-LINUX: "-lresolv"
|
2015-10-13 07:50:19 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2018-04-04 06:33:53 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86-64 %s
|
|
|
|
// CHECK-SHADOWCALLSTACK-LINUX-X86-64-NOT: error:
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld \
|
2018-04-05 05:55:44 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64 %s
|
|
|
|
// CHECK-SHADOWCALLSTACK-LINUX-AARCH64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=riscv32-unknown-elf -fuse-ld=ld \
|
2020-03-27 13:09:31 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-ELF-RISCV32 %s
|
|
|
|
// CHECK-SHADOWCALLSTACK-ELF-RISCV32: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=riscv64-unknown-linux -fuse-ld=ld \
|
2020-03-27 13:09:31 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-RISCV64 %s
|
|
|
|
// CHECK-SHADOWCALLSTACK-LINUX-RISCV64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -ffixed-x18 \
|
2018-04-05 05:55:44 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm64-unknown-ios -fuse-ld=ld \
|
2018-04-05 05:55:44 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux-android -fuse-ld=ld \
|
2018-08-29 09:38:47 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
|
2018-04-05 05:55:44 +08:00
|
|
|
// CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18-NOT: error:
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86-unknown-linux -fuse-ld=ld \
|
2018-04-04 06:33:53 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86 %s
|
|
|
|
// CHECK-SHADOWCALLSTACK-LINUX-X86: error: unsupported option '-fsanitize=shadow-call-stack' for target 'x86-unknown-linux'
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
|
|
|
|
// RUN: -fsanitize=safe-stack --target=x86_64-unknown-linux -fuse-ld=ld \
|
2018-04-04 06:33:53 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK %s
|
2018-11-20 09:01:49 +08:00
|
|
|
// CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error:
|
2018-04-04 06:33:53 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2016-01-16 08:31:22 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
|
|
|
|
// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client-x86_64.a" "--no-whole-archive"
|
|
|
|
// CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
|
2016-01-16 08:31:22 +08:00
|
|
|
// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats-x86_64.a"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
|
2016-01-16 08:31:22 +08:00
|
|
|
// 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"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-pc-windows \
|
2016-01-16 08:31:22 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 %s
|
2021-02-25 06:39:55 +08:00
|
|
|
// 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"
|
2016-01-16 08:31:22 +08:00
|
|
|
// CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
|
|
|
|
// RUN: --target=i686-pc-windows \
|
2016-01-16 08:31:22 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
|
2021-02-25 06:39:55 +08:00
|
|
|
// CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats_client{{(-i386)?}}.lib"
|
|
|
|
// CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats{{(-i386)?}}.lib"
|
2016-01-16 08:31:22 +08:00
|
|
|
// CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
|
2015-10-13 07:50:19 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2015-10-13 07:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -shared 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
|
2015-10-13 07:50:19 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
2016-08-30 07:15:46 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2015-10-13 07:50:19 +08:00
|
|
|
// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack \
|
2015-10-13 07:50:19 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2015-10-13 07:50:19 +08:00
|
|
|
// 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
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
|
2015-10-16 23:08:01 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
|
2018-06-06 22:04:15 +08:00
|
|
|
// CHECK-UBSAN-PS4: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
|
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
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
|
2022-04-28 04:45:15 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS5 %s
|
|
|
|
// CHECK-UBSAN-PS5: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
|
|
|
|
// CHECK-UBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
|
|
|
// CHECK-UBSAN-PS5: -lSceUBSanitizer_nosubmission_stub_weak
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
|
2015-10-16 23:08:01 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
|
2018-06-06 22:04:15 +08:00
|
|
|
// CHECK-ASAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
|
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
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
|
2022-04-28 04:45:15 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-PS5 %s
|
|
|
|
// CHECK-ASAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
|
|
|
|
// CHECK-ASAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
|
|
|
// CHECK-ASAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
|
2015-10-16 23:08:01 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
|
2018-06-06 22:04:15 +08:00
|
|
|
// CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
|
|
|
|
// CHECK-AUBSAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
|
|
|
|
// CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
|
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
|
2016-04-22 05:32:04 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
|
2022-04-28 04:45:15 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS5 %s
|
|
|
|
// CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
|
|
|
|
// CHECK-AUBSAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
|
|
|
|
// CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
|
|
|
|
// CHECK-AUBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
|
|
|
|
// CHECK-AUBSAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
|
2018-12-19 01:03:35 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: -nostdlib \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS4 %s
|
|
|
|
// CHECK-NOLIB-PS4-NOT: SceDbgAddressSanitizer_stub_weak
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
|
2022-04-28 04:45:15 +08:00
|
|
|
// RUN: -shared \
|
|
|
|
// RUN: -nostdlib \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS5 %s
|
|
|
|
// CHECK-NOLIB-PS5-NOT: SceAddressSanitizer_nosubmission_stub_weak
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=scudo -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-04-27 17:15:37 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
|
|
|
|
// CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SCUDO-LINUX: "-pie"
|
2021-05-27 01:50:26 +08:00
|
|
|
// CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo-i386.a" "--no-whole-archive"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-LINUX-NOT: "-lstdc++"
|
|
|
|
// CHECK-SCUDO-LINUX: "-lpthread"
|
|
|
|
// CHECK-SCUDO-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-LINUX: "-lresolv"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -fsanitize=scudo -fsanitize-minimal-runtime -### %s 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld \
|
2021-05-27 01:50:26 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-MINIMAL-LINUX %s
|
|
|
|
// CHECK-SCUDO-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SCUDO-MINIMAL-LINUX: "-pie"
|
|
|
|
// CHECK-SCUDO-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_minimal-i386.a" "--no-whole-archive"
|
|
|
|
// CHECK-SCUDO-MINIMAL-LINUX: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-MINIMAL-LINUX: "-lresolv"
|
2021-05-27 01:50:26 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -o %t.so -shared 2>&1 \
|
|
|
|
// RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
|
2021-05-27 01:50:26 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo-i386.a"
|
|
|
|
// CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo-i386.so"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "-lresolv"
|
2018-02-06 08:50:18 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SCUDO-ANDROID-NOT: "-lc"
|
|
|
|
// CHECK-SCUDO-ANDROID: "-pie"
|
|
|
|
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
|
2021-05-27 01:50:26 +08:00
|
|
|
// CHECK-SCUDO-ANDROID: libclang_rt.scudo-arm-android.so"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-NOT: "-lpthread"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-NOT: "-lresolv"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
|
|
|
// RUN: -static-libsan \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
|
|
|
|
// CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SCUDO-ANDROID-STATIC: "-pie"
|
2021-05-27 01:50:26 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo-arm-android.a" "--no-whole-archive"
|
[Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.
In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.
Reviewers: eugenis, kcc, alekseyshl
Reviewed By: eugenis, alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D39334
llvm-svn: 317337
2017-11-04 01:04:13 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
|
2018-06-27 00:14:35 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
|
|
|
|
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SCUDO-ANDROID-STATIC-NOT: "-lresolv"
|
2017-12-09 09:32:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2017-12-09 09:32:07 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-HWASAN-X86-64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "-pie"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.a"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-x86_64.a.syms"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "-lpthread"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "-lrt"
|
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-HWASAN-X86-64-LINUX: "-lresolv"
|
2017-12-09 09:32:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX: "-pie"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -o %t.so -shared 2>&1 \
|
|
|
|
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
|
2017-12-09 09:32:07 +08:00
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-DSO_SHARED-HWASAN-X86-64-LINUX: "-pie"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
|
2017-12-09 09:32:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2017-12-09 09:32:07 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-HWASAN-AARCH64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "-pie"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.a"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-aarch64.a.syms"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "-lpthread"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "-lrt"
|
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-HWASAN-AARCH64-LINUX: "-lresolv"
|
2017-12-09 09:32:07 +08:00
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: -shared-libsan \
|
2017-12-09 09:32:07 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX: "-pie"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
|
|
|
|
|
2022-05-02 11:44:13 +08:00
|
|
|
// RUN: %clang -### %s -o %t.so -shared 2>&1 \
|
|
|
|
// RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
|
2018-03-24 03:47:45 +08:00
|
|
|
// RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
|
|
|
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
|
2022-06-25 04:52:27 +08:00
|
|
|
//
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
|
|
|
// CHECK-DSO_SHARED-HWASAN-AARCH64-LINUX: "-pie"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
|
2022-06-07 11:50:19 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
|
2018-03-24 03:47:45 +08:00
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
|
|
|
|
// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
|