https://bugs.llvm.org/show_bug.cgi?id=49846
Fangrui Song <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
CC| |[email protected]
--- Comment #1 from Fangrui Song <[email protected]> ---
With traditional -z noseparate-code, GNU ld defaults to a RX/R/RW program
header layout. With -z separate-code (default on Linux/x86 from binutils 2.31
onwards), GNU ld defaults to a R/RX/R/RW program header layout.
I think your script is a -z noseparate-code layout.
LLD defaults to R/RX/RW(RELRO)/RW(non-RELRO). With --rosegment, LLD uses
RX/RW(RELRO)/RW(non-RELRO).
GNU ld's -z noseparate-code layout is not compatible with LLD --rosegment
because there is no maxpagesize alignment between text and rodata like:
. = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. &
(CONSTANT (MAXPAGESIZE) - 1)));
So the two PT_LOAD (RX) PT_LOAD (R) will actually overlap at runtime and the
executable segment will be remapped as readonly and the program will crash.
If you feed a ld.bfd -z separate-code linker script into ld.lld --rosegment, it
should work.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs