pcc created this revision. This allows it to be used with the other sanitizers.
https://reviews.llvm.org/D29545 Files: clang/lib/Driver/Tools.cpp clang/test/Driver/sanitizer-ld.c Index: clang/test/Driver/sanitizer-ld.c =================================================================== --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -416,7 +416,9 @@ // // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SAFESTACK-LINUX-NOT: "-lc" +// CHECK-SAFESTACK-LINUX-NOT: whole-archive // CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a" +// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init" // CHECK-SAFESTACK-LINUX: "-lpthread" // CHECK-SAFESTACK-LINUX: "-ldl" Index: clang/lib/Driver/Tools.cpp =================================================================== --- clang/lib/Driver/Tools.cpp +++ clang/lib/Driver/Tools.cpp @@ -3365,8 +3365,10 @@ if (SanArgs.linkCXXRuntimes()) StaticRuntimes.push_back("ubsan_standalone_cxx"); } - if (SanArgs.needsSafeStackRt()) - StaticRuntimes.push_back("safestack"); + if (SanArgs.needsSafeStackRt()) { + NonWholeStaticRuntimes.push_back("safestack"); + RequiredSymbols.push_back("__safestack_init"); + } if (SanArgs.needsCfiRt()) StaticRuntimes.push_back("cfi"); if (SanArgs.needsCfiDiagRt()) { @@ -3417,7 +3419,7 @@ if (SanArgs.hasCrossDsoCfi() && !AddExportDynamic) CmdArgs.push_back("-export-dynamic-symbol=__cfi_check"); - return !StaticRuntimes.empty(); + return !StaticRuntimes.empty() || !NonWholeStaticRuntimes.empty(); } static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
Index: clang/test/Driver/sanitizer-ld.c =================================================================== --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -416,7 +416,9 @@ // // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SAFESTACK-LINUX-NOT: "-lc" +// CHECK-SAFESTACK-LINUX-NOT: whole-archive // CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a" +// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init" // CHECK-SAFESTACK-LINUX: "-lpthread" // CHECK-SAFESTACK-LINUX: "-ldl" Index: clang/lib/Driver/Tools.cpp =================================================================== --- clang/lib/Driver/Tools.cpp +++ clang/lib/Driver/Tools.cpp @@ -3365,8 +3365,10 @@ if (SanArgs.linkCXXRuntimes()) StaticRuntimes.push_back("ubsan_standalone_cxx"); } - if (SanArgs.needsSafeStackRt()) - StaticRuntimes.push_back("safestack"); + if (SanArgs.needsSafeStackRt()) { + NonWholeStaticRuntimes.push_back("safestack"); + RequiredSymbols.push_back("__safestack_init"); + } if (SanArgs.needsCfiRt()) StaticRuntimes.push_back("cfi"); if (SanArgs.needsCfiDiagRt()) { @@ -3417,7 +3419,7 @@ if (SanArgs.hasCrossDsoCfi() && !AddExportDynamic) CmdArgs.push_back("-export-dynamic-symbol=__cfi_check"); - return !StaticRuntimes.empty(); + return !StaticRuntimes.empty() || !NonWholeStaticRuntimes.empty(); } static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits