[lld] [lld][ELF] Allow `.data.rel.ro.unlikely` to be RELRO (PR #148920)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 11:59:49 PDT 2025


================
@@ -629,9 +629,9 @@ static bool isRelroSection(Ctx &ctx, const OutputSection *sec) {
   // magic section names.
   StringRef s = sec->name;
 
-  bool abiAgnostic = s == ".data.rel.ro" || s == ".bss.rel.ro" ||
-                     s == ".ctors" || s == ".dtors" || s == ".jcr" ||
----------------
lenary wrote:

The proposal also mentions adding ".hot" to the end of section names, so maybe it would be better to do something like this:
`s.starts_with(".data.rel.ro") || s.starts_with(".bss.rel.ro" || s == ".ctors" ...`

Do we also need to slightly revisit the behaviour of `LinkerScript::getOutputSectionName` to not merge these segments when a linker script is not provided? I'll note that there is an option which keeps some `.text`-prefixed sections separated, which we might want to extend to data?

https://github.com/llvm/llvm-project/pull/148920


More information about the llvm-commits mailing list