[PATCH] D22649: [ELF] - Linkerscript: ignore AT
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 14:11:38 PDT 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.
AT is tricky command and we even have a patch for it: D19272
Though looks we do not to support it right now,
but probably it is worth to ignore then.
Patch implements that and just shows warning if it is used.
https://reviews.llvm.org/D22649
Files:
ELF/LinkerScript.cpp
test/ELF/linkerscript-at.s
Index: test/ELF/linkerscript-at.s
===================================================================
--- test/ELF/linkerscript-at.s
+++ test/ELF/linkerscript-at.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "SECTIONS { \
+# RUN: .aaa : AT(0x0) \
+# RUN: { \
+# RUN: } \
+# RUN: }" > %t.script
+# RUN: ld.lld -shared %t --script %t.script -o %t2 2>&1 | \
+# RUN: FileCheck --check-prefix=IGNORED %s
+# IGNORED: AT command is ignored
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -577,6 +577,7 @@
unsigned readPhdrType();
void readSymbolAssignment(StringRef Name);
std::vector<StringRef> readSectionsCommandExpr();
+ void readAt();
const static StringMap<Handler> Cmd;
ScriptConfiguration &Opt = *ScriptConfig;
@@ -789,10 +790,23 @@
Opt.Commands.push_back(llvm::make_unique<SymbolAssignment>(".", Expr));
}
+void ScriptParser::readAt() {
+ warning("AT command is ignored");
+ expect("AT");
+ expect("(");
+ while (!Error) {
+ StringRef Tok = next();
+ if (Tok == ")")
+ break;
+ }
+}
+
void ScriptParser::readOutputSectionDescription(StringRef OutSec) {
OutputSectionCommand *Cmd = new OutputSectionCommand(OutSec);
Opt.Commands.emplace_back(Cmd);
expect(":");
+ if (peek() == "AT")
+ readAt();
expect("{");
while (!Error && !skip("}")) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22649.64959.patch
Type: text/x-patch
Size: 1521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/9d5233d3/attachment.bin>
More information about the llvm-commits
mailing list