[lld] r259945 - Fix PT_GNU_RELRO computation.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 5 14:55:07 PST 2016
Author: rafael
Date: Fri Feb 5 16:55:06 2016
New Revision: 259945
URL: http://llvm.org/viewvc/llvm-project?rev=259945&view=rev
Log:
Fix PT_GNU_RELRO computation.
We were not including TLS sections.
Added:
lld/trunk/test/ELF/relro-tls.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259945&r1=259944&r2=259945&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Feb 5 16:55:06 2016
@@ -1245,9 +1245,9 @@ template <class ELFT> void Writer<ELFT>:
VA = alignTo(VA, Sec->getAlign());
Sec->setVA(VA);
VA += Sec->getSize();
- if (InRelRo)
- updateRelro(PH, &GnuRelroPhdr, VA);
}
+ if (InRelRo)
+ updateRelro(PH, &GnuRelroPhdr, VA);
}
FileOff = alignTo(FileOff, Sec->getAlign());
Added: lld/trunk/test/ELF/relro-tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relro-tls.s?rev=259945&view=auto
==============================================================================
--- lld/trunk/test/ELF/relro-tls.s (added)
+++ lld/trunk/test/ELF/relro-tls.s Fri Feb 5 16:55:06 2016
@@ -0,0 +1,23 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+// RUN: ld.lld %t -o %tout
+// RUN: llvm-readobj -program-headers %tout | FileCheck %s
+
+// CHECK: Type: PT_GNU_RELRO
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: VirtualAddress:
+// CHECK-NEXT: PhysicalAddress:
+// CHECK-NEXT: FileSize: 4
+// CHECK-NEXT: MemSize: 4
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: PF_R
+// CHECK-NEXT: ]
+// CHECK-NEXT: Alignment: 1
+
+.global _start
+_start:
+
+.global d
+.section .foo,"awT", at progbits
+d:
+.long 2
More information about the llvm-commits
mailing list