aboutsummaryrefslogtreecommitdiff
path: root/gas
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
parent9d3fc4e190ff57ce8a128428e4a93386df075d52 (diff)
downloadgdb-3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f.zip
gdb-3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f.tar.gz
gdb-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')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-msp430.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 10a72d2..56146c7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-03 Kevin Buettner <kevinb@redhat.com>
+
+ * config/tc-msp430.h (DWARF2_ADDR_SIZE): Set to 4.
+
2016-02-03 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention new command line option -mfence-as-lock-add=yes
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