This is an archive of the discontinued LLVM Phabricator instance.

[llvm-mc-assemble-fuzzer] Initialize MCTargetOptions.
ClosedPublic

Authored by HsiangKai on Jul 20 2021, 7:40 PM.

Details

Summary

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.

Diff Detail

Event Timeline

HsiangKai created this revision.Jul 20 2021, 7:40 PM
HsiangKai requested review of this revision.Jul 20 2021, 7:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2021, 7:40 PM
xgupta accepted this revision.Jul 21 2021, 7:23 AM
xgupta added a subscriber: xgupta.

I can confirm the issue and the patch is also fixed the assertion. So LGTM.

llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
40

MCTargetOptionsFlags -> MOF
(shorter name might be better? as used in ./llvm/tools/llvm-mca/llvm-mca.cpp:69 or ./llvm/tools/llvm-mc/llvm-mc.cpp:44)

This revision is now accepted and ready to land.Jul 21 2021, 7:23 AM
This revision was landed with ongoing or failed builds.Jul 21 2021, 11:38 PM
This revision was automatically updated to reflect the committed changes.