-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lld-macho] Include branch extension thunks in linker map #120496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,45 @@ | |
| ## (4) early calls to a dylib stub use a thunk, and later calls the stub | ||
| ## directly | ||
| ## (5) Thunks are created for all sections in the text segment with branches. | ||
| ## (6) Thunks are in the linker map file. | ||
| ## Notes: | ||
| ## 0x4000000 = 64 Mi = half the magnitude of the forward-branch range | ||
|
|
||
| # RUN: rm -rf %t; mkdir %t | ||
| # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/input.o | ||
| # RUN: %lld -arch arm64 -dead_strip -lSystem -U _extern_sym -o %t/thunk %t/input.o | ||
| # RUN: %lld -arch arm64 -dead_strip -lSystem -U _extern_sym -map %t/thunk.map -o %t/thunk %t/input.o | ||
| # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/thunk | FileCheck %s | ||
|
|
||
| ## Check that the thunks appear in the map file and that everything is sorted by address | ||
| # Because of the `.space` instructions, there will end up being a lot of dead symbols in the linker map | ||
| # so generate a version of the linker map without dead symbols. | ||
| # RUN: awk '/# Dead Stripped Symbols:/ {exit} {print}' %t/thunk.map > %t/thunk_no_dead_syms.map | ||
|
||
|
|
||
| # RUN: FileCheck %s --input-file %t/thunk_no_dead_syms.map --check-prefix=MAP | ||
|
|
||
| # MAP: [[ADDR1:0x[0-9A-Fa-f]+]] {{.*}} _b | ||
alx32 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # MAP-NEXT: [[ADDR2:0x[0-9A-Fa-f]+]] {{.*}} _c | ||
| # MAP-NEXT: [[ADDR3:0x[0-9A-Fa-f]+]] {{.*}} _d.thunk.0 | ||
| # MAP-NEXT: [[ADDR4:0x[0-9A-Fa-f]+]] {{.*}} _e.thunk.0 | ||
| # MAP-NEXT: [[ADDR5:0x[0-9A-Fa-f]+]] {{.*}} _f.thunk.0 | ||
| # MAP-NEXT: [[ADDR6:0x[0-9A-Fa-f]+]] {{.*}} _g.thunk.0 | ||
| # MAP-NEXT: [[ADDR7:0x[0-9A-Fa-f]+]] {{.*}} _h.thunk.0 | ||
| # MAP-NEXT: [[ADDR8:0x[0-9A-Fa-f]+]] {{.*}} ___nan.thunk.0 | ||
| # MAP-NEXT: [[ADDR9:0x[0-9A-Fa-f]+]] {{.*}} _d | ||
| # MAP-NEXT: [[ADDR10:0x[0-9A-Fa-f]+]] {{.*}} _e | ||
| # MAP-NEXT: [[ADDR11:0x[0-9A-Fa-f]+]] {{.*}} _f | ||
| # MAP-NEXT: [[ADDR12:0x[0-9A-Fa-f]+]] {{.*}} _g | ||
| # MAP-NEXT: [[ADDR13:0x[0-9A-Fa-f]+]] {{.*}} _a.thunk.0 | ||
| # MAP-NEXT: [[ADDR14:0x[0-9A-Fa-f]+]] {{.*}} _b.thunk.0 | ||
| # MAP-NEXT: [[ADDR15:0x[0-9A-Fa-f]+]] {{.*}} _h | ||
| # MAP-NEXT: [[ADDR16:0x[0-9A-Fa-f]+]] {{.*}} _main | ||
| # MAP-NEXT: [[ADDR17:0x[0-9A-Fa-f]+]] {{.*}} _c.thunk.0 | ||
| # MAP-NEXT: [[ADDR18:0x[0-9A-Fa-f]+]] {{.*}} _d.thunk.1 | ||
| # MAP-NEXT: [[ADDR19:0x[0-9A-Fa-f]+]] {{.*}} _e.thunk.1 | ||
| # MAP-NEXT: [[ADDR20:0x[0-9A-Fa-f]+]] {{.*}} _f.thunk.1 | ||
| # MAP-NEXT: [[ADDR21:0x[0-9A-Fa-f]+]] {{.*}} _z | ||
|
|
||
|
|
||
| # CHECK: Disassembly of section __TEXT,__text: | ||
|
|
||
| # CHECK: [[#%.13x, A_PAGE:]][[#%.3x, A_OFFSET:]] <_a>: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.