public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is it safe to use "-shared-libgcc" when building a shared library with gcc ?
@ 2011-05-29 15:09 duncan.loveday
  0 siblings, 0 replies; only message in thread
From: duncan.loveday @ 2011-05-29 15:09 UTC (permalink / raw)
  To: gcc-help

Hi,

gcc allows me to create a shared library and still statically link libgcc but is that a safe thing to do ?

Often, statically linking code into a shared library is unsafe because the code in the static library is not position independent. Does the static version of libgcc contain position independent code ?

My command line is below for reference. Ignore the fact that the output library is also supplied as a -l to the linker, that is a quirk of the makefiles used.

     gcc -static-libgcc -shared -fPIC -Wl,+h -Wl,libdb-4.5.sl -Wl,+b -Wl,/usr/local/BerkeleyDB.4.5/lib -o .libs/libdb-4.5.sl <list of object files> -lpthread -lc


Thanks,

Duncan.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-28 15:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-29 15:09 Is it safe to use "-shared-libgcc" when building a shared library with gcc ? duncan.loveday

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