This repository has been archived by the owner on Apr 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lld] Add Visual Studio compatible diagnostics
Summary: Add a --vs-diagnostics flag that alters the format of diagnostic output to enable source hyperlinks in Visual Studio. Differential Revision: https://reviews.llvm.org/D58484 Reviewed by: ruiu git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@366333 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Chris Jackson
committed
Jul 17, 2019
1 parent
3c312d3
commit 000acde
Showing
12 changed files
with
262 additions
and
6 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
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,31 @@ | ||
.global foo, bar | ||
|
||
.text | ||
foo: | ||
nop | ||
|
||
.file 1 "duplicate2.s" | ||
.loc 1 20 | ||
bar: | ||
nop | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 16 # DW_AT_stmt_list | ||
.byte 23 # DW_FORM_sec_offset | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 0 # EOM(3) | ||
|
||
.section .debug_info,"",@progbits | ||
.long .Lend0 - .Lbegin0 # Length of Unit | ||
.Lbegin0: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit | ||
.long .debug_line # DW_AT_stmt_list | ||
.Lend0: | ||
.section .debug_line,"",@progbits |
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,6 @@ | ||
.file "duplicate3.s" | ||
|
||
.global baz | ||
.text | ||
baz: | ||
nop |
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,63 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate2.s -o %t2.o | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate3.s -o %t3.o | ||
// RUN: not ld.lld --vs-diagnostics %t1.o %t2.o %t3.o -o %tout 2>&1 | FileCheck %s | ||
|
||
// Case 1. Both symbols have full source location. | ||
// CHECK: duplicate.s(15): error: duplicate symbol: bar | ||
// CHECK-NEXT: >>> defined at duplicate.s:15 | ||
// CHECK-NEXT: >>>{{.*}}1.o:(.text+0x{{.+}}) | ||
// CHECK: >>> defined at duplicate2.s:20 | ||
// CHECK: >>>{{.*}}2.o:(.text+0x{{.+}}) | ||
|
||
// Case 2. The source locations are unknown for both symbols. | ||
// CHECK: {{.*}}ld.lld{{.*}}: error: duplicate symbol: foo | ||
// CHECK-NEXT: >>> defined at {{.*}}1.o:(.text+0x{{.+}}) | ||
// CHECK-NEXT: >>> defined at {{.*}}2.o:(.text+0x{{.+}}) | ||
|
||
// Case 3. For the second definition of `baz` we know only the source file found in a STT_FILE symbol. | ||
// CHECK: duplicate.s(30): error: duplicate symbol: baz | ||
// CHECK-NEXT: >>> defined at duplicate.s:30 | ||
// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) | ||
// CHECK-NEXT: >>> defined at duplicate3.s | ||
// CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}}) | ||
|
||
.global _start, foo, bar, baz | ||
.text | ||
_start: | ||
nop | ||
|
||
foo: | ||
nop | ||
|
||
.file 1 "duplicate.s" | ||
.loc 1 15 | ||
|
||
bar: | ||
nop | ||
|
||
.loc 1 30 | ||
baz: | ||
nop | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 16 # DW_AT_stmt_list | ||
.byte 23 # DW_FORM_sec_offset | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 0 # EOM(3) | ||
|
||
.section .debug_info,"",@progbits | ||
.long .Lend0 - .Lbegin0 # Length of Unit | ||
.Lbegin0: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit | ||
.long .debug_line # DW_AT_stmt_list | ||
.Lend0: | ||
.section .debug_line,"",@progbits |
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,35 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o | ||
// RUN: not ld.lld -shared --vs-diagnostics %t.o -o /dev/null 2>&1 | FileCheck %s | ||
|
||
// CHECK: dyn.s(15): error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output | ||
// CHECK-NEXT: >>> defined in {{.*}}.o | ||
// CHECK-NEXT: >>> referenced by dyn.s:15 | ||
// CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}}) | ||
|
||
.file 1 "dyn.s" | ||
.loc 1 15 | ||
|
||
foo: | ||
.quad foo | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 16 # DW_AT_stmt_list | ||
.byte 23 # DW_FORM_sec_offset | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 0 # EOM(3) | ||
|
||
.section .debug_info,"",@progbits | ||
.long .Lend0 - .Lbegin0 # Length of Unit | ||
.Lbegin0: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit | ||
.long .debug_line # DW_AT_stmt_list | ||
.Lend0: | ||
.section .debug_line,"",@progbits |
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,15 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o | ||
// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=ERR -check-prefix=CHECK -DFILE=%t1.o %s | ||
// RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=WARN -check-prefix=CHECK -DFILE=%t1.o %s | ||
|
||
// ERR: [[FILE]]: error: undefined symbol: foo | ||
// WARN: [[FILE]]: warning: undefined symbol: foo | ||
// CHECK-NEXT: >>> referenced by {{.*}}1.o:(.text+0x{{.+}}) | ||
|
||
.global _start, foo | ||
.text | ||
_start: | ||
jmp foo |
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,18 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o | ||
// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=ERR -check-prefix=CHECK %s | ||
// RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=WARN -check-prefix=CHECK %s | ||
|
||
// ERR: {{.*}}ld.lld{{.*}}: error: undefined symbol: foo | ||
// WARN: {{.*}}ld.lld{{.*}}: warning: undefined symbol: foo | ||
// CHECK-NEXT: >>> referenced by undef2.s | ||
// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) | ||
|
||
.file "undef2.s" | ||
|
||
.global _start, foo | ||
.text | ||
_start: | ||
jmp foo |
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,40 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o | ||
// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=ERR -check-prefix=CHECK %s | ||
// RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=WARN -check-prefix=CHECK %s | ||
|
||
// ERR: undef3.s(15): error: undefined symbol: foo | ||
// WARN: undef3.s(15): warning: undefined symbol: foo | ||
// CHECK: >>> referenced by undef3.s:15 | ||
// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) | ||
|
||
.file 1 "undef3.s" | ||
|
||
.global _start, foo | ||
.text | ||
_start: | ||
.loc 1 15 | ||
jmp foo | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 # Abbreviation Code | ||
.byte 17 # DW_TAG_compile_unit | ||
.byte 0 # DW_CHILDREN_no | ||
.byte 16 # DW_AT_stmt_list | ||
.byte 23 # DW_FORM_sec_offset | ||
.byte 0 # EOM(1) | ||
.byte 0 # EOM(2) | ||
.byte 0 # EOM(3) | ||
|
||
.section .debug_info,"",@progbits | ||
.long .Lend0 - .Lbegin0 # Length of Unit | ||
.Lbegin0: | ||
.short 4 # DWARF version number | ||
.long .debug_abbrev # Offset Into Abbrev. Section | ||
.byte 8 # Address Size (in bytes) | ||
.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit | ||
.long .debug_line # DW_AT_stmt_list | ||
.Lend0: | ||
.section .debug_line,"",@progbits |
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,7 @@ | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o | ||
# RUN: rm -f %/terr1.script | ||
# RUN: echo "\"" > %/terr1.script | ||
# RUN: not ld.lld --vs-diagnostics --version-script %/terr1.script -shared %/t.o -o %/t.so 2>&1 | \ | ||
# RUN: FileCheck %s -DSCRIPT="%/terr1.script" | ||
|
||
# CHECK: [[SCRIPT]](1): error: [[SCRIPT]]:1: unclosed quote |