forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstallAPI] Add support for parsing dSYMs (llvm#86852)
InstallAPI does not directly look at object files in the dylib for verification. To help diagnose violations where a declaration is undiscovered in headers, parse the dSYM and look up the source location for symbols. Emitting out the source location with a diagnostic is enough for some IDE's (e.g. Xcode) to have them map back to editable source files.
- Loading branch information
1 parent
0f6ed4c
commit a4de589
Showing
12 changed files
with
263 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
set(LLVM_LINK_COMPONENTS | ||
Support | ||
TextAPI | ||
TextAPIBinaryReader | ||
Demangle | ||
Core | ||
) | ||
|
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,43 @@ | ||
; REQUIRES: system-darwin | ||
|
||
; RUN: rm -rf %t | ||
; RUN: split-file %s %t | ||
|
||
// Build a simple dylib with debug info. | ||
; RUN: %clang --target=arm64-apple-macos13 -g -dynamiclib %t/foo.c \ | ||
; RUN: -current_version 1 -compatibility_version 1 -L%t/usr/lib \ | ||
; RUN: -save-temps \ | ||
; RUN: -o %t/foo.dylib -install_name %t/foo.dylib | ||
; RUN: dsymutil %t/foo.dylib -o %t/foo.dSYM | ||
|
||
; RUN: not clang-installapi -x c++ --target=arm64-apple-macos13 \ | ||
; RUN: -install_name %t/foo.dylib \ | ||
; RUN: -current_version 1 -compatibility_version 1 \ | ||
; RUN: -o %t/output.tbd \ | ||
; RUN: --verify-against=%t/foo.dylib --dsym=%t/foo.dSYM \ | ||
; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s | ||
|
||
; CHECK: violations found for arm64 | ||
; CHECK: foo.c:5:0: error: no declaration found for exported symbol 'bar' in dynamic library | ||
; CHECK: foo.c:1:0: error: no declaration found for exported symbol 'foo' in dynamic library | ||
|
||
;--- foo.c | ||
int foo(void) { | ||
return 1; | ||
} | ||
extern char bar; | ||
char bar = 'a'; | ||
|
||
;--- usr/lib/libSystem.tbd | ||
{ | ||
"main_library": { | ||
"install_names": [ | ||
{"name": "/usr/lib/libSystem.B.dylib"} | ||
], | ||
"target_info": [ | ||
{"target": "arm64-macos"} | ||
] | ||
}, | ||
"tapi_tbd_version": 5 | ||
} | ||
|
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
Oops, something went wrong.