mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[dsymutil] Relocate DW_TAG_label
dsymutil is not relocating the DW_AT_low_pc for a DW_TAG_label. This patch fixes that and adds a test. Differential revision: https://reviews.llvm.org/D99534
This commit is contained in:
parent
905dd0e95b
commit
de3fec33a9
@ -1088,7 +1088,8 @@ unsigned DWARFLinker::DIECloner::cloneAddressAttribute(
|
||||
|
||||
if (AttrSpec.Attr == dwarf::DW_AT_low_pc) {
|
||||
if (Die.getTag() == dwarf::DW_TAG_inlined_subroutine ||
|
||||
Die.getTag() == dwarf::DW_TAG_lexical_block)
|
||||
Die.getTag() == dwarf::DW_TAG_lexical_block ||
|
||||
Die.getTag() == dwarf::DW_TAG_label) {
|
||||
// The low_pc of a block or inline subroutine might get
|
||||
// relocated because it happens to match the low_pc of the
|
||||
// enclosing subprogram. To prevent issues with that, always use
|
||||
@ -1097,7 +1098,7 @@ unsigned DWARFLinker::DIECloner::cloneAddressAttribute(
|
||||
? Info.OrigLowPc
|
||||
: Addr) +
|
||||
Info.PCOffset;
|
||||
else if (Die.getTag() == dwarf::DW_TAG_compile_unit) {
|
||||
} else if (Die.getTag() == dwarf::DW_TAG_compile_unit) {
|
||||
Addr = Unit.getLowPc();
|
||||
if (Addr == std::numeric_limits<uint64_t>::max())
|
||||
return 0;
|
||||
|
BIN
test/tools/dsymutil/Inputs/private/tmp/label/label.o
Normal file
BIN
test/tools/dsymutil/Inputs/private/tmp/label/label.o
Normal file
Binary file not shown.
BIN
test/tools/dsymutil/Inputs/private/tmp/label/label.out
Executable file
BIN
test/tools/dsymutil/Inputs/private/tmp/label/label.out
Executable file
Binary file not shown.
21
test/tools/dsymutil/X86/label2.test
Normal file
21
test/tools/dsymutil/X86/label2.test
Normal file
@ -0,0 +1,21 @@
|
||||
$ cat label.c
|
||||
int main(int argc, char **argv) {
|
||||
if (argc) {
|
||||
goto foobar;
|
||||
}
|
||||
return 1;
|
||||
foobar:
|
||||
return 0;
|
||||
}
|
||||
|
||||
$ clang -g label.c -c -o label.o
|
||||
$ clang label.o -o label.out
|
||||
|
||||
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/label/label.out -o %t.dSYM
|
||||
RUN: dwarfdump %t.dSYM | FileCheck %s
|
||||
|
||||
CHECK: DW_TAG_label
|
||||
CHECK-NEXT: DW_AT_name ("foobar")
|
||||
CHECK-NEXT: DW_AT_decl_file ("/tmp/label/label.c")
|
||||
CHECK-NEXT: DW_AT_decl_line (6)
|
||||
CHECK-NEXT: DW_AT_low_pc (0x0000000100003f9d)
|
Loading…
Reference in New Issue
Block a user