[AVX-512] Make spacing between comma and {sae} operand consistent in asm strings.
[oota-llvm.git] / test / MC / ELF / gen-dwarf.s
index 85e02428fe3ff7db05375191b1d7a6ea65028201..4e773c79af281bbb3bde784fc8a1817b10501def 100644 (file)
@@ -1,4 +1,9 @@
-// RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=obj -o - | elf-dump | FileCheck %s
+// RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
+// RUN: not llvm-mc -g -dwarf-version 1  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF1 %s
+// RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF2 %s
+// RUN: llvm-mc -g -dwarf-version 3 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF3 %s
+// RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF4 %s
+// RUN: not llvm-mc -g -dwarf-version 5  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF5 %s
 
 
 // Test that on ELF:
@@ -14,97 +19,37 @@ foo:
     ret
     .size foo, .-foo
 
-// Section 4 is .debug_line
-// CHECK:       # Section 4
-// CHECK-NEXT:  # '.debug_line'
-
-
-
-// The two relocations, one to symbol 6 and one to 4
-// CHECK:         # '.rel.debug_info'
-// CHECK-NEXT:   ('sh_type',
-// CHECK-NEXT:   ('sh_flags'
-// CHECK-NEXT:   ('sh_addr',
-// CHECK-NEXT:   ('sh_offset',
-// CHECK-NEXT:   ('sh_size',
-// CHECK-NEXT:   ('sh_link',
-// CHECK-NEXT:   ('sh_info',
-// CHECK-NEXT:   ('sh_addralign',
-// CHECK-NEXT:   ('sh_entsize',
-// CHECK-NEXT:   ('_relocations', [
-// CHECK-NEXT:    # Relocation 0
-// CHECK-NEXT:    (('r_offset', 0x00000006)
-// CHECK-NEXT:     ('r_sym', 0x000006)
-// CHECK-NEXT:     ('r_type', 0x01)
-// CHECK-NEXT:    ),
-// CHECK-NEXT:    # Relocation 1
-// CHECK-NEXT:    (('r_offset', 0x0000000c)
-// CHECK-NEXT:     ('r_sym', 0x000004)
-// CHECK-NEXT:     ('r_type', 0x01)
-// CHECK-NEXT:    ),
-
-
-// Section 8 is .debug_abbrev
-// CHECK:       # Section 8
-// CHECK-NEXT:  (('sh_name', 0x00000001) # '.debug_abbrev'
-
-// Section 9 is .debug_aranges
-// CHECK:       # Section 9
-// CHECK-NEXT:  (('sh_name', 0x0000001e) # '.debug_aranges'
-
-// Two relocations in .debug_aranges, one to text and one to debug_info.
-// CHECK:       # '.rel.debug_aranges'
-// CHECK:       # Relocation 0
-// CHECK-NEXT:  (('r_offset', 0x00000006)
-// CHECK-NEXT:   ('r_sym', 0x000005)
-// CHECK-NEXT:   ('r_type', 0x01)
-// CHECK-NEXT:  ),
-// CHECK-NEXT:  # Relocation 1
-// CHECK-NEXT: (('r_offset', 0x00000010)
-// CHECK-NEXT:  ('r_sym', 0x000001)
-// CHECK-NEXT:  ('r_type', 0x01)
-// CHECK-NEXT: ),
-
-// Symbol 1 is section 1 (.text)
-// CHECK:         # Symbol 1
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_value', 0x00000000)
-// CHECK-NEXT:     ('st_size', 0x00000000)
-// CHECK-NEXT:     ('st_bind', 0x0)
-// CHECK-NEXT:     ('st_type', 0x3)
-// CHECK-NEXT:     ('st_other', 0x00)
-// CHECK-NEXT:     ('st_shndx', 0x0001)
-// CHECK-NEXT:    ),
-
-// Symbol 4 is section 4 (.debug_line)
-// CHECK:         # Symbol 4
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_value', 0x00000000)
-// CHECK-NEXT:     ('st_size', 0x00000000)
-// CHECK-NEXT:     ('st_bind', 0x0)
-// CHECK-NEXT:     ('st_type', 0x3)
-// CHECK-NEXT:     ('st_other', 0x00)
-// CHECK-NEXT:     ('st_shndx', 0x0004)
-// CHECK-NEXT:    ),
-
-// Symbol 5 is section 6 (.debug_info)
-// CHECK:         # Symbol 5
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_value', 0x00000000)
-// CHECK-NEXT:     ('st_size', 0x00000000)
-// CHECK-NEXT:     ('st_bind', 0x0)
-// CHECK-NEXT:     ('st_type', 0x3)
-// CHECK-NEXT:     ('st_other', 0x00)
-// CHECK-NEXT:     ('st_shndx', 0x0006)
-// CHECK-NEXT:    ),
-
-// Symbol 6 is section 8 (.debug_abbrev)
-// CHECK:         # Symbol 6
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_value', 0x00000000)
-// CHECK-NEXT:     ('st_size', 0x00000000)
-// CHECK-NEXT:     ('st_bind', 0x0)
-// CHECK-NEXT:     ('st_type', 0x3)
-// CHECK-NEXT:     ('st_other', 0x00)
-// CHECK-NEXT:     ('st_shndx', 0x0008)
-// CHECK-NEXT:    ),
+// CHECK:      Relocations [
+// CHECK:        Section ({{[^ ]+}}) .rel.debug_info {
+// CHECK-NEXT:     0x6 R_386_32 .debug_abbrev 0x0
+// CHECK-NEXT:     0xC R_386_32 .debug_line 0x0
+// CHECK:        }
+// CHECK-NEXT:   Section ({{[^ ]+}}) .rel.debug_aranges {
+// CHECK-NEXT:     0x6 R_386_32 .debug_info 0x0
+// CHECK-NEXT:     0x10 R_386_32 .text 0x0
+// CHECK-NEXT:   }
+// CHECK:      ]
+
+// First instance of the section is just to give it a label for debug_aranges to refer to
+// ASM: .section .debug_info
+
+// ASM: .section .debug_abbrev
+// ASM-NEXT: .Lsection_abbrev:
+// ASM-NEXT: [[ABBREV_LABEL:.Ltmp[0-9]+]]
+
+// Second instance of the section has the CU
+// ASM: .section .debug_info
+// Dwarf version
+// DWARF2: .short 2
+// DWARF3: .short 3
+// DWARF4: .short 4
+// ASM-NEXT: .long [[ABBREV_LABEL]]
+// First .byte 1 is the abbreviation number for the compile_unit abbrev
+// ASM: .byte 1
+// ASM-NEXT: .long [[LINE_LABEL:.L[a-z0-9]+]]
+
+// ASM: .section .debug_line
+// ASM-NEXT: [[LINE_LABEL]]
+
+// DWARF1: Dwarf version 1 is not supported.
+// DWARF5: Dwarf version 5 is not supported.