public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* An alpha/gas bug
@ 1997-11-06 11:54 H.J. Lu
  1997-11-10 13:25 ` Ken Raeburn
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 1997-11-06 11:54 UTC (permalink / raw)
  To: rth; +Cc: Ian Lance Taylor, gas2

The recent gas has an alpha bug. I enclosed 4 files here:

1. foo.cc is the source code.
2. foo.s is compiled with -O -S on linux/alpha with egcs 971031.
3. good.o is assembled with gas in binutils 2.8.1.
4. bad.o is assembled with gas in binutils gas-971031.

I can use good.o with both libstdc++.so and libstdc++.a to generate
a working binary. But I can use bad.o only with libstdc++.a to 
generate a working binary. When I link bad.o with libstdc++.so,
I get junk output after

2 empty strings:

It seems that the return value from cout << is messed up when
libstdc++.so is used.

BTW, the asm output from -O2 works fine with gas-971031. From
what I see, binutils 2.8.1 and binutils gas-971031 treat

	lda $0,_t12basic_string2ZcZt18string_char_traits1Zc$nilRep+32

differently. binutils 2.8.1 generates

	ldq     v0,0(gp)
	lda     v0,32(v0)

and gas-971031 generates

	ldq     v0,0(gp)

I think that is a bug in gas.


-- 
H.J. Lu (hjl@gnu.ai.mit.edu)
---
begin 644 alpha.tar.gz
M'XL(`!L<8C0``^U:2VP;11@>D]#&6QXI%*F\!]>"!-QE=OW*HY1`^HC$0U`>
MBDJ%6:\W]E*_\*[!%2#*C0.'"G'@V$,H'#@4B8<$0JH`"0X<<N#`"?7`@6,K
M<8)#F-F=L<?CG20X301E/F4].]_^KYG]=W;V5Y8:#=T#6PL#H5PF`P&$1CZ+
M2`MAS@Q;##.7R6,BDT89(VV@+!9#1A8!B+8XK@!MS[=:$(+*R]4UY;#8TM)V
M!+2]B.M+;M6)&S"QA#/!MA-:7'_5:7ENHQY/($-'!F$\QX?UAN5K9=LV"W:C
MUL1*)7U&*Q3*]7:7*-C-:MLCQPQ6*E<;Q2JL.36[>4K#)FR?&-5;C9+E6_BZ
M577+=9C6DO/I')&W/-MU8<*$3JWIGX*>W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\,UX^J[XCV&2_:_T!BGZ_[
M\/6@CSD^JKXC^F6\.&_G)7Y7N'Y4?4>TSWBQ'O2+Q/Y_%?3S:DNQ3OT'FLA@
M]1\S3_X7R$!FQE3UG^W`/K=N5]LE!QX(5_"#6H]QZ1*N5PYJFDO_AW9B4GM=
M@_3[`W9F\3EYE<`#!P;_=3=!V$[W)W&BGIC5L$++\=NM.D2SVIM;]Y]M"@H*
I"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@K_#_P-HYH%U0!0````
`
end

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An alpha/gas bug
  1997-11-10 13:25 ` Ken Raeburn
@ 1997-11-10 13:25   ` Richard Henderson
  1997-11-10 13:31   ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1997-11-10 13:25 UTC (permalink / raw)
  To: Ken Raeburn; +Cc: H.J. Lu, rth, Ian Lance Taylor, gas2

On Mon, Nov 10, 1997 at 04:20:06PM -0500, Ken Raeburn wrote:
> > differently. binutils 2.8.1 generates
> > 
> > 	ldq     v0,0(gp)
> > 	lda     v0,32(v0)
> > 
> > and gas-971031 generates
> > 
> > 	ldq     v0,0(gp)
> > 
> 
> I'm in the middle of some gcc work right now, but I may look at this
> tomorrow if Ian or Richard don't.

The bug isn't in gas, since the relocation contains the proper offset.
My guess is the bug is in ld.so, but I havn't had a chance to verify
that; it could potentially be in ld.


r~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An alpha/gas bug
  1997-11-06 11:54 An alpha/gas bug H.J. Lu
@ 1997-11-10 13:25 ` Ken Raeburn
  1997-11-10 13:25   ` Richard Henderson
  1997-11-10 13:31   ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Ken Raeburn @ 1997-11-10 13:25 UTC (permalink / raw)
  To: H.J. Lu; +Cc: rth, Ian Lance Taylor, gas2

Just as an aside, it's helpful to include the relocs (objdump -dr)
when including this sort of snippet in a bug report.  The instructions
alone aren't very informative without the relocs used, when they're
GP-based.  (Any interesting changes in the literal sections would be
good to know too.)

> differently. binutils 2.8.1 generates
> 
> 	ldq     v0,0(gp)
> 	lda     v0,32(v0)
> 
> and gas-971031 generates
> 
> 	ldq     v0,0(gp)
> 

I'm in the middle of some gcc work right now, but I may look at this
tomorrow if Ian or Richard don't.

Ken

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An alpha/gas bug
  1997-11-10 13:25 ` Ken Raeburn
  1997-11-10 13:25   ` Richard Henderson
@ 1997-11-10 13:31   ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 1997-11-10 13:31 UTC (permalink / raw)
  To: Ken Raeburn; +Cc: rth, ian, gas2

> 
> 
> Just as an aside, it's helpful to include the relocs (objdump -dr)
> when including this sort of snippet in a bug report.  The instructions
> alone aren't very informative without the relocs used, when they're
> GP-based.  (Any interesting changes in the literal sections would be
> good to know too.)
> 

My bug report has the asm code and 2 .o files assembled by the
working and non-working as.


H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: An alpha/gas bug
       [not found] <19971106121644.39437@dot.cygnus.com>
@ 1998-01-24 16:47 ` H.J. Lu
  0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 1998-01-24 16:47 UTC (permalink / raw)
  To: rth; +Cc: gas2

> 
> > From what I see, binutils 2.8.1 and binutils gas-971031 treat
> > 
> > 	lda $0,_t12basic_string2ZcZt18string_char_traits1Zc$nilRep+32
> > 
> > differently. binutils 2.8.1 generates
> > 
> > 	ldq     v0,0(gp)
> > 	lda     v0,32(v0)
> > 
> > and gas-971031 generates
> > 
> > 	ldq     v0,0(gp)
> > 
> > I think that is a bug in gas.
> 
> Nope.  If you'll notice, gas-971031 generates
> 
>   4c: ELF_LITERAL _t12basic_string2ZcZt18string_char_traits1Zc$nilRep+0x20
>                                                                      ^^^^^
> 
> Now, the problem may be in either ld or ld.so in their handling of
> dynamic relocations.  I'll check on it later, as I'm a bit busy right now.
> 


Hi,

As of gas 980114, I and other people have verified that the patch
below is needed for Linux/Alpha to pass "make check" for egcs with
libg++ as well as build a working glibc 2. I intend to include it
in the next binutils for Linux.

Thanks.


H.J.
----
Wed Jan 21 17:10:34 1998  H.J. Lu  (hjl@gnu.org)

	* config/tc-alpha.c (load_expression): Undo the change of
	Wed Oct  8 16:28:53 1997  Richard Henderson  <rth@cygnus.com>.

Index: config/tc-alpha.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-alpha.c,v
retrieving revision 1.10
diff -u -r1.10 tc-alpha.c
--- tc-alpha.c	1998/01/15 17:52:30	1.10
+++ tc-alpha.c	1998/01/22 01:08:07
@@ -2256,7 +2256,11 @@
 	/* XXX: Disable this .got minimizing optimization so that we can get
 	   better instruction offset knowledge in the compiler.  This happens
 	   very infrequently anyway.  */
+	/* FIXME: Enable it again. Otherwise, it won't work on
+	   Linux/Alpha.
 	if (1 || !range_signed_32 (addend)
+	*/
+	if (!range_signed_32 (addend)
 	    && (alpha_noat_on || targreg == AXP_REG_AT))
 	  {
 	    newtok[1] = *exp;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-01-24 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-06 11:54 An alpha/gas bug H.J. Lu
1997-11-10 13:25 ` Ken Raeburn
1997-11-10 13:25   ` Richard Henderson
1997-11-10 13:31   ` H.J. Lu
     [not found] <19971106121644.39437@dot.cygnus.com>
1998-01-24 16:47 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).