Hi Segher, thanks for looking into this! As per your request on IRC, attached are the files which comprise the XIP code we are having problems with. *.85.* has the non-extern variant of initram_printktest.c and does abort with a linker error (duplicate symbols), *.86.* has the extern variant and links fine.
Short list of files with explanations: build/stage0-prefixed.85.o build/stage0-prefixed.86.o Object we link against with --just-symbols. It contains the non-PIC code we want to call. build/mainboard/emulation/qemu-x86/initram_xip.85.o build/mainboard/emulation/qemu-x86/initram_xip.86.o PIC object with "ret (*func)(args) = stage0_##func;" sequence, contains main(), which calls printk() and printktest(). build/mainboard/emulation/qemu-x86/initram_printktest_xip.85.o PIC object with "ret (*func)(args) = stage0_##func;" sequence, contains printktest(), which calls printk(). build/mainboard/emulation/qemu-x86/initram_printktest_xip.86.o PIC object with "extern ret (*func)(args);" sequence, contains printktest(), which calls printk(). initram_printktest.85.i initram_printktest.85.s initram_printktest.86.i initram_printktest.86.s Preprocessed output of the above. initram.85.i initram.85.s initram.86.i initram.86.s Assembler output of the above. shortlog.85.txt shortlog.86.txt gcc/ld commands used. build/linuxbios.initram.86.o Final linked object. build/linuxbios.initram.85.o did not link. Call sequence is as follows: initram.c:main() ->printk()->stage0_printk() ->printk()->stage0_printk() ->printktest1() ->printk()->stage0_printk() ->printk()->stage0_printk() ->initram_printktest.c:printktest() ->printk()->stage0_printk() -----dies here The generated code for printktest() is what we have problems with. Regards, Carl-Daniel
call-nonPIC-from-PIC.tar.gz
Description: GNU Zip compressed data
-- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios