[PATCH] D79782: Clang crash targeting ARM or Thumb when assembling a prel31 relocation variant

Simon Wallis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 06:57:26 PDT 2020


simonwallis2 created this revision.
simonwallis2 added reviewers: llvm-commits, MarkMurrayARM.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79782

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
  llvm/test/MC/ARM/error-location.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79782.263422.patch
Type: text/x-patch
Size: 4643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200512/2c2c4906/attachment-0001.bin>


More information about the llvm-commits mailing list