mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
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. llvm-svn: 362290
This commit is contained in:
parent
99aa81cc48
commit
a3f218a091
@ -129,7 +129,7 @@ public:
|
||||
|
||||
DWARFExpression(DataExtractor Data, uint16_t Version, uint8_t AddressSize)
|
||||
: Data(Data), Version(Version), AddressSize(AddressSize) {
|
||||
assert(AddressSize == 8 || AddressSize == 4);
|
||||
assert(AddressSize == 8 || AddressSize == 4 || AddressSize == 2);
|
||||
}
|
||||
|
||||
iterator begin() const { return iterator(this, 0); }
|
||||
|
@ -155,17 +155,21 @@ bool DWARFExpression::Operation::extract(DataExtractor Data, uint16_t Version,
|
||||
case Operation::SizeAddr:
|
||||
if (AddressSize == 8) {
|
||||
Operands[Operand] = Data.getU64(&Offset);
|
||||
} else {
|
||||
assert(AddressSize == 4);
|
||||
} else if (AddressSize == 4) {
|
||||
Operands[Operand] = Data.getU32(&Offset);
|
||||
} else {
|
||||
assert(AddressSize == 2);
|
||||
Operands[Operand] = Data.getU16(&Offset);
|
||||
}
|
||||
break;
|
||||
case Operation::SizeRefAddr:
|
||||
if (getRefAddrSize(AddressSize, Version) == 8) {
|
||||
Operands[Operand] = Data.getU64(&Offset);
|
||||
} else {
|
||||
assert(getRefAddrSize(AddressSize, Version) == 4);
|
||||
} else if (getRefAddrSize(AddressSize, Version) == 4) {
|
||||
Operands[Operand] = Data.getU32(&Offset);
|
||||
} else {
|
||||
assert(getRefAddrSize(AddressSize, Version) == 2);
|
||||
Operands[Operand] = Data.getU16(&Offset);
|
||||
}
|
||||
break;
|
||||
case Operation::SizeLEB:
|
||||
|
19
test/MC/AVR/dwarf-asm-no-code.s
Normal file
19
test/MC/AVR/dwarf-asm-no-code.s
Normal file
@ -0,0 +1,19 @@
|
||||
// RUN: llvm-mc < %s -triple=avr -filetype=obj -o %t -g -fdebug-compilation-dir=/tmp
|
||||
// RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF %s
|
||||
// RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC %s
|
||||
|
||||
// If there is no code in an assembly file, no debug info is produced
|
||||
|
||||
.section .data, "aw"
|
||||
a:
|
||||
.long 42
|
||||
|
||||
// DWARF: ELF32-avr
|
||||
// DWARF-NOT: contents:
|
||||
// DWARF: .debug_line contents:
|
||||
|
||||
// RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_info]:
|
||||
|
||||
// RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_ranges]:
|
||||
|
||||
// RELOC-NOT: RELOCATION RECORDS FOR [.rel.debug_aranges]:
|
Loading…
Reference in New Issue
Block a user