This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ELF symbol aliasing in
On Wed, Nov 18, 2009 at 8:56 AM, Matthias Urlichs <matthias@urlichs.de> wrote:
> On Wed, 2009-11-18 at 06:16 -0800, H.J. Lu wrote:
>> Glibc uses alias. What is the problem?
>
> As I already said, the problem is that gcc's alias only works for
> symbols which are defined in the same source file as the alias
> declaration.
>
I don't know what your problem is. Here is an example to make
"print" as an alias of "printf":
[hjl@gnu-6 tmp]$ cat x.c
int
main ()
{
print ("hello\n");
}
[hjl@gnu-6 tmp]$ cat x.h
#include <stdio.h>
extern __typeof (printf) print __asm__ ("printf");
[hjl@gnu-6 tmp]$ gcc --include x.h x.c
[hjl@gnu-6 tmp]$ ./a.out
hello
[hjl@gnu-6 tmp]$
Does it work for you?
--
H.J.