llvm-gcc fortran bootstrap broken

On x86-64 linux, in stage 2, I get:

c++ -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -o f951 \
                fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o fortran/error.o fortran/expr.o fortran/interface.o fortran/intrinsic.o fortran/io.o fortran/iresolve.o fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o fortran/symbol.o fortran/convert.o fortran/dependency.o fortran/f95-lang.o fortran/trans.o fortran/trans-array.o fortran/trans-common.o fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o fortran/trans-stmt.o fortran/trans-types.o llvm-main.o tree-browser.o libbackend.a ../libcpp/libcpp.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMBitReader.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMipo.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMBitWriter.a /home/duncan/LLVM/llvm-objects/Debug/lib/LLVMX86.o /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMSelectionDAG.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMCodeGen.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMScalarOpts.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMTransformUtils.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMipa.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMAnalysis.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMTarget.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMCore.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMSupport.a /home/duncan/LLVM/llvm-objects/Debug/lib/libLLVMSystem.a attribs.o stub-objc.o stub-c.o -lmpfr -lgmp ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/home/duncan/LLVM/llvm-objects/Debug/lib -lpthread -ldl -lm
libbackend.a(dwarf2out.o): In function `add_type_attribute':
(.text+0x1ffb3): undefined reference to `invoke_impl_ptr_type'
libbackend.a(llvm-backend.o): In function `createOptimizationPasses':
/home/duncan/LLVM/gcc-4.2.llvm-objects/gcc/../../gcc-4.2.llvm/gcc/llvm-backend.cpp:384: undefined reference to `flag_no_builtin'

Duncan.

libbackend.a(dwarf2out.o): In function `add_type_attribute':
(.text+0x1ffb3): undefined reference to `invoke_impl_ptr_type'
libbackend.a(llvm-backend.o): In function `createOptimizationPasses':
/home/duncan/LLVM/gcc-4.2.llvm-objects/gcc/../../gcc-4.2.llvm/gcc/llvm-backend.cpp:384: undefined reference to `flag_no_builtin'

Same problem when building Ada.

Ciao,

Duncan.

This one (with Ada):
libbackend.a(dwarf2out.o): In function `modified_type_die':
gcc/../../gcc-4.2.llvm/gcc/dwarf2out.c:8617: undefined reference to `c_language'

Seems to be due to placing C language specific stuff in a generic file.
Take a look (dwarf2out.c):

+/* APPLE LOCAL radar 5811943 - Fix type of pointers to Blocks */
+/* APPLE LOCAL Radar 5741731, typedefs used in '@try' blocks */
+#include "c-common.h"

^ Including a C language header!!!

...

+ /* APPLE LOCAL begin Radar 5741731, typedefs used in '@try' blocks */
+ if (is_volatile_type
+ && c_dialect_objc ()
+ && lookup_attribute ("objc_volatilized", TYPE_ATTRIBUTES (type)))
+ {
+ is_volatile_type = 0;
+ if (TYPE_NAME (type) && TREE_TYPE (TYPE_NAME (type)))
+ type = TREE_TYPE (TYPE_NAME (type));
+ }
+ /* APPLE LOCAL end Radar 5741731, typedefs used in '@try' blocks */

^ Using a C language method (c_dialect_objc)!!!

How about something like this instead (I have no idea if this works):

Index: gcc-4.2.llvm/gcc/dwarf2out.c

Done. Thanks!

-bw

And how about this one so as not to include a C specific
header in llvm-backend (!!!) and not to have llvm-backend
use a C specific flag (flag_no_builtin)?

Index: gcc-4.2.llvm/gcc/c-opts.c

Done.

-bw

Thanks Bill - the Fortran and Ada builds are now getting
a lot further.

Ciao,

Duncan.