llvm-project
119d507a - [LLD][COFF] Add support for custom section layout (#152779)

Commit
4 days ago
[LLD][COFF] Add support for custom section layout (#152779) MS link.exe provides the `/sectionlayout:@` option to specify the order of output sections at the granularity of individual sections. LLD/COFF currently does not have capability for user-controlled ordering of one or more output sections (as LLD/COFF does not support linker scripts), and this PR adds the option to align with MS link.exe. The option accepts only a file that specifies the order of sections, one per line. For example, `mylayout.txt` could emit the `.text` section after all other sections while preserving the original relative order of the remaining sections. ``` .data .rdata .pdata .rsrc .reloc .text ``` ```bash echo 'int main() { return 0; }' > main.c cl main.c /link /entry:main /sectionlayout:@mylayout.txt llvm-readobj --sections main.exe ```
Author
Parents
Loading