Calling non-PIC code from PIC code
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 <at> gmx.net>
2007-12-01 04:19:20 GMT
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
(Continue reading)