public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* A serious gas/gld bug
       [not found] <199411082146.NAA14605@cygnus.com>
@ 1994-11-09 10:59 ` H.J. Lu
  1994-11-09 15:07   ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 1994-11-09 10:59 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Ian Lance Taylor, Ken Raeburn, gas2, Eric Youngdale

> 
> >>>>> H J Lu <hjl@nynexst.com> writes:
> 
> >> >>>>> H J Lu <hjl@nynexst.com> writes:
> 
> >> > crtstuff.c is responsible for the .fini section which is registered
> >> > via atexit().  The .fini section contains your crtstuff.c messed up
> >> > 'i' after the .fini section returns.
> 
> >> I don't understand how this could happen.  Can't you step through the call
> 
> > I can guess 'i' is in a register. The weird things we did in crtstuff
> > as well as the linker did didn't help much. The rfg's approach is very
> > reasonable. It uses a complete function which is combined from
> > two parts.
> 
> If 'i' is in a register that is going to be clobbered, it should be
> reloaded after the call.  My approach is more in line with existing
> practice -- crt[in].o provide a function prologue and epilogue, why don't
> we use them?
> 
> >> to _fini and see why 'i' is being clobbered?
> 

It is gas/gld who clobbered ebx which is used by 'i'. Here is the test
case. Jason, could you please verify gas/gld on x86 UnixWare? I am
curious why you didn't see problem on x86 UnixWare.

It seems that gas/gld cannot handle

	.section	.fini/.init

right. As you can see from objdump --disassemble,

fini_dummy:
	.section        .fini
	call __do_global_dtors_aux

becomes

	call __do_global_dtors_aux+2

At the final linking, a.out.asm, you can see it become

	call __do_global_dtors_aux+1

Similar thing also happens to __do_global_ctors_aux. That screwed up
everything since it skip the very importmant

	push	%ebx


H.J.
---

begin 644 binutils-bug.tar.gz
M'XL( .,9P2X  ^U<RV\D1QDOQT[8:1(@B ,2' IG(VW8<:>[IQ\>9^.L$V\V
MB4PVBAU K*#I1[4]9F9Z--V3]49(!)D#4A3)AQP0XL A!_X"A,1Q)<[\&7M%
MXKC(5/6[JKH]8^,9=K/U2>.>ZOI]]?BJOE=[NN17]YW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@6>*)/X'9
MXHD_-^#8>.)+,%L\\5<P6SSQ?7P#9O'$BZ YGKB!F7Y=TQ[)E*47,Q[,W,W*
MR=H^Q7$%]?^_N63_,^3_AL[Z?\W4A?]?!$WS__[4_)\XZ^/7R=_3(O]_=/S:
MZ6SY?T&7Z^/)8\D4D'Y;4/Y_!6P".O]_EZI?!C^ARJR/?6SS?Z^2_Y>/0T'Y
MI)ESUN633# K733W_^(KDOM_^13F_C[#EMT6N?^"B/[_[WP"@ OD_[HB?O^S
M$)I/_O_H^.C1:27_?W2\>7K^_+^@)S0VH//_*V /T/F_3=4O@P%5GA8;/#'Y
MOS<U_Y];1"'R_Z<Q__^DICV1_]<3\___N1P!-?WW7^7['T;R^R]-[0C_OQ"2
MRI]^7.P0J.PPIHP:7F=ECG9(:;:C'?)3"%*:_5 '/6>9Y3B'=#QG'^>0TDS'
M.:3-G?LXAY3M',<YI SG/,XA93KW<0XIVTS'.4R??M[<[,<YI/C9CG-(L;,=
MYY!B9SO.(2&-.<YAR_?'*(J@<J2IL!?!<!(3_7##R="/IKX=7E&;RG\WRK?$
MLSY)??6%5VWSLG[+G-K_#V]M;?_HUB4UR=$4^P]-I?S]KY78?T47Y_\MAM[I
MM27IW1AO3#2(8'R K3[>$'C_#7&R! ^<H=]'$OO2UZOISSZE<6__();A5@3O
MAQ/"0YJ!P3@<P- ]Q HR@FMK?J$!"'=%O9^6MYIOA/2-LK/>A)9<A),,%$EG
MH:YKDK05X\D@\HZ<TX?]WO!7O>%^&Q;G7+:I$?=BF+8KG=VN*DF[O4&OCS=,
M?( ;A$X_"K&01B,TQ,(+ZW_Z*L,](M;(&Z-[R(>3D80^1N/[20NR)+TCOR>+
M-Q,$"1(D2) @08($"1(D2) @08($"1(D2) @08($"1(D2) @08($78S^"WT%
&IXH >   
 
end


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

* Re: A serious gas/gld bug
  1994-11-09 10:59 ` A serious gas/gld bug H.J. Lu
@ 1994-11-09 15:07   ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 1994-11-09 15:07 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Ian Lance Taylor, Ken Raeburn, gas2, Eric Youngdale

>>>>> H J Lu <hjl@nynexst.com> writes:

> It is gas/gld who clobbered ebx which is used by 'i'. Here is the test
> case. Jason, could you please verify gas/gld on x86 UnixWare? I am
> curious why you didn't see problem on x86 UnixWare.

They seem to work properly on x86 Unixware.

> It seems that gas/gld cannot handle

> 	.section	.fini/.init

> right. As you can see from objdump --disassemble,

> fini_dummy:
> 	.section        .fini
> 	call __do_global_dtors_aux

> becomes

> 	call __do_global_dtors_aux+2

Hmm.  On UnixWare, it becomes

Disassembly of section .fini:
	call 00000001 <__DTOR_LIST__+1>

which I assume is a reference to the first relocation entry for .fini:

RELOCATION RECORDS FOR [.fini]:
OFFSET   TYPE              VALUE 
00000001 R_386_PLT32       __do_global_dtors_aux

Are there two relocation entries for .fini under Linux-ELF?

> At the final linking, a.out.asm, you can see it become

> 	call __do_global_dtors_aux+1

On UnixWare, the link creating the shared library fixes up the reference to
be an actual call to the function.  It does not seem to be off by one.

objdump -xd libg++.so
...
SYMBOL TABLE:
...
000672f4 l       .text  __do_global_ctors_aux
...
0001eadc l       .text  __do_global_dtors_aux
...
Disassembly of section .init:
0001cc14 <_init> call   000672f4 <__do_global_ctors_aux>
0001cc19 <_init+5> ret    $0x0
...
Disassembly of section .fini:
00067350 <_fini> call   0001eadc <__do_global_dtors_aux>
00067355 <_fini+5> ret    $0x0
...

> Similar thing also happens to __do_global_ctors_aux. That screwed up
> everything since it skip the very importmant

> 	push	%ebx

Did this happen when you were stepping through at runtime?

Jason


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

end of thread, other threads:[~1994-11-09 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199411082146.NAA14605@cygnus.com>
1994-11-09 10:59 ` A serious gas/gld bug H.J. Lu
1994-11-09 15:07   ` Jason Merrill

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).