[lld] 3a4615c - [ELF] Clarify the first entry of .got.plt NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 21 16:42:49 PST 2024


Author: Fangrui Song
Date: 2024-01-21T16:42:44-08:00
New Revision: 3a4615c0fe985fe7b971bf5c067ff0f7ce5e3d10

URL: https://github.com/llvm/llvm-project/commit/3a4615c0fe985fe7b971bf5c067ff0f7ce5e3d10
DIFF: https://github.com/llvm/llvm-project/commit/3a4615c0fe985fe7b971bf5c067ff0f7ce5e3d10.diff

LOG: [ELF] Clarify the first entry of .got.plt NFC

Differential Revision: https://reviews.llvm.org/D47053

Added: 
    

Modified: 
    lld/ELF/Arch/X86_64.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index c28e01e48195843..de459013595fed8 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -403,10 +403,10 @@ RelExpr X86_64::getRelExpr(RelType type, const Symbol &s,
 }
 
 void X86_64::writeGotPltHeader(uint8_t *buf) const {
-  // The first entry holds the value of _DYNAMIC. It is not clear why that is
-  // required, but it is documented in the psabi and the glibc dynamic linker
-  // seems to use it (note that this is relevant for linking ld.so, not any
-  // other program).
+  // The first entry holds the link-time address of _DYNAMIC. It is documented
+  // in the psABI and glibc before Aug 2021 used the entry to compute run-time
+  // load address of the shared object (note that this is relevant for linking
+  // ld.so, not any other program).
   write64le(buf, mainPart->dynamic->getVA());
 }
 


        


More information about the llvm-commits mailing list