public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Edelsohn <dje@watson.ibm.com>
To: lrtaylor@micron.com, longp@cae.com
Cc: gcc-help@gcc.gnu.org
Subject: Re: compiling g++ 3.2.3
Date: Mon, 21 Jun 2004 19:54:00 -0000	[thread overview]
Message-ID: <200406211953.i5LJrqa30182@makai.watson.ibm.com> (raw)
In-Reply-To: Message from lrtaylor@micron.com  of "Mon, 21 Jun 2004 13:23:36 MDT." <363801FFD7B74240A329CEC3F7FE4CC40215DB3A@ntxboimbx07.micron.com>

>>>>> lrtaylor  writes:

Lyle> Actually, AIX has three library concepts or types on the Power platform
Lyle> rather than the traditional two.  There are static libraries (which are
Lyle> .a archive files just like those you see on many other UNIX platforms),
Lyle> shared libraries (which are special .a archive files that are built in
Lyle> such as way as to be linked in dynamically at run time - as opposed to
Lyle> statically like normal .a files are), and shared objects (the
Lyle> traditional .so file).  The terms "shared library" and "shared object"
Lyle> are not synonymous on AIX like they essentially are on many other UNIX
Lyle> platforms.

	AIX treats shared libraries (an archive of shared objects) and
shared objects the same.  An executable or shared object depends on a
shared object archive member of the shared library.  The shared library
may contain both shared objects and non-shared objects.

	".so" file extension and shared object are completely separate and
orthogonal concepts.  On AIX, a shared object can have any file extension.
The AIX linker only recognizes certain extensions when one does not refer
to the entire filename (e.g., -lfoo).  On AIX, ".so" file extension
normally corresponds to shared objects with the additional semantics of
runtime linking for compatibility with other Unixes.  A shared object can
be named shr.o or libfoo.a or libbar.so, for example.  The ".so" file
extension is a convention on AIX but does not itself imply any different
semantics. 

Lyle> AIX links to libraries ending in .a by default.  This does not mean that
Lyle> it is linking statically by default, unless the library it finds is a
Lyle> static library. In order to tell the linker to link to .so files by
Lyle> default, you need to specify the -brtl option (for run-time linking as
Lyle> they call it).  That's the option that is passed to IBM's VisualAge
Lyle> compiler, so I don't know if GCC recognizes it.  If it doesn't, then you
Lyle> might try '-Wl,-brtl'.

	-brtl tells the linker to look for ".so" file extension as well
and changes the semantics to runtime linking, but ".so" does not mean
runtime linking unless the developer follows the naming conventions.

	GCC does not require runtime linking.  GCC libstdc++ is built
runtime linking ready (with -G option), but applications do not link using
-brtl by default.  It only helps in corner cases (like user overriding
new[] operator). 

	One can add -Wl,-brtl to GCC link line and it will work, but it is
better to avoid those semantics unless needed.

	The AIX command

$ dump -H <filename>

prints the shared library dependencies and will show if the library was
linked shared.

	Bottom line: ".a" file extension does not mean static linking.

David

  reply	other threads:[~2004-06-21 19:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-21 19:23 lrtaylor
2004-06-21 19:54 ` David Edelsohn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-08 15:24 Tan-Long Phan
2004-07-08 15:35 ` Ed Schouten
2004-06-22 14:16 Tan-Long Phan
2004-06-22 14:17 ` David Edelsohn
     [not found] <719A38AB7279D511B91900D0B7444A9E0FAF70AB@caemsx03.cae.ca>
2004-06-21 19:10 ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406211953.i5LJrqa30182@makai.watson.ibm.com \
    --to=dje@watson.ibm.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=longp@cae.com \
    --cc=lrtaylor@micron.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).