[PATCH] D76746: [MC][ARM] Make .reloc support arbitrary relocation types
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 01:35:35 PDT 2020
psmith added a comment.
I think this could work, I've got a few comments on the generic part, but otherwise looks reasonable to me. Would be nice to extend this to AArch64 as there are some relocs that GCC/GNU as can emit that llvm-mc does not and it would be good to support these in LLVM.
================
Comment at: llvm/include/llvm/MC/MCFixup.h:58
+ /// Fixup kind 256 + V represents the relocation type with number V.
+ FirstLiteralRelocationKind = 256,
----------------
It could be worth making it explicit that the range delimited by LiteralRelocationKind to MaxFixupKind (see next comment) is used for relocations coming from .reloc directive.
================
Comment at: llvm/include/llvm/MC/MCFixup.h:63
// later.
- MaxTargetFixupKind = (1 << 8)
+ // R_AARCH64_IRELATIVE = 1032
+ MaxTargetFixupKind = FirstLiteralRelocationKind + 1032,
----------------
I recommend we rename MaxTargetFixupKind to MaxFixupKind as MaxTargetFixupKind is now 255
I'm guessing R_AARCH64_IRELATIVE is the largest reloc type in use throughout the targets? For a 64-bit RELA relocation this could be any 32-bit value. I think it will be worth giving a little room for aarch64 to expand and explaining what the limit is. For example:
```
Set limit to accommodate the highest reloc type in use for all Targets, currently R_AARCH64_IRELATIVE at 1032, including room for expansion.
MaxFixupKind = FirstLiteralRelocationKind + 1032 + 32,
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76746/new/
https://reviews.llvm.org/D76746
More information about the llvm-commits
mailing list