-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dsymutil] Fix handling of common symbols in multiple object files.
For common symbols the linker emits only a single symbol entry in the debug map. This caused dsymutil to not relocate common symbols when linking DWARF coming form object files that did not have this entry. This patch fixes that by keeping track of common symbols in the object files and synthesizing a debug map entry for them using the address from the main binary. Differential revision: https://reviews.llvm.org/D68680 llvm-svn: 374139
- Loading branch information
1 parent
0746aaf
commit 4ac388f
Showing
5 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,39 @@ | ||
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/common/com -f -o - | llvm-dwarfdump -debug-info - | FileCheck %s | ||
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/common/com -dump-debug-map | FileCheck %s --check-prefix DEBUGMAP | ||
|
||
The test was compiled from two source files: | ||
$ cd /private/tmp/common | ||
$ cat com1.c | ||
int i[1000]; | ||
int main() { | ||
return i[1]; | ||
} | ||
$ cat com2.c | ||
extern int i[1000]; | ||
int bar() { | ||
return i[0]; | ||
} | ||
$ clang -fcommon -g -c com1.c -o com1.o | ||
$ clang -fcommon -g -c com2.c -o com2.o | ||
$ clang -fcommon -g com1.o com2.o -o com | ||
|
||
CHECK: DW_TAG_compile_unit | ||
CHECK: DW_TAG_variable | ||
CHECK-NOT: {{NULL|DW_TAG}} | ||
CHECK: DW_AT_name{{.*}}"i" | ||
CHECK-NOT: {{NULL|DW_TAG}} | ||
CHECK: DW_AT_location{{.*}}DW_OP_addr 0x100001000) | ||
|
||
CHECK: DW_TAG_compile_unit | ||
CHECK: DW_TAG_variable | ||
CHECK-NOT: {{NULL|DW_TAG}} | ||
CHECK: DW_AT_name{{.*}}"i" | ||
CHECK-NOT: {{NULL|DW_TAG}} | ||
CHECK: DW_AT_location{{.*}}DW_OP_addr 0x100001000) | ||
|
||
DEBUGMAP: filename:{{.*}}com1.o | ||
DEBUGMAP: symbols: | ||
DEBUGMAP: sym: _i, binAddr: 0x0000000100001000, size: 0x00000000 | ||
DEBUGMAP: filename:{{.*}}com2.o | ||
DEBUGMAP: symbols: | ||
DEBUGMAP: sym: _i, binAddr: 0x0000000100001000, size: 0x00000000 |
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