[PATCH] D48405: [ELF] Put .rodata before .text even if --no-rosegment

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 16:24:16 PDT 2018


MaskRay created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

Currently when --no-rosegment is specified, .rodata .text are assigned the same rank and .rodata may be ordered after .text .
This increases the gap between .text and .bss and can cause pc-relative relocation overflow (e.g. gcc crtbegin.o crtbegin.S have R_X86_64_PC32 relocation from .text to .bss)


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48405

Files:
  ELF/Writer.cpp


Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -764,7 +764,7 @@
   if (IsExec) {
     if (IsWrite)
       Rank |= RF_EXEC_WRITE;
-    else if (!Config->SingleRoRx)
+    else
       Rank |= RF_EXEC;
   } else {
     if (IsWrite)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48405.152199.patch
Type: text/x-patch
Size: 312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180620/4441fcb8/attachment.bin>


More information about the llvm-commits mailing list