forked from llvm-mirror/llvm
-
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.
[DWARF] Fix a bug in line info handling
This fixes a bug in the line info handling in the dwarf code, based on a problem I when implementing RelocVisitor support for MachO. Since addr+size will give the first address past the end of the function, we need to back up one line table entry. Fix this by looking up the end_addr-1, which is the last address in the range. Note that this also removes a duplicate output from the llvm-rtdyld line table dump. The relevant line is the end_sequence one in the line table and has an offset of the first address part the end of the range and hence should not be included. Also factor out the common functionality into a separate function. This comes up on MachO much more than on ELF, since MachO doesn't store the symbol size separately, hence making said situation always occur. Differential Revision: http://reviews.llvm.org/D9925 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238699 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
4 changed files
with
88 additions
and
72 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,12 +1,43 @@ | ||
# Check that relocations get applied | ||
RUN: llvm-dwarfdump %p/Inputs/test-simple-macho.o | FileCheck %s | ||
RUN: llvm-dwarfdump %p/Inputs/test-multiple-macho.o | FileCheck %s | ||
RUN: llvm-rtdyld -printline %p/Inputs/test-multiple-macho.o | \ | ||
RUN: FileCheck --check-prefix=SIZE %s | ||
RUN: llvm-rtdyld -printline %p/Inputs/test-multiple-macho.o | FileCheck %s | ||
RUN: llvm-rtdyld -printobjline %p/Inputs/test-multiple-macho.o | FileCheck %s | ||
|
||
SIZE: Function: _bar, Size = 48 | ||
SIZE: Function: _foo, Size = 16 | ||
SIZE: Function: _fubar, Size = 46 | ||
|
||
CHECK-NOT: error: failed to compute relocation: X86_64_RELOC_UNSIGNED | ||
|
||
# Check that relocations get applied correctly | ||
RUN: llvm-rtdyld -printobjline %p/Inputs/test-simple-macho.o \ | ||
RUN: | FileCheck %s -check-prefix TEST_SIMPLE | ||
RUN: llvm-rtdyld -printline %p/Inputs/test-simple-macho.o \ | ||
RUN: | FileCheck %s -check-prefix TEST_SIMPLE | ||
RUN: llvm-rtdyld -printobjline %p/Inputs/test-multiple-macho.o \ | ||
RUN: | FileCheck %s -check-prefix TEST_MULTIPLE | ||
RUN: llvm-rtdyld -printline %p/Inputs/test-multiple-macho.o \ | ||
RUN: | FileCheck %s -check-prefix TEST_MULTIPLE | ||
|
||
TEST_SIMPLE: Function: _foo, Size = 11 | ||
TEST_SIMPLE-NEXT: Line info @ 0: simple.c, line:1 | ||
TEST_SIMPLE-NEXT: Line info @ 7: simple.c, line:2 | ||
TEST_SIMPLE-NOT: Line info @ 11: simple.c, line:2 | ||
|
||
TEST_MULTIPLE: Function: _bar, Size = 48 | ||
TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:5 | ||
TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:6 | ||
TEST_MULTIPLE-NEXT: Line info @ 16: multiple.c, line:9 | ||
TEST_MULTIPLE-NEXT: Line info @ 21: multiple.c, line:9 | ||
TEST_MULTIPLE-NEXT: Line info @ 26: multiple.c, line:7 | ||
TEST_MULTIPLE-NEXT: Line info @ 33: multiple.c, line:10 | ||
TEST_MULTIPLE-NOT: Line info @ 48: multiple.c, line:12 | ||
TEST_MULTIPLE-NEXT: Function: _foo, Size = 16 | ||
TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:1 | ||
TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:2 | ||
TEST_MULTIPLE-NOT: Line info @ 16: multiple.c, line:5 | ||
TEST_MULTIPLE-NEXT: Function: _fubar, Size = 46 | ||
TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:12 | ||
TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:13 | ||
TEST_MULTIPLE-NEXT: Line info @ 12: multiple.c, line:17 | ||
TEST_MULTIPLE-NEXT: Line info @ 25: multiple.c, line:15 | ||
TEST_MULTIPLE-NEXT: Line info @ 34: multiple.c, line:19 | ||
TEST_MULTIPLE-NEXT: Line info @ 41: multiple.c, line:21 | ||
TEST_MULTIPLE-NOT: Line info @ 46: multiple.c, line:21 |
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