-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm-objdump][macho] Add support for ObjC relative method lists #84250
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+3.09 KB
llvm/test/tools/llvm-objdump/MachO/AArch64/Inputs/rel-method-lists-arm64.dylib
Binary file not shown.
Binary file added
BIN
+2.65 KB
llvm/test/tools/llvm-objdump/MachO/AArch64/Inputs/rel-method-lists-arm64_32.dylib
Binary file not shown.
87 changes: 87 additions & 0 deletions
87
llvm/test/tools/llvm-objdump/MachO/AArch64/macho-relative-method-lists.test
This file contains hidden or 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,87 @@ | ||
RUN: llvm-objdump --macho --objc-meta-data %p/Inputs/rel-method-lists-arm64_32.dylib | FileCheck %s --check-prefix=CHK32 | ||
RUN: llvm-otool -ov %p/Inputs/rel-method-lists-arm64_32.dylib | FileCheck %s --check-prefix=CHK32 | ||
|
||
RUN: llvm-objdump --macho --objc-meta-data %p/Inputs/rel-method-lists-arm64.dylib | FileCheck %s --check-prefix=CHK64 | ||
RUN: llvm-otool -ov %p/Inputs/rel-method-lists-arm64.dylib | FileCheck %s --check-prefix=CHK64 | ||
|
||
CHK32: baseMethods 0x660 (struct method_list_t *) | ||
CHK32-NEXT: entsize 12 (relative) | ||
CHK32-NEXT: count 3 | ||
CHK32-NEXT: name 0x144 (0x7ac) instance_method_00 | ||
CHK32-NEXT: types 0x91 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffff18 (0x588) -[MyClass instance_method_00] | ||
CHK32-NEXT: name 0x13c (0x7b0) instance_method_01 | ||
CHK32-NEXT: types 0x85 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffff28 (0x5a4) -[MyClass instance_method_01] | ||
CHK32-NEXT: name 0x134 (0x7b4) instance_method_02 | ||
CHK32-NEXT: types 0x79 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffff38 (0x5c0) -[MyClass instance_method_02] | ||
|
||
CHK32: baseMethods 0x630 (struct method_list_t *) | ||
CHK32-NEXT: entsize 12 (relative) | ||
CHK32-NEXT: count 3 | ||
CHK32-NEXT: name 0x180 (0x7b8) class_method_00 | ||
CHK32-NEXT: types 0xc1 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffff9c (0x5dc) +[MyClass class_method_00] | ||
CHK32-NEXT: name 0x178 (0x7bc) class_method_01 | ||
CHK32-NEXT: types 0xb5 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffffac (0x5f8) +[MyClass class_method_01] | ||
CHK32-NEXT: name 0x170 (0x7c0) class_method_02 | ||
CHK32-NEXT: types 0xa9 (0x6fd) v8@0:4 | ||
CHK32-NEXT: imp 0xffffffbc (0x614) +[MyClass class_method_02] | ||
|
||
CHK64: baseMethods 0x7d8 (struct method_list_t *) | ||
CHK64-NEXT: entsize 24 | ||
CHK64-NEXT: count 3 | ||
CHK64-NEXT: name 0x6a4 instance_method_00 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp -[MyClass instance_method_00] | ||
CHK64-NEXT: name 0x6b7 instance_method_01 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp -[MyClass instance_method_01] | ||
CHK64-NEXT: name 0x6ca instance_method_02 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp -[MyClass instance_method_02] | ||
|
||
CHK64: baseMethods 0x740 (struct method_list_t *) | ||
CHK64-NEXT: entsize 24 | ||
CHK64-NEXT: count 3 | ||
CHK64-NEXT: name 0x674 class_method_00 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp +[MyClass class_method_00] | ||
CHK64-NEXT: name 0x684 class_method_01 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp +[MyClass class_method_01] | ||
CHK64-NEXT: name 0x694 class_method_02 | ||
CHK64-NEXT: types 0x6dd v16@0:8 | ||
CHK64-NEXT: imp +[MyClass class_method_02] | ||
|
||
|
||
######## Generate rel-method-lists-arm64.dylib ######## | ||
// clang -c main.mm -o main.o -target arm64-apple-macos -arch arm64 | ||
// ld64.ld64 -dylib -demangle -dynamic main.o -o rel-method-lists-arm64.dylib -syslibroot MacOSX14.2.sdk -segalign 0x10 -objc_relative_method_lists | ||
|
||
######## Generate rel-method-lists-arm64_32.dylib ######## | ||
// clang -c main.mm -o main.o -target arm64_32-apple-watchos -arch arm64_32 | ||
// ld64.ld64 -dylib -demangle -dynamic main.o -o rel-method-lists-arm64_32.dylib -syslibroot WatchOS.sdk -segalign 0x10 -objc_relative_method_lists | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~ main.mm ~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
__attribute__((objc_root_class)) | ||
@interface MyClass | ||
- (void)instance_method_00; | ||
- (void)instance_method_01; | ||
- (void)instance_method_02; | ||
+ (void)class_method_00; | ||
+ (void)class_method_01; | ||
+ (void)class_method_02; | ||
@end | ||
@implementation MyClass | ||
- (void)instance_method_00 {} | ||
- (void)instance_method_01 {} | ||
- (void)instance_method_02 {} | ||
+ (void)class_method_00 {} | ||
+ (void)class_method_01 {} | ||
+ (void)class_method_02 {} | ||
@end | ||
void *_objc_empty_cache; | ||
void *_objc_empty_vtable; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.