Compile SPEC2006 with clang-3.2, multi definition errors.

When compile 403.gcc, there are link errors.

  1. environment
    1.1) OS

Linux gnode107 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

1.2) The default GCC compiler is
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.2) The compiler I used to build clang/llvm

gcc (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.3) /usr/bin/ld

GNU ld version 2.17.50.0.6-9.el5 20061020
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.

2. errors when link

/tmp/concat-yeQL2V.o: In function gnu_dev_major': /usr/include/sys/sysmacros.h:44: multiple definition of gnu_dev_major’
/tmp/alloca-YSgYzY.o:/usr/include/sys/sysmacros.h:44: first defined here
/tmp/concat-yeQL2V.o: In function gnu_dev_makedev': /usr/include/sys/sysmacros.h:56: multiple definition of gnu_dev_makedev’
/tmp/alloca-YSgYzY.o:/usr/include/sys/sysmacros.h:56: first defined here
/tmp/concat-yeQL2V.o: In function gnu_dev_minor': /usr/include/sys/sysmacros.h:50: multiple definition of gnu_dev_minor’
/tmp/alloca-YSgYzY.o:/usr/include/sys/sysmacros.h:50: first defined here

/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 25.

/tmp/getpwd-UxjZIi.o: In function fstat': /usr/include/sys/stat.h:449: multiple definition of fstat’
/tmp/c-parse-7tFGiF.o:/usr/include/sys/stat.h:449: first defined here
/tmp/getpwd-UxjZIi.o: In function fstat64': /usr/include/sys/stat.h:498: multiple definition of fstat64’
/tmp/c-parse-7tFGiF.o:/usr/include/sys/stat.h:498: first defined here
/tmp/getpwd-UxjZIi.o: In function `fstatat’:

2.1 ) the link commands details

clang -g -DSPEC_CPU -DNDEBUG -DSPEC_CPU_LP64 -I. -DHTYU -DSPEC_CPU_LINUX alloca.bc asprintf.bc vasprintf.bc c-parse.bc c-lang.bc attribs.bc c-errors.bc c-le
x.bc c-pragma.bc c-decl.bc c-typeck.bc c-convert.bc c-aux-info.bc c-common.bc c-format.bc c-semantics.bc c-objc-common.bc main.bc cpplib.bc cpplex.bc cppmacr
o.bc cppexp.bc cppfiles.bc cpphash.bc cpperror.bc cppinit.bc cppdefault.bc line-map.bc mkdeps.bc prefix.bc version.bc mbchar.bc alias.bc bb-reorder.bc bitmap
.bc builtins.bc caller-save.bc calls.bc cfg.bc cfganal.bc cfgbuild.bc cfgcleanup.bc cfglayout.bc cfgloop.bc cfgrtl.bc combine.bc conflict.bc convert.bc cse.b
c cselib.bc dbxout.bc debug.bc dependence.bc df.bc diagnostic.bc doloop.bc dominance.bc dwarf2asm.bc dwarf2out.bc dwarfout.bc emit-rtl.bc except.bc explow.bc
expmed.bc expr.bc final.bc flow.bc fold-const.bc function.bc gcse.bc genrtl.bc ggc-common.bc global.bc graph.bc haifa-sched.bc hash.bc hashtable.bc hooks.bc
ifcvt.bc insn-attrtab.bc insn-emit.bc insn-extract.bc insn-opinit.bc insn-output.bc insn-peep.bc insn-recog.bc integrate.bc intl.bc jump.bc langhooks.bc lcm
.bc lists.bc local-alloc.bc loop.bc obstack.bc optabs.bc params.bc predict.bc print-rtl.bc print-tree.bc profile.bc real.bc recog.bc reg-stack.bc regclass.bc
regmove.bc regrename.bc reload.bc reload1.bc reorg.bc resource.bc rtl.bc rtlanal.bc rtl-error.bc sbitmap.bc sched-deps.bc sched-ebb.bc sched-rgn.bc sched-vi
s.bc sdbout.bc sibcall.bc simplify-rtx.bc ssa.bc ssa-ccp.bc ssa-dce.bc stmt.bc stor-layout.bc stringpool.bc timevar.bc toplev.bc tree.bc tree-dump.bc tree-in
line.bc unroll.bc varasm.bc varray.bc vmsdbgout.bc xcoffout.bc ggc-page.bc i386.bc xmalloc.bc xexit.bc hashtab.bc safe-ctype.bc splay-tree.bc xstrdup.bc md5.
bc fibheap.bc xstrerror.bc concat.bc partition.bc hex.bc lbasename.bc getpwd.bc ucbqsort.bc -lm -o gcc-llvm

I tried to add -std=gnu89, but it did not work.

These errors are absolutely gnu89 related.

If you test with libc++ you'll hit an issue with GAMESS. I have an
outstanding patch and src.alt which I need to get off my butt and get
approved. (I'll try to get that formalized this week or next)

I don't know about that particular version of binutils, but I'd
strongly recommend manually installing 2.25.

As of this week I'm officially participating in SPEC CPU work. Part of
that role is testing the upcoming benchmark "v6" on systems and
compilers which others may not have tested yet. I hadn't planned to
test vanilla clang, but if there's interest let me know. (On or off
list is fine)

(Sorry - I don't mean to hijack this thread. Just want to help with
SPEC related things if I can)

yes,I install the 2.20 version LD, it works now.

Best Regards!
Eric Lew