public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc the gnu linker and the -z extract option
@ 2008-07-24 16:58 eoin
  2008-07-28  9:39 ` Andrew Haley
  2008-07-31 17:15 ` eoin
  0 siblings, 2 replies; 4+ messages in thread
From: eoin @ 2008-07-24 16:58 UTC (permalink / raw)
  To: gcc-help


Hi,
     I'm a new poster here. I am porting some Solaris code over to Linux and
using the GNU compiler and linker. Now I have a "meta library"(creating a
"master" shared object from mayny shared objects) which creates fine in
Solaris but in Linux it doesn't create as a meta library - ldd suggests that
it depends on the libraries which were previously used to produce the meta
library on solaris.
     Looking into this I can see that with every .so we effectively lose the
identity and so with a metalibrary what we need to do is to "unravel" the
.sos to produce the meta library.
     I do this in Solaris using the -z extract option. I can't see how to do
this in Linux using the GNU linker. Anyone any ideas?

Thanks
-- 
View this message in context: http://www.nabble.com/gcc-the-gnu-linker-and-the--z-extract-option-tp18635245p18635245.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc the gnu linker and the -z extract option
  2008-07-24 16:58 gcc the gnu linker and the -z extract option eoin
@ 2008-07-28  9:39 ` Andrew Haley
  2008-07-31 17:15 ` eoin
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2008-07-28  9:39 UTC (permalink / raw)
  To: eoin; +Cc: gcc-help

eoin wrote:

>      I'm a new poster here. I am porting some Solaris code over to Linux and
> using the GNU compiler and linker. Now I have a "meta library"(creating a
> "master" shared object from mayny shared objects) which creates fine in
> Solaris but in Linux it doesn't create as a meta library - ldd suggests that
> it depends on the libraries which were previously used to produce the meta
> library on solaris.

What should be in this meta library?  Is it all the contents of all the libraries?

>      Looking into this I can see that with every .so we effectively lose the
> identity and so with a metalibrary what we need to do is to "unravel" the
> .sos to produce the meta library.

"Lose the idenitity?"  I don't know what you mean.

>      I do this in Solaris using the -z extract option. I can't see how to do
> this in Linux using the GNU linker.

Compile every .o file with -fpic.  Make them all into archives with ar.
Link all the archives together into a .so.

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc the gnu linker and the -z extract option
  2008-07-24 16:58 gcc the gnu linker and the -z extract option eoin
  2008-07-28  9:39 ` Andrew Haley
@ 2008-07-31 17:15 ` eoin
  2008-07-31 22:15   ` Andrew Haley
  1 sibling, 1 reply; 4+ messages in thread
From: eoin @ 2008-07-31 17:15 UTC (permalink / raw)
  To: gcc-help


Ok - I now know better what I want to do.

Basically using gcc I want to statically link a number of .as to a shared
object and dynamically link the rest.

In Solaris I do -h <so name> -z muldefs -z allextract -Bstatic <list of
archives> -Bdynamic

In gcc what I'm trying is -shared (I require this option due to a few other
things) -z muldefs -static <list of archives> -shared

This however does not statically link the archives into the shared
object(acccording to ldd). Any ideas?

Thanks


eoin wrote:
> 
> Hi,
>      I'm a new poster here. I am porting some Solaris code over to Linux
> and using the GNU compiler and linker. Now I have a "meta
> library"(creating a "master" shared object from mayny shared objects)
> which creates fine in Solaris but in Linux it doesn't create as a meta
> library - ldd suggests that it depends on the libraries which were
> previously used to produce the meta library on solaris.
>      Looking into this I can see that with every .so we effectively lose
> the identity and so with a metalibrary what we need to do is to "unravel"
> the .sos to produce the meta library.
>      I do this in Solaris using the -z extract option. I can't see how to
> do this in Linux using the GNU linker. Anyone any ideas?
> 
> Thanks
> 

-- 
View this message in context: http://www.nabble.com/gcc-the-gnu-linker-and-the--z-extract-option-tp18635245p18759076.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc the gnu linker and the -z extract option
  2008-07-31 17:15 ` eoin
@ 2008-07-31 22:15   ` Andrew Haley
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2008-07-31 22:15 UTC (permalink / raw)
  To: eoin; +Cc: gcc-help

eoin wrote:
> Ok - I now know better what I want to do.
> 
> Basically using gcc I want to statically link a number of .as to a shared
> object and dynamically link the rest.
> 
> In Solaris I do -h <so name> -z muldefs -z allextract -Bstatic <list of
> archives> -Bdynamic
> 
> In gcc what I'm trying is -shared (I require this option due to a few other
> things) -z muldefs -static <list of archives> -shared
> 
> This however does not statically link the archives into the shared
> object(acccording to ldd). Any ideas?

-Wl,-whole-archive

> 
> Thanks
> 
> 
> eoin wrote:
>> Hi,
>>      I'm a new poster here. I am porting some Solaris code over to Linux
>> and using the GNU compiler and linker. Now I have a "meta
>> library"(creating a "master" shared object from mayny shared objects)
>> which creates fine in Solaris but in Linux it doesn't create as a meta
>> library - ldd suggests that it depends on the libraries which were
>> previously used to produce the meta library on solaris.
>>      Looking into this I can see that with every .so we effectively lose
>> the identity and so with a metalibrary what we need to do is to "unravel"
>> the .sos to produce the meta library.
>>      I do this in Solaris using the -z extract option. I can't see how to
>> do this in Linux using the GNU linker. Anyone any ideas?
>>
>> Thanks
>>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-31 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24 16:58 gcc the gnu linker and the -z extract option eoin
2008-07-28  9:39 ` Andrew Haley
2008-07-31 17:15 ` eoin
2008-07-31 22:15   ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).