This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: PR41180 - Fix bootstrap on Darwin10
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mrs at apple dot com
- Date: Fri, 28 Aug 2009 19:37:47 -0400
- Subject: [PATCH]: PR41180 - Fix bootstrap on Darwin10
Both gcc 4.4.1 and gcc trunk fail to compile on *-apple-darwin10
with its Xcode 3.2 due to a linker bug (radar 6320843 - duplicate symbols
from static libraries not properly ignored). Apple's response was...
> Darwin static archives traditionally do not have common in their
> table of contents. The -c option (in ranlib) forces common symbols into
> the table of contents and causes this problem.
While we could remove the -c from the ranlib command on darwin10 which
causes the linkage against the resulting libbackend.a to fail...
gcc -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -o cc1plus-dummy \
cp/cp-lang.o stub-objc.o cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o tree-mudflap.o attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o darwin-c.o c-pretty-print.o c-opts.o c-pch.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o c-gimplify.o c-omp.o tree-inline.o dummy-checksum.o main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -lintl -L/sw/lib -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/sw/lib -lmpfr -lgmp
ld: duplicate symbol _init_inline_once in libbackend.a(tree-inline.o) and tree-inline.o
collect2: ld returned 1 exit status
make: *** [cc1plus-dummy] Error 1
...the easier fix is to remove the redundant object files from the linkage of
cc1plus-dummy. The attached patch implements this approach and builds gcc 4.4.1
and gcc trunk without regressions on *-apple-darwin9 and *-apple-darwin10.
Okay for gcc trunk and gcc-4_4-branch for gcc 4.4.2?
Jack
2009-08-28 Jack Howarth <howarth@bromo.med.uc.edu>
PR bootstrap/41180
* gcc/cp/Make-lang.in: Remove redundant code from linkage for darwin10.
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in (revision 151195)
+++ gcc/cp/Make-lang.in (working copy)
@@ -73,8 +73,8 @@
# Shared with C front end:
CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
- incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
- c-gimplify.o c-omp.o tree-inline.o
+ incpath.o c-ppoutput.o c-cppbuiltin.o prefix.o \
+ c-gimplify.o c-omp.o
# Language-specific object files for C++ and Objective C++.
CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \