This is an archive of the discontinued LLVM Phabricator instance.

Clang crash targeting ARM or Thumb when assembling a prel31 relocation variant
ClosedPublic

Authored by simonwallis2 on May 12 2020, 6:52 AM.

Details

Summary

In the assembler or inline assembler,
attempting to use an invalid fixup type
gives a crash with a segmentation fault.

attribute((naked))
void foo(void) {
asm("mov r9, :lower16:bar(prel31)");
}

This should give a proper error message when building for ARM or Thumb.
This brings it in line with AARCH64.

This fixes all 8 instances of llvm_unreachable("Unsupported Modifier");
in ARM/MCTargetDesc/ARMELFObjectWriter.cpp.
A test is provided for each instance.

Diff Detail

Event Timeline

simonwallis2 created this revision.May 12 2020, 6:52 AM
This revision is now accepted and ready to land.May 12 2020, 8:37 AM
This revision was automatically updated to reflect the committed changes.