llvm.org GIT mirror llvm / 0755809
Extend the DWARFExpression address handling to support 16-bit addresses This allows the DWARFExpression class to handle addresses without crashing on targets with 16-bit pointers like AVR. This is required in order to generate assembly from clang via the '-S' flag. This fixes an error with the following message: clang: llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h:132: llvm::DWARFExpression::DWARFExpression(llvm::DataExtractor, uint16_t, uint8_t): Assertion `AddressSize == 8 || AddressSize == 4' failed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362290 91177308-0d34-0410-b5e6-96231b3b80d8 Dylan McKay 4 months ago
3 changed file(s) with 28 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
128128
129129 DWARFExpression(DataExtractor Data, uint16_t Version, uint8_t AddressSize)
130130 : Data(Data), Version(Version), AddressSize(AddressSize) {
131 assert(AddressSize == 8 || AddressSize == 4);
131 assert(AddressSize == 8 || AddressSize == 4 || AddressSize == 2);
132132 }
133133
134134 iterator begin() const { return iterator(this, 0); }
154154 case Operation::SizeAddr:
155155 if (AddressSize == 8) {
156156 Operands[Operand] = Data.getU64(&Offset);
157 } else if (AddressSize == 4) {
158 Operands[Operand] = Data.getU32(&Offset);
157159 } else {
158 assert(AddressSize == 4);
159 Operands[Operand] = Data.getU32(&Offset);
160 assert(AddressSize == 2);
161 Operands[Operand] = Data.getU16(&Offset);
160162 }
161163 break;
162164 case Operation::SizeRefAddr:
163165 if (getRefAddrSize(AddressSize, Version) == 8) {
164166 Operands[Operand] = Data.getU64(&Offset);
167 } else if (getRefAddrSize(AddressSize, Version) == 4) {
168 Operands[Operand] = Data.getU32(&Offset);
165169 } else {
166 assert(getRefAddrSize(AddressSize, Version) == 4);
167 Operands[Operand] = Data.getU32(&Offset);
170 assert(getRefAddrSize(AddressSize, Version) == 2);
171 Operands[Operand] = Data.getU16(&Offset);
168172 }
169173 break;
170174 case Operation::SizeLEB:
0 // RUN: llvm-mc < %s -triple=avr -filetype=obj -o %t -g -fdebug-compilation-dir=/tmp
1 // RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF %s
2 // RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC %s
3
4 // If there is no code in an assembly file, no debug info is produced
5
6 .section .data, "aw"
7 a:
8 .long 42
9
10 // DWARF: ELF32-avr
11 // DWARF-NOT: contents:
12 // DWARF: .debug_line contents:
13
14 // RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_info]:
15
16 // RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_ranges]:
17
18 // RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_aranges]: