aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-msp430.h
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2016-01-27 12:44:38 -0700
committerKevin Buettner <kevinb@redhat.com>2016-02-03 09:21:51 -0700
commit3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f (patch)
treee842b0d0b12528904be545c3bfafcdfa3d6bd3aa /gas/config/tc-msp430.h
parent9d3fc4e190ff57ce8a128428e4a93386df075d52 (diff)
downloadbinutils-3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f.zip
binutils-3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f.tar.gz
binutils-3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f.tar.bz2
msp430: Set DWARF2_ADDR_SIZE to 4.
This change makes gas's notion of the msp430 dwarf2 address size match that of gcc and gdb. This is needed so that the format of addresses generated for DW_LNE_set_address in .debug_line will match the address size for the compilation unit. In gcc/config/msp430/msp430.h, it's set to 4: #define DWARF2_ADDR_SIZE 4 Likewise in gdb/msp430-tdep.c: set_gdbarch_dwarf2_addr_size (gdbarch, 4); (As far as I can tell, however, GDB doesn't use this value when decoding .debug_line. Instead, GDB uses the Pointer Size from the compilation unit.) readelf is able to seamlessly handle mismatches between these various sizes by using the size of the DW_LNE_set_address instruction to determine the address size. Another way to fix this problem is to make GDB behave in a similar manner. In my opinion, GDB should detect and inform the user about these mismatches; it's not clear to me if it's correct for GDB to go ahead and read the address anyway when a size mismatch is detected. Without this change, addresses in .debug_line are encoded in two bytes for some multilibs. When GDB reads the address for DW_LNE_set_address, it uses the pointer size provided by the CU. When these values don't match, GDB reads the wrong number of bytes. In the cases that I've looked at, GDB is reading 4 bytes from a 2 byte container, which results in a garbage address. GDB discards lines which have a bogus address; the end result is that GDB records no line number information for CUs which have a mismatch between the address size (from the CU) and the format of the address used by DW_LNE_set_address. gas/ChangeLog: * config/tc-msp430.h (DWARF2_ADDR_SIZE): Set to 4.
Diffstat (limited to 'gas/config/tc-msp430.h')
-rw-r--r--gas/config/tc-msp430.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h
index 4a02452..86c9117 100644
--- a/gas/config/tc-msp430.h
+++ b/gas/config/tc-msp430.h
@@ -171,3 +171,5 @@ extern bfd_boolean msp430_allow_local_subtract (expressionS *, expressionS *, se
#define DWARF2_USE_FIXED_ADVANCE_PC 1
#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING))
+
+#define DWARF2_ADDR_SIZE(bfd) 4