From c6d5dd6f538e5eb139c7391dc88cf742a1b0ea45 Mon Sep 17 00:00:00 2001 From: Hsiangkai Wang Date: Wed, 21 Jul 2021 10:27:35 +0800 Subject: [PATCH] [llvm-mc-assemble-fuzzer] Initialize MCTargetOptions. When run the command in the llvm-mc-assemble-fuzzer document, ``` llvm-mc-fuzzer --triple=aarch64-linux-gnu --fuzzer-args -max_len=4 ``` it triggers the following assertion: ``` llvm-mc-assemble-fuzzer: llvm-project/llvm/lib/MC/MCTargetOptionsCommandFlags.cpp:38: bool llvm::mc::getRelaxAll(): Assertion `RelaxAllView && "RegisterMCTargetOptionsFlags not created."' failed. ``` It is caused by no global RegisterMCTargetOptionsFlags object to initialize the MC target options. Differential Revision: https://reviews.llvm.org/D106417 --- tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp b/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp index 74051666a6e..e32eb113971 100644 --- a/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp +++ b/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp @@ -37,6 +37,8 @@ using namespace llvm; +static mc::RegisterMCTargetOptionsFlags MOF; + static cl::opt TripleName("triple", cl::desc("Target triple to assemble for, " "see -version for available targets"));