public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 3.3.2 collect2 on AIX with .so libraries
@ 2004-10-25 14:56 Albert Chin
  2004-10-25 15:13 ` David Edelsohn
  0 siblings, 1 reply; 8+ messages in thread
From: Albert Chin @ 2004-10-25 14:56 UTC (permalink / raw)
  To: gcc

[Initially posted to gcc-help but I didn't receive a response so I'm
 trying here]

I tried building libsigc++-2.0.6 (http://libsigc.sourceforge.net/) on
AIX 5.2 with GCC 3.3.2 and 3.4.2. GCC 3.4.2 worked fine. However, with
GCC 3.3.2, I ran into the following problem:
  ..
  /bin/sh ../libtool --mode=link g++  -O2 -mcpu=common
  -Wl,-blibpath:/opt/TWWfsw/gcc332r/lib -Wl,-brtl -Wl,-blibpath:/usr/lib
  -o test_trackable  test_trackable.o ../sigc++/libsigc-2.0.la 
  g++ -O2 -mcpu=common -Wl,-blibpath:/opt/TWWfsw/gcc332r/lib
  -Wl,-brtl -Wl,-blibpath:/usr/lib -o .libs/test_trackable test_trackable.o
  -L../sigc++/.libs -lsigc-2.0 -L/opt/TWWfsw/gcc332/lib -lstdc++
  -Wl,-blibpath:/opt/TWWfsw/libsigc++20/lib/gcc32:\
  /opt/TWWfsw/gcc332/lib:/opt/TWWfsw/gcc332r/lib:/usr/lib 
  ld: 0711-317 ERROR: Undefined symbol: _GLOBAL__F_signal.ccAo6sTo
  ld: 0711-317 ERROR: Undefined symbol: _GLOBAL__F_functors_slot.cccL3Cqq

Because I set LDFLAGS="-Wl,-brtl" during the ./configure state,
libtool will create a static and shared version of the libsigc++
library. The two undefined symbols, _GLOBAL__F_signal.ccAo6sTo and
_GLOBAL__F_functors_slot.cccL3Cqq, come from the static version of the
libsigc++ library, ../sigc++/.libs/libsigc-2.0.a. I thought it odd the
linker would use ../sigc++/.libs/libsigc-2.0.a rather than
../sigc++/.libs/libsigc-2.0.so. However, after adding "-v -Wl,-v" to
the final link command, I found the following:
  g++ -v -Wl,-v -O2 -mcpu=common -Wl,-blibpath:/opt/TWWfsw/gcc332r/lib
  -Wl,-brtl -Wl,-blibpath:/usr/lib -o .libs/test_trackable test_trackable.o
  -L../sigc++/.libs -lsigc-2.0 -L/opt/TWWfsw/gcc332/lib -lstdc++
  -Wl,-blibpath:/opt/TWWfsw/libsigc++20/lib/gcc32:\
  /opt/TWWfsw/gcc332/lib:/opt/TWWfsw/gcc332r/lib:/usr/lib 
  ...
  /opt/TWWfsw/gcc332/bin/g++ -x c -c -o /tmp//ccI74qdc.o -mcpu=common
  -fno-exceptions -w /tmp//ccgMXWab.c
  ...

Looking at the /tmp/ccgMXWab.c file, I see:
  extern void *x13 __asm__ ("_GLOBAL__F_signal.ccAo6sTo");
  extern void *x19 __asm__ ("_GLOBAL__F_functors_slot.cccL3Cqq");

If I change these two lines to match the corresponding entries in
../sigc++/.libs/libsigc-2.0.so:
  extern void *x13 __asm__ ("_GLOBAL__F_signal.ccKvSdiF");
  extern void *x19 __asm__ ("_GLOBAL__F_functors_slot.ccHOMFb6");
then the link step that failed above succeeds.

So, is the error because collect2 is not honoring -brtl and reading
../sigc++/.libs/libsigc-2.0.a rather than
../sigc++/.libs/libsigc-2.0.so? If so, what is the solution?

BTW, GCC 3.4.2 doesn't seem to have this problem because it never
generates the _GLOBAL__F_signal or _GLOBAL__F_functors_slot entries.
Also, the "ccKvSdiF" extension to _GLOBAL__F_signal changes at every
compilation so we cannot rely on it as a constant value.

-- 
albert chin (china@thewrittenword.com)

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 14:56 3.3.2 collect2 on AIX with .so libraries Albert Chin
@ 2004-10-25 15:13 ` David Edelsohn
  2004-10-25 15:29   ` Albert Chin
  0 siblings, 1 reply; 8+ messages in thread
From: David Edelsohn @ 2004-10-25 15:13 UTC (permalink / raw)
  To: Albert Chin; +Cc: gcc

	GCC collect2 searches for library file extension ".a" first, then
looks for library file extension ".so".

David

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 15:13 ` David Edelsohn
@ 2004-10-25 15:29   ` Albert Chin
  2004-10-25 15:30     ` David Edelsohn
  0 siblings, 1 reply; 8+ messages in thread
From: Albert Chin @ 2004-10-25 15:29 UTC (permalink / raw)
  To: gcc

On Mon, Oct 25, 2004 at 10:19:55AM -0400, David Edelsohn wrote:
> 	GCC collect2 searches for library file extension ".a" first, then
> looks for library file extension ".so".

How do I get it to prefer ".so"?

-- 
albert chin (china@thewrittenword.com)

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 15:29   ` Albert Chin
@ 2004-10-25 15:30     ` David Edelsohn
  2004-10-25 16:03       ` Albert Chin
  2004-11-28 19:26       ` Albert Chin
  0 siblings, 2 replies; 8+ messages in thread
From: David Edelsohn @ 2004-10-25 15:30 UTC (permalink / raw)
  To: Albert Chin; +Cc: gcc

>>>>> Albert Chin writes:

Albert> On Mon, Oct 25, 2004 at 10:19:55AM -0400, David Edelsohn wrote:
>> GCC collect2 searches for library file extension ".a" first, then
>> looks for library file extension ".so".

Albert> How do I get it to prefer ".so"?

	Change collect2.c libext array.

	One could change it for all situations or depend on -brtl.

David

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 15:30     ` David Edelsohn
@ 2004-10-25 16:03       ` Albert Chin
       [not found]         ` <gcc@mlists.thewrittenword.com>
  2004-10-25 17:17         ` David Edelsohn
  2004-11-28 19:26       ` Albert Chin
  1 sibling, 2 replies; 8+ messages in thread
From: Albert Chin @ 2004-10-25 16:03 UTC (permalink / raw)
  To: gcc

On Mon, Oct 25, 2004 at 10:45:56AM -0400, David Edelsohn wrote:
> >>>>> Albert Chin writes:
> 
> Albert> On Mon, Oct 25, 2004 at 10:19:55AM -0400, David Edelsohn wrote:
> >> GCC collect2 searches for library file extension ".a" first, then
> >> looks for library file extension ".so".
> 
> Albert> How do I get it to prefer ".so"?
> 
> 	Change collect2.c libext array.
> 
> 	One could change it for all situations or depend on -brtl.

Would a patch to prefer ".so" with "-brtl" be accepted? That seems
like the correct approach.

-- 
albert chin (china@thewrittenword.com)

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

* Re: 3.3.2 collect2 on AIX with .so libraries
       [not found]         ` <gcc@mlists.thewrittenword.com>
@ 2004-10-25 16:53           ` David Edelsohn
  0 siblings, 0 replies; 8+ messages in thread
From: David Edelsohn @ 2004-10-25 16:53 UTC (permalink / raw)
  To: gcc

>>>>> Albert Chin writes:

Albert> Would a patch to prefer ".so" with "-brtl" be accepted? That seems
Albert> like the correct approach.

Albert> -- 
Albert> albert chin (china@thewrittenword.com)

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 16:03       ` Albert Chin
       [not found]         ` <gcc@mlists.thewrittenword.com>
@ 2004-10-25 17:17         ` David Edelsohn
  1 sibling, 0 replies; 8+ messages in thread
From: David Edelsohn @ 2004-10-25 17:17 UTC (permalink / raw)
  To: Albert Chin; +Cc: gcc

>>>>> Albert Chin writes:

Albert> Would a patch to prefer ".so" with "-brtl" be accepted? That seems
Albert> like the correct approach.

	It depends on the details of the patch.  I already suggested the
change, so I have no objection to the concept.

David

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

* Re: 3.3.2 collect2 on AIX with .so libraries
  2004-10-25 15:30     ` David Edelsohn
  2004-10-25 16:03       ` Albert Chin
@ 2004-11-28 19:26       ` Albert Chin
  1 sibling, 0 replies; 8+ messages in thread
From: Albert Chin @ 2004-11-28 19:26 UTC (permalink / raw)
  To: gcc

On Mon, Oct 25, 2004 at 10:45:56AM -0400, David Edelsohn wrote:
> >>>>> Albert Chin writes:
> 
> Albert> On Mon, Oct 25, 2004 at 10:19:55AM -0400, David Edelsohn wrote:
> >> GCC collect2 searches for library file extension ".a" first, then
> >> looks for library file extension ".so".
> 
> Albert> How do I get it to prefer ".so"?
> 
> 	Change collect2.c libext array.
> 
> 	One could change it for all situations or depend on -brtl.

I have a working patch for GCC 3.3.x but need a little help for 3.4.x.
gcc/collect2.c for 3.4.x has:
  /* Parse command line early for instances of -debug.  This allows
     the debug flag to be set before functions like find_a_file()
     are called.  */
  {
    int i;

    for (i = 1; argv[i] != NULL; i ++)
      { 
        if (! strcmp (argv[i], "-debug"))
          debug = 1;
        COLLECT_PARSE_FLAG (argv[i]);
      }
    vflag = debug;
  }

So, I need to hook into COLLECT_PARSE_FLAG to change libexts for
-brtl. Do I define COLLECT_PARSE_FLAG() in gcc/config/rs6000/aix.h or
do I need a separate copy for gcc/config/rs6000/aix[43|51|52].h?
Looking at config.gcc, any change I make to rs6000/aix.h affects
powerpc-*-beos*, rs6000-ibm-aix*, and powerpc-ibm-aix*. I'm unsure if
my impending change to COLLECT_PARSE_FLAG will bork powerpc-*-beos* as
its linker might not honor -brtl. Although, if this target doesn't
honor -brtl, I suppose it'll never be used so I might be safe after
all.

-- 
albert chin (china@thewrittenword.com)

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

end of thread, other threads:[~2004-11-28 18:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-25 14:56 3.3.2 collect2 on AIX with .so libraries Albert Chin
2004-10-25 15:13 ` David Edelsohn
2004-10-25 15:29   ` Albert Chin
2004-10-25 15:30     ` David Edelsohn
2004-10-25 16:03       ` Albert Chin
     [not found]         ` <gcc@mlists.thewrittenword.com>
2004-10-25 16:53           ` David Edelsohn
2004-10-25 17:17         ` David Edelsohn
2004-11-28 19:26       ` Albert Chin

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