1 ; This test checks to ensure that if three DWARFv5 object files have correct values for the DW_AT_addr_base in their compile units.
3 ; 1.o was produced with the source file:
6 ; __attribute__((section("1,__text_foo"))) void foo() {}
20 ; clang -g -c -O1 a.cpp -gdwarf-5 -o 1.o
22 ; 2.o was produced with the following source file:
25 ; __attribute__((section("1,__text_foo"))) void bar() {}
35 ; clang -g -c -O1 b.cpp -gdwarf-5 -o 2.o
37 ; 3.o was produced with the following source file:
45 ; clang -g -c -O1 c.cpp -gdwarf-5 -o 3.o
48 RUN: rm -rf %t.dir && mkdir -p %t.dir
49 RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
50 RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s
52 RUN: rm -rf %t.dir && mkdir -p %t.dir
53 RUN: dsymutil --linker llvm -y %p/dummy-debug-map-amr64.map \
54 RUN: -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base \
55 RUN: -o %t.dir/dwarf5-addr-base.dSYM
56 RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s
58 RUN: rm -rf %t.dir && mkdir -p %t.dir
59 RUN: dsymutil --update -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
60 RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s --check-prefix=UPD
62 RUN: rm -rf %t.dir && mkdir -p %t.dir
63 RUN: dsymutil --linker llvm --update -y %p/dummy-debug-map-amr64.map \
64 RUN: -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base \
65 RUN: -o %t.dir/dwarf5-addr-base.dSYM
66 RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | \
67 RUN: FileCheck %s --check-prefix=UPD
69 CHECK: .debug_info contents:
70 CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
72 CHECK: 0x0000000c: DW_TAG_compile_unit [1] *
73 CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
75 CHECK: 0x0000002c: DW_TAG_subprogram [2] * (0x0000000c)
76 CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR1:[0-9a-f]+]])
79 CHECK: 0x0000004e: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x00{{00|5a}}, addr_size = 0x08
81 CHECK: 0x0000005a: DW_TAG_compile_unit [1] *
82 CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000018)
84 CHECK: 0x0000007a: DW_TAG_subprogram [2] * (0x0000005a)
85 CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR2:[0-9a-f]+]])
87 CHECK: 0x0000009c: Compile Unit: length = 0x00000043, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x00{{00|b4}}, addr_size = 0x08
89 CHECK: 0x000000a8: DW_TAG_compile_unit {{.*}} *
90 CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000028)
92 CHECK: 0x000000c1: DW_TAG_subprogram [2] * (0x000000a8)
93 CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR3:[0-9a-f]+]])
95 CHECK: .debug_addr contents:
96 CHECK-NEXT: 0x00000000: Address table header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
98 CHECK-NEXT: 0x[[ADDR1]]
100 CHECK-NEXT: 0x00000010: Address table header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
102 CHECK-NEXT: 0x[[ADDR2]]
104 CHECK-NEXT: 0x00000020: Address table header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
106 CHECK-NEXT: 0x[[ADDR3]]
109 UPD: .debug_info contents:
110 UPD-NEXT: 0x00000000: Compile Unit: length = 0x00000081, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
112 UPD: 0x0000000c: DW_TAG_compile_unit [1] *
113 UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
115 UPD: 0x00000031: DW_TAG_subprogram [2] (0x0000000c)
116 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
118 UPD: 0x0000003d: DW_TAG_subprogram [3] * (0x0000000c)
119 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000000)
121 UPD: 0x00000057: DW_TAG_subprogram [3] * (0x0000000c)
122 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000008)
124 UPD: 0x00000071: DW_TAG_subprogram [5] (0x0000000c)
125 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000000010)
128 UPD: 0x00000085: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x00{{00|99}}, addr_size = 0x08
130 UPD: 0x00000091: DW_TAG_compile_unit [1] *
131 UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
133 UPD: 0x000000b6: DW_TAG_subprogram [2] (0x00000091)
134 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
136 UPD: 0x000000c2: DW_TAG_subprogram [3] * (0x00000091)
137 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000000)
139 UPD: 0x000000dc: DW_TAG_subprogram [3] * (0x00000091)
140 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000008)
142 UPD: 0x000000fb: Compile Unit: length = 0x00000044, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0{{000|115}}, addr_size = 0x08
144 UPD: 0x00000107: DW_TAG_compile_unit {{.*}} *
145 UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
147 UPD: 0x00000124: DW_TAG_subprogram {{.*}} * (0x00000107)
148 UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
150 UPD: .debug_addr contents:
151 UPD-NEXT: 0x00000000: Address table header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
153 UPD-NEXT: 0x0000000000000018
154 UPD-NEXT: 0x0000000000000000
155 UPD-NEXT: 0x0000000000000008
156 UPD-NEXT: 0x0000000000000010
158 UPD-NEXT: 0x00000028: Address table header: length = 0x0000001c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
160 UPD-NEXT: 0x0000000000000010
161 UPD-NEXT: 0x0000000000000000
162 UPD-NEXT: 0x0000000000000008
164 UPD-NEXT: 0x00000048: Address table header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
166 UPD-NEXT: 0x0000000000000000