mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[llvm-objcopy][MachO] Do not strip symbols with the flag REFERENCED_DYNAMICALLY set
Do not strip symbols having the flag REFERENCED_DYNAMICALLY set. Test plan: make check-all Differential revision: https://reviews.llvm.org/D104092
This commit is contained in:
parent
bd92e2af3f
commit
29e2b0118b
@ -254,9 +254,9 @@ LoadCommands:
|
|||||||
- cmd: LC_SYMTAB
|
- cmd: LC_SYMTAB
|
||||||
cmdsize: 24
|
cmdsize: 24
|
||||||
symoff: 2136
|
symoff: 2136
|
||||||
nsyms: 3
|
nsyms: 4
|
||||||
stroff: 2184
|
stroff: 2204
|
||||||
strsize: 20
|
strsize: 40
|
||||||
- cmd: LC_DYSYMTAB
|
- cmd: LC_DYSYMTAB
|
||||||
cmdsize: 80
|
cmdsize: 80
|
||||||
ilocalsym: 0
|
ilocalsym: 0
|
||||||
@ -279,23 +279,31 @@ LoadCommands:
|
|||||||
nlocrel: 0
|
nlocrel: 0
|
||||||
LinkEditData:
|
LinkEditData:
|
||||||
NameList:
|
NameList:
|
||||||
- n_strx: 1
|
- n_strx: 21
|
||||||
n_type: 0x0E
|
n_type: 0x0E
|
||||||
n_sect: 2
|
n_sect: 2
|
||||||
n_desc: 0
|
n_desc: 0
|
||||||
n_value: 36
|
n_value: 36
|
||||||
- n_strx: 11
|
- n_strx: 31
|
||||||
n_type: 0x0F
|
n_type: 0x0F
|
||||||
n_sect: 1
|
n_sect: 1
|
||||||
n_desc: 0
|
n_desc: 0
|
||||||
n_value: 0
|
n_value: 0
|
||||||
- n_strx: 6
|
## __mh_execute_header
|
||||||
|
- n_strx: 1
|
||||||
|
n_type: 0xF
|
||||||
|
n_sect: 1
|
||||||
|
## ReferencedDynamically (0x10)
|
||||||
|
n_desc: 16
|
||||||
|
n_value: 4294967296
|
||||||
|
- n_strx: 26
|
||||||
n_type: 0x01
|
n_type: 0x01
|
||||||
n_sect: 0
|
n_sect: 0
|
||||||
n_desc: 512
|
n_desc: 512
|
||||||
n_value: 4
|
n_value: 4
|
||||||
StringTable:
|
StringTable:
|
||||||
- ''
|
- ''
|
||||||
|
- __mh_execute_header
|
||||||
- _bar
|
- _bar
|
||||||
- _foo
|
- _foo
|
||||||
- _main
|
- _main
|
||||||
|
@ -45,8 +45,20 @@
|
|||||||
# DWARF-NOT: Name: __debug_line
|
# DWARF-NOT: Name: __debug_line
|
||||||
# DWARF: ]
|
# DWARF: ]
|
||||||
|
|
||||||
## Make sure that all relocations and symbols are removed.
|
## Make sure that all relocations and symbols
|
||||||
|
## (except those which have the flag ReferencedDynamically set) are removed.
|
||||||
# COMMON: Relocations [
|
# COMMON: Relocations [
|
||||||
# COMMON-NEXT: ]
|
# COMMON-NEXT: ]
|
||||||
# COMMON: Symbols [
|
# COMMON-NEXT: Symbols [
|
||||||
|
# COMMON-NEXT: Symbol {
|
||||||
|
# COMMON-NEXT: Name: __mh_execute_header
|
||||||
|
# COMMON-NEXT: Extern
|
||||||
|
# COMMON-NEXT: Type: Section
|
||||||
|
# COMMON-NEXT: Section: __text
|
||||||
|
# COMMON-NEXT: RefType: UndefinedNonLazy
|
||||||
|
# COMMON-NEXT: Flags [ (0x10)
|
||||||
|
# COMMON-NEXT: ReferencedDynamically (0x10)
|
||||||
|
# COMMON-NEXT: ]
|
||||||
|
# COMMON-NEXT: Value:
|
||||||
|
# COMMON-NEXT: }
|
||||||
# COMMON-NEXT: ]
|
# COMMON-NEXT: ]
|
||||||
|
@ -99,6 +99,8 @@ static void updateAndRemoveSymbols(const CommonConfig &Config, Object &Obj) {
|
|||||||
return false;
|
return false;
|
||||||
if (Config.KeepUndefined && N->isUndefinedSymbol())
|
if (Config.KeepUndefined && N->isUndefinedSymbol())
|
||||||
return false;
|
return false;
|
||||||
|
if (N->n_desc & MachO::REFERENCED_DYNAMICALLY)
|
||||||
|
return false;
|
||||||
if (Config.StripAll)
|
if (Config.StripAll)
|
||||||
return true;
|
return true;
|
||||||
if (Config.DiscardMode == DiscardType::All && !(N->n_type & MachO::N_EXT))
|
if (Config.DiscardMode == DiscardType::All && !(N->n_type & MachO::N_EXT))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user