[PATCH] D23031: [LinkerScript] Support OR of FLAGS in PHDR directives
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 13:15:13 PDT 2016
davide created this revision.
davide added a reviewer: ruiu.
davide added subscribers: llvm-commits, rafael.
https://reviews.llvm.org/D23031
Files:
ELF/LinkerScript.cpp
test/ELF/linkerscript/linkerscript-phdrs-flags.s
Index: test/ELF/linkerscript/linkerscript-phdrs-flags.s
===================================================================
--- test/ELF/linkerscript/linkerscript-phdrs-flags.s
+++ test/ELF/linkerscript/linkerscript-phdrs-flags.s
@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (1);} \
+# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (0x1 | 0x2);} \
# RUN: SECTIONS { \
# RUN: . = 0x10000200; \
# RUN: .text : {*(.text.*)} :all \
@@ -17,7 +17,8 @@
# CHECK-NEXT: PhysicalAddress: 0x10000000
# CHECK-NEXT: FileSize: 521
# CHECK-NEXT: MemSize: 521
-# CHECK-NEXT: Flags [ (0x1)
+# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: PF_W (0x2)
# CHECK-NEXT: PF_X (0x1)
# CHECK-NEXT: ]
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -644,8 +644,14 @@
else if (Tok == "PHDRS")
PhdrCmd.HasPhdrs = true;
else if (Tok == "FLAGS") {
+ // This can contain a bitwise-OR of flags.
expect("(");
- next().getAsInteger(0, PhdrCmd.Flags);
+ uint8_t Flags;
+ PhdrCmd.Flags = 0;
+ do {
+ next().getAsInteger(0, Flags);
+ PhdrCmd.Flags |= Flags;
+ } while (skip("|"));
expect(")");
} else
setError("unexpected header attribute: " + Tok);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23031.66366.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160801/558aa385/attachment.bin>
More information about the llvm-commits
mailing list