Why link C with crtstuff? [patch]

Sergei Ivanov svivanov@pdmi.ras.ru
Sun Apr 26 12:45:00 GMT 1998


> 
> The patch is wrong. Please try this patch.
> 
Thanks. It works for all my primitive tests except one.
I have a shared library compiled by gcc-2.8.1 (libvga-1.2.13, but this
should not be important):

~/test$ nm -D /usr/lib/libvga.so.1 | grep register_frame_info
000164e0 T __deregister_frame_info
0001644c T __register_frame_info
00016498 T __register_frame_info_table

I compile "main(){}" with -lvga. It works ok but:

~/test/oldvga$ nm -D a.out | grep register_frame_info
         U __deregister_frame_info
         U __register_frame_info

Now I recompile the library and replace the old one:

~/test$ nm -D /usr/lib/libvga.so.1 | grep register_frame_info
         U __deregister_frame_info
         U __register_frame_info

(btw, are they really need to be U, not just absent?)
The binary stops working:

~/test/oldvga$ ./a.out
./a.out: can't resolve symbol '__register_frame_info'

This is a kind of vicious circle. With an old-gcc made library,
it's hard to compile a binary that will work with a new-gcc library.
(old-gcc = without the patch, new-gcc = with the patch).

Sergei



More information about the Gcc mailing list