[PATCH] D61992: [ARM] Support .reloc *, R_ARM_NONE, *

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 06:41:05 PDT 2019


MaskRay marked 3 inline comments as done.
MaskRay added inline comments.


================
Comment at: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp:50
+Optional<MCFixupKind> ARMAsmBackend::getFixupKind(StringRef Name) const {
+  if (Name == "R_ARM_NONE")
+    return (MCFixupKind)ARM::fixup_arm_NONE;
----------------
peter.smith wrote:
> Is there a way of making R_ARM_NONE only accepted on ELF. There are also Windows (COFF) and MachO users that may come through this code-path, we need to make sure that they don't get a fixup they can't handle.
Good point! Added a check `STI.getTargetTriple().isOSBinFormatELF() `

```
% llvm-mc -filetype=obj -triple=armv7a-windows-itanium reloc-directive.s -o t.o
reloc-directive.s:17:13: error: unknown relocation name
  .reloc 4, R_ARM_NONE, foo+4

% llvm-mc -filetype=obj -triple=armv7-apple-macho reloc-directive.s -o t.o
reloc-directive.s:17:13: error: unknown relocation name
  .reloc 4, R_ARM_NONE, foo+4
```

Before, the diagnostic for coff is:
```
LLVM ERROR: unsupported relocation type: fixup_arm_NONE
```

macho:
```
reloc-directive.s:17:3: error: unsupported relocation on symbol                                                 
  .reloc 4, R_ARM_NONE, foo+4
```

I think X86 and MIPS need a similar fix..


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61992/new/

https://reviews.llvm.org/D61992





More information about the llvm-commits mailing list