xref: /llvm-project/llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s (revision e28b3ea52aa68114ad9862ba2609042556d713ae)
1# Test objective to verify warning is printed if DWO secton has relocations.
2#
3# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
4# RUN: llvm-dwarfdump --debug-info %t.o | FileCheck %s
5# RUN: llvm-dwarfdump --debug-info %t.o 2> %t.txt
6# RUN: FileCheck --input-file=%t.txt %s --check-prefix=PART2 --implicit-check-not=warning:
7
8        .section .debug_str.dwo,"MSe",@progbits,1
9.dwo_producer:
10        .asciz "Handmade DWO producer"
11.dwo_CU_5:
12        .asciz "V5_dwo_compile_unit"
13
14        .section	.debug_str_offsets.dwo,"e",@progbits
15        .long	Lstr_offsets_end-Lstr_offsets_start                              # Length of String Offsets Set
16        Lstr_offsets_start:
17	.short	5
18	.short	0
19	.long	.dwo_producer-.debug_str.dwo
20	.long	.dwo_CU_5-.debug_str.dwo
21        Lstr_offsets_end:
22
23# And a .dwo copy for the .dwo sections.
24        .section .debug_abbrev.dwo,"e",@progbits
25        .byte 0x01  # Abbrev code
26        .byte 0x11  # DW_TAG_compile_unit
27        .byte 0x00  # DW_CHILDREN_no
28        .byte 0x25  # DW_AT_producer
29        .byte 0x0e  # DW_FORM_strp
30        .byte 0x03  # DW_AT_name
31        .byte 0x25  # DW_FORM_strx1
32        .byte 0x00  # EOM(1)
33        .byte 0x00  # EOM(2)
34        .byte 0x00  # EOM(3)
35
36# PART2: warning: unexpected relocations for dwo section '.debug_abbrev.dwo'
37        .reloc ., R_X86_64_NONE, 0
38
39        .section .debug_info.dwo,"e",@progbits
40# CHECK-LABEL: .debug_info.dwo
41
42# DWARF v5 split CU header.
43        .long  CU_split_5_end-CU_split_5_version # Length of Unit
44CU_split_5_version:
45        .short 5                # DWARF version number
46        .byte 5                 # DWARF Unit Type
47        .byte 8                 # Address Size (in bytes)
48        .long 0 # Offset Into Abbrev. Section
49        .quad 0x5a              # DWO ID
50# The split compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.
51        .byte 1
52        .long .dwo_producer
53        .byte 1
54        .byte 0 # NULL
55CU_split_5_end:
56
57# CHECK: 0x00000000: Compile Unit: length = 0x00000017, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0x000000000000005a (next unit at 0x0000001b)
58# CHECK: 0x00000014: DW_TAG_compile_unit
59# CHECK-NEXT: DW_AT_producer	("Handmade DWO producer")
60# CHECK-NEXT: DW_AT_name	("V5_dwo_compile_unit")
61# PART2: warning: unexpected relocations for dwo section '.debug_info.dwo'
62
63## No warning, even if their names end with ".dwo".
64        .section .rodata.dwo,"a"
65        .long ext
66        .section .foo.dwo,""
67        .long .dwo_producer
68