Skip to content

Commit

Permalink
[llvm-objdump][MachO] Print a newline before lazy bind/bind/weak/expo…
Browse files Browse the repository at this point in the history
…rts trie

This adds a separator between two pieces of information.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D102114
  • Loading branch information
MaskRay committed May 10, 2021
1 parent cfef7c9 commit 7a0231a
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 39 deletions.
1 change: 1 addition & 0 deletions lld/test/MachO/local-got.s
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lld/test/MachO/tlv.s
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lld/test/MachO/x86-64-stubs.s
Expand Up @@ -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

Expand Down
19 changes: 11 additions & 8 deletions llvm/test/tools/llvm-objdump/MachO/bind.test
@@ -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
18 changes: 10 additions & 8 deletions llvm/test/tools/llvm-objdump/MachO/exports-trie.test
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions llvm/test/tools/llvm-objdump/MachO/lazy-bind.test
@@ -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
28 changes: 15 additions & 13 deletions llvm/test/tools/llvm-objdump/MachO/rebase.test
@@ -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
10 changes: 5 additions & 5 deletions llvm/tools/llvm-objdump/MachODump.cpp
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7a0231a

Please sign in to comment.