This is the mail archive of the gcc-patches@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: [PATCH] fix PR ada/42554 by dropping -c from ranlib on darwin10 and later


On Thu, Feb 04, 2010 at 03:21:51PM +0100, Tristan Gingold wrote:
> 
> > If so, we should definitely keep pushing Apple to
> > fix radar 6320843.
> 
> It is possible to read the content of this radar issue ?

Tristan,
   My original report was...

----------------------------------------------------------

26-Oct-2008 09:43 AM Jack Howarth:
Xcode 3.2 fails to link cc1plus-dummy from gcc 4.3.2 due to a reappearance of radar 5808800//5779681 which appeared and was fixed during the Xcode 3.1 development cycle. The bug causes the following link failure while building FSF gcc 4.3.2...

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

To reproduce this bug...
1) Install XXXXXX and Xcode 3.2.
2) Launch the Terminal application and execute "tar -zxvf ld_bug_1.tar.gz' to extract the attached test case.
3) Execute the  "bad_link_command" script in the ld_bug_1 directory to execute ld in the same fashion as during the gcc build.

I expected the link command to complete with the bad_link_command script (which is how gcc actually has ld do the linkage). The same test case and files links fine with both the bad_link_command and good_link_command scripts under 10.5.5 and Xcode 3.1.1.

The link in ld fails with the error message...

ld: duplicate symbol _init_inline_once in libbackend.a(tree-inline.o) and tree-inline.o
collect2: ld returned 1 exit status

This is exactly the same bug as radar 5808800//5779681 which appeared and was fixed during the Xcode 3.1 development cycle

There is no workaround. The linker is not properly ignoring duplicate symbols from static libraries. This is a serious regression in Xcode 3.2. One can force the linkage using the good_link_command script which removes the object file with the duplicate symbol but this should not be required for a unix linker.


'ld_bug_1.tar.gz' and 'MacBook Pro 17' were successfully uploaded

06-Nov-2008 08:20 PM Jack Howarth:
The commands used by FSF gcc 4.3.2 to create libbackend.a are as follows...

rm -rf libbackend.a
ar rc libbackend.a insn-attrtab.o insn-automata.o insn-emit.o insn-extract.o insn-modes.o insn-opinit.o insn-output.o insn-peep.o insn-preds.o insn-recog.o ggc-page.o alias.o alloc-pool.o auto-inc-dec.o bb-reorder.o bitmap.o bt-load.o builtins.o caller-save.o calls.o cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfgexpand.o cfghooks.o cfglayout.o cfgloop.o cfgloopanal.o cfgloopmanip.o cfgrtl.o combine.o combine-stack-adj.o convert.o coverage.o cse.o cselib.o dbxout.o dbgcnt.o dce.o ddg.o debug.o df-core.o df-problems.o df-scan.o dfp.o diagnostic.o dojump.o dominance.o domwalk.o double-int.o dse.o dwarf2asm.o dwarf2out.o ebitmap.o emit-rtl.o et-forest.o except.o explow.o expmed.o expr.o final.o fixed-value.o fold-const.o function.o fwprop.o gcse.o genrtl.o ggc-common.o gimple-low.o gimplify.o global.o graph.o graphds.o gtype-desc.o haifa-sched.o hooks.o ifcvt.o init-regs.o integrate.o intl.o jump.o lambda-code.o lambda-mat.o lambda-trans.o langhooks.o lcm.o lists.o local-alloc.o loop-doloop.o loop-init.o loop-invariant.o loop-iv.o loop-unroll.o loop-unswitch.o lower-subreg.o mode-switching.o modulo-sched.o omega.o omp-low.o optabs.o options.o opts-common.o opts.o params.o passes.o pointer-set.o postreload-gcse.o postreload.o predict.o pretty-print.o print-rtl.o print-tree.o profile.o ra-conflict.o real.o recog.o reg-stack.o regclass.o regmove.o regrename.o regstat.o reload.o reload1.o reorg.o resource.o rtl-error.o rtl-factoring.o rtl.o rtlanal.o rtlhooks.o sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o see.o simplify-rtx.o sparseset.o sreal.o stack-ptr-mod.o stmt.o stor-layout.o stringpool.o struct-equiv.o targhooks.o timevar.o toplev.o tracer.o tree-affine.o tree-cfg.o tree-cfgcleanup.o tree-chrec.o tree-complex.o tree-data-ref.o tree-dfa.o tree-dump.o tree-eh.o tree-gimple.o tree-if-conv.o tree-into-ssa.o tree-iterator.o tree-loop-linear.o tree-nested.o tree-nrv.o tree-object-size.o tree-optimize.o tree-outof-ssa.o tree-parloops.o tree-phinodes.o tree-predcom.o tree-pretty-print.o tree-profile.o tree-scalar-evolution.o tree-sra.o tree-ssa-address.o tree-ssa-alias.o tree-ssa-alias-warnings.o tree-ssa-ccp.o tree-ssa-coalesce.o tree-ssa-copy.o tree-ssa-copyrename.o tree-ssa-dce.o tree-ssa-dom.o tree-ssa-dse.o tree-ssa-forwprop.o tree-ssa-ifcombine.o tree-ssa-live.o tree-ssa-loop-ch.o tree-ssa-loop-im.o tree-ssa-loop-ivcanon.o tree-ssa-loop-ivopts.o tree-ssa-loop-manip.o tree-ssa-loop-niter.o tree-ssa-loop-prefetch.o tree-ssa-loop-unswitch.o tree-ssa-loop.o tree-ssa-math-opts.o tree-ssa-operands.o tree-ssa-phiopt.o tree-ssa-pre.o tree-ssa-propagate.o tree-ssa-reassoc.o tree-ssa-sccvn.o tree-ssa-sink.o tree-ssa-structalias.o tree-ssa-ter.o tree-ssa-threadedge.o tree-ssa-threadupdate.o tree-ssa-uncprop.o tree-ssa.o tree-ssanames.o tree-stdarg.o tree-tailcall.o tree-vect-analyze.o tree-vect-generic.o tree-vect-patterns.o tree-vect-transform.o tree-vectorizer.o tree-vn.o tree-vrp.o tree.o value-prof.o var-tracking.o varasm.o varray.o vec.o version.o vmsdbgout.o web.o xcoffout.o i386.o darwin.o host-darwin.o host-i386-darwin.o cgraph.o cgraphbuild.o cgraphunit.o ipa-cp.o ipa-inline.o ipa-prop.o ipa-pure-const.o ipa-reference.o ipa-struct-reorg.o ipa-type-escape.o ipa-utils.o ipa.o matrix-reorg.o tree-inline.o tree-nomudflap.o varpool.o
ranlib: file: libbackend.a(insn-peep.o) has no symbols
ranlib: file: libbackend.a(loop-doloop.o) has no symbols
ranlib: file: libbackend.a(vmsdbgout.o) has no symbols
ranlib: file: libbackend.a(xcoffout.o) has no symbols
ranlib -c libbackend.a
ranlib: file: libbackend.a(insn-peep.o) has no symbols
ranlib: file: libbackend.a(loop-doloop.o) has no symbols
ranlib: file: libbackend.a(vmsdbgout.o) has no symbols
ranlib: file: libbackend.a(xcoffout.o) has no symbols

These appear to be almost identical to those used by current FSF gcc trunk (4.4.0) to create libbackend.a...

rm -rf libbackend.a
ar rc libbackend.a insn-attrtab.o insn-automata.o insn-emit.o insn-extract.o insn-modes.o insn-opinit.o insn-output.o insn-peep.o insn-preds.o insn-recog.o ggc-page.o alias.o alloc-pool.o auto-inc-dec.o bb-reorder.o bitmap.o bt-load.o builtins.o caller-save.o calls.o cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfgexpand.o cfghooks.o cfglayout.o cfgloop.o cfgloopanal.o cfgloopmanip.o cfgrtl.o combine.o combine-stack-adj.o convert.o coverage.o cse.o cselib.o dbxout.o dbgcnt.o dce.o ddg.o debug.o df-byte-scan.o df-core.o df-problems.o df-scan.o dfp.o diagnostic.o dojump.o dominance.o domwalk.o double-int.o dse.o dwarf2asm.o dwarf2out.o ebitmap.o emit-rtl.o et-forest.o except.o explow.o expmed.o expr.o final.o fixed-value.o fold-const.o function.o fwprop.o gcse.o genrtl.o ggc-common.o gimple.o gimple-iterator.o gimple-low.o gimple-pretty-print.o gimplify.o global.o graph.o graphds.o graphite.o gtype-desc.o haifa-sched.o hooks.o ifcvt.o init-regs.o integrate.o intl.o ira.o ira-build.o ira-costs.o ira-conflicts.o ira-color.o ira-emit.o ira-lives.o jump.o lambda-code.o lambda-mat.o lambda-trans.o langhooks.o lcm.o lists.o local-alloc.o loop-doloop.o loop-init.o loop-invariant.o loop-iv.o loop-unroll.o loop-unswitch.o lower-subreg.o mcf.o mode-switching.o modulo-sched.o omega.o omp-low.o optabs.o options.o opts-common.o opts.o params.o passes.o pointer-set.o postreload-gcse.o postreload.o predict.o pretty-print.o print-rtl.o print-tree.o profile.o ra-conflict.o real.o recog.o reg-stack.o regclass.o regmove.o regrename.o regstat.o reload.o reload1.o reorg.o resource.o rtl-error.o rtl-factoring.o rtl.o rtlanal.o rtlhooks.o sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o see.o sel-sched-ir.o sel-sched-dump.o sel-sched.o simplify-rtx.o sparseset.o sreal.o stack-ptr-mod.o statistics.o stmt.o stor-layout.o stringpool.o targhooks.o timevar.o toplev.o tracer.o tree-affine.o tree-call-cdce.o tree-cfg.o tree-cfgcleanup.o tree-chrec.o tree-complex.o tree-data-ref.o tree-dfa.o tree-dump.o tree-eh.o tree-if-conv.o tree-into-ssa.o tree-iterator.o tree-loop-distribution.o tree-loop-linear.o tree-nested.o tree-nrv.o tree-object-size.o tree-optimize.o tree-outof-ssa.o tree-parloops.o tree-phinodes.o tree-predcom.o tree-pretty-print.o tree-profile.o tree-scalar-evolution.o tree-sra.o tree-switch-conversion.o tree-ssa-address.o tree-ssa-alias.o tree-ssa-alias-warnings.o tree-ssa-ccp.o tree-ssa-coalesce.o tree-ssa-copy.o tree-ssa-copyrename.o tree-ssa-dce.o tree-ssa-dom.o tree-ssa-dse.o tree-ssa-forwprop.o tree-ssa-ifcombine.o tree-ssa-live.o tree-ssa-loop-ch.o tree-ssa-loop-im.o tree-ssa-loop-ivcanon.o tree-ssa-loop-ivopts.o tree-ssa-loop-manip.o tree-ssa-loop-niter.o tree-ssa-loop-prefetch.o tree-ssa-loop-unswitch.o tree-ssa-loop.o tree-ssa-math-opts.o tree-ssa-operands.o tree-ssa-phiopt.o tree-ssa-phiprop.o tree-ssa-pre.o tree-ssa-propagate.o tree-ssa-reassoc.o tree-ssa-sccvn.o tree-ssa-sink.o tree-ssa-structalias.o tree-ssa-ter.o tree-ssa-threadedge.o tree-ssa-threadupdate.o tree-ssa-uncprop.o tree-ssa.o tree-ssanames.o tree-stdarg.o tree-tailcall.o tree-vect-analyze.o tree-vect-generic.o tree-vect-patterns.o tree-vect-transform.o tree-vectorizer.o tree-vrp.o tree.o value-prof.o var-tracking.o varasm.o varray.o vec.o version.o vmsdbgout.o web.o xcoffout.o i386.o darwin.o host-darwin.o host-i386-darwin.o cgraph.o cgraphbuild.o cgraphunit.o cppdefault.o incpath.o ipa-cp.o ipa-inline.o ipa-prop.o ipa-pure-const.o ipa-reference.o ipa-struct-reorg.o ipa-type-escape.o ipa-utils.o ipa.o matrix-reorg.o prefix.o tree-inline.o tree-nomudflap.o varpool.o
ranlib: file: libbackend.a(insn-peep.o) has no symbols
ranlib: file: libbackend.a(loop-doloop.o) has no symbols
ranlib: file: libbackend.a(vmsdbgout.o) has no symbols
ranlib: file: libbackend.a(xcoffout.o) has no symbols
ranlib -c libbackend.a
ranlib: file: libbackend.a(insn-peep.o) has no symbols
ranlib: file: libbackend.a(loop-doloop.o) has no symbols
ranlib: file: libbackend.a(vmsdbgout.o) has no symbols
ranlib: file: libbackend.a(xcoffout.o) has no symbols
 
Oddly this bug doesn't effect gcc trunk so the it can go latent. My understanding is that this bug,
radar 5613343, was fixed in Xcode 3.1 but has been backed out for Xcode 3.2 because it broke something
else. A proper fix should be reintroduced for Xcode 3.2 since lots of Makefiles out there may expect
'ranlib -c' to work properly.

--------------------------------------------------------

Apple's response was...

-------------------------------------------------------
06-Nov-2008 02:04 PM KIT CHEUNG :
Engineering has requested the following information in order to further investigate this issue:
 
How was libbackend.a created?  Its table of contents is wrong because it contains entries for tentative definitions.  

We ran ranlib on libbackend.a then bad_link_command succeeded.  

If you run:
   ranlib -c libbackend.a
then bad_link_command fails again.   

So my guess is that the build used the -c option when creating libbackend.a.  Is there a reason for this? 

Darwin static archives traditionally do not have common symbols in there table of contents.  The -c option forces common symbols into the table of contents and causes this problem.
-------------------------------------------------------

There is nothing further on that radar but it is still open.
Keep in mind that these linkage failures are rare so if you
can provide Apple with any additional stand-alone examples
on radar it would help. I used '-v' to deduce the link
command being used for ld and provided them with a directory
with all of those binaries in the linkage and a shell script
to reproduce the linkage failure.
              Jack


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