[llvm] r312011 - Fix build of llvm-mc-assemble/disassemble-fuzzer

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 10:08:44 PDT 2017


Author: bogner
Date: Tue Aug 29 10:08:44 2017
New Revision: 312011

URL: http://llvm.org/viewvc/llvm-project?rev=312011&view=rev
Log:
Fix build of llvm-mc-assemble/disassemble-fuzzer

Since these aren't built by default unless building with coverage (and
even then they aren't built for the check target) they've managed to
bit rot a little.

This just fixes the build. See llvm.org/pr34314 for the plan on making
sure these don't bit rot again.

Modified:
    llvm/trunk/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
    llvm/trunk/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp

Modified: llvm/trunk/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp?rev=312011&r1=312010&r2=312011&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp (original)
+++ llvm/trunk/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp Tue Aug 29 10:08:44 2017
@@ -171,8 +171,7 @@ int AssembleOneInput(const uint8_t *Data
   MCContext Ctx(MAI.get(), MRI.get(), &MOFI, &SrcMgr);
 
   static const bool UsePIC = false;
-  static const CodeModel::Model CMModel = CodeModel::Default;
-  MOFI.InitMCObjectFileInfo(TheTriple, UsePIC, CMModel, Ctx);
+  MOFI.InitMCObjectFileInfo(TheTriple, UsePIC, Ctx);
 
   const unsigned OutputAsmVariant = 0;
   std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
@@ -243,11 +242,12 @@ int AssembleOneInput(const uint8_t *Data
   return 0;
 }
 
-int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   return AssembleOneInput(Data, Size);
 }
 
-int LLVMFuzzerInitialize(int *argc, char ***argv) {
+extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(int *argc,
+                                                        char ***argv) {
   // The command line is unusual compared to other fuzzers due to the need to
   // specify the target. Options like -triple, -mcpu, and -mattr work like
   // their counterparts in llvm-mc, while -fuzzer-args collects options for the

Modified: llvm/trunk/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp?rev=312011&r1=312010&r2=312011&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp (original)
+++ llvm/trunk/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp Tue Aug 29 10:08:44 2017
@@ -73,11 +73,12 @@ int DisassembleOneInput(const uint8_t *D
   return 0;
 }
 
-int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   return DisassembleOneInput(Data, Size);
 }
 
-int LLVMFuzzerInitialize(int *argc, char ***argv) {
+extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(int *argc,
+                                                        char ***argv) {
   // The command line is unusual compared to other fuzzers due to the need to
   // specify the target. Options like -triple, -mcpu, and -mattr work like
   // their counterparts in llvm-mc, while -fuzzer-args collects options for the




More information about the llvm-commits mailing list