Commit 80ee67f4 authored by Max Moroz's avatar Max Moroz Committed by Commit Bot

Add visibility attributes to LLVMFuzzerInitialize on Mac in JS parser proto fuzzer.

That prevents linker on Mac from dead-stripping the function, as it's actually used
but is being called indirectly using dlsym().

Bug: 837477
Change-Id: Ic02066132cba3e1f9deb977219b4f3ec13207991
Reviewed-on: https://chromium-review.googlesource.com/1050505Reviewed-by: default avatarJonathan Metzman <metzman@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556844}
parent e2637742
...@@ -27,7 +27,14 @@ std::string protobuf_to_string( ...@@ -27,7 +27,14 @@ std::string protobuf_to_string(
return source; return source;
} }
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { // Explicitly specify some attributes to avoid issues with the linker dead-
// stripping the following function on macOS, as it is not called directly
// by fuzz target. LibFuzzer runtime uses dlsym() to resolve that function.
#if V8_OS_MACOSX
__attribute__((used)) __attribute__((visibility("default")))
#endif // V8_OS_MACOSX
extern "C" int
LLVMFuzzerInitialize(int* argc, char*** argv) {
v8::V8::InitializeICUDefaultLocation((*argv)[0]); v8::V8::InitializeICUDefaultLocation((*argv)[0]);
v8::V8::InitializeExternalStartupData((*argv)[0]); v8::V8::InitializeExternalStartupData((*argv)[0]);
v8::V8::SetFlagsFromCommandLine(argc, *argv, true); v8::V8::SetFlagsFromCommandLine(argc, *argv, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment