diff mbox

Fix missing plugin headers

Message ID 1386090757.12091.53.camel@surprise
State New
Headers show

Commit Message

David Malcolm Dec. 3, 2013, 5:12 p.m. UTC
I attempted to build gcc-python-plugin against gcc trunk (r205358
specifically).

I ran into three kinds of issues:
  (A) tracking down where declarations have landed in the new layout
  (B) adding new headers to the list of those to be installed
  (C) some porting due to "real" changes e.g. passes becoming C++
classes.

Attached is a patch for gcc trunk to add various headers to
PLUGIN_HEADERS (either directly, or indirectly via TREE_H), ensuring
that all of the needed headers are installed.

One detail is that some headers are target-specific: on i386 there are
the headers "stringop.def" and "x86-tune.def" needed by
config/i386/i386.h.

I initially tried fixing this by adding
  PLUGIN_HEADERS += config/i386/stringop.def config/i386/x86-tune.def
to gcc/config/i386/t-i386, but this didn't work, presumably because the:
   include $(tmake_file)
happens in line 1567 of my generated Makefile, whereas PLUGIN_HEADERS is
set up way further down at line 3127.  So we perhaps could reorder these
(I don't know if this leads to another issue), but instead I invented a
macro TARGET_PLUGIN_HEADERS, setting it up in t-i386 on this target, and
relying on an empty default expansion on other targets.

Successfully bootstrapped on x86_64-unknown-linux-gnu.

OK for trunk?

For reference, the corresponding patch to fixup gcc-python-plugin to
build against gcc 4.9 (or at least current trunk) can be seen here:
https://git.fedorahosted.org/cgit/gcc-python-plugin.git/commit/?id=903202a97f30f1cf10e4c57b70c31894f0c2cc97
(posting here since it might be helpful to other plugins).
diff mbox

Patch

commit 022bcca7a42be2cb794d378691b2044edc424e0d
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Mon Dec 2 14:45:35 2013 -0500

    Add missing headers to PLUGIN_HEADERS
    
    gcc/
    	* Makefile.in (BUILTINS_DEF): Add chkp-builtins.def.
    	(TREE_H): Add fold-const.h.
    	(PLUGIN_HEADERS): Add gimple-iterator.h, gimple-walk.h, print-tree.h,
    	context.h, pass_manager.h, pass-instances.def, and new macro
    	TARGET_PLUGIN_HEADERS.
    
    	* config/i386/t-i386 (TARGET_PLUGIN_HEADERS): New.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 4d683a0..0522e2c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -873,7 +873,8 @@  RTL_H = $(RTL_BASE_H) $(FLAGS_H) genrtl.h
 READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
 PARAMS_H = params.h params.def
 BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def \
-	gtm-builtins.def sanitizer.def cilkplus.def cilk-builtins.def
+	gtm-builtins.def sanitizer.def cilkplus.def cilk-builtins.def \
+	chkp-builtins.def
 INTERNAL_FN_DEF = internal-fn.def
 INTERNAL_FN_H = internal-fn.h $(INTERNAL_FN_DEF)
 TREE_CORE_H = tree-core.h coretypes.h all-tree.def tree.def \
@@ -882,7 +883,7 @@  TREE_CORE_H = tree-core.h coretypes.h all-tree.def tree.def \
 	$(VEC_H) treestruct.def $(HASHTAB_H) \
 	double-int.h alias.h $(SYMTAB_H) $(FLAGS_H) \
 	$(REAL_H) $(FIXED_VALUE_H)
-TREE_H = tree.h $(TREE_CORE_H)  tree-check.h
+TREE_H = tree.h $(TREE_CORE_H)  tree-check.h fold-const.h
 REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
 BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) \
 	cfg-flags.def cfghooks.h
@@ -3117,7 +3118,9 @@  PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h \
   $(GIMPLE_PRETTY_PRINT_H) realmpfr.h \
   $(IPA_PROP_H) $(TARGET_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) \
-  version.h stringpool.h
+  version.h stringpool.h gimple-iterator.h gimple-walk.h print-tree.h \
+  context.h pass_manager.h pass-instances.def \
+  $(TARGET_PLUGIN_HEADERS)
 
 # generate the 'build fragment' b-header-vars
 s-header-vars: Makefile
diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index 1a76c41..c7a9fdf 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -16,6 +16,8 @@ 
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
+TARGET_PLUGIN_HEADERS = config/i386/stringop.def config/i386/x86-tune.def
+
 i386-c.o: $(srcdir)/config/i386/i386-c.c i386-builtin-types.inc
 	  $(COMPILE) $<
 	  $(POSTCOMPILE)