[llvm-objdump][MachO] Print a newline before lazy bind/bind/weak/exports trie

This adds a separator between two pieces of information.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D102114
This commit is contained in:
Fangrui Song 2021-05-10 09:16:18 -07:00
parent cfef7c918b
commit 7a0231ae59
8 changed files with 52 additions and 39 deletions

View File

@ -33,6 +33,7 @@
# PIE-NEXT: __DATA_CONST __got 0x[[#ADDR + 8]] pointer
## Check that a non-locally-defined symbol is still bound at the correct offset:
# CHECK-EMPTY:
# CHECK-NEXT: Bind table:
# CHECK-NEXT: segment section address type addend dylib symbol
# CHECK-NEXT: __DATA_CONST __got 0x[[#ADDR+16]] pointer 0 libhello _hello_its_me

View File

@ -61,6 +61,7 @@
## Make sure we don't emit rebase opcodes for relocations in __thread_vars.
# LINKEDIT: Rebase table:
# LINKEDIT-NEXT: segment section address type
# LINKEDIT-EMPTY:
# LINKEDIT-NEXT: Bind table:
# LINKEDIT: __DATA __thread_vars 0x{{[0-9a-f]*}} pointer 0 libSystem __tlv_bootstrap
# LINKEDIT: __DATA __thread_vars 0x{{[0-9a-f]*}} pointer 0 libSystem __tlv_bootstrap

View File

@ -44,6 +44,7 @@
# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#%X, ADDR:]] pointer
# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#ADDR + 8]] pointer
# CHECK-EMPTY:
# CHECK-NEXT: Bind table:
# CHECK: __DATA_CONST __got 0x[[#%x, BINDER:]] pointer 0 libSystem dyld_stub_binder

View File

@ -1,10 +1,13 @@
# RUN: llvm-objdump --macho --bind %p/Inputs/bind.macho-x86_64 \
# RUN: | FileCheck %s
# RUN: | FileCheck %s --match-full-lines --strict-whitespace
# CHECK:__DATA __data 0x00001028 pointer 0 flat-namespace _any
# CHECK:__DATA __data 0x00001020 pointer 0 main-executable _fromApp
# CHECK:__DATA __data 0x00001018 pointer 0 this-image _myfunc
# CHECK:__DATA __data 0x00001000 pointer 0 libfoo _foo
# CHECK:__DATA __data 0x00001008 pointer 0 libbar _bar
# CHECK:__DATA __data 0x00001010 pointer 0 libSystem _malloc
# CHECK:{{.*}}bind.macho-x86_64:
#CHECK-EMPTY:
# CHECK-NEXT:Bind table:
# CHECK-NEXT:segment section address type addend dylib symbol
# CHECK-NEXT:__DATA __data 0x00001028 pointer 0 flat-namespace _any
# CHECK-NEXT:__DATA __data 0x00001020 pointer 0 main-executable _fromApp
# CHECK-NEXT:__DATA __data 0x00001018 pointer 0 this-image _myfunc
# CHECK-NEXT:__DATA __data 0x00001000 pointer 0 libfoo _foo
# CHECK-NEXT:__DATA __data 0x00001008 pointer 0 libbar _bar
# CHECK-NEXT:__DATA __data 0x00001010 pointer 0 libSystem _malloc

View File

@ -1,15 +1,17 @@
# RUN: llvm-objdump --macho --exports-trie --arch x86_64 \
# RUN: %p/Inputs/exports-trie.macho-x86_64 2>/dev/null | FileCheck %s
# RUN: %p/Inputs/exports-trie.macho-x86_64 2>/dev/null | FileCheck %s --match-full-lines --strict-whitespace
# RUN: llvm-objdump --macho --exports-trie --arch x86_64 \
# RUN: %p/Inputs/weak-bind.macho-x86_64 2>/dev/null | FileCheck --check-prefix=EXE %s
# CHECK:[re-export] _malloc (from libSystem)
# CHECK:[re-export] _myfree (_free from libSystem)
# CHECK:0x00000F70 _myWeak [weak_def]
# CHECK:0x00001018 _myTLV [per-thread]
# CHECK:0x12345678 _myAbs [absolute]
# CHECK:0x00000F60 _foo
# CHECK:{{.*}}exports-trie.macho-x86_64:
#CHECK-EMPTY:
# CHECK-NEXT:Exports trie:
# CHECK-NEXT:[re-export] _malloc (from libSystem)
# CHECK-NEXT:[re-export] _myfree (_free from libSystem)
# CHECK-NEXT:0x00000F70 _myWeak [weak_def]
# CHECK-NEXT:0x00001018 _myTLV [per-thread]
# CHECK-NEXT:0x12345678 _myAbs [absolute]
# CHECK-NEXT:0x00000F60 _foo
# EXE: 0x100000000 __mh_execute_header

View File

@ -1,7 +1,10 @@
# RUN: llvm-objdump --macho --lazy-bind %p/Inputs/lazy-bind.macho-x86_64 \
# RUN: | FileCheck %s
# RUN: | FileCheck %s --match-full-lines --strict-whitespace
# CHECK: __DATA __la_symbol_ptr 0x100001010 libfoo _foo
# CHECK: __DATA __la_symbol_ptr 0x100001018 libbar _bar
# CHECK: __DATA __la_symbol_ptr 0x100001020 libSystem _malloc
# CHECK:{{.*}}lazy-bind.macho-x86_64:
#CHECK-EMPTY:
# CHECK-NEXT:Lazy bind table:
# CHECK-NEXT:segment section address dylib symbol
# CHECK-NEXT:__DATA __la_symbol_ptr 0x100001010 libfoo _foo
# CHECK-NEXT:__DATA __la_symbol_ptr 0x100001018 libbar _bar
# CHECK-NEXT:__DATA __la_symbol_ptr 0x100001020 libSystem _malloc

View File

@ -1,15 +1,17 @@
# RUN: llvm-objdump --macho --rebase --arch x86_64 \
# RUN: %p/Inputs/rebase.macho-x86_64 | FileCheck %s
# RUN: %p/Inputs/rebase.macho-x86_64 | FileCheck %s --match-full-lines --strict-whitespace
# CHECK: segment section address type
# CHECK: __DATA __data 0x00001010 pointer
# CHECK: __DATA __data 0x00001028 pointer
# CHECK: __DATA __data 0x00001030 pointer
# CHECK: __DATA __data 0x00001038 pointer
# CHECK: __DATA __data 0x00001040 pointer
# CHECK: __DATA __data 0x00001258 pointer
# CHECK: __DATA __mystuff 0x00001278 pointer
# CHECK: __DATA __mystuff 0x00001288 pointer
# CHECK: __DATA __mystuff 0x00001298 pointer
# CHECK: __DATA __mystuff 0x000012A8 pointer
# CHECK:{{.*}}rebase.macho-x86_64:
#CHECK-EMPTY:
# CHECK-NEXT:Rebase table:
# CHECK-NEXT:segment section address type
# CHECK-NEXT:__DATA __data 0x00001010 pointer
# CHECK-NEXT:__DATA __data 0x00001028 pointer
# CHECK-NEXT:__DATA __data 0x00001030 pointer
# CHECK-NEXT:__DATA __data 0x00001038 pointer
# CHECK-NEXT:__DATA __data 0x00001040 pointer
# CHECK-NEXT:__DATA __data 0x00001258 pointer
# CHECK-NEXT:__DATA __mystuff 0x00001278 pointer
# CHECK-NEXT:__DATA __mystuff 0x00001288 pointer
# CHECK-NEXT:__DATA __mystuff 0x00001298 pointer
# CHECK-NEXT:__DATA __mystuff 0x000012A8 pointer

View File

@ -10467,7 +10467,7 @@ static const char *get_dyld_bind_info_symbolname(uint64_t ReferenceValue,
}
void objdump::printLazyBindTable(ObjectFile *o) {
outs() << "Lazy bind table:\n";
outs() << "\nLazy bind table:\n";
if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOLazyBindTable(MachO);
else
@ -10477,7 +10477,7 @@ void objdump::printLazyBindTable(ObjectFile *o) {
}
void objdump::printWeakBindTable(ObjectFile *o) {
outs() << "Weak bind table:\n";
outs() << "\nWeak bind table:\n";
if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOWeakBindTable(MachO);
else
@ -10487,7 +10487,7 @@ void objdump::printWeakBindTable(ObjectFile *o) {
}
void objdump::printExportsTrie(const ObjectFile *o) {
outs() << "Exports trie:\n";
outs() << "\nExports trie:\n";
if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOExportsTrie(MachO);
else
@ -10497,7 +10497,7 @@ void objdump::printExportsTrie(const ObjectFile *o) {
}
void objdump::printRebaseTable(ObjectFile *o) {
outs() << "Rebase table:\n";
outs() << "\nRebase table:\n";
if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachORebaseTable(MachO);
else
@ -10507,7 +10507,7 @@ void objdump::printRebaseTable(ObjectFile *o) {
}
void objdump::printBindTable(ObjectFile *o) {
outs() << "Bind table:\n";
outs() << "\nBind table:\n";
if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOBindTable(MachO);
else