Relocatable linking on x86-64 for i386

Relocatable linking on x86-64 for i386

Valery Reznic valery_reznic at yahoo.com
Tue Apr 5 11:27:47 IDT 2011



--- On Tue, 4/5/11, Ehud Karni <ehud at unix.mvs.co.il> wrote:

> From: Ehud Karni <ehud at unix.mvs.co.il>
> Subject: Re: Relocatable linking on x86-64 for i386
> To: valery_reznic at yahoo.com
> Cc: gleb at minantech.com, shachar at shemesh.biz, linux-il at cs.huji.ac.il
> Date: Tuesday, April 5, 2011, 10:58 AM
> On Mon, 4 Apr 2011 23:19:43 -0700,
> Valery Reznic wrote:
> >
> > --- On Mon, 4/4/11, Ehud Karni <ehud at unix.mvs.co.il>
> wrote:
> >
> > > In fact you can do: gcc -m32 file1.o file2.o -o
> output.o
> >
> > I vaguely remember that I tried to use gcc instead of
> ld long time ago, but gcc gave me some trouble - may be link
> failed after that, may be run-time problems.
> 

Create programs using gcc -m32 is fine.
But I use ld command not to create the program, but to create object file 

While both 
ld -m elf_i386 file1.o file2.o -o output.o
and
gcc -m32 file1.o file2.o -o output.o

create EXECUTABLE file (despite .o extension)

I use
ld -r file1.o file2.o -o output.o # Note -r

that create "partially linked object file"
And with this operation (even on i386 system, without need for -m32 flag)
I had a problem. Or at least I remember it.

Valery.



> Just to state the facts. I use `gcc -m32' regularly to
> create 32 bit
> programs on 64 bit systems.  I checked the ld
> replacement command
> specifically, and it worked without any problems.
> 
> Ehud.
> 
> 
> --
>  Ehud Karni       
>    Tel: +972-3-7966-561  /"\
>  Mivtach - Simon      Fax:
> +972-3-7976-561  \ /  ASCII Ribbon Campaign
>  Insurance agencies   (USA) voice mail
> and   X   Against   HTML   Mail
>  http://www.mvs.co.il  FAX: 
> 1-815-5509341  / \
>  GnuPG: 98EA398D <http://www.keyserver.net/>   Better Safe Than Sorry
> 



More information about the Linux-il mailing list