[PATCH] D62014: [X86] Support .reloc *, R_{386,X86_64}_NONE, *

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 18:50:46 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added a comment.

`.init_array+R_*_NONE` is a missed optimization in linkers (ld.bfd+gold+lld) but I'm not sure how useful it is. It may break semantics and I think usually it indicates real bugs, see PR41693 for a recent issue.

This is interesting as I want Android guys to use a better workaround than the current PT_TLS hack in lld ELF ARM/AArch64. (https://reviews.llvm.org/D61824#1500063)

@pcc told me this trick long ago and mentioned `.reloc` is not supported in llvm:) The trick is also mentioned on https://lwn.net/Articles/741494/

The `R_386_NONE` support can be used to add tests for a bug in lld that I want to fix https://reviews.llvm.org/D61973#1504227



================
Comment at: lib/Target/X86/MCTargetDesc/X86FixupKinds.h:17
 enum Fixups {
-  reloc_riprel_4byte = FirstTargetFixupKind, // 32-bit rip-relative
+  reloc_NONE = FirstTargetFixupKind, // 32-bit rip-relative
+  reloc_riprel_4byte, // 32-bit rip-relative
----------------
pcc wrote:
> The comment isn't accurate.
> 
> Should this be a generic fixup kind (i.e. MCFixupKind)? It seems that both ELF and COFF support it on all targets.
Thanks for pointing this out.

I'll add a generic fixup in the ARM patch D61992.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62014





More information about the llvm-commits mailing list