forked from OSchip/llvm-project
[llvm-objcopy] Allow 'protected' visibility to be set when using
add-symbol Reviewers: Maskray, rupprecht Differential Revision: https://reviews.llvm.org/D65891 llvm-svn: 368982
This commit is contained in:
parent
04f2f32869
commit
e5cdfbc65c
|
@ -160,6 +160,7 @@ them.
|
|||
- `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.
|
||||
|
|
|
@ -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 @@ ProgramHeaders:
|
|||
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
|
||||
|
|
|
@ -232,6 +232,7 @@ static Expected<NewSymbolInfo> parseNewSymbolInfo(StringRef FlagValue) {
|
|||
.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; })
|
||||
|
|
|
@ -214,7 +214,7 @@ def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
|
|||
|
||||
defm add_symbol
|
||||
: Eq<"add-symbol", "Add new symbol <name> 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.">,
|
||||
|
|
Loading…
Reference in New Issue