[all-commits] [llvm/llvm-project] 278f80: [ELF] Fix compareSections assertion failure when O...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Feb 3 10:39:24 PST 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 278f80ce95401f7920845d1281aa99804a139b6c
      https://github.com/llvm/llvm-project/commit/278f80ce95401f7920845d1281aa99804a139b6c
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-02-03 (Sat, 03 Feb 2024)

  Changed paths:
    M lld/ELF/Writer.cpp
    M lld/test/ELF/linkerscript/insert-before.test

  Log Message:
  -----------
  [ELF] Fix compareSections assertion failure when OutputDescs in sectionCommands are non-contiguous

In a `--defsym y0=0 -T a.lds` link where a.lds contains only INSERT
commands, the `script->sectionCommands` layout may be:
```
orphan sections
SymbolAssignment due to --defsym
sections created by INSERT commands
```

The `OutputDesc` objects are not contiguous in sortInputSections, and
`compareSections` will be called with a SymbolAssignment argument,
leading to an assertion failure.

(cherry picked from commit dee8786f70a3d62b639113343fa36ef55bdbad63)




More information about the All-commits mailing list