diff mbox series

Fix up plugin header install

Message ID 20201014123503.GK2176@tucnak
State New
Headers show
Series Fix up plugin header install | expand

Commit Message

Jakub Jelinek Oct. 14, 2020, 12:35 p.m. UTC
Hi!

Jeff has noticed and I've confirmed that config/i386/i386.h header which is
installed on x86 in plugin/include/ directory newly in GCC 11 has
#include "common/config/i386/i386-cpuinfo.h"
which breaks all plugins that include tm.h etc. because that header is not
shipped.
The following patch seems to fix that.  Unfortunately it isn't just a matter
of TM_H += t-i386 change, because the header has full path and therefore
needs to be installed in its full path.
Additionally, I've noticed that the b-header-vars generation is completely
broken, it will just throw many of the dependencies away, because it
incorrectly removed everything from first ... remaining till the last /,
while what it clearly wants to do is remove each ... till last / in the same
header path (i.e. instead of .* should have used [^ 	]* and g modifier).
I've also noticed that some other headers mentioned in #include of other
headers aren't included (gomp-constants.h as dependency of omp-general.h
and various dependencies of expr.h (where omp-general.h and expr.h were
previously installed)).

Tested on x86_64-linux with make install, ok for trunk?

2020-10-14  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (PLUGIN_HEADERS): Add gomp-constants.h and $(EXPR_H).
	(s-header-vars): Accept not just spaces but also tabs between *_H name
	and =.  Handle common/config/ headers similarly to config.  Don't
	throw away everything from first ... to last / on the remaining
	string, instead skip just ... to corresponding last / without
	intervening spaces and tabs.
	(install-plugin): Treat common/config headers like config headers.
	* config/i386/t-i386 (TM_H): Add
	$(srcdir)/common/config/i386/i386-cpuinfo.h.


	Jakub
diff mbox series

Patch

--- gcc/Makefile.in.jj	2020-10-06 23:35:52.616444535 +0200
+++ gcc/Makefile.in	2020-10-14 14:15:43.179074337 +0200
@@ -3594,7 +3594,8 @@  PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $
   tree-ssa-threadupdate.h inchash.h wide-int.h signop.h hash-map.h \
   hash-set.h dominance.h cfg.h cfgrtl.h cfganal.h cfgbuild.h cfgcleanup.h \
   lcm.h cfgloopmanip.h file-prefix-map.h builtins.def $(INSN_ATTR_H) \
-  pass-instances.def params.list
+  pass-instances.def params.list $(srcdir)/../include/gomp-constants.h \
+  $(EXPR_H)
 
 # generate the 'build fragment' b-header-vars
 s-header-vars: Makefile
@@ -3604,7 +3605,7 @@  s-header-vars: Makefile
 # more portable than a trailing "-e d" to filter out the uninteresting lines,
 # in particular on ia64-hpux where "s/.../p" only prints if -n was requested
 # as well.
-	$(foreach header_var,$(shell sed < Makefile -n -e 's/^\([A-Z0-9_]*_H\)[      ]*=.*/\1/p'),echo $(header_var)=$(shell echo $($(header_var):$(srcdir)/%=.../%) | sed -e 's~\.\.\./config/~config/~' -e 's~\.\.\..*/~~') >> tmp-header-vars;) \
+	$(foreach header_var,$(shell sed < Makefile -n -e 's/^\([A-Z0-9_]*_H\)[ 	]*=.*/\1/p'),echo $(header_var)=$(shell echo $($(header_var):$(srcdir)/%=.../%) | sed -e 's~\.\.\./config/~config/~' -e 's~\.\.\./common/config/~common/config/~' -e 's~\.\.\.[^ 	]*/~~g') >> tmp-header-vars;)
 	$(SHELL) $(srcdir)/../move-if-change tmp-header-vars b-header-vars
 	$(STAMP) s-header-vars
 
@@ -3630,7 +3631,8 @@  install-plugin: installdirs lang.install
 	  else continue; \
 	  fi; \
 	  case $$path in \
-	  "$(srcdir)"/config/* | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
+	  "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
+	  | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
 	    base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
 	  *) base=`basename $$path` ;; \
 	  esac; \
--- gcc/config/i386/t-i386.jj	2020-01-14 20:02:45.861623645 +0100
+++ gcc/config/i386/t-i386	2020-10-14 13:41:38.503905771 +0200
@@ -17,7 +17,8 @@ 
 # <http://www.gnu.org/licenses/>.
 
 OPTIONS_H_EXTRA += $(srcdir)/config/i386/stringop.def
-TM_H += $(srcdir)/config/i386/x86-tune.def
+TM_H += $(srcdir)/config/i386/x86-tune.def \
+	$(srcdir)/common/config/i386/i386-cpuinfo.h
 PASSES_EXTRA += $(srcdir)/config/i386/i386-passes.def
 
 i386-c.o: $(srcdir)/config/i386/i386-c.c