public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Frank.Seehase@pdv-FS.de
To: gcc-help@gcc.gnu.org
Subject: Link Problems with gcc/g++ 3.1 on AIX 4.3.3
Date: Mon, 22 Jul 2002 05:25:00 -0000	[thread overview]
Message-ID: <E8CDBCCCB3158347AC15ADEBFB24A84F0A8E2E@fsexchng.pdv-Online.de> (raw)


Hi, I got a problem:

When linking an executable, not referenced objects 
from libraries are pulled in, maybe due to static 
objects initialization code, even if there is no C++ code.

The garbarge collection of the AIX Linker seem to fail.
If the code is compiled as .c (not .cc) files with gcc 
(not g++) there is no problem.

AIX 4.3.3 ML 10
Configured with: ../configure --prefix=/tools/pkg/gcc/3.1 --disable-threads
Thread model: aix

> g++ -v
Reading specs from
/tools/pkg/gcc/3.1/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.1/specs
Configured with: ../configure --prefix=/tools/pkg/gcc/3.1 --disable-threads
Thread model: aix
gcc version 3.1

> ar -V
GNU ar 2.12.1


Example follows. The symbol fct3 is missing even fct2 is unused.

> g++ -Wall -c -o fct1.o fct1.cc> g++ -Wall -c -o fct2.o fct2.cc
> g++ -Wall -c -o main.o main.cc> ar -rv libTst.a fct1.o fct2.o
> g++ -Wall -o main main.o libTst.a 
or
> g++ -Wall -o main main.o -L. -lTst


The sources:

/* ---------------------------------- */
/* --- fct2.cc --- */
void fct3( void );

void fct2( void )
{
  fct3( );
}


/* --- fct1.cc --- */
void fct1( void )
{
}


/* --- main.cc --- */
void fct1( void );

int main( void )
{
  fct1( );
  return 0;
}

/* ---------------------------------- */

Whats wrong?
Any idea?

Thanks, Frank
  

                 reply	other threads:[~2002-07-22 12:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E8CDBCCCB3158347AC15ADEBFB24A84F0A8E2E@fsexchng.pdv-Online.de \
    --to=frank.seehase@pdv-fs.de \
    --cc=gcc-help@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).