[PATCH] D45788: Mitigate relocation overflow [part 1 of 2]

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 13:04:46 PDT 2018


shenhan updated this revision to Diff 144769.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45788

Files:
  ELF/Writer.cpp
  test/ELF/dynsec-at-beginning.s


Index: test/ELF/dynsec-at-beginning.s
===================================================================
--- test/ELF/dynsec-at-beginning.s
+++ test/ELF/dynsec-at-beginning.s
@@ -8,9 +8,9 @@
 # SHF_ALLOC sections.
 # CHECK:      .dynsym  {{.*}}   A
 # CHECK-NEXT: .dynstr  {{.*}}   A
+# CHECK-NEXT: foo      {{.*}}   A
 # CHECK-NEXT: .hash    {{.*}}   A
-# CHECK-NEXT: .text    {{.*}}   AX
-# CHECK-NEXT: foo      {{.*}}   WA
+# CHECK-NEXT: .text    {{.*}}   A
 
-.section foo, "aw"
+.section foo, "a"
 .byte 0
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -681,11 +681,12 @@
   RF_NOT_INTERP = 1 << 17,
   RF_NOT_ALLOC = 1 << 16,
   RF_WRITE = 1 << 15,
-  RF_EXEC_WRITE = 1 << 13,
-  RF_EXEC = 1 << 12,
-  RF_NON_TLS_BSS = 1 << 11,
-  RF_NON_TLS_BSS_RO = 1 << 10,
-  RF_NOT_TLS = 1 << 9,
+  RF_EXEC_WRITE = 1 << 14,
+  RF_EXEC = 1 << 13,
+  RF_NON_TLS_BSS = 1 << 12,
+  RF_NON_TLS_BSS_RO = 1 << 11,
+  RF_NOT_TLS = 1 << 10,
+  RF_DYN_SYM = 1 << 9,
   RF_BSS = 1 << 8,
   RF_NOTE = 1 << 7,
   RF_PPC_NOT_TOCBSS = 1 << 6,
@@ -725,7 +726,7 @@
   // but without SHF_ALLOC is placed at the end. All "Sec" reaching
   // here has SHF_ALLOC bit set.
   if (Sec->Type == SHT_DYNSYM || Sec->Type == SHT_STRTAB)
-    return Rank;
+    return Rank | RF_DYN_SYM;
 
   // Sort sections based on their access permission in the following
   // order: R, RX, RWX, RW.  This order is based on the following


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45788.144769.patch
Type: text/x-patch
Size: 1477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/e68261b4/attachment.bin>


More information about the llvm-commits mailing list