[PATCH] D23534: [ELF] Linkerscript: support hidden symbols assignments
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 15 17:59:55 PDT 2016
phosek updated this revision to Diff 68119.
phosek marked 3 inline comments as done.
https://reviews.llvm.org/D23534
Files:
ELF/LinkerScript.cpp
test/ELF/linkerscript/linkerscript-symbols.s
Index: test/ELF/linkerscript/linkerscript-symbols.s
===================================================================
--- test/ELF/linkerscript/linkerscript-symbols.s
+++ test/ELF/linkerscript/linkerscript-symbols.s
@@ -35,6 +35,12 @@
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN2 %s
# HIDDEN2: 0000000000000000 *ABS* 00000000 somesym
+# Hidden symbol assignment.
+# RUN: echo "SECTIONS { HIDDEN(newsym = 1);}" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN3 %s
+# HIDDEN3: 0000000000000001 *ABS* 00000000 .hidden newsym
+
.global _start
_start:
nop
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -602,7 +602,7 @@
InputSectionDescription *readInputSectionRules();
unsigned readPhdrType();
SortKind readSortKind();
- SymbolAssignment *readProvide(bool Hidden);
+ SymbolAssignment *readProvideHidden(bool Provide, bool Hidden);
SymbolAssignment *readProvideOrAssignment(StringRef Tok);
Expr readAlign();
void readSort();
@@ -969,10 +969,10 @@
return { uint8_t(V >> 24), uint8_t(V >> 16), uint8_t(V >> 8), uint8_t(V) };
}
-SymbolAssignment *ScriptParser::readProvide(bool Hidden) {
+SymbolAssignment *ScriptParser::readProvideHidden(bool Provide, bool Hidden) {
expect("(");
SymbolAssignment *Cmd = readAssignment(next());
- Cmd->Provide = true;
+ Cmd->Provide = Provide;
Cmd->Hidden = Hidden;
expect(")");
expect(";");
@@ -985,9 +985,11 @@
Cmd = readAssignment(Tok);
expect(";");
} else if (Tok == "PROVIDE") {
- Cmd = readProvide(false);
+ Cmd = readProvideHidden(true, false);
+ } else if (Tok == "HIDDEN") {
+ Cmd = readProvideHidden(false, true);
} else if (Tok == "PROVIDE_HIDDEN") {
- Cmd = readProvide(true);
+ Cmd = readProvideHidden(true, true);
}
return Cmd;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23534.68119.patch
Type: text/x-patch
Size: 1972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160816/a1a13dd9/attachment.bin>
More information about the llvm-commits
mailing list