On Tue, 7 Mar 2000, Roland McGrath wrote:

> > I found that if I compile binaries to object files under linux and then
> > link it under hurd agains its libc everything works OK.
> 
> It is true that they are both ELF/x86 platforms.  But the ABIs are not
> binary compatible at any level.  So compiling sources with Linux header
> files and then linking on the Hurd is not going to work (any cases that
> work are just luck, but you cannot expect to do this generally).
> 
That's true, but my assumption is also true for simple binaries that does
not use shared libraries...

> > I'am trying to port a386 and Linux/a386 to hurd, so I'm compiling linux
> > kernel under linux and I would like to link it against hurd's a386 and
> > libc, but the problem is that I'm not using gcc but ld directly.
> 
> You'll have to give more details about precisely what you are doing.  The
> only things that you can compile in a Linux native development environment
> and then link on the Hurd are things that use no system header files at
> all.  (For example, kernels like gnumach, and kernel-building libraries
> like those in the oskit, you can compile on any ELF/x86 platform and link
> on any other ELF/x86 platform without a problem; that is because these
> sources do not use any of the development environment's installed header
> files.)
> 
I can link binaries with libc. Both Linux and HURD are glibc systems and
uses same linb and same (or almost equal) header files, so I can link
against libc too.

My question is how should I link binaries that I compile under hurd
(forget about crosslinking for awhile) against its linc and standard
libraries?

Under Linux I could do it for example like that:
ld -Bstatic  -m elf_i386 -e _start main.o /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/crtn.o /usr/lib/libc.a
/usr/lib/gcc-lib/i486-unknown-linux-gnulibc1/2.7.2.3/libgcc.a
-rpath /lib -Bstatic -o main

But when I do similar it produces broken _init():
ld -Bstatic -m elf_i386  -e _start /usr/lib/crtn.o main.o /usr/lib/crt0.o
/usr/lib/crti.o /lib/libc.a -o main -Bstatic

??? How can I produce valid code?

--
Mariusz Wołoszyn
Internet Security Specialist, Internet Partners, GTS Poland

Reply via email to