OSDN Git Service

[DebugInfo] Explicitly permit addr_size = 0x02 when parsing DWARF data
authorAnatoly Trosinenko <atrosinenko@accesssoftek.com>
Mon, 22 Jun 2020 10:08:20 +0000 (13:08 +0300)
committerAnton Korobeynikov <anton@korobeynikov.info>
Mon, 22 Jun 2020 10:11:55 +0000 (13:11 +0300)
commit359fae6eb094e8eacc466b9ce5802563771a3cb9
tree8ce2b18a309165430b4541e127f546271bfa1304
parent23063296b539feb405fb3ce61711a3c1cc1c94d0
[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_size`s 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
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/test/DebugInfo/Inputs/dwarfdump-16bit-addr.o [new file with mode: 0644]
llvm/test/DebugInfo/dwarfdump-16bit-addr.test [new file with mode: 0644]