[PATCH][PR ld/10144] MIPS/BFD: Don't make debug section relocs dynamic
Maciej W. Rozycki
macro@codesourcery.com
Tue Dec 7 20:27:00 GMT 2010
On Mon, 15 Nov 2010, Alan Modra wrote:
> > OK, cc-ed Alan Modra, the original offender. ;) Perhaps he'll be able to
> > provide input about the directive and its origins.
>
> .dc.a was invented for use in our testsuite. No other use is
> supported, which is why it hasn't been documented. I won't stand in
> the way of anyone who wants to change mips .dc.a behaviour,
> particularly if doing so makes it easier to write generic tests for
> mips.
Alan, thanks for the clarification.
Richard, I believe the above explanation clears your concerns. Here's a
change to make .dc.a emit a 32-bit or 64-bit entity as expected:
$ cat comm-data2.s
.text
.globl _start
.globl __start
_start:
__start:
.comm foo, 4, 4
.section .debug_foo,"",%progbits
.balign 16
.dc.a foo
.balign 16
$ mips-sde-elf-objdump -r comm-data2-32.o
comm-data2-32.o: file format elf32-tradbigmips
RELOCATION RECORDS FOR [.debug_foo]:
OFFSET TYPE VALUE
00000000 R_MIPS_32 foo
$ mips-sde-elf-objdump -r comm-data2-n32.o
comm-data2-n32.o: file format elf32-ntradbigmips
RELOCATION RECORDS FOR [.debug_foo]:
OFFSET TYPE VALUE
00000000 R_MIPS_32 foo
$ mips-sde-elf-objdump -r comm-data2-64.o
comm-data2-64.o: file format elf64-tradbigmips
RELOCATION RECORDS FOR [.debug_foo]:
OFFSET TYPE VALUE
0000000000000000 R_MIPS_64 foo
0000000000000000 R_MIPS_NONE *ABS*
0000000000000000 R_MIPS_NONE *ABS*
$
Regression tested with mips-sde-elf and mips-gnu-linux.
2010-12-07 Maciej W. Rozycki <macro@codesourcery.com>
gas/
* config/tc-mips.h (TC_ADDRESS_BYTES): New macro.
(mips_address_bytes): New prototype.
* config/tc-mips.c (mips_address_bytes): New function.
OK to apply?
Maciej
binutils-gas-mips-address-bits.diff
Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c 2010-12-07 18:03:09.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c 2010-12-07 18:21:46.000000000 +0000
@@ -1235,6 +1235,15 @@ static const pseudo_typeS mips_nonecoff_
{ NULL, NULL, 0 },
};
+/* Export the ABI address size for use by TC_ADDRESS_BYTES for the
+ purpose of the `.dc.a' internal pseudo-op. */
+
+int
+mips_address_bytes (void)
+{
+ return HAVE_64BIT_ADDRESSES ? 8 : 4;
+}
+
extern void pop_insert (const pseudo_typeS *);
void
Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.h
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.h 2010-12-07 18:03:09.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.h 2010-12-07 18:13:47.000000000 +0000
@@ -42,6 +42,9 @@ struct expressionS;
#define MAX_RELOC_EXPANSION 3
#define LOCAL_LABELS_FB 1
+#define TC_ADDRESS_BYTES mips_address_bytes
+extern int mips_address_bytes (void);
+
/* Maximum symbol offset that can be encoded in a BFD_RELOC_GPREL16
relocation. */
#define MAX_GPREL_OFFSET (0x7FF0)
More information about the Binutils
mailing list