diff options
-rw-r--r-- | llvm/lib/MC/MCCodeView.cpp | 1 | ||||
-rw-r--r-- | llvm/test/MC/COFF/cv-inline-linetable-unlikely.s | 40 | ||||
-rw-r--r-- | llvm/test/MC/COFF/cv-inline-linetable.s | 4 | ||||
-rw-r--r-- | llvm/test/MC/COFF/cv-loc-unreachable-2.s | 41 | ||||
-rw-r--r-- | llvm/test/MC/COFF/cv-loc-unreachable.s | 42 |
5 files changed, 77 insertions, 51 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index 1a71b542bd0..b2983c11e34 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -535,7 +535,6 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, unsigned Length = computeLabelDiff(Layout, LastLabel, Loc.getLabel()); compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer); compressAnnotation(Length, Buffer); - LastLabel = Loc.getLabel(); } HaveOpenRange = false; continue; diff --git a/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s index 0ad3559beb7..3f693ee6329 100644 --- a/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s +++ b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s @@ -1,4 +1,6 @@ -# RUN: llvm-mc -triple=x86_64-windows -filetype=obj < %s | llvm-readobj --codeview | FileCheck %s +# RUN: llvm-mc -triple=x86_64-windows -filetype=obj < %s -o %t.obj +# RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=ASM +# RUN: llvm-pdbutil dump -symbols %t.obj | FileCheck %s --check-prefix=CODEVIEW # C source to generate the assembly: # volatile int unlikely_cond = 0; @@ -19,20 +21,28 @@ # calls to __asan_report*, for which it is very important to have an accurate # stack trace. -# CHECK: GlobalProcIdSym { -# CHECK: FunctionType: g (0x1003) -# CHECK: CodeOffset: g+0x0 -# CHECK: DisplayName: g -# CHECK: LinkageName: g -# CHECK: } -# CHECK: InlineSiteSym { -# 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: ] +# ASM: 0000000000000000 g: +# ASM-NEXT: 0: 48 83 ec 28 subq $40, %rsp +# ASM-NEXT: 4: c7 05 fc ff ff ff 00 00 00 00 movl $0, -4(%rip) +# Begin inline loc (matches cv_loc below) +# ASM-NEXT: e: 83 3d ff ff ff ff 00 cmpl $0, -1(%rip) +# ASM-NEXT: 15: 75 0f jne 15 <g+0x26> +# End inline loc +# ASM-NEXT: 17: c7 05 fc ff ff ff 00 00 00 00 movl $0, -4(%rip) +# ASM-NEXT: 21: 48 83 c4 28 addq $40, %rsp +# ASM-NEXT: 25: c3 retq +# Begin inline loc (matches cv_loc below) +# ASM-NEXT: 26: e8 00 00 00 00 callq 0 <g+0x2b> +# ASM-NEXT: 2b: 0f 0b ud2 +# End inline loc + +# CODEVIEW: S_INLINESITE [size = 26] +# CODEVIEW-NEXT: inlinee = 0x1002 (f), parent = 0, end = 0 +# CODEVIEW-NEXT: 0B2E code 0xE (+0xE) line 1 (+1) +# CODEVIEW-NEXT: 0409 code end 0x17 (+0x9) +# CODEVIEW-NEXT: 0602 line 2 (+1) +# CODEVIEW-NEXT: 0318 code 0x26 (+0x18) +# CODEVIEW-NEXT: 0407 code end 0x2D (+0x7) .text .globl g diff --git a/llvm/test/MC/COFF/cv-inline-linetable.s b/llvm/test/MC/COFF/cv-inline-linetable.s index f226d6fe21f..08f250eb43b 100644 --- a/llvm/test/MC/COFF/cv-inline-linetable.s +++ b/llvm/test/MC/COFF/cv-inline-linetable.s @@ -123,7 +123,9 @@ Ltmp3: .short Ltmp5-Ltmp4 Ltmp4: .short 4429 - .asciz "\000\000\000\000\000\000\000\000\003\020\000" + .long 0 # parent + .long 0 # end + .long 0x1003 # inlinee, bar .cv_inline_linetable 1 1 9 Lfunc_begin0 Lfunc_end0 # CHECK: InlineSiteSym { # CHECK: PtrParent: 0x0 diff --git a/llvm/test/MC/COFF/cv-loc-unreachable-2.s b/llvm/test/MC/COFF/cv-loc-unreachable-2.s index be96e82fa1b..e13ad84a814 100644 --- a/llvm/test/MC/COFF/cv-loc-unreachable-2.s +++ b/llvm/test/MC/COFF/cv-loc-unreachable-2.s @@ -1,26 +1,33 @@ -# RUN: llvm-mc < %s -triple=i686-pc-win32 -filetype=obj | llvm-readobj - --codeview | FileCheck %s +# RUN: llvm-mc %s -triple=i686-pc-win32 -filetype=obj -o %t.obj +# RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=ASM +# RUN: llvm-pdbutil dump -il -symbols %t.obj | FileCheck %s --check-prefix=CODEVIEW # Based on the other cv-loc-unreachable-2.s, but with other code in the same # section afterwards. We had negative label difference assertions when .cv_loc # bound tightly to the next instruction. -# CHECK-LABEL: InlineeSourceLine { -# CHECK: Inlinee: do_exit (0x1002) -# CHECK: FileID: C:\src\llvm-project\build\t.cpp (0x0) -# CHECK: SourceLineNum: 3 -# CHECK: } +# ASM: 0000000000000000 _callit: +# begin inline { +# ASM-NEXT: 0: e8 00 00 00 00 calll 0 <_callit+0x5> +# ASM-NEXT: 5: 85 c0 testl %eax, %eax +# ASM-NEXT: 7: 75 01 jne 1 <_callit+0xa> +# } end inline +# ASM-NEXT: 9: c3 retl +# begin inline { +# ASM-NEXT: a: 6a 20 pushl $32 +# ASM-NEXT: c: ff 15 00 00 00 00 calll *0 +# } end inline -# CHECK-LABEL: InlineSiteSym { -# CHECK: Kind: S_INLINESITE (0x114D) -# CHECK: Inlinee: do_exit (0x1002) -# CHECK: BinaryAnnotations [ -# CHECK-NEXT: ChangeLineOffset: 1 -# CHECK-NEXT: ChangeCodeLength: 0x9 -# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x1, LineOffset: 1} -# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 1} -# CHECK-NEXT: ChangeCodeLength: 0x0 -# CHECK-NEXT: ] -# CHECK: } +# CODEVIEW: Inlinee | Line | Source File +# CODEVIEW: 0x1002 | 3 | C:\src\llvm-project\build\t.cpp (MD5: 0BC092F354CE14FDC2FA78F8EDE7426E) + +# CODEVIEW: S_INLINESITE [size = 26] +# CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0 +# CODEVIEW-NEXT: 0602 line 1 (+1) +# CODEVIEW-NEXT: 0409 code end 0x9 (+0x9) +# CODEVIEW-NEXT: 0B2A code 0xA (+0xA) line 2 (+1) +# CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1) +# CODEVIEW-NEXT: 0400 code end 0x12 (+0x0) .text .def _callit; .scl 2; .type 32; .endef diff --git a/llvm/test/MC/COFF/cv-loc-unreachable.s b/llvm/test/MC/COFF/cv-loc-unreachable.s index 945e519f506..bd6f8f75a8c 100644 --- a/llvm/test/MC/COFF/cv-loc-unreachable.s +++ b/llvm/test/MC/COFF/cv-loc-unreachable.s @@ -1,4 +1,6 @@ -# RUN: llvm-mc < %s -triple=i686-pc-win32 -filetype=obj | llvm-readobj - --codeview | FileCheck %s +# RUN: llvm-mc %s -triple=i686-pc-win32 -filetype=obj -o %t.obj +# RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=ASM +# RUN: llvm-pdbutil dump -il -symbols %t.obj | FileCheck %s --check-prefix=CODEVIEW # Original source, slightly modified with an extra .cv_loc directive (at EXTRA # below) that was causing assertions: @@ -14,23 +16,29 @@ # do_exit(); # } -# CHECK-LABEL: InlineeSourceLine { -# CHECK: Inlinee: do_exit (0x1002) -# CHECK: FileID: C:\src\llvm-project\build\t.cpp (0x0) -# CHECK: SourceLineNum: 3 -# CHECK: } -# CHECK-LABEL: InlineSiteSym { -# CHECK: Kind: S_INLINESITE (0x114D) -# CHECK: Inlinee: do_exit (0x1002) -# CHECK: BinaryAnnotations [ -# CHECK-NEXT: ChangeLineOffset: 1 -# CHECK-NEXT: ChangeCodeLength: 0x9 -# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x1, LineOffset: 1} -# CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 1} -# CHECK-NEXT: ChangeCodeLength: 0x0 -# CHECK-NEXT: ] -# CHECK: } +# ASM: 0000000000000000 _callit: +# begin inline { +# ASM-NEXT: 0: e8 00 00 00 00 calll 0 <_callit+0x5> +# ASM-NEXT: 5: 85 c0 testl %eax, %eax +# ASM-NEXT: 7: 75 01 jne 1 <_callit+0xa> +# } end inline +# ASM-NEXT: 9: c3 retl +# begin inline { +# ASM-NEXT: a: 6a 20 pushl $32 +# ASM-NEXT: c: ff 15 00 00 00 00 calll *0 +# } end inline + +# CODEVIEW: Inlinee | Line | Source File +# CODEVIEW: 0x1002 | 3 | C:\src\llvm-project\build\t.cpp (MD5: 0BC092F354CE14FDC2FA78F8EDE7426E) + +# CODEVIEW: S_INLINESITE [size = 26] +# CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0 +# CODEVIEW-NEXT: 0602 line 1 (+1) +# CODEVIEW-NEXT: 0409 code end 0x9 (+0x9) +# CODEVIEW-NEXT: 0B2A code 0xA (+0xA) line 2 (+1) +# CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1) +# CODEVIEW-NEXT: 0400 code end 0x12 (+0x0) .text .def _callit; .scl 2; .type 32; .endef |