Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -982,6 +982,12 @@ if (peek() == "=" || peek() == "+=") { Cmd = readAssignment(Tok); expect(";"); + } else if (Tok == "HIDDEN") { + expect("("); + Cmd = readAssignment(next()); + Cmd->Hidden = true; + expect(")"); + expect(";"); } else if (Tok == "PROVIDE") { Cmd = readProvide(false); } else if (Tok == "PROVIDE_HIDDEN") { 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