ron minnich wrote:
On 8/29/07, Stefan Reinauer stepan@coresystems.de wrote:
What was that linker auto rename trick that Marc mentioned recently?
The naming is not the issue. The issue is getting gcc to do abs calls, not relative calls, for some symbols.
I did the auto-rename trick. It is a simple objcopy with --prefix-symbols and whatever you want -- e.g. stage0.
Then in initram you can do this (which I did): int (*printk)(int level, char *fmt, ...) = stage0printk;
The problem comes in with includes. How do you declare printk? In console.h it is this:
#ifndef STAGE0
int printk(int level, char *fmt, ...);
#else
int (*printk)(int level, char *fmt, ...) = stage0printk;
#endif
It even fails for those symbols that we don't explicitly want to export. Pretty good I guess.
So you get a compile time error. Do you change all the include files? uck.
No, only one header?!?
The simplest, easiest way to make this go would be a pragma on certain symbols that makes gcc do an absolute, not relative, call. is this possible?
This sounds even better. No idea though.