Index: llvm/trunk/docs/CommandGuide/llvm-objcopy.rst =================================================================== --- llvm/trunk/docs/CommandGuide/llvm-objcopy.rst +++ llvm/trunk/docs/CommandGuide/llvm-objcopy.rst @@ -160,6 +160,7 @@ - `weak` = the symbol will have weak binding. - `default` = the symbol will have default visibility. - `hidden` = the symbol will have hidden visibility. + - `protected` = the symbol will have protected visibility. - `file` = the symbol will be an `STT_FILE` symbol. - `section` = the symbol will be an `STT_SECTION` symbol. - `object` = the symbol will be an `STT_OBJECT` symbol. Index: llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test =================================================================== --- llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test +++ llvm/trunk/test/tools/llvm-objcopy/ELF/add-symbol.test @@ -2,6 +2,7 @@ # RUN: llvm-objcopy --add-symbol='abs1=1' \ # RUN: --add-symbol='abs2=2,LoCaL,HiDdEn,FuNcTiOn' \ # RUN: --add-symbol='abs3=3,global,default,object' \ +# RUN: --add-symbol='abs4=4,global,protected,object' \ # RUN: --add-symbol='foo.cpp=0,file' \ # RUN: --add-symbol='=.text:0,section' \ # RUN: --add-symbol='data=.data:0x100,weak' \ @@ -58,14 +59,15 @@ Sections: - Section: .data -# CHECK: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND +# CHECK: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND # CHECK-NEXT: 1: 00000001 0 NOTYPE GLOBAL DEFAULT ABS abs1 # CHECK-NEXT: 2: 00000002 0 FUNC LOCAL HIDDEN ABS abs2 # CHECK-NEXT: 3: 00000003 0 OBJECT GLOBAL DEFAULT ABS abs3 -# CHECK-NEXT: 4: 00000000 0 FILE GLOBAL DEFAULT ABS foo.cpp -# CHECK-NEXT: 5: 00001000 0 SECTION GLOBAL DEFAULT 1 -# CHECK-NEXT: 6: 00002100 0 NOTYPE WEAK DEFAULT 2 data -# CHECK-NEXT: 7: 00001000 0 IFUNC GLOBAL DEFAULT 1 ifunc +# CHECK-NEXT: 4: 00000004 0 OBJECT GLOBAL PROTECTED ABS abs4 +# CHECK-NEXT: 5: 00000000 0 FILE GLOBAL DEFAULT ABS foo.cpp +# CHECK-NEXT: 6: 00001000 0 SECTION GLOBAL DEFAULT 1 +# CHECK-NEXT: 7: 00002100 0 NOTYPE WEAK DEFAULT 2 data +# CHECK-NEXT: 8: 00001000 0 IFUNC GLOBAL DEFAULT 1 ifunc # IGNORED: 1: 00000000 0 NOTYPE GLOBAL DEFAULT ABS dummy1 # IGNORED-NEXT: 2: 00000000 0 NOTYPE GLOBAL DEFAULT ABS dummy2 Index: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp =================================================================== --- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp +++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp @@ -232,6 +232,7 @@ .CaseLower("weak", [&SI] { SI.Bind = ELF::STB_WEAK; }) .CaseLower("default", [&SI] { SI.Visibility = ELF::STV_DEFAULT; }) .CaseLower("hidden", [&SI] { SI.Visibility = ELF::STV_HIDDEN; }) + .CaseLower("protected", [&SI] { SI.Visibility = ELF::STV_PROTECTED; }) .CaseLower("file", [&SI] { SI.Type = ELF::STT_FILE; }) .CaseLower("section", [&SI] { SI.Type = ELF::STT_SECTION; }) .CaseLower("object", [&SI] { SI.Type = ELF::STT_OBJECT; }) Index: llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td =================================================================== --- llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td +++ llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td @@ -214,7 +214,7 @@ defm add_symbol : Eq<"add-symbol", "Add new symbol to .symtab. Accepted flags: " - "global, local, weak, default, hidden, file, section, object, " + "global, local, weak, default, hidden, protected, file, section, object, " "function, indirect-function. Accepted but ignored for " "compatibility: debug, constructor, warning, indirect, synthetic, " "unique-object, before.">,