Commit 096b8003 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[fuzzer] Add attributes to LLVMFuzzerInitialize definition

That prevents the linker from dead-stripping the function, as it is not called
directly, it is resolved in the runtime via dlsym().

I copied the change from https://crrev.com/c/833995

R=mmoroz@chromium.org

Bug: 837098
Change-Id: I998517ebab623e67d275fe656643a8ee5fd1e951
Reviewed-on: https://chromium-review.googlesource.com/1148391Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577532}
parent 74222e77
......@@ -113,7 +113,11 @@ struct Environment {
bool is_running;
};
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.
extern "C" __attribute__((used)) __attribute__((visibility("default"))) int
LLVMFuzzerInitialize(int* argc, char*** argv) {
v8::V8::InitializeICUDefaultLocation((*argv)[0]);
v8::V8::InitializeExternalStartupData((*argv)[0]);
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