[PATCH] D58055: [CMake][LibFuzzer] Match symbol visibility setting between LibFuzzer object files and unit tests.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 08:43:17 PST 2019
delcypher created this revision.
delcypher added reviewers: george.karpenkov, kubamracek, kcc, yln.
Herald added subscribers: Sanitizers, mgorny.
Herald added projects: LLVM, Sanitizers.
This fixes inconsistent symbol visibility. This shows up as a linker
warning if r336238 (43f633564e338a6dde83d49a48e5bfcbfdce292c) is
reverted.
ld: warning: direct access in function 'fuzzer::CleanseCrashInput(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, fuzzer::FuzzingOptions const&)' from file '/Volumes/data/dev/llvm/upstream/master/builds/projects/compiler-rt/lib/fuzzer/tests/libRTFuzzerTest.x86_64.a(FuzzerDriver.cpp.o)' to global weak symbol 'fuzzer::Command::ignoreRemainingArgs()::kIgnoreRemaining' from file 'FuzzerTestObjects.FuzzerUnittest.cpp.x86_64.o' means the weak symbol cannot be overridden
at runtime. This was likely caused by different translation units being compiled with different visibility settings.
r336238 just hid the issue rather than fixing the real issue. On macOS
and other platforms we usually compile with `-fvisibility=hidden` but
the unit tests were compiled without this flag.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D58055
Files:
lib/fuzzer/tests/CMakeLists.txt
Index: lib/fuzzer/tests/CMakeLists.txt
===================================================================
--- lib/fuzzer/tests/CMakeLists.txt
+++ lib/fuzzer/tests/CMakeLists.txt
@@ -27,6 +27,11 @@
list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++)
endif()
+if ("-fvisibility=hidden" IN_LIST LIBFUZZER_CFLAGS)
+ # Match visibility settings.
+ list(APPEND LIBFUZZER_UNITTEST_CFLAGS "-fvisibility=hidden")
+endif()
+
if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
# libFuzzer unit tests are only run on the host machine.
set(arch ${COMPILER_RT_DEFAULT_TARGET_ARCH})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58055.186266.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/1218701d/attachment.bin>
More information about the llvm-commits
mailing list