public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Using --disable-shared to build non-apple gcc on darwin
@ 2004-09-07 13:01 Peter O'Gorman
  2004-09-07 19:28 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: Peter O'Gorman @ 2004-09-07 13:01 UTC (permalink / raw)
  To: gcc

Hi,
First, I'd like to apologize if this is a silly question, sorry...

When gcc is built having been configured --disable-shared, it builds libgcc, 
libstdc++ etc without any pic flags, so on darwin, the fortran libraries, 
for example, contain common symbols (gcc-3.4.1) and cannot be used as input 
to ld when building a shared library (.dylib). Also, in the FSF gcc (not the 
apple branch), there's no comcept of private external symbols, so generating 
multiple shared libraries (obviously not fortran ones :-p) and then using 
these to create a program will likely give you errors about multiple 
definitions of symbols (these symbols having made their way into many shared 
libs by virtue of being global symbols in libgcc).

My questions is, is this by design? Should we not expect to be able to build 
working shared libraries with a compiler built --disable-shared?

Thanks,
Peter

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

* Re: Using --disable-shared to build non-apple gcc on darwin
  2004-09-07 13:01 Using --disable-shared to build non-apple gcc on darwin Peter O'Gorman
@ 2004-09-07 19:28 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2004-09-07 19:28 UTC (permalink / raw)
  To: Peter O'Gorman; +Cc: gcc


On Sep 7, 2004, at 5:59 AM, Peter O'Gorman wrote:

> Hi,
> First, I'd like to apologize if this is a silly question, sorry...
>
> When gcc is built having been configured --disable-shared, it builds 
> libgcc, libstdc++ etc without any pic flags, so on darwin, the fortran 
> libraries, for example, contain common symbols (gcc-3.4.1) and cannot 
> be used as input to ld when building a shared library (.dylib). Also, 
> in the FSF gcc (not the apple branch), there's no comcept of private 
> external symbols, so generating multiple shared libraries (obviously 
> not fortran ones :-p) and then using these to create a program will 
> likely give you errors about multiple definitions of symbols (these 
> symbols having made their way into many shared libs by virtue of being 
> global symbols in libgcc).

First -fPIC is not needed on Darwin to produce shared libraries as it
is PIC by default.  Second yes we do have the concept of private
external for Darwin too.  Look at the attribute visibility for how
to use "private external" symbols, I cannot remember if this made it
into 3.4.0 or not.  But really you should not be using --disable-shared
without using --with-pic if you want to use shared libraries.

Also you should not be using --diable-shared at all because it is not
the tested way of compiling the compiler.



> My questions is, is this by design? Should we not expect to be able to 
> build working shared libraries with a compiler built --disable-shared?

Yes this is by design, see above about --with-pic but I think that only
works with libtool based projects.

Thanks,
Andrew Pinski

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

end of thread, other threads:[~2004-09-07 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-07 13:01 Using --disable-shared to build non-apple gcc on darwin Peter O'Gorman
2004-09-07 19:28 ` Andrew Pinski

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).