https://sourceware.org/bugzilla/show_bug.cgi?id=34003
Fangrui Song <maskray at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maskray at sourceware dot org
--- Comment #1 from Fangrui Song <maskray at sourceware dot org> ---
GNU ld's current behavior.
┌───────────────────────────────────┬──────────┬────────────────┐
│ Options │ Segments │ Layout │
├───────────────────────────────────┼──────────┼────────────────┤
│ -z noseparate-code --no-rosegment │ 2 │ R+X, RW │
├───────────────────────────────────┼──────────┼────────────────┤
│ -z noseparate-code --rosegment │ 2 │ R+X, RW (same) │
├───────────────────────────────────┼──────────┼────────────────┤
│ -z separate-code --no-rosegment │ 4 │ R, R+X, R, RW │
├───────────────────────────────────┼──────────┼────────────────┤
│ -z separate-code --rosegment │ 3 │ R+X, R, RW │
└───────────────────────────────────┴──────────┴────────────────┘
--rosegment/--no-rosegment don't make a difference when -z noseparate-code is
used. This is an implementation limitation.
For -z separate-code, --no-rosegment should produce fewer segments than
--rosegment. The behavior seems inverted.
---
ld.lld behavior. lld utilitizes two RW PT_LOAD program headers: one for RELRO
sections and the other for non-RELRO sections. Although this might appear
unusual initially, it eliminates the need for alignment padding as seen in GNU
ld's layout.
┌──────────────────────────────────────────┬──────────┬────────────────┐
│ Options │ Segments │ Layout │
├──────────────────────────────────────────┼──────────┼────────────────┤
│ -z noseparate-code --rosegment (default) │ 4 │ R, R+X, RW, RW │
├──────────────────────────────────────────┼──────────┼────────────────┤
│ -z noseparate-code --no-rosegment │ 3 │ R+X, RW, RW │
├──────────────────────────────────────────┼──────────┼────────────────┤
│ -z separate-code --rosegment │ 4 │ R, R+X, RW, RW │
├──────────────────────────────────────────┼──────────┼────────────────┤
│ -z separate-code --no-rosegment │ 3 │ R+X, RW, RW │
└──────────────────────────────────────────┴──────────┴────────────────┘
--
You are receiving this mail because:
You are on the CC list for the bug.