I think gengtype is failing me here, but I'm not sure. In PR 48167 we are failing to link cc1objplus because of undefined references:
cp/parser.o:(.rodata+0x2b18): undefined reference to `gt_ggc_mx_cp_parser' cp/parser.o:(.rodata+0x2b20): undefined reference to `gt_pch_nx_cp_parser' cp/tree.o: In function `gt_ggc_mx_lang_tree_node': tree.c:(.text+0xd33e): undefined reference to `gt_ggc_mx_cp_token_cache' cp/tree.o: In function `gt_pch_nx_lang_tree_node': tree.c:(.text+0xea2e): undefined reference to `gt_pch_nx_cp_token_cache' cp/tree.o: In function `gt_ggc_mx_lang_decl': tree.c:(.text+0xd23b): undefined reference to `gt_ggc_mx_cp_token_cache' cp/tree.o: In function `gt_pch_nx_lang_decl': tree.c:(.text+0xe923): undefined reference to `gt_pch_nx_cp_token_cache' collect2: ld returned 1 exit status make: *** [cc1objplus] Error 1 The problem is that those GTY functions are generated in cp/cp-lang.o, which is not linked to cc1objplus. The usual way of getting these functions generated is to #include the header file in <fe>/<fe>-lang.c and add it to gtfiles in config-lang.in (which this patch does). However, gengtype is not generating the functions, so I'm not sure how to make it do that. The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/, so I'm missing some other connection I need to make to fix this. Any ideas? Thanks. Diego. diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in index 5bbd27e..e2e0196 100644 --- a/gcc/objcp/Make-lang.in +++ b/gcc/objcp/Make-lang.in @@ -45,7 +45,7 @@ obj-c++: cc1objplus$(exeext) .PHONY: obj-c++ START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \ - langhooks.h c-family/c-objc.h objc/objc-act.h + langhooks.h c-family/c-objc.h objc/objc-act.h $(CXX_PARSER_H) # Use maximal warnings for this front end. Also, make ObjC and C++ # headers accessible. diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in index 8c3d9c5..985da17 100644 --- a/gcc/objcp/config-lang.in +++ b/gcc/objcp/config-lang.in @@ -37,5 +37,5 @@ build_by_default="no" lang_requires="objc c++" subdir_requires="objc cp" -gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c " +gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/method.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/rtti.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/objcp/objcp-lang.c" diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c index fe2be66..65857b5 100644 --- a/gcc/objcp/objcp-lang.c +++ b/gcc/objcp/objcp-lang.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks-def.h" #include "target.h" #include "cp-objcp-common.h" +#include "parser.h" enum c_language_kind c_language = clk_objcxx; static void objcxx_init_ts (void); -- This patch is available for review at http://codereview.appspot.com/4291054