bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gas 2.11.2 mishandles sparc `.uaword' pseudo-ops


From: TAKAI Kousuke
Subject: gas 2.11.2 mishandles sparc `.uaword' pseudo-ops
Date: 9 Aug 2001 22:41:03 +0900
Date: 09 Aug 2001 22:41:02 +0900
User-agent: T-gnus/6.15.0 (based on Oort Gnus v0.01) (revision 09) NISEMI/1.14.1 (筒井弘) SLIM/1.14.7 (酒井彩名) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.5.1) MULE/4.0 (花宴)

Hello,

I am trying to use binutils 2.11.2 for sparc-sun-solaris2.5.1 system
(host = build = target = sparc-sun-solaris2.5.1 and using gcc 2.95.3),
but found a bug that `as' mishandles .uaword pseudo-ops.

This bug causes two problem.  First, when the following source is
assembled (assuming `foo', `bar' as external references):

|       .section ".text"
|       .align 4
|       .byte   1
|       .uaword foo, bar

gas should emit two R_SPARC_UA32 relocations, but actually emit
one R_SPARC_UA32 for `foo' and R_SPARC_32 for `bar'.
This seems to be not a problem for GNU ld, but the SunOS 5.5.1
dynamic linker (ld.so.1) fails to handle unaligned R_SPARC_32
relocations (when this `as' is used to build shared libraries).

Another problem is that gas sometimes misses misaligned data even with
`--enforce-aligned-data'.  Following source should generate
`misaligned data' error for the line containing `.word',
but gas ignores unalignedness of `.word'.

|       .section ".text"
|       .align 4
|       .byte 1
|       .uaword 0x12345678
|       .word   0x9ABCDEF0

These problems are seemed to be because `sparc_no_align_cons' are
cleared (only) when gas emits relocations.
Here is a correction for gas 2.11.2.

Sorry for my poor English.

-- 
 TAKAI Kousuke <address@hidden>
  Dept. of Communications and Computer Engineering,
  Graduate School of Infomatics, Kyoto University, Japan

2001-08-08  TAKAI Kousuke  <address@hidden>

        * config/tc-sparc.c (cons_fix_new_sparc): Move
        `sparc_no_align_cons = 0;' to...
        (s_uacons): ...here so that sparc_no_align_cons will get
        cleared properly.

--- binutils-2.11.2/gas/config/tc-sparc.c.orig  Thu Jun  7 12:15:33 2001
+++ binutils-2.11.2/gas/config/tc-sparc.c       Wed Aug  8 22:09:10 2001
@@ -3920,6 +3920,7 @@
   /* Tell sparc_cons_align not to align this value.  */
   sparc_no_align_cons = 1;
   cons (bytes);
+  sparc_no_align_cons = 0;
 }
 
 /* This handles the native word allocation pseudo-op .nword.
@@ -4213,7 +4214,6 @@
        case 8: r = BFD_RELOC_SPARC_UA64; break;
        default: abort ();
        }
-      sparc_no_align_cons = 0;
     }
 
   fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
[end of patch]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]