mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-28 22:00:30 +00:00
Revert [llvm-nm] Fix handling of symbol types + [llvm-nm] Generalize symbol types
This reverts r359311 and r359312 (git commit 0bf06a8f59b0074a60871865e828d92db8930c59 and 5f184f17800ea2ac27be5e4ab540cb94a46e80c7) llvm-svn: 359830
This commit is contained in:
parent
ce03ba5572
commit
dc435f6b24
BIN
test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
Executable file
BIN
test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
Executable file
Binary file not shown.
BIN
test/tools/llvm-nm/X86/Inputs/weak.obj.elf-x86_64
Normal file
BIN
test/tools/llvm-nm/X86/Inputs/weak.obj.elf-x86_64
Normal file
Binary file not shown.
@ -1,50 +1,8 @@
|
||||
# RUN: yaml2obj %s -o %t
|
||||
# RUN: llvm-nm -B -S %t | FileCheck %s
|
||||
!ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_EXEC
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .text
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
||||
- Name: .init_array
|
||||
Type: SHT_INIT_ARRAY
|
||||
Flags: [ SHF_ALLOC, SHF_WRITE ]
|
||||
- Name: .preinit_array
|
||||
Type: SHT_PREINIT_ARRAY
|
||||
Flags: [ SHF_ALLOC, SHF_WRITE ]
|
||||
- Name: .fini_array
|
||||
Type: SHT_FINI_ARRAY
|
||||
Flags: [ SHF_ALLOC, SHF_WRITE ]
|
||||
- Name: .data
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC, SHF_WRITE ]
|
||||
- Name: .bss
|
||||
Type: SHT_NOBITS
|
||||
Flags: [ SHF_ALLOC, SHF_WRITE ]
|
||||
Symbols:
|
||||
- Name: __init_array_start
|
||||
Section: .init_array
|
||||
- Name: __preinit_array_start
|
||||
Section: .preinit_array
|
||||
- Name: __fini_array_start
|
||||
Section: .fini_array
|
||||
- Name: __bss_start
|
||||
Section: .bss
|
||||
Binding: STB_GLOBAL
|
||||
- Name: _edata
|
||||
Section: .data
|
||||
Binding: STB_GLOBAL
|
||||
- Name: _end
|
||||
Section: .bss
|
||||
Binding: STB_GLOBAL
|
||||
# RUN: llvm-nm -B -S %p/Inputs/init-fini.out.elf-x86_64 | FileCheck --match-full-lines %s
|
||||
|
||||
# CHECK: B __bss_start
|
||||
# CHECK: d __fini_array_start
|
||||
# CHECK: d __init_array_start
|
||||
# CHECK: d __preinit_array_start
|
||||
# CHECK: D _edata
|
||||
# CHECK: B _end
|
||||
CHECK: 00000000006000c2 0000000000000000 T __bss_start
|
||||
CHECK: 00000000006000c2 0000000000000000 t __init_array_end
|
||||
CHECK: 00000000006000ba 0000000000000000 t __init_array_start
|
||||
CHECK: 00000000006000c2 0000000000000000 T _edata
|
||||
CHECK: 00000000006000c8 0000000000000000 T _end
|
||||
CHECK: 00000000004000b0 0000000000000000 T _start
|
||||
|
@ -1,36 +1,7 @@
|
||||
# RUN: yaml2obj %s -o %t
|
||||
# RUN: llvm-nm -B -S %t | FileCheck --match-full-lines %s
|
||||
# RUN: llvm-nm -W -B -S %t | count 0
|
||||
!ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .text
|
||||
Type: SHT_PROGBITS
|
||||
- Name: .data
|
||||
Type: SHT_PROGBITS
|
||||
Symbols:
|
||||
- Name: weak_func
|
||||
Type: STT_FUNC
|
||||
Section: .text
|
||||
Binding: STB_WEAK
|
||||
Size: 17
|
||||
- Name: weak_var
|
||||
Type: STT_OBJECT
|
||||
Section: .data
|
||||
Binding: STB_WEAK
|
||||
Size: 4
|
||||
- Name: weak_extern_func
|
||||
Type: STT_FUNC
|
||||
Binding: STB_WEAK
|
||||
- Name: weak_extern_var
|
||||
Type: STT_OBJECT
|
||||
Binding: STB_WEAK
|
||||
# RUN: llvm-nm -B -S %p/Inputs/weak.obj.elf-x86_64 | FileCheck --match-full-lines %s
|
||||
# RUN: llvm-nm -W -B -S %p/Inputs/weak.obj.elf-x86_64 | count 0
|
||||
|
||||
# CHECK: w weak_extern_func
|
||||
# CHECK: v weak_extern_var
|
||||
# CHECK: 0000000000000000 0000000000000011 W weak_func
|
||||
# CHECK: 0000000000000000 0000000000000004 V weak_var
|
||||
CHECK: w weak_extern_func
|
||||
CHECK: w weak_extern_var
|
||||
CHECK: 0000000000000000 0000000000000011 W weak_func
|
||||
CHECK: 0000000000000000 0000000000000004 V weak_var
|
||||
|
@ -901,26 +901,43 @@ static char getSymbolNMTypeChar(ELFObjectFileBase &Obj,
|
||||
|
||||
elf_section_iterator SecI = *SecIOrErr;
|
||||
if (SecI != Obj.section_end()) {
|
||||
uint32_t Type = SecI->getType();
|
||||
uint64_t Flags = SecI->getFlags();
|
||||
if (Type == ELF::SHT_NOBITS)
|
||||
switch (SecI->getType()) {
|
||||
case ELF::SHT_PROGBITS:
|
||||
case ELF::SHT_DYNAMIC:
|
||||
switch (SecI->getFlags()) {
|
||||
case (ELF::SHF_ALLOC | ELF::SHF_EXECINSTR):
|
||||
return 't';
|
||||
case (ELF::SHF_TLS | ELF::SHF_ALLOC | ELF::SHF_WRITE):
|
||||
case (ELF::SHF_ALLOC | ELF::SHF_WRITE):
|
||||
return 'd';
|
||||
case ELF::SHF_ALLOC:
|
||||
case (ELF::SHF_ALLOC | ELF::SHF_MERGE):
|
||||
case (ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS):
|
||||
return 'r';
|
||||
}
|
||||
break;
|
||||
case ELF::SHT_NOBITS:
|
||||
return 'b';
|
||||
if (Flags & ELF::SHF_EXECINSTR)
|
||||
case ELF::SHT_INIT_ARRAY:
|
||||
case ELF::SHT_FINI_ARRAY:
|
||||
return 't';
|
||||
if (Flags & ELF::SHF_ALLOC)
|
||||
return Flags & ELF::SHF_WRITE ? 'd' : 'r';
|
||||
}
|
||||
}
|
||||
|
||||
if (SymI->getELFType() == ELF::STT_SECTION) {
|
||||
Expected<StringRef> Name = SymI->getName();
|
||||
if (!Name) {
|
||||
consumeError(Name.takeError());
|
||||
return '?';
|
||||
}
|
||||
if (Name->startswith(".debug"))
|
||||
return 'N';
|
||||
if (!(Flags & ELF::SHF_WRITE))
|
||||
return 'n';
|
||||
return StringSwitch<char>(*Name)
|
||||
.StartsWith(".debug", 'N')
|
||||
.StartsWith(".note", 'n')
|
||||
.StartsWith(".comment", 'n')
|
||||
.Default('?');
|
||||
}
|
||||
|
||||
return '?';
|
||||
return 'n';
|
||||
}
|
||||
|
||||
static char getSymbolNMTypeChar(COFFObjectFile &Obj, symbol_iterator I) {
|
||||
|
Loading…
Reference in New Issue
Block a user