[compiler-rt] r362970 - Add unused symbol to thunk files to force wholearchive inclusion
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 10:50:28 PDT 2019
Author: rnk
Date: Mon Jun 10 10:50:28 2019
New Revision: 362970
URL: http://llvm.org/viewvc/llvm-project?rev=362970&view=rev
Log:
Add unused symbol to thunk files to force wholearchive inclusion
These "dynamic_runtime_thunk" object files exist to create a weak alias
from 'foo' to 'foo_dll' for all weak sanitizer runtime symbols. The weak
aliases are implemented as /alternatename linker options in the
.drective section, so they are not actually in the symbol table. In
order to force the Visual C++ linker to load the object, even with
-wholearchive:, we have to provide at least one external symbol. Once we
do that, it will read the .drective sections and see the weak aliases.
Fixes PR42074
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc?rev=362970&r1=362969&r2=362970&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc Mon Jun 10 10:50:28 2019
@@ -18,3 +18,9 @@
#define INTERFACE_WEAK_FUNCTION(Name) WIN_WEAK_IMPORT_DEF(Name)
#include "sanitizer_coverage_interface.inc"
#endif // SANITIZER_DYNAMIC_RUNTIME_THUNK
+
+namespace __sanitizer {
+// Add one, otherwise unused, external symbol to this object file so that the
+// Visual C++ linker includes it and reads the .drective section.
+void ForceWholeArchiveIncludeForSanCov() {}
+}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc?rev=362970&r1=362969&r2=362970&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc Mon Jun 10 10:50:28 2019
@@ -18,3 +18,9 @@
#define INTERFACE_WEAK_FUNCTION(Name) WIN_WEAK_IMPORT_DEF(Name)
#include "sanitizer_common_interface.inc"
#endif // SANITIZER_DYNAMIC_RUNTIME_THUNK
+
+namespace __sanitizer {
+// Add one, otherwise unused, external symbol to this object file so that the
+// Visual C++ linker includes it and reads the .drective section.
+void ForceWholeArchiveIncludeForSanitizerCommon() {}
+}
More information about the llvm-commits
mailing list