public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kstemen at centeris dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/31033]  New: Collect2 will not allow shared gcc with cross compiler
Date: Sun, 04 Mar 2007 07:53:00 -0000	[thread overview]
Message-ID: <bug-31033-14186@http.gcc.gnu.org/bugzilla/> (raw)

First off, here's what I passed to the gcc configure script:
CC=gcc
CC="$CC" CFLAGS="" CXXFLAGS="" CPPFLAGS="" ../configure --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info \
        --enable-shared --enable-threads=posix --enable-checking=release \
        --with-system-zlib --disable-libunwind-exceptions \
        --prefix=/usr --exec-prefix=/usr \
        --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc \
        --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 \
        --libexecdir=/usr/libexec --localstatedir=/var \
        --sharedstatedir=/usr/com --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --without-long-double-128 \
        --enable-languages=c \
        --host=x86_64-redhat-linux --build=x86_64-redhat-linux \
        --target=powerpc-ibm-aix5.3.0 --with-cpu=default32 \
        --with-gnu-as --with-gnu-ld --enable-libssp=no \
        --with-sysroot=/usr/powerpc-ibm-aix5.3.0/sys-root

If I try to compile hello world on the resultant compiler with the following
options, it works (and runs on AIX):
[kyle@ryoko ~]$ powerpc-ibm-aix5.3.0-gcc -c hello.c 
[kyle@ryoko ~]$ powerpc-ibm-aix5.3.0-gcc hello.o -o hello
[kyle@ryoko ~]$ ls -l hello
-rwxrwxr-x 1 kyle kyle 282114 Mar  3 23:41 hello

Howerver, if I try to compile it with a shared libgcc, it fails:
[kyle@ryoko ~]$ powerpc-ibm-aix5.3.0-gcc -c hello.c 
[kyle@ryoko ~]$ powerpc-ibm-aix5.3.0-gcc -shared-libgcc hello.o -o hello
collect2: init function found in object
/usr/lib64/gcc/powerpc-ibm-aix5.3.0/4.1.1/../../../../powerpc-ibm-aix5.3.0/lib/libgcc_s.a

I have tracked the error message down to the collect2 program. It comes from
collect2.c. Collect2 will run nm on all of the libraries. If it finds a symbol
that starts with "GLOBAL__FI_", it will report that error, but only if collect2
is built as a cross compiler.

This shows that the native gcc in the AIX Toolbox works despite the same
export:
[kyle@ryoko ~]$ powerpc-ibm-aix5.3.0-nm
/usr/lib64/gcc/powerpc-ibm-aix5.3.0/4.1.1/../../../../powerpc-ibm-aix5.3.0/lib/libgcc_s.a
| grep GLOBAL__FI_
0000000010000238 T ._GLOBAL__FI_shr_o
0000000020000ae8 d _GLOBAL__FI_shr_o
0000000020000ae8 D _GLOBAL__FI_shr_o
[kyle@ryoko ~]$ scp hello.o testuser@aix64build:
testuser@localhost's password: 
hello.o                                       100% 1040     1.0KB/s   00:00    
[testuser@aix64build ~]$ nm
/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/libgcc_s.a | grep
GLOBAL__FI_
._GLOBAL__FI_shr_o   T   268463976
_GLOBAL__FI_shr_o    D   536873824
_GLOBAL__FI_shr_o    d   536873824          12
[testuser@aix64build ~]$ gcc -shared-libgcc hello.o -o hello
[testuser@aix64build ~]$ ls -l hello
-rwxr-xr-x   1 testuser staff         17487 Mar 03 23:49 hello


-- 
           Summary: Collect2 will not allow shared gcc with cross compiler
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kstemen at centeris dot com
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: powerpc-ibm-aix5.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31033


             reply	other threads:[~2007-03-04  7:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04  7:53 kstemen at centeris dot com [this message]
2007-03-20 21:40 ` [Bug c/31033] " dje at gcc dot gnu dot org
2007-03-20 21:48 ` kstemen at centeris dot com
2007-03-20 21:59 ` [Bug other/31033] " pinskia at gcc dot gnu dot org
2007-03-20 22:10 ` kstemen at centeris dot com
2007-03-20 22:15 ` pinskia at gcc dot gnu dot org
2007-03-20 22:19 ` kstemen at centeris dot com
2007-03-20 22:41 ` dje at gcc dot gnu dot org
2007-03-21 15:50 ` dje at gcc dot gnu dot org

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=bug-31033-14186@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).