[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] plt.c and Mach-O ABI
From: |
Aurelien Chanudet |
Subject: |
[Gcl-devel] plt.c and Mach-O ABI |
Date: |
Sat, 28 Feb 2004 18:18:36 +0100 |
Just a quick note. Nothing really worth Camm's attention here as I
understand that the plt trick is a temporary solution.
In the Mach-O ABI, the gcc prepends a leading underscore to any C
symbol name (however, symbols declared in raw assembler don't get this
leading underscore prepended). The real symbol name is the one with the
leading underscore (i.e. the mangled one). This means for instance that
it's not possible to use nm output to declare C function prototypes
without further parsing.
Here is what I get on Debian :
address@hidden:/tmp$ uname -a
Linux aljunied 2.4.18-newpmac #1 Thu Mar 14 22:44:49 EST 2002 ppc
unknown
address@hidden:/tmp$ cat toto.c
#include <stdio.h>
int main ()
{
printf ("hello, world!\n");
exit (0);
return 0;
}
address@hidden:/tmp$ gcc -c toto.c
address@hidden:/tmp$ nm toto.o
U exit
00000000 t gcc2_compiled.
00000000 T main
U printf
address@hidden:/tmp$ exit
logout
And here is what I get on Darwin :
-bash2.05b /tmp $ uname -a
Darwin sabine.local 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11
16:20:23 PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power
Macintosh powerpc
-bash2.05b /tmp $ cat toto.c
#include <stdio.h>
int main ()
{
printf ("hello, world!\n");
exit (0);
return 0;
}
-bash2.05b /tmp $ gcc -c toto.c
-bash2.05b /tmp $ nm toto.o
U _exit
00000000 T _main
U _printf
U dyld_stub_binding_helper
Note the difference in the way symbol names are mangled. I've tried to
unravel the logic in plt.c, but I cannot compile it as such. Anyway,
I'm not sure I need this file plt.o due to substantial differences in
the ELF and Mach-O linking semantics.
Aurelien
- [Gcl-devel] plt.c and Mach-O ABI,
Aurelien Chanudet <=