[PATCH] D22848: [ELF] - Linkerscript: ignore SORT(CONSTRUCTORS)
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 00:25:58 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276965: [ELF] - Linkerscript: ignore SORT(CONSTRUCTORS) (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D22848?vs=65688&id=65880#toc
Repository:
rL LLVM
https://reviews.llvm.org/D22848
Files:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/linkerscript-sort-constructors.s
Index: lld/trunk/test/ELF/linkerscript/linkerscript-sort-constructors.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/linkerscript-sort-constructors.s
+++ lld/trunk/test/ELF/linkerscript/linkerscript-sort-constructors.s
@@ -0,0 +1,5 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
+# RUN: echo "SECTIONS { .aaa : { SORT(CONSTRUCTORS) } }" > %t1.script
+# RUN: ld.lld -shared -o %t1 --script %t1.script %t1.o
+# RUN: llvm-readobj %t1 > /dev/null
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -442,6 +442,7 @@
unsigned readPhdrType();
void readProvide(bool Hidden);
void readAlign(OutputSectionCommand *Cmd);
+ void readSort();
Expr readExpr();
Expr readExpr1(Expr Lhs, int MinPrec);
@@ -701,6 +702,12 @@
expect(")");
}
+void ScriptParser::readSort() {
+ expect("(");
+ expect("CONSTRUCTORS");
+ expect(")");
+}
+
void ScriptParser::readOutputSectionDescription(StringRef OutSec) {
OutputSectionCommand *Cmd = new OutputSectionCommand(OutSec);
Opt.Commands.emplace_back(Cmd);
@@ -736,6 +743,8 @@
readProvide(false);
} else if (Tok == "PROVIDE_HIDDEN") {
readProvide(true);
+ } else if (Tok == "SORT") {
+ readSort();
} else {
setError("unknown command " + Tok);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22848.65880.patch
Type: text/x-patch
Size: 1474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/023f94ec/attachment.bin>
More information about the llvm-commits
mailing list