Re: Rename symbol at link time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 06.06.2012 12:58, schrieb DamienDaG:
I my case I'd like to replace a call to a function that doesn't exist by a
call to an existing function. This is to be applied to a project where a
function is called with a name (e.g. fct1_wrongname in my example), but is
implemented with another name (e.g. fct9). Since I cannot modify source
code, I'd like to make this with the help of a linker script.
It looks strange but in the final project, a part of the code calling
fct1_wrongname is generated automatically, so I cannot modify it.

I'm afraid I cannot use alias as you mentioned because it makes me modify
source code.
In my example, I need to "rename" function. Eventually I'll need to "rename"
variables as well.


Can you not simply implement fctl_wrongname() and have it call fct9()? Perhaps by the means of linking an additional .o file that includes the wrapper? Since you can modify the linker script I assume you can change the linker command line too.

i.e. "void fctl_wrongname(void) { fct9(); }"

Best regards


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux