HomePhabricator

[DebugInfo] Explicitly permit addr_size = 0x02 when parsing DWARF data

Authored by atrosinenko on Jun 22 2020, 3:08 AM.

Description

[DebugInfo] Explicitly permit addr_size = 0x02 when parsing DWARF data

Current LLVM implementation uses MCAsmInfo::CodePointerSize as addr_size when emitting the DWARF data. llvm-dwarfdump, on the other hand, handles addr_sizes of 4 and 8 properly and considers all other sizes as an error. This works for most of mainline targets except for MSP430 and AVR.

msp430-gcc v8.3.1 emits DWARF32 with addr_size = 4 (DWARF32 does not imply addr_size = 4, 32 refers to internal offset width of 4 bytes) that is handled by llvm-dwarfdump already. Still, emitting 2-byte target pointers on MSP430 seems correct as well (but not for MSP430X that is supported by msp430-gcc but not by LLVM and has 20-bit address space).

This patch make it possible for MSP430 debug info support to be tested with llvm-dwarfdump.

Differential Revision: https://reviews.llvm.org/D82055