[PATCH] D56920: [PPC64] Sort .toc sections accessed with small code model relocs close to the .got

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 20 23:02:30 PST 2019


MaskRay added inline comments.


================
Comment at: ELF/Arch/PPC64.cpp:112
+    return false;
+}
+
----------------
grimar wrote:
> This does not seem to be clang-formatted.
> Also, since you only have 3 entries here, probably it will be better to use `if` instead of `switch`.
Using a `switch` for 3 entries looks good to me. I guess this is an incomplete list (but enough to make some not-so-small applications able to link against `libgcc.a`). If it is indeed incomplete, this code deserves a comment.

I've checked some powerpc64le target which failed to link due to
`libgcc/libgcc2.c:1444: relocation R_PPC64_ADDR16_DS out of range: 37088 is not in [-32768, 32767]`
The relocation out-of-range issues goes away with this patch.

"Power Architecture 64-bit ELF V2 ABI Specification" published on July 16, 2015 does not give examples what relocation types may be used in small/medium/large code models... The x86-64 ABI gives a few regarding PIC/non-PIC * small/medium/large code model..


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D56920





More information about the llvm-commits mailing list