Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ld shared object



On Sat, 22 Jun 1996 01:53:58 -0500 (CDT),
YU SONG <cs_yus%cs4.lamar.edu@localhost> wrote about ld shared object:
> Hi, everyone.
> 
> I have some difficulties to build shared library under NetBSD-amiga. The 
> gcc flag -shared and -fpic informs compiler to build PIC and shared 
shared is for ELF binaries I think. why doesn't NetBSd use ELF too ?

> object, in which _GLOBAL_OFFSET_TABLE and _DYNAMIC global symbol shall be 
> defined. So I do like these: gcc -shared -fpic -Wl,-M -o lib***.so.1.0 **.o 
> **.o >out. The compiler compiler complains: RRS text relocate at ***... So I 
> use:gcc -shared -fpic -Wl,-r,-M -o lib***.so.1.0 **.o **.o>out. The build 
> is fine without error. However, after I check out file to see the defined 
> global symbols, both _GLOBAL_OFFSET_TABLE and _DYNAMIC are undefined. Did 
> I do something wrong? what flag shall I pass to compiler ot link to make 
> it work?
Well a short summary:
* -fPIC doens't works, the assembler doesn'r recognize the 'K' flag: -fpic
does fine though
* -shared is for ELF, I think

Well, how to create s.o files ?


1. gcc -pic on all sources you need
2. use ar cq libsharedstuff.a *.o 
3. use ranlib libsharedstuff.a
4. finally, use ld -x -Bshareable -Bforcearchive -o libsharedstuff.so.1.0
libsharedstuff.a
   et voila, you have a dynamic linkable library.
> 
> Any help is appreciated.
> 
> cs_yus%cs4.lamar.edu@localhost
> 
> 
> 


-- 
 ____________________________________________________________
/___________________________ //_____________________________/| PGP Public
|  _             _        |\X/ Amiga is it, the rest is ... ||_  @ / Key on
| /_)     | /   /_'       |Email: staveren%ronix.ptf.hro.nl@localhost || \/##\ 
Request
|/  \uben |/an __/taveren |(A1230-882@50/14/500) tO tHE eND!||   ##/
|-----------------------------------------------------------||   ||`
|      "Quantum Physics:The Dreams Stuff Are Made Of.."     ||  _|\ NetBSD
| URL: http://www.ptf.hro.nl/~staveren  BrintaBBS: The Guru ||    / - 1.1 -
|           ---==* Invasion Of Our Piracy! *==---           |'
`-----------------------------------------------------------'





Home | Main Index | Thread Index | Old Index