[PATCH] D28272: ELF: Reserve space for copy relocations of read-only symbols in relro.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 21:22:04 PST 2017


ruiu added a comment.

Looks like ld.bfd and ld.gold have something similar already. Are they using the same section name, .bss.rel.ro?



================
Comment at: lld/ELF/Relocations.cpp:419-426
+  for (const Elf_Phdr &Phdr : check(SS->file()->getObj().program_headers())) {
+    if ((Phdr.p_type == ELF::PT_LOAD || Phdr.p_type == ELF::PT_GNU_RELRO) &&
+        !(Phdr.p_flags & ELF::PF_W) && Value >= Phdr.p_vaddr &&
+        Value < Phdr.p_vaddr + Phdr.p_memsz) {
+      BssSec = Out<ELFT>::BssRelRo;
+      break;
+    }
----------------
Can you factor the new code as a function taking a SharedSymbol and returning a boolean value?


https://reviews.llvm.org/D28272





More information about the llvm-commits mailing list