[PATCH] D103815: [LLD][ELF] Fix PT_LOAD program header creation for NO_LOAD sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 12:57:33 PDT 2021


MaskRay added a comment.

> During PHDR creation, the case where an output section does not require a PT_LOAD header but still occupies memory in the current VMA region was not handled.

I think our `needsPtLoad` may not match GNU ld. "does not require a PT_LOAD" may be incorrect.

The latest GNU ld code has a comment from 
https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=ld/ldlang.c;h=9038ebfff3b40298572b3eaf10eb0531e105d4fa;hp=798d7a1109712033d7764e2ef8e59351476d89b2;hb=f4eaaf7fceed097ed62542f9940986b1de01aa48;hpb=7cdfa31841aea9665682cadb03aaade2821721b1

The semantics appear to be different from what is documented here https://sourceware.org/binutils/docs/ld/Output-Section-Type.html



================
Comment at: lld/test/ELF/linkerscript/phdrs-noload.test:37
+{
+    .text :
+    {
----------------
This style is too verbose. `{` can be at the line end.

If the input section descriptions are short, you may even consider place the whole thing on one line.


================
Comment at: lld/test/ELF/linkerscript/phdrs-noload.test:72
+.long 0xbcdefa12
\ No newline at end of file

----------------
No newline at end of file


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103815/new/

https://reviews.llvm.org/D103815



More information about the llvm-commits mailing list