Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is useful for debugging why lld loads .o files it shouldn't load. It's also useful for users of lld -- I've used ld64's version of this a few times. Differential Revision: https://reviews.llvm.org/D92496
- Loading branch information
Showing
7 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# REQUIRES: x86 | ||
# RUN: rm -rf %t | ||
# RUN: split-file %s %t | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/objc.o %t/objc.s | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/foo.o %t/foo.s | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/bar.o %t/bar.s | ||
# RUN: llvm-ar csr %t/lib.a %t/objc.o %t/foo.o %t/bar.o | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s | ||
|
||
# The first line checks that we never demangle symbols in -why_load output. | ||
# RUN: %lld %t/main.o %t/lib.a -o /dev/null -why_load -demangle | \ | ||
# RUN: FileCheck %s --check-prefix=WHY | ||
# RUN: %lld %t/main.o -force_load %t/lib.a -o /dev/null -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYFORCE | ||
# RUN: %lld %t/main.o %t/lib.a -o /dev/null -all_load -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYALL | ||
# RUN: %lld %t/main.o -force_load %t/lib.a -o /dev/null -all_load -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYALLFORCE | ||
|
||
# RUN: %lld %t/main.o %t/lib.a -o /dev/null -ObjC -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYOBJC | ||
# RUN: %lld %t/main.o -force_load %t/lib.a -o /dev/null -ObjC -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYOBJCFORCE | ||
# RUN: %lld %t/main.o %t/lib.a -o /dev/null -ObjC -all_load -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYOBJCALL | ||
# RUN: %lld %t/main.o -force_load %t/lib.a -o /dev/null -ObjC -all_load -why_load | \ | ||
# RUN: FileCheck %s --check-prefix=WHYOBJCALLFORCE | ||
|
||
# WHY-DAG: _bar forced load of lib.a(bar.o) | ||
# WHY-DAG: __Z3foo forced load of lib.a(foo.o) | ||
# WHY-NOT: {{.*}} forced load of lib.a(objc.o) | ||
|
||
# WHYFORCE-DAG: -force_load forced load of lib.a(bar.o) | ||
# WHYFORCE-DAG: -force_load forced load of lib.a(foo.o) | ||
# WHYFORCE-DAG: -force_load forced load of lib.a(objc.o) | ||
|
||
# WHYALL-DAG: -all_load forced load of lib.a(bar.o) | ||
# WHYALL-DAG: -all_load forced load of lib.a(foo.o) | ||
# WHYALL-DAG: -all_load forced load of lib.a(objc.o) | ||
|
||
# WHYALLFORCE-DAG: -force_load forced load of lib.a(bar.o) | ||
# WHYALLFORCE-DAG: -force_load forced load of lib.a(foo.o) | ||
# WHYALLFORCE-DAG: -force_load forced load of lib.a(objc.o) | ||
|
||
# WHYOBJC-DAG: _bar forced load of lib.a(bar.o) | ||
# WHYOBJC-DAG: __Z3foo forced load of lib.a(foo.o) | ||
# WHYOBJC-DAG: -ObjC forced load of lib.a(objc.o) | ||
|
||
# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(bar.o) | ||
# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(foo.o) | ||
# WHYOBJCFORCE-DAG: -force_load forced load of lib.a(objc.o) | ||
|
||
# WHYOBJCALL-DAG: -all_load forced load of lib.a(bar.o) | ||
# WHYOBJCALL-DAG: -all_load forced load of lib.a(foo.o) | ||
# WHYOBJCALL-DAG: -all_load forced load of lib.a(objc.o) | ||
|
||
# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(bar.o) | ||
# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(foo.o) | ||
# WHYOBJCALLFORCE-DAG: -force_load forced load of lib.a(objc.o) | ||
|
||
#--- objc.s | ||
.section __DATA,__objc_catlist | ||
.quad 0x1234 | ||
|
||
#--- foo.s | ||
.globl __Z3foo | ||
__Z3foo: | ||
ret | ||
|
||
#--- bar.s | ||
.globl _bar | ||
_bar: | ||
callq __Z3foo | ||
ret | ||
|
||
#--- main.s | ||
.globl _main | ||
_main: | ||
callq _bar | ||
callq __Z3foo | ||
ret |