--- On Mon, 4/4/11, Shachar Shemesh <shac...@shemesh.biz> wrote:
> From: Shachar Shemesh <shac...@shemesh.biz> > Subject: Re: Relocatable linking on x86-64 for i386 > To: "Valery Reznic" <valery_rez...@yahoo.com> > Cc: linux-il@cs.huji.ac.il > Date: Monday, April 4, 2011, 11:13 AM > On 04/04/11 10:15, Valery Reznic > wrote: > > Hello. I am trying to make relocatable linking on > x86-64 box for objects in format i386 > > > > Naive > > > > ld -r file1.o file2.o -o output.o > > > > produce > > ld: Relocatable linking with relocations from format > elf32-i386 (file1.o) to format elf64-x86-64 (output.o) is > not supported > > > > But even when I add --oformat situation not improved: > > > > ld --output-format elf32-i386 -r file1.o file2.o -o > output.o > > ld: Relocatable linking with relocations from format > elf32-i386 (file1.o) to format elf32-i386 (output.o) is not > supported > > > > So linker correctly recognize what input and output > format should be, > > but for some reason don't want do it. > > > > Do you have any ideas if it can be done at all and > how? > > > Can't. You're trying to link objects compiled for different > machine codes. Tis not the linking stage that is wrong. I am not trying to mix i386 and x86_64 code in the same object. I have two object files for i386 and I want to combine it into one object file for i386 two. It works perfectly well on i386 box, but on x86-64 it's not. Valery. > > While it is possible to run both machine codes on your > computer, they must run in different processes (the kernel > actually treats x86 and amd64 codes differently when it sets > up the registers for the context switch), and thus you > cannot link them into a single executable, cannot > dynamically load one from the other, and cannot have two > threads with different types. Your only option for > interaction is RPC of some sort (or recompile one of them). > > Shachar > > -- Shachar Shemesh > Lingnu Open Source Consulting Ltd. > http://www.lingnu.com > > _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il