[all-commits] [llvm/llvm-project] 03051f: [ELF] Preserve section order within an INSERT AFTE...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Jun 30 11:36:03 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 03051f7ac8a3e2eda44b8280290c90863a064f0e
https://github.com/llvm/llvm-project/commit/03051f7ac8a3e2eda44b8280290c90863a064f0e
Author: Fangrui Song <i at maskray.me>
Date: 2021-06-30 (Wed, 30 Jun 2021)
Changed paths:
M lld/ELF/LinkerScript.cpp
M lld/ELF/LinkerScript.h
M lld/ELF/ScriptParser.cpp
A lld/test/ELF/linkerscript/insert-multi.test
Log Message:
-----------
[ELF] Preserve section order within an INSERT AFTER command
For
```
SECTIONS {
text.0 : {}
text.1 : {}
text.2 : {}
} INSERT AFTER .data;
```
the current order is `.data text.2 text.1 text.0`. It makes more sense to
preserve the specified order and thus improve compatibility with GNU ld.
For
```
SECTIONS { text.0 : {} } INSERT AFTER .data;
SECTIONS { text.3 : {} } INSERT AFTER .data;
```
GNU ld somehow collects sections with `INSERT AFTER .data` together (IMO
inconsistent) but I think it makes more sense to execute the commands in order
and get `.data text.3 text.0` instead.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D105158
More information about the All-commits
mailing list