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

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 09:12:58 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.
+static bool isRelRoDataSection(Ctx &ctx, StringRef SectionName) {
+  // If -z keep-data-section-prefix is given, '<section>.hot' and
----------------
snehasish wrote:

>From the function name I expected this logic to use the `sh_type` and `sh_flag` to determine if it was relocatable and read only. Would that be more robust than relying on the name? If we choose to keep this logic based on the name, maybe note that in the function comment?

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


More information about the llvm-commits mailing list