[PATCH] D89828: [ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a].dyn

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 14:48:57 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: grimar, psmith.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a project: LLVM.
MaskRay requested review of this revision.

The ELF spec says

> If the sh_flags field for this section header includes the attribute SHF_INFO_LINK, then this member represents a section header table index.

Set SHF_INFO_LINK so that binary manipulation tools know that sh_info is
an index instead of (the number of local symbols in the case of SHT_SYMTAB/SHT_DYNSYM).
For example, we can teach llvm-objcopy to preserve the section index if
SHF_INFO_LINK is set. (GNU objcopy recognizes .rel[a].plt and updates
sh_info even if SHF_INFO_LINK is not set).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89828

Files:
  lld/ELF/SyntheticSections.cpp
  lld/test/ELF/aarch64-gnu-ifunc.s
  lld/test/ELF/arm-combined-dynrel-ifunc.s
  lld/test/ELF/arm-gnu-ifunc.s
  lld/test/ELF/dynamic-reloc.s
  lld/test/ELF/gnu-ifunc-i386.s
  lld/test/ELF/gnu-ifunc.s
  lld/test/ELF/x86-64-combined-dynrel.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89828.299483.patch
Type: text/x-patch
Size: 3458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201020/f7e71b90/attachment.bin>


More information about the llvm-commits mailing list