Message ID | AM4PR0701MB216279A16CA1B1D69DCFE1D7E4400@AM4PR0701MB2162.eurprd07.prod.outlook.com |
---|---|
State | New |
Headers | show |
On 02/06/17 10:44, Bernd Edlinger wrote: > I tested this change with different arm-linux-gnueabihf cross > compilers, and verified that mkheaders still works on the host system. > > Bootstrapped and reg-tested on x86_64-pc-linux-gnu. > Is it OK for trunk? As long as you certify that this is correct for all systems we care about: +BUILD_SYSTEM_HEADER_DIR = ` + echo $(CROSS_SYSTEM_HEADER_DIR) | \ + sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` that is pretty obtuse sed-speak to me. I suggest a comment explaining what sed is supposed to be doing. What should "$(CROSS_SYSTEM_HEADER_DIR)" look like?
On 02/18/17 00:37, Bruce Korb wrote: > On 02/06/17 10:44, Bernd Edlinger wrote: >> I tested this change with different arm-linux-gnueabihf cross >> compilers, and verified that mkheaders still works on the host system. >> >> Bootstrapped and reg-tested on x86_64-pc-linux-gnu. >> Is it OK for trunk? > > As long as you certify that this is correct for all systems we care about: > > +BUILD_SYSTEM_HEADER_DIR = ` > + echo $(CROSS_SYSTEM_HEADER_DIR) | \ > + sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` > > that is pretty obtuse sed-speak to me. I suggest a comment > explaining what sed is supposed to be doing. What should > "$(CROSS_SYSTEM_HEADER_DIR)" look like? > I took it just from a few lines above, so I thought that comment would sufficiently explain the syntax: # autoconf sets SYSTEM_HEADER_DIR to one of the above. # Purge it of unnecessary internal relative paths # to directories that might not exist yet. # The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. # Use single quotes here to avoid nested double- and backquotes, this # macro is also used in a double-quoted context. SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` But I guess it would not hurt to just repeat "Purge it of unnecessary internal relative paths" here as well. CROSS_SYSTEM_HEADER_DIR is where the target system headers are located on the build system (IOW the system root), that can be something like "CROSS_SYSTEM_HEADER_DIR = $(gcc_tooldir)/sys-include" Which may expand to something like that: "/home/ed/gnu/arm-linux-gnueabihf-cross/lib/gcc/arm-linux-gnueabihf/7.0.1/../../../../arm-linux-gnueabihf/sys-include" which the sed script changes then to "/home/ed/gnu/arm-linux-gnueabihf-cross/arm-linux-gnueabihf/sys-include" And in deed, I have put the target header files there on the build machine. But on the target system the include files are simply at "/usr/include" which is the value of SYSTEM_HEADER_DIR, thus SYSTEM_HEADER_DIR is not a path where the headers are visible at the build system, only code that executes on the target system should use SYSTEM_HEADER_DIR. Thanks Bernd.
On 02/18/17 01:01, Bernd Edlinger wrote: > On 02/18/17 00:37, Bruce Korb wrote: >> On 02/06/17 10:44, Bernd Edlinger wrote: >>> I tested this change with different arm-linux-gnueabihf cross >>> compilers, and verified that mkheaders still works on the host system. >>> >>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu. >>> Is it OK for trunk? >> >> As long as you certify that this is correct for all systems we care about: >> >> +BUILD_SYSTEM_HEADER_DIR = ` >> + echo $(CROSS_SYSTEM_HEADER_DIR) | \ >> + sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` >> >> that is pretty obtuse sed-speak to me. I suggest a comment >> explaining what sed is supposed to be doing. What should >> "$(CROSS_SYSTEM_HEADER_DIR)" look like? >> > > I took it just from a few lines above, so I thought that comment would > sufficiently explain the syntax: I confess, I didn't pull a new copy of gcc, sorry. So it looks good to me.
2017-02-06 Bernd Edlinger <bernd.edlinger@hotmail.de> * Makefile.in (BUILD_SYSTEM_HEADER_DIR): New make variabe. (LIMITS_H_TEST, if_multiarch, stmp-fixinc): Use BUILD_SYSTEM_HEADER_DIR instead of SYSTEM_HEADER_DIR. Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 245184) +++ gcc/Makefile.in (working copy) @@ -517,11 +517,18 @@ # macro is also used in a double-quoted context. SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` +# Path to the system headers on the build machine +ifeq ($(build),$(host)) +BUILD_SYSTEM_HEADER_DIR = $(SYSTEM_HEADER_DIR) +else +BUILD_SYSTEM_HEADER_DIR = `echo $(CROSS_SYSTEM_HEADER_DIR) | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` +endif + # Control whether to run fixincludes. STMP_FIXINC = @STMP_FIXINC@ # Test to see whether <limits.h> exists in the system header files. -LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] +LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ] # Directory for prefix to system directories, for # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc. @@ -572,7 +579,7 @@ else ifeq ($(enable_multiarch),auto) # SYSTEM_HEADER_DIR is makefile syntax, cannot be evaluated in configure.ac - if_multiarch = $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1)) + if_multiarch = $(if $(wildcard $(shell echo $(BUILD_SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1)) else if_multiarch = endif @@ -2990,11 +2997,11 @@ sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \ multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \ fix_dir=include-fixed$${multi_dir}; \ - if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \ + if ! $(inhibit_libc) && test ! -d ${BUILD_SYSTEM_HEADER_DIR}; then \ echo The directory that should contain system headers does not exist: >&2 ; \ - echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ + echo " ${BUILD_SYSTEM_HEADER_DIR}" >&2 ; \ tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \ - if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \ + if test "x${BUILD_SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \ then sleep 1; else exit 1; fi; \ fi; \ $(mkinstalldirs) $${fix_dir}; \ @@ -3005,7 +3012,7 @@ export TARGET_MACHINE srcdir SHELL MACRO_LIST && \ cd $(build_objdir)/fixincludes && \ $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \ - $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ + $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ rm -f $${fix_dir}/syslimits.h; \ if [ -f $${fix_dir}/limits.h ]; then \ mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \