[PATCH] D59594: [ELF] Change GOT*_FROM_END (relative to end(.got)) to GOTPLT* (start(.got.plt))

Siva Chandra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 15:29:06 PDT 2019


sivachandra added inline comments.


================
Comment at: ELF/Relocations.cpp:1073-1075
+    // These x86 and x86_64 relocation types are relative to GOTPLT but their
+    // description uses GOT (the address of the global offset table), thus also
+    // ensure GOT is created.
----------------
ruiu wrote:
> Is this logically x86-64 only? I think it is fine to create a .got when you create .got.plt, but the comment should explain that.
One need not emit `.got` even if emitting `.got.plt`. For example, for non-PIE but statically linked excutables, ld.bfd does not emit `.got` but still emits `.got.plt`.

That said, I am not sure if not emitting a `.got` (when emitting `.got.plt`) for other kinds of executables is a good/bad thing. IMO, emitting a `.got` even when not required will only add a few bytes at most.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D59594





More information about the llvm-commits mailing list