[PATCH] D124656: [ELF] Support custom sections before DATA_SEGMENT_RELRO_END

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 23:49:43 PDT 2022


MaskRay added a comment.

Thanks for the detailed reply. With this patch, users needing custom RELRO sections can specify a full `SECTIONS` command.

The current Error behavior seems fine.
I believe Promote-RO is technically possible (only addresses of PT_GNU_RELRO are used; the pt_offset is ignored) but may look strange and may confuse binary manipulation tools (llvm-objcopy, objcopy).

> All: RELRO is from [first RELRO section start, last RELRO section end). This could cause runtime errors if a RW section in the RELRO region is written to. This is the trust me, I know what I'm doing option.

This may probably be the most convenient approach if the user just wants to specify a linker script fragment (e.g.`SECTIONS { ... } INSERT [BEFORE|AFTER] ...;`).
But I agree that it is not a safe default.

---

Given that there are not demanding needs, perhaps not doing anything is fine for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124656



More information about the llvm-commits mailing list