[all-commits] [llvm/llvm-project] a8f9f0: [ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Oct 22 09:48:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a8f9f0801816953e9cf792448dcffd9000227b27
      https://github.com/llvm/llvm-project/commit/a8f9f0801816953e9cf792448dcffd9000227b27
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-10-22 (Thu, 22 Oct 2020)

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

  Log Message:
  -----------
  [ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a].dyn

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
a section header table index instead of (the number of local symbols in the case of SHT_SYMTAB/SHT_DYNSYM).
We have already added SHF_INFO_LINK for --emit-relocs retained SHT_REL[A].

For example, we can teach llvm-objcopy to preserve the section index of the sh_info referenced section if
SHF_INFO_LINK is set. (GNU objcopy recognizes .rel[a].plt and updates
sh_info even if SHF_INFO_LINK is not set).

Reviewed By: grimar, psmith

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




More information about the All-commits mailing list