[PATCH] D20741: [LibFuzzer] Fix weak linking issues building tests under OSX.

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 17:54:55 PDT 2016


mehdi_amini added a comment.

Talked to Nick about the linker on Darwin, and he's confirming that we shouldn't rely on weak external, or even on weak override as it is too easy to get wrong.
He's suggesting that the most reliable way is to handle this at the API level, i.e. something like:

  int MyTestInput(const uint8_t *data, size_t size);
  
  struct FuzzerAPI {
    int (*TestOneInput)(const uint8_t *data, size_t size);
  //  ... other overridable APIs
  };
  extern "C" void LLVMFuzzerRegistration(FuzzerAPI *API) {
    API->TestOneInput = MyTestInput;
  }

That adds a few lines of boilerplate on the client side...


http://reviews.llvm.org/D20741





More information about the llvm-commits mailing list