[PATCH] D22676: [ELF] - Linkerscript: ignore DATA_SEGMENT_RELRO_END expression
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 07:05:16 PDT 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.
DATA_SEGMENT_RELRO_END expression is used to protect first 3 entries of
.got.plt with relro technologie.
Since we desided not to support this in lld, I also see no reasons to try implement this in LS,
therefore expression is just ignored.
https://reviews.llvm.org/D22676
Files:
ELF/LinkerScript.cpp
test/ELF/linkerscript-locationcounter.s
Index: test/ELF/linkerscript-locationcounter.s
===================================================================
--- test/ELF/linkerscript-locationcounter.s
+++ test/ELF/linkerscript-locationcounter.s
@@ -37,6 +37,9 @@
# RUN: . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); \
# RUN: .datasegmentalign : { *(.datasegmentalign) } \
# RUN: . = DATA_SEGMENT_END (.); \
+# RUN: . = 0x27000; \
+# RUN: . = DATA_SEGMENT_RELRO_END (24, .); \
+# RUN: .datasegmentrelroend : { *(.datasegmentrelroend) } \
# RUN: }" > %t.script
# RUN: ld.lld %t --script %t.script -o %t2
# RUN: llvm-readobj -s %t2 | FileCheck %s
@@ -296,6 +299,21 @@
# CHECK-NEXT: AddressAlignment:
# CHECK-NEXT: EntrySize:
# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index:
+# CHECK-NEXT: Name: .datasegmentrelroend
+# CHECK-NEXT: Type: SHT_PROGBITS
+# CHECK-NEXT: Flags [
+# CHECK-NEXT: SHF_ALLOC
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x27000
+# CHECK-NEXT: Offset: 0x11000
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Link:
+# CHECK-NEXT: Info:
+# CHECK-NEXT: AddressAlignment:
+# CHECK-NEXT: EntrySize:
+# CHECK-NEXT: }
## Mailformed number error.
# RUN: echo "SECTIONS { \
@@ -399,3 +417,6 @@
.section .datasegmentalign, "a"
.quad 0
+
+.section .datasegmentrelroend, "a"
+.quad 0
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -159,6 +159,14 @@
expect(")");
return Dot;
}
+ if (Tok == "DATA_SEGMENT_RELRO_END") {
+ expect("(");
+ next();
+ expect(",");
+ next();
+ expect(")");
+ return Dot;
+ }
uint64_t V = 0;
if (Tok.getAsInteger(0, V))
setError("malformed number: " + Tok);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22676.65071.patch
Type: text/x-patch
Size: 1826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160722/14ad02fa/attachment.bin>
More information about the llvm-commits
mailing list