shared libraries with gcc (Green Hills)

Jon Zeeff zeeff at b-tech.UUCP
Mon Sep 19 07:56:41 AEST 1988


In article <4766 at b-tech.UUCP> zeeff at b-tech.UUCP (Jon Zeeff) writes:
>To take advantage of shared libraries, I normally have /lib/libc.a be 
>the shared version.  With the Green Hills gcc, this doesn't work 

bigtex!james (James Van Artsdalen) writes:
>
>Currently GNU C is in very good shape, with no bugs in 1.28 that I 
>know of (though I'm sure they're there - I just haven't found any).  
>
>Ah, the advantages of having source.  GNU C didn't handle shared libraries
>right at first either.  So I fixed it.  :-)
>
>It's always possible Greenhills is using crt0.o instead of crt1.o and crtn.o.
>

James has it right - if you use this program, things will work.  Copying 
libc_s.a on top of libc.a may not be a good idea - libc.a includes a few
routines that libc_s.a doesn't.


/*
   This allows gcc to be used with shared libraries 

   To install,

   1) compile this program creating ld
   3) cp /usr/ghs/BIN/386/lib/crt0.o to crt0.o.bak
   4) cp /lib/crt1.o to /usr/ghs/BIN/386/lib/crt0.o
   5) mv this program (ld) to /usr/gcc
   6) mv /bin/gcc to /usr/gcc/cc
   7) use -lc_s on your cc lines. 
   8) set your path to use /usr/gcc before /bin

    Anything you compile should now used shared libraries

*/

#include <stdio.h>

main(argc,argv)
int argc;
char **argv;
{
int i;
char *new_argv[500];

for (i = 0; i < argc; ++i) {
   new_argv[i] = argv[i];
}

new_argv[i++] = "/lib/crtn.o";
new_argv[i] = NULL;

execv("/bin/ld",new_argv);

return 1;

}
-- 
Jon Zeeff      			Branch Technology,
umix!b-tech!zeeff  		zeeff at b-tech.ann-arbor.mi.us



More information about the Comp.unix.microport mailing list