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

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Feb 1 21:20:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dee8786f70a3d62b639113343fa36ef55bdbad63
      https://github.com/llvm/llvm-project/commit/dee8786f70a3d62b639113343fa36ef55bdbad63
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-02-01 (Thu, 01 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.




More information about the All-commits mailing list