[PATCH] D83469: [LLD][ELF] - Allow relocation sections to appear before their target sections.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 10:07:36 PDT 2020


MaskRay added a comment.

Looks good. Some comment suggestions.



================
Comment at: lld/ELF/InputFiles.cpp:646
+  // 1) handle SHF_LINK_ORDER sections.
+  // 2) create SHT_REL[A} sections. In some cases relocated sections may follow
+  //    the corresponding relocation section. In such a case, the relocation
----------------
jhenderson wrote:
> Typo? '}' -> ']'
... the section header index of a relocation section may be smaller than that of the relocated section


================
Comment at: lld/test/ELF/reloc-sec-before-target.test:1
+## In this case we have an object with a relocation section before
+## the corresponding relocatable target section. Normally it is not what
----------------
If the section header index of a SHT_REL[A] section is smaller than the section header index of the relocated section


================
Comment at: lld/test/ELF/reloc-sec-before-target.test:3
+## the corresponding relocatable target section. Normally it is not what
+## compilers would emit. We have to support it, because some custom tools might
+## want to use this feature, which is not restricted by ELF gABI.
----------------
> We have to support it, because some custom tools might want to use this feature, which is not restricted by ELF gABI.

Worth mentioning that GNU ld supports this as well.


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

https://reviews.llvm.org/D83469





More information about the llvm-commits mailing list