public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Edelsohn <dje@watson.ibm.com>
To: pooh@msu.ru
Cc: egcs@cygnus.com
Subject: Re: egcs on AIX: native or gnu ld?
Date: Sun, 19 Oct 1997 14:52:00 -0000	[thread overview]
Message-ID: <9710192145.AA33534@rios1.watson.ibm.com> (raw)
In-Reply-To: <34492834.BA7DDDC4@msu.ru>

>>>>> Andrey Slepuhin writes:

Andrey> ld: 0711-319 WARNING: Exported symbol not defined: _GLOBAL_.I.f__Fv
Andrey> ld: 0711-318 ERROR: Undefined symbols were found.
Andrey> _GLOBAL_.I.f__Fv          [2]     ER DS ccMav3Ma.c(/tmp/ccMav3Ma.o)

	I think that this is an individual constructor.

Andrey> Manually relinking files once more I obtain correct exexutable (If extra pass
Andrey> is needed why not to do it automatically?). Unfortunately, -frepo option is
Andrey> bad documented :-(

	XLC has a twolink option performs the link phase twice.  This
allows the IBM garbage-collecting linker to perform a pass and then
re-examine the global symbols needing export.  This frequently is useful
for static contructors.  What may happen is that the initial examination
recognizes the symbol as a candidate for export but the linker discovers
that the symbol is not referenced and removes it altogether which then
causes an error because the original pass included it in the list of
exports.  The two-pass version only exports those symbols present after
symbol garbage-collection.

>> The _GLOBAL__DI/_GLOBAL_DD symbols invoke the global constructors
>> and destructors for a shared object and are exported for AIX.  Because
>> each shared object will contain those same entry points, they will be
>> duplicated and the AIX linker will warn about them.  In AIX 4, the linker
>> now announced a lot more warnings about these type of issues which always
>> were produced by GCC.

Andrey> Well, I undestand this, but if I link my program with several shared objects,
Andrey> can I be sure that global constructors/destructors code will be called for
Andrey> each object?

	These GLOBAL__DI/DD symbols exist for each library.  collect2 and
gnu ld collect all of the static constructors to be run at program startup
-- both symbols within the program and symbols within any libraries.  The
GLOBAL__DI/DD symbols are present and duplicated in the executable because
they are present in each library as a defining instance, but they never
are referenced because collect2 has created a separate list of all of the
constructor symbols for the executable.

	Wilfried Philips and someone from IBM Austin previously posted
makeC++SharedLib-like scripts to create an export file.  I do not know if
you can use it (appended) combined with your own hacks and any necessary
multiple link phases automation to create a single patch for improved
shared library support by GCC/EGCS that you would like to submit for
inclusion in future releases.

David

----- Begin Included Text -----

From: Wilfried Philips <philips@ibmmbv2.elis.rug.ac.be>
Newsgroups: comp.unix.aix
Subject: Re: Dynamic Loading...
Date: 17 Feb 1997 18:40:40 +0100
Organization: ELIS-RUG (University of Gent, Belgium)

%%%%%%%%%%%mkexps%%%%%%%%%%%%%%%%%%%%%%
#!/bin/ksh
#
# mkexps - make export list
# This program creates an export list by combining all the "." and normal names
# into one list.
#
if [[ "$#" -ne 1 ]]
then
    print "Usage: mkexps ArchiveFile"
    exit -2
fi
if [[ ! -f $1 ]]
then
    print "mkexps: Cannot open file \"$1\""
    exit -1
fi

dump -g $1 | awk '
BEGIN {
        top = 1
}
/^[ ]*[0-9][0-9]*/ {
    if ( (n = index( $2, "." )) > 0 ) {
        export_array[ top++ ] = substr( $2, n+1, length( $2 ))
    }
    else {
	export_array[ top++ ] = $2
    }
}

END {
    for ( i = 1; i < top; i++ )
    {
	print export_array[ i ]
    }

}' | sort | uniq

%%%%%%%%%%%mkexps%%%%%%%%%%%%%%%%%%%%%%

*** OR ***

From: dosha@austin.ibm.com
Subject: Re: Dynamic Loading...
Date: Thu, 20 Feb 1997 17:30:29 -0600
Organization: IBM Austin

Try the following:

nm libtest.a | grep ' [BAD] ' | cut -f1 -d ' '  > test.exp

----- End Incuded Text -----
===============================================================================
David Edelsohn                                      T.J. Watson Research Center
dje@watson.ibm.com                                  P.O. Box 218
+1 914 945 4364 (TL 862)                            Yorktown Heights, NY 10598

  reply	other threads:[~1997-10-19 14:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-17  3:12 Andrey Slepuhin
1997-10-17 19:31 ` David Edelsohn
1997-10-18 12:56   ` Joe Buck
1997-10-18 16:18     ` David Edelsohn
1997-10-18 13:24   ` Andrey Slepuhin
1997-10-19 14:52     ` David Edelsohn [this message]
1997-10-20  2:42       ` Andrey Slepuhin
1997-10-20 10:49         ` David Edelsohn
1997-10-20  5:58       ` Andrey Slepuhin
1997-10-20  6:51       ` Andrey Slepuhin
1997-10-20 14:37 Mike Stump
1997-10-20 18:12 ` David Edelsohn
1997-10-20 18:12 Mike Stump

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=9710192145.AA33534@rios1.watson.ibm.com \
    --to=dje@watson.ibm.com \
    --cc=egcs@cygnus.com \
    --cc=pooh@msu.ru \
    /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).