[comp.unix.microport] shared libraries with gcc

zeeff@b-tech.UUCP (Jon Zeeff) (09/18/88)

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 
(although programs can be compiled with gcc and linked with cc).  It's 
probably just the ld options gcc uses.  Does anyone have a fix for 
this?  

--Jon
-- 
Jon Zeeff      			Branch Technology,
umix!b-tech!zeeff  		zeeff%b-tech.uucp@umix.cc.umich.edu

zeeff@b-tech.UUCP (Jon Zeeff) (09/19/88)

In article <4766@b-tech.UUCP> zeeff@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@b-tech.ann-arbor.mi.us