Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/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; } Index: lld/trunk/test/ELF/linkerscript/linkerscript-symbols.s =================================================================== --- lld/trunk/test/ELF/linkerscript/linkerscript-symbols.s +++ lld/trunk/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