[all-commits] [llvm/llvm-project] 56d811: [ELF] -r: fix crash when processing a SHT_REL[A] t...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Oct 24 11:35:47 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 56d81104f145ad2ff65ec88b249262888f80e9bc
      https://github.com/llvm/llvm-project/commit/56d81104f145ad2ff65ec88b249262888f80e9bc
  Author: Fangrui Song <maskray at google.com>
  Date:   2019-10-24 (Thu, 24 Oct 2019)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    A lld/test/ELF/merge-relocatable.s

  Log Message:
  -----------
  [ELF] -r: fix crash when processing a SHT_REL[A] that relocates a SHF_MERGE after D67504/r372734

Fix PR43767

In -r mode, when processing a SHT_REL[A] that relocates a SHF_MERGE, sec->getRelocatedSection() is a
MergeInputSection and its parent is an OutputSection but is asserted to
be a SyntheticSection (MergeSyntheticSection) in LinkerScript.cpp:addInputSec().
 ##
The code path is not exercised in non -r mode because the relocated
section changed from MergeInputSection to InputSection.

Reorder the code to make the non -r logic apply to -r as well, thus fix
the crash.

Reviewed By: peter.smith

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




More information about the All-commits mailing list