link 32bit .o with 64bit .o

GuoMinskey minskey_guo@hotmail.com
Mon Apr 11 02:54:00 GMT 2011



On x86 platform,  is there any means to link 32 bit ELF output into 64 bit  ?
In Linux kernel,  arch/x86/boot/compressed/head_64.S,   starts from32-bit code and enables CPU to jump into 64-bit.  So, that file is assembled into 64 bit ELF object with mixed 32/64 bit code.
Now, I want to call a routine from somewhere in the 32bit code part of head_64.S.    And I write the routine by C language,  say test.c and compile  it with "gcc -m32 -c -o test.o".    How can I link mytest.o to head_64.o ?  Or I have to use assembly language to rewritemy routine and embed it directly into head_64.S source code ?
please reply me directly
thanks,-minskey
 		 	   		  



More information about the Gcc-help mailing list