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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 19 00:09:16 PDT 2025


================
@@ -553,6 +553,22 @@ template <class ELFT> void Writer<ELFT>::addSectionSymbols() {
   }
 }
 
+// Returns true if the section is a data section that's read only and
+// relocatable per its section name.
+static bool isRelRoDataSection(Ctx &ctx, StringRef SectionName) {
----------------
MaskRay wrote:

`secName`

`if (!secName.consume_front(".data.rel.ro")) return false;` then check .hot or .unlikely

This is more efficient.

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


More information about the llvm-commits mailing list