Bug 27408 - [4.2 Regression] g++ -force_flat_namespace fails due to crt3.o multiply defined symbols
Summary: [4.2 Regression] g++ -force_flat_namespace fails due to crt3.o multiply defin...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 major
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-03 13:49 UTC by Peter O'Gorman
Modified: 2006-05-23 21:21 UTC (History)
2 users (show)

See Also:
Host:
Target: *-*-darwin8*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter O'Gorman 2006-05-03 13:49:32 UTC
03-May-2006 12:37 PM Peter O'Gorman:
g++ -force_flat_namespace dies with multiple definition of symbols in libSystem and crt3.o on Mac OS X 10.4.

peter$ /opt/gcc_mainline/bin/g++ -force_flat_namespace -o foo foo.cpp
/opt/odcctools/bin/ld: multiple definitions of symbol _atexit
/opt/gcc_mainline/lib/gcc/powerpc-apple-darwin8.6.0/4.2.0/crt3.o private external definition of _atexit in section (__TEXT,__text)
/usr/lib/libSystem.dylib(atexit.So) definition of _atexit
/opt/odcctools/bin/ld: multiple definitions of symbol ___cxa_atexit
/opt/gcc_mainline/lib/gcc/powerpc-apple-darwin8.6.0/4.2.0/crt3.o private external definition of ___cxa_atexit in section (__TEXT,__text)
/usr/lib/libSystem.dylib(atexit.So) definition of ___cxa_atexit
collect2: ld returned 1 exit status

I expected the link to succeed. This bug is also an Apple radar - rdar://problem/4535166

Peter
Comment 1 Geoff Keating 2006-05-03 17:12:26 UTC
If fixed, this will be fixed in the Darwin linker.  In the meantime, don't use -force_flat_namespace.  In fact, it's probably better if you don't use it at all; the system libraries aren't expecting it and this is just one of many possible problems.
Comment 2 Andrew Pinski 2006-05-03 23:34:19 UTC
Can we then have a new cctools which includes a newer ld64 also since right now powerpc-darwin is broken on a G5 without using --disable-multilib.
Comment 3 Geoff Keating 2006-05-23 21:21:57 UTC
(In reply to comment #2)
> Can we then have a new cctools which includes a newer ld64 also since right now
> powerpc-darwin is broken on a G5 without using --disable-multilib.

This specific problem should be resolved with Xcode 2.3, just released.  However -force_flat_namespace still doesn't work.