public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* Re: ld -r in gas-940816
       [not found] <199408172205.SAA13025@sanguine.cygnus.com>
@ 1994-08-17 19:26 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 1994-08-17 19:26 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Eric Youngdale, gas2

> 
>    Date: Wed, 17 Aug 94 17:30:41 EDT
>    From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
> 
> 	   Enclosed.  Here is the relevant output of some tests:
> 
> Thanks for the test case.
> 
> My impression is that this problem is specific to the relationship
> between the .data section and the .bss section, since the VMA of the
> .bss section in an input file is fixed at the VMA of the .data section
> plus the size of the .data section.
> 
> This patch appears to fix the test case.  If nobody sees any problems
> with it, I will check it in.
> 
> Ian

I tried your patch on the Linuc C library with ld -r -x. It still
doesn't work. I got the core dump with the shared library in the
dynamic linker while in __do_fixups at fixups.c:137.

I compiled a "hello world" with the static library built with ld -r -x
also. It doesn't print out anything. It looks ld -r -x is totally
broken, at least under Linux, maybe all aout-i386 :-(.

I will replace the .o file in a good static libc.a with the one built by
ld -r -x one by one. I hope I can track down the really mis-lded .o
file. But there are more than 600 files in libc.sa. I don't know when
I will finish it in my spare time :-(.

H.J.
H.J.


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

* ld -r in gas-940816
       [not found] <199408161134.HAA02540@cais.cais.com>
@ 1994-08-16 11:12 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 1994-08-16 11:12 UTC (permalink / raw)
  To: Eric Youngdale; +Cc: gas2

Hi,

I found out ld -r in gas-940816 under a.out-i386-linux changes the
alignment from 2**2 specified in the asm file to 2**3. I don't know
what else it does besides that.

For whatever reason, after doing

gcc -c foo.c
ld -r -x foo.o
mv a.out foo.o

the result foo.o is changed such that it cannot be used to built the
shared image for Linux with

ld -x -Ttext -Tdata -o libc.so.xxxxx foo.o .....

I don't know why. ld -r works with binutils 1.9. If I just do

gcc -c foo.c
.....
ld -x -Ttext -Tdata -o libc.so.xxxxx foo.o ....

everything is fine. Here are some outputs. It looks like gas-940816
misinterpreted something and did something funny to .o file when -r
is used.

BTW, Eric, it looks my patch for tools 2.15 is ok. Please make tools
2.16.


H.J.
----
# gcc -c x.s
# nm.o
00000000 t ___gnu_compiled_c
00000000 T _foo
00000004 D _x
00000008 D _y
00000000 t gcc2_compiled.
# objdump --dis x.o
 
x.o:     file format a.out-i386-linux
  
Disassembly of section .text:
00000000 <_foo> ret    
00000001 <_foo+1> nop    
00000002 <_foo+2> nop    
00000003 <_foo+3> Address 0x4 is out of bounds.
Disassembly of section .data:
00000004 <_x> addl   $0x5000000,%eax
# ld -r -o 2.5 x.o
# objdump --dis 2.5
 
2.5:     file format a.out-i386-linux
  
Disassembly of section .text:
00000000 <_foo> ret    
00000001 <_foo+1> nop    
00000002 <_foo+2> nop    
00000003 <_foo+3> nop    
...
Disassembly of section .data:
00000008 <_x> addl   $0x5000000,%eax
# ld.1.9 -r -o 1.9 x.o
# objdump --dis 1.9

1.9:     file format a.out-i386-linux

Disassembly of section .text:
00000000 <_foo> ret    
00000001 <_foo+1> nop    
00000002 <_foo+2> nop    
00000003 <_foo+3> Address 0x4 is out of bounds.
Disassembly of section .data:
00000004 <_x> addl   $0x5000000,%eax

-----x.s--
	.file	"x.c"
gcc2_compiled.:
___gnu_compiled_c:
.globl _x
.data
	.align 2
_x:
	.long 5
.text
	.align 4
.globl _foo
_foo:
	ret
.globl _y
.data
	.align 2
_y:
	.long 5



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

end of thread, other threads:[~1994-08-17 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199408172205.SAA13025@sanguine.cygnus.com>
1994-08-17 19:26 ` ld -r in gas-940816 H.J. Lu
     [not found] <199408161134.HAA02540@cais.cais.com>
1994-08-16 11:12 ` 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).