This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Problems linking c++ statically on AIX using gcc 3.2


Hello,

> -----Original Message-----
> From: David Edelsohn [mailto:dje@watson.ibm.com]

Thanks for the reply.

> 	First, try this without GNU binutils.
>
> 	Second, read the target/host specific installation
> notes for AIX:
>
> "The GNU Assembler incorrectly reports that it supports WEAK
> symbols on
> AIX which causes GCC to try to utilize weak symbol
> functionality which is
> not really supported on the platform. The native as and ld still are
> recommended. The native AIX tools do interoperate with GCC."


I am aware of the recommandation of native binutils, but was trying gnu
binutils to avoid the following problem:


bash-2.05$ cat testlib.cpp

void functionintestlib()
{
}

bash-2.05$ cat testlibunused.cpp

void undefinedfunction();

void unusedfunction()
{
undefinedfunction();
}

bash-2.05$ cat test.cpp

void functionintestlib();

int main()
{
functionintestlib();
}

bash-2.05$ g++ -c testlib.cpp -o testlib.o
bash-2.05$ g++ -c testlibunused.cpp -o testlibunused.o
bash-2.05$ ar rc testlib.a testlib.o testlibunused.o
bash-2.05$ g++ -c test.cpp -o test.o
bash-2.05$ g++ test.o testlib.a -o test
ld: 0711-317 ERROR: Undefined symbol: .undefinedfunction()
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
collect2: ld returned 8 exit status
bash-2.05$


Removing testlibunused from the archive is not an option.

The example works on HP, Sun and Linux, but not on AIX.

How do I link the example on AIX? Is it possible?


/Mads


> -----Original Message-----
> From: David Edelsohn [mailto:dje@watson.ibm.com]
> Sent: Thursday, September 05, 2002 6:24 PM
> To: Mads
> Cc: gcc@gcc.gnu.org
> Subject: Re: Problems linking c++ statically on AIX using gcc 3.2
>
>
> >>>>> Mads  writes:
>
> Mads> and binutils 2.13 (ld & as)
>
> Mads> Linking on AIX is tricky. But using gnu ld it shouldn't
> be THAT tricky?
>
> Mads> Can anyone give me a hint to what the problem (or the
> solution) is?
>
> 	First, try this without GNU binutils.
>
> 	Second, read the target/host specific installation
> notes for AIX:
>
> "The GNU Assembler incorrectly reports that it supports WEAK
> symbols on
> AIX which causes GCC to try to utilize weak symbol
> functionality which is
> not really supported on the platform. The native as and ld still are
> recommended. The native AIX tools do interoperate with GCC."
>
> David
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]