summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/DebugInfo/COFF/inlining-header.ll7
-rw-r--r--llvm/test/DebugInfo/COFF/inlining-levels.ll4
-rw-r--r--llvm/test/DebugInfo/COFF/inlining.ll10
-rw-r--r--llvm/test/DebugInfo/COFF/local-variables.ll3
-rw-r--r--llvm/test/MC/COFF/cv-def-range.s1
-rw-r--r--llvm/test/MC/COFF/cv-empty-linetable.s1
-rw-r--r--llvm/test/MC/COFF/cv-errors.s56
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable-infloop.s3
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable-unlikely.s191
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable-unreachable.s2
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable.s27
-rw-r--r--llvm/test/MC/COFF/cv-loc-cross-section.s26
-rw-r--r--llvm/test/MC/COFF/cv-loc.s2
13 files changed, 315 insertions, 18 deletions
diff --git a/llvm/test/DebugInfo/COFF/inlining-header.ll b/llvm/test/DebugInfo/COFF/inlining-header.ll
index 6a57e182a32..143bd48e4be 100644
--- a/llvm/test/DebugInfo/COFF/inlining-header.ll
+++ b/llvm/test/DebugInfo/COFF/inlining-header.ll
@@ -25,13 +25,16 @@
; ASM: _main: # @main
; ASM: Lfunc_begin0:
+; ASM: .cv_func_id 0
; ASM: # BB#0: # %entry
; ASM: .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
; ASM: .cv_loc 0 1 9 5 is_stmt 0 # t.cpp:9:5
; ASM: incl "?x@@3HC"
+; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 10 3
; ASM: .cv_loc 1 1 4 5 # t.cpp:4:5
; ASM: addl $2, "?x@@3HC"
; ASM: .cv_file 2 "D:\\src\\llvm\\build\\t.h"
+; ASM: .cv_inline_site_id 2 within 1 inlined_at 1 5 3
; ASM: .cv_loc 2 2 2 5 # ./t.h:2:5
; ASM: addl $3, "?x@@3HC"
; ASM: .cv_loc 1 1 6 5 # t.cpp:6:5
@@ -61,7 +64,6 @@
; OBJ: Subsection [
; OBJ: SubSectionType: Symbols (0xF1)
-; OBJ: SubSectionSize: 0x62
; OBJ: ProcStart {
; OBJ: Kind: S_GPROC32_ID (0x1147)
; OBJ: FunctionType: main (0x1005)
@@ -78,7 +80,8 @@
; OBJ: Inlinee: g (0x1002)
; OBJ: BinaryAnnotations [
; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
-; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xE, LineOffset: 2}
+; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
+; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
; OBJ-NEXT: ChangeCodeLength: 0x7
; OBJ-NEXT: ]
; OBJ: }
diff --git a/llvm/test/DebugInfo/COFF/inlining-levels.ll b/llvm/test/DebugInfo/COFF/inlining-levels.ll
index 2c25670dee5..55ce3de8479 100644
--- a/llvm/test/DebugInfo/COFF/inlining-levels.ll
+++ b/llvm/test/DebugInfo/COFF/inlining-levels.ll
@@ -20,13 +20,13 @@
; OBJ: SubSectionType: Symbols (0xF1)
; OBJ: ProcStart {
; OBJ: InlineSite {
-; OBJ: Inlinee: h (0x1004)
+; OBJ: Inlinee: h (0x1002)
; OBJ: }
; OBJ: InlineSite {
; OBJ: Inlinee: g (0x1003)
; OBJ: }
; OBJ: InlineSite {
-; OBJ: Inlinee: f (0x1002)
+; OBJ: Inlinee: f (0x1004)
; OBJ: }
; OBJ: InlineSiteEnd {
; OBJ: }
diff --git a/llvm/test/DebugInfo/COFF/inlining.ll b/llvm/test/DebugInfo/COFF/inlining.ll
index 815111f9cbf..9ca4c4120a0 100644
--- a/llvm/test/DebugInfo/COFF/inlining.ll
+++ b/llvm/test/DebugInfo/COFF/inlining.ll
@@ -21,11 +21,14 @@
; 16: x += 7;
; 17: }
+; ASM: .cv_func_id 0
; ASM: .cv_loc 0 1 13 0 is_stmt 0 # t.cpp:13:0
; ASM: .cv_loc 0 1 14 5 # t.cpp:14:5
; ASM: addl $6, "?x@@3HC"
+; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 15 3
; ASM: .cv_loc 1 1 9 5 # t.cpp:9:5
; ASM: addl $4, "?x@@3HC"
+; ASM: .cv_inline_site_id 2 within 1 inlined_at 1 10 3
; ASM: .cv_loc 2 1 3 7 # t.cpp:3:7
; ASM: .cv_loc 2 1 4 5 # t.cpp:4:5
; ASM: addl {{.*}}, "?x@@3HC"
@@ -60,7 +63,7 @@
; ASM: .long
; ASM: .long
; ASM: .long
-; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 Lfunc_end0 contains 2
+; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 Lfunc_end0
; ASM: .short 4429
; ASM: .long
; ASM: .long
@@ -184,8 +187,9 @@
; OBJ: Inlinee: bar (0x1002)
; OBJ: BinaryAnnotations [
; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 1}
-; OBJ-NEXT: ChangeLineOffset: 2
-; OBJ-NEXT: ChangeCodeOffset: 0x25
+; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
+; OBJ-NEXT: ChangeLineOffset: 1
+; OBJ-NEXT: ChangeCodeOffset: 0x1E
; OBJ-NEXT: ChangeCodeLength: 0x7
; OBJ: ]
; OBJ: }
diff --git a/llvm/test/DebugInfo/COFF/local-variables.ll b/llvm/test/DebugInfo/COFF/local-variables.ll
index 86356fdde45..2c3fd89a9d4 100644
--- a/llvm/test/DebugInfo/COFF/local-variables.ll
+++ b/llvm/test/DebugInfo/COFF/local-variables.ll
@@ -22,6 +22,7 @@
; 17: }
; ASM: f: # @f
+; ASM: .cv_func_id 0
; ASM: .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
; ASM: .cv_loc 0 1 7 0 is_stmt 0 # t.cpp:7:0
; ASM: .seh_proc f
@@ -40,6 +41,7 @@
; ASM: .cv_loc 0 1 9 9 # t.cpp:9:9
; ASM: movl $42, 40(%rsp)
; ASM: [[inline_site1:\.Ltmp.*]]:
+; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 10 5
; ASM: .cv_loc 1 1 4 7 # t.cpp:4:7
; ASM: movl $3, 44(%rsp)
; ASM: leaq 44(%rsp), %rcx
@@ -54,6 +56,7 @@
; ASM: .cv_loc 0 1 13 9 # t.cpp:13:9
; ASM: movl $42, 36(%rsp)
; ASM: [[inline_site2:\.Ltmp.*]]:
+; ASM: .cv_inline_site_id 2 within 0 inlined_at 1 14 5
; ASM: .cv_loc 2 1 4 7 # t.cpp:4:7
; ASM: movl $3, 48(%rsp)
; ASM: leaq 48(%rsp), %rcx
diff --git a/llvm/test/MC/COFF/cv-def-range.s b/llvm/test/MC/COFF/cv-def-range.s
index a1ae1404e92..5ac0df7f7d9 100644
--- a/llvm/test/MC/COFF/cv-def-range.s
+++ b/llvm/test/MC/COFF/cv-def-range.s
@@ -15,6 +15,7 @@
_g: # @g
Lfunc_begin0:
.cv_file 1 "\\usr\\local\\google\\home\\majnemer\\llvm\\src\\<stdin>"
+ .cv_func_id 0
.cv_loc 0 1 3 0 is_stmt 0 # <stdin>:3:0
# BB#0: # %entry
pushl %ebp
diff --git a/llvm/test/MC/COFF/cv-empty-linetable.s b/llvm/test/MC/COFF/cv-empty-linetable.s
index 4fcafd2d268..568d55a3657 100644
--- a/llvm/test/MC/COFF/cv-empty-linetable.s
+++ b/llvm/test/MC/COFF/cv-empty-linetable.s
@@ -16,6 +16,7 @@ _f: # @f
Lfunc_begin0:
# BB#0: # %entry
.cv_file 1 "cv-empty-linetable.s"
+ .cv_func_id 1
.cv_loc 1 1 3 15 is_stmt 0
jmp _g # TAILCALL
Lfunc_end0:
diff --git a/llvm/test/MC/COFF/cv-errors.s b/llvm/test/MC/COFF/cv-errors.s
new file mode 100644
index 00000000000..ca2f77549c5
--- /dev/null
+++ b/llvm/test/MC/COFF/cv-errors.s
@@ -0,0 +1,56 @@
+# RUN: not llvm-mc %s -o /dev/null 2>&1 | FileCheck %s
+
+.text
+foo:
+.cv_file a
+# CHECK: error: expected file number in '.cv_file' directive
+# CHECK-NOT: error:
+.cv_file 0 "t.cpp"
+# CHECK: error: file number less than one
+# CHECK-NOT: error:
+.cv_func_id x
+# CHECK: error: expected function id in '.cv_func_id' directive
+# CHECK-NOT: error:
+.cv_func_id -1
+# CHECK: error: expected function id in '.cv_func_id' directive
+# CHECK-NOT: error:
+.cv_func_id 0xFFFFFFFFFFFFFFFF
+# CHECK: error: expected function id within range [0, UINT_MAX)
+# CHECK-NOT: error:
+.cv_inline_site_id x
+# CHECK: error: expected function id in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_file 1 "t.cpp"
+.cv_func_id 0
+
+.cv_inline_site_id 0 0 0 0 0 0
+# CHECK: error: expected 'within' identifier in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_inline_site_id 0 within a
+# CHECK: error: expected function id in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_inline_site_id 0 within 0 x
+# CHECK: error: expected 'inlined_at' identifier in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_inline_site_id 0 within 0 inlined_at 0 0 0
+# CHECK: error: file number less than one in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_inline_site_id 0 within 0 inlined_at 10 0 0
+# CHECK: error: unassigned file number in '.cv_inline_site_id' directive
+# CHECK-NOT: error:
+
+.cv_inline_site_id 0 within 0 inlined_at 1 1 1
+# CHECK: error: function id already allocated
+# CHECK-NOT: error:
+
+.cv_inline_site_id 1 within 0 inlined_at 1 1 1
+
+.cv_loc 0 1 1 1 # t.cpp:1:1
+nop
+.cv_loc 1 1 1 1 # t.cpp:1:1
+nop
diff --git a/llvm/test/MC/COFF/cv-inline-linetable-infloop.s b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
index cd0a073be2a..804ed6f404d 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s
@@ -19,6 +19,8 @@
.p2align 4, 0x90
infloop: # @infloop
.Lfunc_begin1:
+ .cv_func_id 0
+ .cv_inline_site_id 2 within 0 inlined_at 1 1 1
.cv_loc 2 1 3 7 # t.c:3:7
jmp .Lfunc_begin1
.Lfunc_end1:
@@ -31,6 +33,7 @@ infloop: # @infloop
.globl afterinfloop
.p2align 4, 0x90
afterinfloop: # @afterinfloop
+ .cv_func_id 3
.cv_loc 3 1 13 0 # t.c:13:0
retq
diff --git a/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
new file mode 100644
index 00000000000..dd3a66f419c
--- /dev/null
+++ b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
@@ -0,0 +1,191 @@
+# RUN: llvm-mc -triple=x86_64-windows -filetype=obj < %s | llvm-readobj -codeview | FileCheck %s
+
+# C source to generate the assembly:
+# volatile int unlikely_cond = 0;
+# extern void __declspec(noreturn) abort();
+# __forceinline void f() {
+# if (unlikely_cond)
+# abort();
+# }
+# void g() {
+# unlikely_cond = 0;
+# f();
+# unlikely_cond = 0;
+# }
+
+# This test is interesting because the inlined instructions are discontiguous.
+# LLVM's block layout algorithms will put the 'abort' call last, as it is
+# considered highly unlikely to execute. This is similar to what it does for
+# calls to __asan_report*, for which it is very important to have an accurate
+# stack trace.
+
+# CHECK: ProcStart {
+# CHECK: FunctionType: g (0x1003)
+# CHECK: CodeOffset: g+0x0
+# CHECK: DisplayName: g
+# CHECK: LinkageName: g
+# CHECK: }
+# CHECK: InlineSite {
+# CHECK: Inlinee: f (0x1002)
+# CHECK: BinaryAnnotations [
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xE, LineOffset: 1}
+# CHECK-NEXT: ChangeCodeLength: 0x9
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xF, LineOffset: 1}
+# CHECK-NEXT: ChangeCodeLength: 0x7
+# CHECK-NEXT: ]
+
+ .text
+ .globl g
+g: # @g
+.Lfunc_begin0:
+ .cv_func_id 0
+ .cv_file 1 "C:\\src\\llvm\\build\\t.cpp"
+ .cv_loc 0 1 7 0 is_stmt 0 # t.cpp:7:0
+.seh_proc g
+ subq $40, %rsp
+ .seh_stackalloc 40
+ .seh_endprologue
+ .cv_loc 0 1 8 17 # t.cpp:8:17
+ movl $0, unlikely_cond(%rip)
+ .cv_inline_site_id 1 within 0 inlined_at 1 9 3
+ .cv_loc 1 1 4 7 # t.cpp:4:7
+ cmpl $0, unlikely_cond(%rip)
+ jne .LBB0_1
+ .cv_loc 0 1 10 17 # t.cpp:10:17
+ movl $0, unlikely_cond(%rip)
+ .cv_loc 0 1 11 1 # t.cpp:11:1
+ addq $40, %rsp
+ retq
+
+.LBB0_1: # %if.then.i
+ .cv_loc 1 1 5 5 # t.cpp:5:5
+ callq abort
+ ud2
+.Lfunc_end0:
+ .seh_handlerdata
+ .text
+ .seh_endproc
+
+ .bss
+ .globl unlikely_cond # @unlikely_cond
+ .p2align 2
+unlikely_cond:
+ .long 0 # 0x0
+
+ .section .debug$S,"dr"
+ .p2align 2
+ .long 4 # Debug section magic
+ .long 246 # Inlinee lines subsection
+ .long .Ltmp9-.Ltmp8 # Subsection size
+.Ltmp8:
+ .long 0 # Inlinee lines signature
+
+ # Inlined function f starts at t.cpp:3
+ .long 4098 # Type index of inlined function
+ .long 0 # Offset into filechecksum table
+ .long 3 # Starting line number
+.Ltmp9:
+ .p2align 2
+ .long 241 # Symbol subsection for g
+ .long .Ltmp11-.Ltmp10 # Subsection size
+.Ltmp10:
+ .short .Ltmp13-.Ltmp12 # Record length
+.Ltmp12:
+ .short 4423 # Record kind: S_GPROC32_ID
+ .long 0 # PtrParent
+ .long 0 # PtrEnd
+ .long 0 # PtrNext
+ .long .Lfunc_end0-g # Code size
+ .long 0 # Offset after prologue
+ .long 0 # Offset before epilogue
+ .long 4099 # Function type index
+ .secrel32 g # Function section relative address
+ .secidx g # Function section index
+ .byte 0 # Flags
+ .asciz "g" # Function name
+.Ltmp13:
+ .short .Ltmp15-.Ltmp14 # Record length
+.Ltmp14:
+ .short 4429 # Record kind: S_INLINESITE
+ .long 0 # PtrParent
+ .long 0 # PtrEnd
+ .long 4098 # Inlinee type index
+ .cv_inline_linetable 1 1 3 .Lfunc_begin0 .Lfunc_end0
+.Ltmp15:
+ .short 2 # Record length
+ .short 4430 # Record kind: S_INLINESITE_END
+ .short 2 # Record length
+ .short 4431 # Record kind: S_PROC_ID_END
+.Ltmp11:
+ .p2align 2
+ .cv_linetable 0, g, .Lfunc_end0
+ .long 241 # Symbol subsection for globals
+ .long .Ltmp17-.Ltmp16 # Subsection size
+.Ltmp16:
+ .short .Ltmp19-.Ltmp18 # Record length
+.Ltmp18:
+ .short 4365 # Record kind: S_GDATA32
+ .long 4100 # Type
+ .secrel32 unlikely_cond # DataOffset
+ .secidx unlikely_cond # Segment
+ .asciz "unlikely_cond" # Name
+.Ltmp19:
+.Ltmp17:
+ .p2align 2
+ .cv_filechecksums # File index to string table offset subsection
+ .cv_stringtable # String table
+ .section .debug$T,"dr"
+ .p2align 2
+ .long 4 # Debug section magic
+ # ArgList (0x1000) {
+ # TypeLeafKind: LF_ARGLIST (0x1201)
+ # NumArgs: 0
+ # Arguments [
+ # ]
+ # }
+ .byte 0x06, 0x00, 0x01, 0x12
+ .byte 0x00, 0x00, 0x00, 0x00
+ # Procedure (0x1001) {
+ # TypeLeafKind: LF_PROCEDURE (0x1008)
+ # ReturnType: void (0x3)
+ # CallingConvention: NearC (0x0)
+ # FunctionOptions [ (0x0)
+ # ]
+ # NumParameters: 0
+ # ArgListType: () (0x1000)
+ # }
+ .byte 0x0e, 0x00, 0x08, 0x10
+ .byte 0x03, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00
+ .byte 0x00, 0x10, 0x00, 0x00
+ # FuncId (0x1002) {
+ # TypeLeafKind: LF_FUNC_ID (0x1601)
+ # ParentScope: 0x0
+ # FunctionType: void () (0x1001)
+ # Name: f
+ # }
+ .byte 0x0e, 0x00, 0x01, 0x16
+ .byte 0x00, 0x00, 0x00, 0x00
+ .byte 0x01, 0x10, 0x00, 0x00
+ .byte 0x66, 0x00, 0xf2, 0xf1
+ # FuncId (0x1003) {
+ # TypeLeafKind: LF_FUNC_ID (0x1601)
+ # ParentScope: 0x0
+ # FunctionType: void () (0x1001)
+ # Name: g
+ # }
+ .byte 0x0e, 0x00, 0x01, 0x16
+ .byte 0x00, 0x00, 0x00, 0x00
+ .byte 0x01, 0x10, 0x00, 0x00
+ .byte 0x67, 0x00, 0xf2, 0xf1
+ # Modifier (0x1004) {
+ # TypeLeafKind: LF_MODIFIER (0x1001)
+ # ModifiedType: int (0x74)
+ # Modifiers [ (0x2)
+ # Volatile (0x2)
+ # ]
+ # }
+ .byte 0x0a, 0x00, 0x01, 0x10
+ .byte 0x74, 0x00, 0x00, 0x00
+ .byte 0x02, 0x00, 0xf2, 0xf1
+
diff --git a/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s b/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s
index eb89dd51927..0f29d1667c3 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s
@@ -15,6 +15,8 @@
_g: # @g
Lfunc_begin0:
.cv_file 1 "\\usr\\local\\google\\home\\majnemer\\llvm\\src\\<stdin>"
+ .cv_func_id 0
+ .cv_inline_site_id 1 within 0 inlined_at 1 1 1
.cv_loc 0 1 7 0 is_stmt 0 # <stdin>:7:0
# BB#0: # %entry
pushl %ebp
diff --git a/llvm/test/MC/COFF/cv-inline-linetable.s b/llvm/test/MC/COFF/cv-inline-linetable.s
index 67c6da2ab09..bb68fcde21b 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable.s
@@ -15,6 +15,9 @@
"?baz@@YAXXZ": # @"\01?baz@@YAXXZ"
Lfunc_begin0:
.cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
+ .cv_func_id 0
+ .cv_inline_site_id 1 within 0 inlined_at 1 15 3
+ .cv_inline_site_id 2 within 1 inlined_at 1 10 3
.cv_loc 0 1 13 0 is_stmt 0 # t.cpp:13:0
# BB#0: # %entry
pushl %eax
@@ -84,16 +87,18 @@ Ltmp3:
Ltmp4:
.short 4429
.asciz "\000\000\000\000\000\000\000\000\003\020\000"
- .cv_inline_linetable 1 1 9 Lfunc_begin0 Lfunc_end0 contains 2
+ .cv_inline_linetable 1 1 9 Lfunc_begin0 Lfunc_end0
# CHECK: InlineSite {
# CHECK: PtrParent: 0x0
# CHECK: PtrEnd: 0x0
# CHECK: Inlinee: bar (0x1003)
# CHECK: BinaryAnnotations [
-# CHECK: ChangeLineOffset: 2
-# CHECK: ChangeCodeOffset: 0x2D
-# CHECK: ChangeCodeLength: 0x7
-# CHECK: ]
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 0}
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
+# CHECK-NEXT: ChangeLineOffset: 1
+# CHECK-NEXT: ChangeCodeOffset: 0x1E
+# CHECK-NEXT: ChangeCodeLength: 0x7
+# CHECK-NEXT: ]
# CHECK: }
Ltmp5:
.short Ltmp7-Ltmp6
@@ -106,12 +111,12 @@ Ltmp6:
# CHECK: PtrEnd: 0x0
# CHECK: Inlinee: foo (0x1004)
# CHECK: BinaryAnnotations [
-# CHECK: ChangeLineOffset: 1
-# CHECK: ChangeCodeOffset: 0x19
-# CHECK: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
-# CHECK: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
-# CHECK: ChangeCodeLength: 0x7
-# CHECK: ]
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xF, LineOffset: 0}
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xA, LineOffset: 1}
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
+# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
+# CHECK-NEXT: ChangeCodeLength: 0x7
+# CHECK-NEXT: ]
# CHECK: }
Ltmp7:
.short 2
diff --git a/llvm/test/MC/COFF/cv-loc-cross-section.s b/llvm/test/MC/COFF/cv-loc-cross-section.s
new file mode 100644
index 00000000000..357fe5b2565
--- /dev/null
+++ b/llvm/test/MC/COFF/cv-loc-cross-section.s
@@ -0,0 +1,26 @@
+# RUN: not llvm-mc < %s -o /dev/null 2>&1 | FileCheck %s
+
+ .text
+ .global baz
+baz:
+.Lfunc_begin0:
+ .cv_file 1 "t.cpp"
+ .cv_func_id 0
+ .cv_loc 0 1 1 1
+ pushq %rbp
+ movq %rsp, %rbp
+ .cv_loc 0 1 2 1
+
+ .data # Switching sections raises an error.
+
+ incl x(%rip)
+ .cv_loc 0 1 3 1
+# CHECK: error: all .cv_loc directives for a function must be in the same section
+ popq %rbp
+ retq
+.Lfunc_end0:
+
+ .section .debug$S,"dr"
+ .cv_linetable 0 .Lfunc_begin0 .Lfunc_end0
+ .short 2 # Record length
+ .short 2 # Record kind: S_INLINESITE_END
diff --git a/llvm/test/MC/COFF/cv-loc.s b/llvm/test/MC/COFF/cv-loc.s
index 08ab15aea44..01d5d02b224 100644
--- a/llvm/test/MC/COFF/cv-loc.s
+++ b/llvm/test/MC/COFF/cv-loc.s
@@ -7,6 +7,8 @@
.cv_file 1 "a.c"
.cv_file 2 "t.inc"
+.cv_func_id 0
+
# Implements this C:
# void f(volatile int *x) {
# ++*x;
OpenPOWER on IntegriCloud