-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[MC] Add .loc_label instruction #99710
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
6 commits
Select commit
Hold shift + click to select a range
6c12825
[MC] Add .loc_label instruction
bb6bdda
Address Feedback Nr.1
d8c4a05
Address Feedback Nr.2
43dbc80
Correctly set end for end_sequence line entry
56b5365
Address Feedback nr4: error checks; llvm-readelf; fix comments; etc...
abb02b7
Rebase & fix 'x86_64-linux-elf' triple
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
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
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
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
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
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
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
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
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
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,101 @@ | ||
// Verify that the .loc_label instruction resets the line sequence and generates | ||
// the requested label at the correct position in the line stream | ||
|
||
// RUN: llvm-mc -filetype obj -triple x86_64 %s -o %t.o | ||
// RUN: llvm-dwarfdump -v --debug-line %t.o | FileCheck %s --check-prefix=CHECK-LINE-TABLE | ||
// RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM | ||
// RUN: llvm-objdump -s -j .offsets %t.o | FileCheck %s --check-prefix=CHECK-OFFSETS | ||
|
||
// RUN: not llvm-mc -filetype obj -triple x86_64 --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error: | ||
// RUN: not llvm-mc -filetype obj -triple x86_64 --defsym ERR2=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2 --implicit-check-not=error: | ||
|
||
|
||
|
||
# CHECK-LINE-TABLE: Address Line Column File ISA Discriminator OpIndex Flags | ||
# CHECK-LINE-TABLE-NEXT: ------------------ ------ ------ ------ --- ------------- ------- ------------- | ||
# CHECK-LINE-TABLE-NEXT: 0x00000028: 05 DW_LNS_set_column (1) | ||
# CHECK-LINE-TABLE-NEXT: 0x0000002a: 00 DW_LNE_set_address (0x0000000000000000) | ||
# CHECK-LINE-TABLE-NEXT: 0x00000035: 01 DW_LNS_copy | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000000 1 1 1 0 0 0 is_stmt | ||
# CHECK-LINE-TABLE-NEXT: 0x00000036: 00 DW_LNE_end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000000 1 1 1 0 0 0 is_stmt end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x00000039: 05 DW_LNS_set_column (2) | ||
# CHECK-LINE-TABLE-NEXT: 0x0000003b: 00 DW_LNE_set_address (0x0000000000000008) | ||
# CHECK-LINE-TABLE-NEXT: 0x00000046: 01 DW_LNS_copy | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000008 1 2 1 0 0 0 is_stmt | ||
# CHECK-LINE-TABLE-NEXT: 0x00000047: 00 DW_LNE_end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000008 1 2 1 0 0 0 is_stmt end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000004a: 05 DW_LNS_set_column (3) | ||
# CHECK-LINE-TABLE-NEXT: 0x0000004c: 00 DW_LNE_set_address (0x0000000000000010) | ||
# CHECK-LINE-TABLE-NEXT: 0x00000057: 01 DW_LNS_copy | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000010 1 3 1 0 0 0 is_stmt | ||
# CHECK-LINE-TABLE-NEXT: 0x00000058: 00 DW_LNE_end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000010 1 3 1 0 0 0 is_stmt end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000005b: 05 DW_LNS_set_column (4) | ||
# CHECK-LINE-TABLE-NEXT: 0x0000005d: 00 DW_LNE_set_address (0x0000000000000018) | ||
# CHECK-LINE-TABLE-NEXT: 0x00000068: 01 DW_LNS_copy | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 4 1 0 0 0 is_stmt | ||
# CHECK-LINE-TABLE-NEXT: 0x00000069: 05 DW_LNS_set_column (5) | ||
# CHECK-LINE-TABLE-NEXT: 0x0000006b: 01 DW_LNS_copy | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 5 1 0 0 0 is_stmt | ||
# CHECK-LINE-TABLE-NEXT: 0x0000006c: 00 DW_LNE_end_sequence | ||
# CHECK-LINE-TABLE-NEXT: 0x0000000000000018 1 5 1 0 0 0 is_stmt end_sequence | ||
|
||
# CHECK-SYM: Symbol table '.symtab' contains 9 entries: | ||
# CHECK-SYM-NEXT: Num: Value Size Type Bind Vis Ndx Name | ||
# CHECK-SYM-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND | ||
# CHECK-SYM-NEXT: 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c | ||
# CHECK-SYM-NEXT: 2: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text | ||
# CHECK-SYM-NEXT: 3: 0000000000000039 0 NOTYPE LOCAL DEFAULT 3 my_label_02 | ||
# CHECK-SYM-NEXT: 4: 000000000000004a 0 NOTYPE LOCAL DEFAULT 3 my_label_03 | ||
# CHECK-SYM-NEXT: 5: 000000000000005b 0 NOTYPE LOCAL DEFAULT 3 my_label_04 | ||
# CHECK-SYM-NEXT: 6: 000000000000004a 0 NOTYPE LOCAL DEFAULT 3 my_label_03.1 | ||
# CHECK-SYM-NEXT: 7: 000000000000006f 0 NOTYPE LOCAL DEFAULT 3 my_label_05 | ||
# CHECK-SYM-NEXT: 8: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 foo | ||
|
||
# CHECK-OFFSETS: 0000 39000000 4a000000 5b000000 | ||
|
||
.text | ||
.file "test.c" | ||
.globl foo | ||
.align 16, 0x90 | ||
.type foo,@function | ||
foo: | ||
.Lfunc_begin0: | ||
.file 1 "test.c" | ||
.cfi_startproc | ||
.loc 1 1 1 | ||
mov %rax, 0x01 | ||
.loc_label my_label_02 | ||
.loc 1 1 2 | ||
mov %rax, 0x02 | ||
.loc 1 1 3 | ||
.loc_label my_label_03 | ||
.loc_label my_label_03.1 | ||
mov %rax, 0x03 | ||
.loc 1 1 4 | ||
.loc_label my_label_04 | ||
.loc 1 1 5 | ||
.ifdef ERR | ||
.loc_label my_label_04 | ||
# ERR: [[#@LINE+1]]:13: error: expected identifier | ||
.loc_label | ||
# ERR: [[#@LINE+1]]:19: error: expected newline | ||
.loc_label aaaa bbbb | ||
.endif | ||
.ifdef ERR2 | ||
# ERR2: [[#@LINE+1]]:14: error: symbol 'my_label_04' is already defined | ||
.loc_label my_label_04 | ||
.endif | ||
mov %rax, 0x04 | ||
.loc_label my_label_05 | ||
ret | ||
.cfi_endproc | ||
|
||
.section .debug_line,"",@progbits | ||
.Lline_table_start0: | ||
|
||
.section .offsets,"",@progbits | ||
.long my_label_02-.Lline_table_start0 | ||
.long my_label_03-.Lline_table_start0 | ||
.long my_label_04-.Lline_table_start0 |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage: the test doesn't fail if I remove
&& !IsAtStartSeq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added coverage.