[all-commits] [llvm/llvm-project] 2fc704: [ELF] --emit-relocs: fix st_value of STT_SECTION i...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Nov 2 08:37:34 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fc704a0a529dd7eba7566a293f981a86bfa5c3e
      https://github.com/llvm/llvm-project/commit/2fc704a0a529dd7eba7566a293f981a86bfa5c3e
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/Writer.cpp
    A lld/test/ELF/section-symbol-gap.s

  Log Message:
  -----------
  [ELF] --emit-relocs: fix st_value of STT_SECTION in the presence of a gap before the first input section

In the presence of a gap, the st_value field of a STT_SECTION symbol is the
address of the first input section (incorrect if there is a gap). Set it to the
output section address instead.

In -r mode, this bug can cause an incorrect non-zero st_value of a STT_SECTION
symbol (while output sections have zero addresses, input sections may have
non-zero outSecOff).  The non-zero st_value can cause the final link to have
incorrect relocation computation (both GNU ld and LLD add st_value of the
STT_SECTION symbol to the output section address).

Reviewed By: grimar

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




More information about the All-commits mailing list