[PATCH]: gold sparc unaligned...
David Miller
davem@davemloft.net
Tue Feb 9 17:34:00 GMT 2010
From: Eric Botcazou <ebotcazou@adacore.com>
Date: Tue, 9 Feb 2010 17:14:11 +0100
>> I really have no idea. I doubt many people test with GAS but not GNU
>> ld on Solaris.
>
> We do it all the time, the Solaris assembler is not very well maintained and
> the GNU linker doesn't have all the features of the Sun linker on Solaris 10.
I'm steadily trying to close those gaps. I actually enjoy hacking on
these tools so just tell me what the most important stuff is. :-)
What assembler features are missing? I thought I had added the most
important ones already.
After I finish GOTDATA_OP optimization support (will post the patch
for that today) the only missing linker features should be the fortran
data compression hacks. Are there any others you really need?
> So it would be better to do something like:
>
> 2006-11-27 Eric Botcazou <ebotcazou@adacore.com>
>
> * config/tc-sparc.c (tc_gen_reloc): Turn aligned relocs into
> their unaligned counterparts in debugging sections.
This is a good idea, but overkill. We have access to the
relocation information, so we can see whether the offset
is going to be unaligned or not.
I cooked up the following patch yesterday while looking
into these issues. Want me to commit it?
gas/
2010-02-09 David S. Miller <davem@davemloft.net>
* config/tc-sparc.c (cons_fix_new_sparc): Use unaligned reloc
variant if relocation offset is unaligned.
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 26ecc86..d65c71a 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -4443,15 +4443,41 @@ cons_fix_new_sparc (fragS *frag,
expressionS *exp)
{
bfd_reloc_code_real_type r;
+ int unaligned = 0;
- r = (nbytes == 1 ? BFD_RELOC_8 :
- (nbytes == 2 ? BFD_RELOC_16 :
- (nbytes == 4 ? BFD_RELOC_32 : BFD_RELOC_64)));
+ switch (nbytes)
+ {
+ case 1:
+ r = BFD_RELOC_8;
+ break;
+
+ case 2:
+ r = BFD_RELOC_16;
+ unaligned = (where & 1);
+ break;
+
+ case 4:
+ r = BFD_RELOC_32;
+ unaligned = (where & 3);
+ break;
+
+ case 8:
+ r = BFD_RELOC_64;
+ unaligned = (where & 7);
+ break;
+
+ default:
+ abort ();
+ }
if (target_little_endian_data
&& nbytes == 4
&& now_seg->flags & SEC_ALLOC)
- r = BFD_RELOC_SPARC_REV32;
+ {
+ if (unaligned)
+ abort ();
+ r = BFD_RELOC_SPARC_REV32;
+ }
if (sparc_cons_special_reloc)
{
@@ -4477,7 +4503,8 @@ cons_fix_new_sparc (fragS *frag,
case 8: r = BFD_RELOC_SPARC_TLS_DTPOFF64; break;
}
}
- else if (sparc_no_align_cons)
+ else if (sparc_no_align_cons
+ || unaligned)
{
switch (nbytes)
{
More information about the Binutils
mailing list