public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Importing gnulib into the gcc tree
@ 2016-06-25 15:02 ayush goel
  2016-06-25 21:57 ` Jakub Sejdak
  2016-06-27 18:02 ` Joseph Myers
  0 siblings, 2 replies; 13+ messages in thread
From: ayush goel @ 2016-06-25 15:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Manuel López-Ibáñez

Hey, 
As a first step of my GSOC project (https://gcc.gnu.org/wiki/replacelibibertywithgnulib) I have imported the gnulib library inside the gcc tree. I have created gnulib as a top level directory which contains the necessary scripts to import the modules. It also contains the necessary Makefile.in and configure.ac files.
I have made the corresponding changes in the Makefile.def and configure.ac files, adding gnulib both as a build and host library, and subsequently regenerated the Makefile.in and configure files. 

Initially I have just imported the bcopy module from gnulib which will eventually replace gcc’s dependency on libiberty’s bcopy. 


Bootstrapped/regtested on x86_64-linux and x86_64-apple-darwin15.5.0


——————————————————————————

M       src/Makefile.def
M       src/Makefile.in
M       src/configure
M       src/configure.ac
A       src/gnulib
A       src/gnulib/Makefile.in
A       src/gnulib/aclocal.m4
A       src/gnulib/config.in
A       src/gnulib/configure
A       src/gnulib/configure.ac
A       src/gnulib/import
A       src/gnulib/import/Makefile.am
A       src/gnulib/import/Makefile.in
A       src/gnulib/import/bcopy.c
A       src/gnulib/import/dummy.c
A       src/gnulib/import/extra
A       src/gnulib/import/extra/snippet
A       src/gnulib/import/extra/snippet/arg-nonnull.h
A       src/gnulib/import/extra/snippet/c++defs.h
A       src/gnulib/import/extra/snippet/warn-on-use.h
A       src/gnulib/import/m4
A       src/gnulib/import/m4/00gnulib.m4
A       src/gnulib/import/m4/absolute-header.m4
A       src/gnulib/import/m4/gnulib-cache.m4
A       src/gnulib/import/m4/gnulib-common.m4
A       src/gnulib/import/m4/gnulib-comp.m4
A       src/gnulib/import/m4/gnulib-tool.m4
A       src/gnulib/import/m4/include_next.m4
A       src/gnulib/import/m4/off_t.m4
A       src/gnulib/import/m4/ssize_t.m4
A       src/gnulib/import/m4/strings_h.m4
A       src/gnulib/import/m4/sys_types_h.m4
A       src/gnulib/import/m4/warn-on-use.m4
A       src/gnulib/import/strings.in.h
A       src/gnulib/import/sys_types.in.h
A       src/gnulib/update-gnulib.sh

————————————————————————————

--  
Thanks,  
Ayush Goel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-06-25 15:02 Importing gnulib into the gcc tree ayush goel
@ 2016-06-25 21:57 ` Jakub Sejdak
  2016-06-27 18:02 ` Joseph Myers
  1 sibling, 0 replies; 13+ messages in thread
From: Jakub Sejdak @ 2016-06-25 21:57 UTC (permalink / raw)
  To: ayush goel; +Cc: gcc-patches, Manuel López-Ibáñez

I think, that you missed the patch file or it was removed from your
email by server.

2016-06-25 14:06 GMT+02:00 ayush goel <ayushgoel1610@gmail.com>:
> Hey,
> As a first step of my GSOC project (https://gcc.gnu.org/wiki/replacelibibertywithgnulib) I have imported the gnulib library inside the gcc tree. I have created gnulib as a top level directory which contains the necessary scripts to import the modules. It also contains the necessary Makefile.in and configure.ac files.
> I have made the corresponding changes in the Makefile.def and configure.ac files, adding gnulib both as a build and host library, and subsequently regenerated the Makefile.in and configure files.
>
> Initially I have just imported the bcopy module from gnulib which will eventually replace gcc’s dependency on libiberty’s bcopy.
>
>
> Bootstrapped/regtested on x86_64-linux and x86_64-apple-darwin15.5.0
>
>
> ——————————————————————————
>
> M       src/Makefile.def
> M       src/Makefile.in
> M       src/configure
> M       src/configure.ac
> A       src/gnulib
> A       src/gnulib/Makefile.in
> A       src/gnulib/aclocal.m4
> A       src/gnulib/config.in
> A       src/gnulib/configure
> A       src/gnulib/configure.ac
> A       src/gnulib/import
> A       src/gnulib/import/Makefile.am
> A       src/gnulib/import/Makefile.in
> A       src/gnulib/import/bcopy.c
> A       src/gnulib/import/dummy.c
> A       src/gnulib/import/extra
> A       src/gnulib/import/extra/snippet
> A       src/gnulib/import/extra/snippet/arg-nonnull.h
> A       src/gnulib/import/extra/snippet/c++defs.h
> A       src/gnulib/import/extra/snippet/warn-on-use.h
> A       src/gnulib/import/m4
> A       src/gnulib/import/m4/00gnulib.m4
> A       src/gnulib/import/m4/absolute-header.m4
> A       src/gnulib/import/m4/gnulib-cache.m4
> A       src/gnulib/import/m4/gnulib-common.m4
> A       src/gnulib/import/m4/gnulib-comp.m4
> A       src/gnulib/import/m4/gnulib-tool.m4
> A       src/gnulib/import/m4/include_next.m4
> A       src/gnulib/import/m4/off_t.m4
> A       src/gnulib/import/m4/ssize_t.m4
> A       src/gnulib/import/m4/strings_h.m4
> A       src/gnulib/import/m4/sys_types_h.m4
> A       src/gnulib/import/m4/warn-on-use.m4
> A       src/gnulib/import/strings.in.h
> A       src/gnulib/import/sys_types.in.h
> A       src/gnulib/update-gnulib.sh
>
> ————————————————————————————
>
> --
> Thanks,
> Ayush Goel
>



-- 
Jakub Sejdak
Software Engineer
Phoenix Systems (www.phoesys.com)
+48 608 050 163

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-06-25 15:02 Importing gnulib into the gcc tree ayush goel
  2016-06-25 21:57 ` Jakub Sejdak
@ 2016-06-27 18:02 ` Joseph Myers
  2016-07-07 12:48   ` ayush goel
  1 sibling, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2016-06-27 18:02 UTC (permalink / raw)
  To: ayush goel; +Cc: gcc-patches, Manuel López-Ibáñez

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

On Sat, 25 Jun 2016, ayush goel wrote:

> Initially I have just imported the bcopy module from gnulib which will 
> eventually replace gcc’s dependency on libiberty’s bcopy. 

GCC should not depend on bcopy.  Any bcopy use is a bug and it should be 
replaced by memcpy or memmove as appropriate.  The poisoning in system.h 
should prevent such uses from building in the first place.

You should only import gnulib modules for functionality actually used in 
GCC - remembering that GCC now depends on at least a C++98 compiler and 
library, so it's unlikely that modules for ISO C90 functionality are 
actually relevant on any currently supported host or build system.

For example, GCC uses obstacks, so the gnulib version of obstack is 
appropriate to replace the libiberty version.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-06-27 18:02 ` Joseph Myers
@ 2016-07-07 12:48   ` ayush goel
  2016-07-07 20:59     ` Manuel López-Ibáñez
  0 siblings, 1 reply; 13+ messages in thread
From: ayush goel @ 2016-07-07 12:48 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches, Manuel López-Ibáñez

[-- Attachment #1: Type: text/plain, Size: 4892 bytes --]

Hey, 
As a first step of my GSOC project (https://gcc.gnu.org/wiki/replacelibibertywithgnulib) I have imported the gnulib library inside the gcc tree. I have created gnulib as a top level directory which contains the necessary scripts to import the modules. It also contains the necessary Makefile.in and configure.ac files. 
I have made the corresponding changes in the Makefile.def and configure.ac files, adding gnulib both as a build and host library, and subsequently regenerated the Makefile.in and configure files. 

In order to show the setup works, I’ve replaced libiberty’s version by obstack by gnulib’s. This was made possible by replacing the corresponding header file and then including gnulib headers and gnulib static library in the build path required to compile gcc files.

Used gdb’s scripts to import gnulib
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=tree;f=gdb/gnulib;h=cdf326774716ae427dc4fb47c9a410fcdf715563;hb=HEAD 


7-7-16 Ayush Goel <ayushgoel1610@gmail.com>

		* Makefile.def: Added gnulib as build & host library and dependency of all-gcc on gnulib
		* Makefile.in: regenerated
		* configure.ac: Added gnulib as build and host library
		* configure: regenerated
		* gnulib: created directory
		* gnulib/Makefile.in: new file
		* gnulib/configure.ac: new file
		* gnulib/update-gnulib.sh: script to import gnulib modules using gnulib-tool
		* gnulib/import: created by update-gnulib.sh
		* gnulib/import/Makefile.in: imported from gnulib 
       		* gnulib/import/alignof.h: Imported from gnulib 
		* gnulib/import/exitfail.c: Imported from gnulib 
		* gnulib/import/exitfail.h: Imported from gnulib 
		* gnulib/import/extra: Imported from gnulib 
		* gnulib/import/extra/snippet: Imported from gnulib 
		* gnulib/import/extra/snippet/_Noreturn.h: Imported from gnulib 
		* gnulib/import/extra/snippet/arg-nonnull.h: Imported from gnulib 
		* gnulib/import/extra/snippet/c++defs.h: Imported from gnulib 
		* gnulib/import/extra/snippet/warn-on-use.h: Imported from gnulib 
		* gnulib/import/gettext.h: Imported from gnulib 
		* gnulib/import/m4: Imported from gnulib 
		* gnulib/import/m4/00gnulib.m4: Imported from gnulib 
		* gnulib/import/m4/absolute-header.m4: Imported from gnulib 
		* gnulib/import/m4/extern-inline.m4: Imported from gnulib 
		* gnulib/import/m4/gnulib-cache.m4: Imported from gnulib 
		* gnulib/import/m4/gnulib-common.m4: Imported from gnulib 
		* gnulib/import/m4/gnulib-comp.m4: Imported from gnulib 
		* gnulib/import/m4/gnulib-tool.m4: Imported from gnulib 
		* gnulib/import/m4/include_next.m4: Imported from gnulib 
		* gnulib/import/m4/longlong.m4: Imported from gnulib 
		* gnulib/import/m4/multiarch.m4: Imported from gnulib 
		* gnulib/import/m4/obstack.m4: Imported from gnulib 
		* gnulib/import/m4/off_t.m4: Imported from gnulib 
		* gnulib/import/m4/ssize_t.m4: Imported from gnulib 
		* gnulib/import/m4/stddef_h.m4: Imported from gnulib 
		* gnulib/import/m4/stdint.m4: Imported from gnulib 
		* gnulib/import/m4/stdlib_h.m4: Imported from gnulib 
		* gnulib/import/m4/sys_types_h.m4: Imported from gnulib 
		* gnulib/import/m4/unistd_h.m4: Imported from gnulib 
		* gnulib/import/m4/warn-on-use.m4: Imported from gnulib 
		* gnulib/import/m4/wchar_t.m4: Imported from gnulib 
		* gnulib/import/obstack.c: Imported from gnulib 
		* gnulib/import/obstack.h: Imported from gnulib 
		* gnulib/import/stddef.in.h: Imported from gnulib 
		* gnulib/import/stdint.in.h: Imported from gnulib 
		* gnulib/import/stdlib.in.h: Imported from gnulib 
		* gnulib/import/sys: Imported from gnulib 
		* gnulib/import/sys_types.in.h: Imported from gnulib 
		* gnulib/import/unistd.c: Imported from gnulib 
		* gnulib/import/unistd.in.h: Imported from gnulib 
		* gnulib/stamp-h1: generated
		
		

 

--  
Thanks,  
Ayush Goel

On 27 June 2016 at 11:22:38 PM, Joseph Myers (joseph@codesourcery.com) wrote:
> On Sat, 25 Jun 2016, ayush goel wrote:
>  
> > Initially I have just imported the bcopy module from gnulib which will
> > eventually replace gcc’s dependency on libiberty’s bcopy.
>  
> GCC should not depend on bcopy. Any bcopy use is a bug and it should be
> replaced by memcpy or memmove as appropriate. The poisoning in system.h
> should prevent such uses from building in the first place.
>  
> You should only import gnulib modules for functionality actually used in
> GCC - remembering that GCC now depends on at least a C++98 compiler and
> library, so it's unlikely that modules for ISO C90 functionality are
> actually relevant on any currently supported host or build system.
>  
> For example, GCC uses obstacks, so the gnulib version of obstack is
> appropriate to replace the libiberty version.
>  
> --
> Joseph S. Myers
> joseph@codesourcery.com

[-- Attachment #2: importgnulib_7_7 --]
[-- Type: application/octet-stream, Size: 19057 bytes --]

Index: src/Makefile.def
===================================================================
--- src/Makefile.def	(revision 237184)
+++ src/Makefile.def	(working copy)
@@ -25,6 +25,7 @@
 // that recursive target in its Makefile.
 
 build_modules= { module= libiberty; };
+build_modules= { module= gnulib; };
 build_modules= { module= bison; };
 build_modules= { module= flex; };
 build_modules= { module= m4; };
@@ -112,6 +113,8 @@
 host_modules= { module= zlib; no_install=true; no_check=true;
 		bootstrap=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
+host_modules= { module= gnulib;
+              bootstrap=true; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -342,6 +345,8 @@
 dependencies = { module=all-gcc; on=all-build-fixincludes; };
 dependencies = { module=all-gcc; on=all-build-libcpp; };
 dependencies = { module=all-gcc; on=all-zlib; };
+dependencies=  { module=all-gcc; on=all-gnulib; hard=true; };
+dependencies = { module=all-gcc; on=all-build-gnulib; };
 dependencies = { module=all-gcc; on=all-libbacktrace; hard=true; };
 dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
 dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
Index: src/configure.ac
===================================================================
--- src/configure.ac	(revision 237184)
+++ src/configure.ac	(working copy)
@@ -125,7 +125,7 @@
 # these library is used by various programs built for the build
 # environment
 #
-build_libs="build-libiberty build-libcpp"
+build_libs="build-libiberty build-libcpp build-gnulib"
 
 # these tools are built for the build environment
 build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
@@ -132,7 +132,7 @@
 
 # these libraries are used by various programs built for the host environment
 #f
-host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv"
+host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv gnulib"
 
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
Index: src/gcc/Makefile.in
===================================================================
--- src/gcc/Makefile.in	(revision 237184)
+++ src/gcc/Makefile.in	(working copy)
@@ -484,12 +484,14 @@
 
 # Where to find some libiberty headers.
 HASHTAB_H   = $(srcdir)/../include/hashtab.h
-OBSTACK_H   = $(srcdir)/../include/obstack.h
 SPLAY_TREE_H= $(srcdir)/../include/splay-tree.h
 MD5_H	    = $(srcdir)/../include/md5.h
 XREGEX_H    = $(srcdir)/../include/xregex.h
 FNMATCH_H   = $(srcdir)/../include/fnmatch.h
 
+# GNULIB headers
+OBSTACK_H   = $(srcdir)/../gnulib/import/obstack.h
+
 # Linker plugin API headers
 LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 
@@ -1022,9 +1024,13 @@
 BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
 endif
 
+# Where to find the gnulib library
+LIBGNU = ../gnulib/import/libgnu.a
+INCGNU = -I../gnulib -I$(srcdir)/../gnulib/import
+
 # Dependencies on the intl and portability libraries.
 LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
-	$(LIBDECNUMBER) $(LIBBACKTRACE)
+	$(LIBDECNUMBER) $(LIBBACKTRACE) $(LIBGNU)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -1066,7 +1072,7 @@
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
 	   -I$(srcdir)/../include @INCINTL@ \
 	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
-	   $(ISLINC)
+	   $(ISLINC) $(INCGNU)
 
 COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
 ifeq ($(CXXDEPMODE),depmode=gcc3)
Index: src/gnulib/Makefile.in
===================================================================
--- src/gnulib/Makefile.in	(nonexistent)
+++ src/gnulib/Makefile.in	(working copy)
@@ -0,0 +1,290 @@
+# Copyright (C) 1989-2016 Free Software Foundation, Inc.
+
+# This file is part of GCC.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(libdir)/$(target_alias)
+
+datadir = @datadir@
+localedir = @localedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+infodir = @infodir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+htmldir = @htmldir@
+pdfdir = @pdfdir@
+includedir = @includedir@
+
+SHELL = @SHELL@
+EXEEXT = @EXEEXT@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DESTDIR =
+
+AR = @AR@
+AR_FLAGS = qv
+RANLIB = @RANLIB@
+DLLTOOL = @DLLTOOL@
+
+SUBDIRS = import
+CLEANDIRS = $(SUBDIRS)
+REQUIRED_SUBDIRS = $(SUBDIRS)
+
+# If you are compiling with GCC, make sure that either 1) You have the
+# fixed include files where GCC can reach them, or 2) You use the
+# -traditional flag.  Otherwise the ioctl calls in inflow.c
+# will be incorrectly compiled.  The "fixincludes" script in the gcc
+# distribution will fix your include files up.
+CC=@CC@
+
+# Directory containing source files.
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC_LD=$(CC)
+
+# CFLAGS is specifically reserved for setting from the command line
+# when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
+CFLAGS = @CFLAGS@
+
+# LDFLAGS is specifically reserved for setting from the command line
+# when running make.
+LDFLAGS = @LDFLAGS@
+
+FLAGS_TO_PASS = \
+	"prefix=$(prefix)" \
+	"exec_prefix=$(exec_prefix)" \
+	"infodir=$(infodir)" \
+	"datarootdir=$(datarootdir)" \
+	"docdir=$(docdir)" \
+	"htmldir=$(htmldir)" \
+	"pdfdir=$(pdfdir)" \
+	"libdir=$(libdir)" \
+	"mandir=$(mandir)" \
+	"datadir=$(datadir)" \
+	"includedir=$(includedir)" \
+	"against=$(against)" \
+	"DESTDIR=$(DESTDIR)" \
+	"AR=$(AR)" \
+	"AR_FLAGS=$(AR_FLAGS)" \
+	"CC=$(CC)" \
+	"CFLAGS=$(CFLAGS)" \
+	"CXX=$(CXX)" \
+	"CXXFLAGS=$(CXXFLAGS)" \
+	"DLLTOOL=$(DLLTOOL)" \
+	"LDFLAGS=$(LDFLAGS)" \
+	"RANLIB=$(RANLIB)" \
+	"MAKEINFO=$(MAKEINFO)" \
+	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
+	"MAKEINFO_EXTRA_FLAGS=$(MAKEINFO_EXTRA_FLAGS)" \
+	"MAKEHTML=$(MAKEHTML)" \
+	"MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
+	"INSTALL=$(INSTALL)" \
+	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+	"INSTALL_DATA=$(INSTALL_DATA)" \
+	"RUNTEST=$(RUNTEST)" \
+	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
+
+all installcheck check info install-info clean-info dvi pdf install-pdf html install-html: force
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+# Traditionally "install" depends on "all".  But it may be useful
+# not to; for example, if the user has made some trivial change to a
+# source file and doesn't care about rebuilding or just wants to save the
+# time it takes for make to check that all is up to date.
+# install-only is intended to address that need.
+install: all
+	@$(MAKE) $(FLAGS_TO_PASS) install-only
+
+install-only: $(CONFIG_INSTALL)
+	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+uninstall: force $(CONFIG_UNINSTALL)
+	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+# Convenience rule to handle recursion.
+$(LIBGNU) $(GNULIB_H): all-lib
+all-lib: import/Makefile
+	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=import subdir_do
+.PHONY: all-lib
+
+clean mostlyclean: $(CONFIG_CLEAN)
+	@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
+
+distclean: clean
+	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
+	rm -f config.status config.h stamp-h
+	rm -f config.log config.cache
+	rm -f Makefile
+	rm -rf $(DEPDIR)
+
+maintainer-clean: local-maintainer-clean do-maintainer-clean distclean
+realclean: maintainer-clean
+
+local-maintainer-clean:
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+	rm -f config.status
+
+do-maintainer-clean:
+	@$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(CLEANDIRS)" \
+		subdir_do
+
+subdir_do: force
+	@for i in $(DODIRS); do \
+		case $$i in \
+		$(REQUIRED_SUBDIRS)) \
+			if [ ! -f ./$$i/Makefile ] ; then \
+				echo "Missing $$i/Makefile" >&2 ; \
+				exit 1 ; \
+			fi ;; \
+		esac ; \
+		if [ -f ./$$i/Makefile ] ; then \
+			if (cd ./$$i; \
+				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
+			else exit 1 ; fi ; \
+		else true ; fi ; \
+	done
+
+Makefile: Makefile.in config.status
+	# Regenerate the Makefile.
+	CONFIG_FILES="Makefile" \
+	  CONFIG_COMMANDS= \
+	  CONFIG_HEADERS= \
+	  $(SHELL) config.status
+
+gnulib/Makefile: gnulib/Makefile.in config.status
+	CONFIG_FILES="gnulib/Makefile" \
+	  CONFIG_COMMANDS="depfiles" \
+	  CONFIG_HEADERS= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.h: stamp-h ; @true
+stamp-h: $(srcdir)/config.in config.status
+	CONFIG_HEADERS=config.h:config.in \
+	  CONFIG_COMMANDS="default depdir" \
+	  CONFIG_FILES= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.status: $(srcdir)/configure
+	$(SHELL) config.status --recheck
+
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I import/m4 -I ../../config
+aclocal_m4_deps = \
+	configure.ac \
+	import/m4/00gnulib.m4 \
+	import/m4/alloca.m4 \
+	import/m4/codeset.m4 \
+	import/m4/configmake.m4 \
+	import/m4/extensions.m4 \
+	import/m4/fcntl-o.m4 \
+	import/m4/fnmatch.m4 \
+	import/m4/glibc21.m4 \
+	import/m4/gnulib-cache.m4 \
+	import/m4/gnulib-common.m4 \
+	import/m4/gnulib-comp.m4 \
+	import/m4/gnulib-tool.m4 \
+	import/m4/include_next.m4 \
+	import/m4/inttypes-pri.m4 \
+	import/m4/inttypes.m4 \
+	import/m4/localcharset.m4 \
+	import/m4/locale-fr.m4 \
+	import/m4/locale-ja.m4 \
+	import/m4/locale-zh.m4 \
+	import/m4/longlong.m4 \
+	import/m4/mbrtowc.m4 \
+	import/m4/mbsinit.m4 \
+	import/m4/mbsrtowcs.m4 \
+	import/m4/mbstate_t.m4 \
+	import/m4/memchr.m4 \
+	import/m4/memmem.m4 \
+	import/m4/mmap-anon.m4 \
+	import/m4/multiarch.m4 \
+	import/m4/off_t.m4 \
+	import/m4/pathmax.m4 \
+	import/m4/ssize_t.m4 \
+	import/m4/stdbool.m4 \
+	import/m4/stddef_h.m4 \
+	import/m4/stdint.m4 \
+	import/m4/obstack.m4 \
+	import/m4/strtok_r.m4 \
+	import/m4/sys_types_h.m4 \
+	import/m4/unistd_h.m4 \
+	import/m4/warn-on-use.m4 \
+	import/m4/wchar_h.m4 \
+	import/m4/wchar_t.m4 \
+	import/m4/wctype_h.m4 \
+	import/m4/wint_t.m4
+
+$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+AUTOCONF = autoconf
+configure_deps = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+
+AUTOHEADER = autoheader
+$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOHEADER)
+	rm -f stamp-h
+	touch $@
+
+# automatic rebuilding in automake-generated Makefiles requires
+# this rule in the toplevel Makefile, which, with GNU make, causes
+# the desired updates through the implicit regeneration of the Makefile
+# and all of its prerequisites.
+am--refresh:
+	@:
+
+force:
+
+force_update:
+
+# GNU Make has an annoying habit of putting *all* the Makefile variables
+# into the environment, unless you include this target as a circumvention.
+# Rumor is that this will be fixed (and this target can be removed)
+# in GNU Make 4.0.
+.NOEXPORT:
+
+# GNU Make 3.63 has a different problem: it keeps tacking command line
+# overrides onto the definition of $(MAKE).  This variable setting
+# will remove them.
+MAKEOVERRIDES=
+
+### end of the libgnu Makefile.in.
Index: src/gnulib/configure.ac
===================================================================
--- src/gnulib/configure.ac	(nonexistent)
+++ src/gnulib/configure.ac	(working copy)
@@ -0,0 +1,60 @@
+dnl Autoconf configure script for GCC.
+dnl Copyright (C) 1995-2016 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.64)dnl
+AC_INIT()
+AC_CONFIG_HEADER(config.h:config.in)
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_USE_SYSTEM_EXTENSIONS
+gl_EARLY
+AM_PROG_CC_STDC
+
+AC_CONFIG_AUX_DIR(..)
+AC_CANONICAL_SYSTEM
+
+gl_INIT
+
+# Gnulib uses automake.  This line lets gcc generate
+# its Makefile.in.
+AM_INIT_AUTOMAKE(libgnu, UNUSED-VERSION, [no-define])
+
+# --------------------- #
+# Checks for programs.  #
+# --------------------- #
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+
+AC_CHECK_TOOL(AR, ar)
+
+# ---------------------- #
+# Checks for libraries.  #
+# ---------------------- #
+
+AC_OUTPUT(Makefile import/Makefile,
+[
+case x$CONFIG_HEADERS in
+xconfig.h:config.in)
+echo > stamp-h ;;
+esac
+])
+
+exit 0
Index: src/gnulib/update-gnulib.sh
===================================================================
--- src/gnulib/update-gnulib.sh	(nonexistent)
+++ src/gnulib/update-gnulib.sh	(working copy)
@@ -0,0 +1,129 @@
+#! /bin/sh
+
+# Copyright (C) 2011-2016 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Usage: update-gnulib.sh <path-to-gnulib-repository>
+# Update our import of gnulib in the GCC source tree.
+#
+# This script assumes that it is being called from the gcc/gnulib
+# subdirectory.
+#
+# This script will also make a number of other verifications:
+#   . The gnulib version (it should match $GNULIB_COMMIT_SHA1).
+#   . The correct versions of the auto-tools that are used to
+#     regenerate the various scripts and Makefiles are on the PATH.
+
+# The list of gnulib modules we are importing in GCC.
+IMPORTED_GNULIB_MODULES="\
+    obstack \
+"
+
+# The gnulib commit ID to use for the update.
+GNULIB_COMMIT_SHA1="1029a8112290f6eee9d7878a391c49db42c999bd"
+
+# The expected version number for the various auto tools we will
+# use after the import.
+AUTOCONF_VERSION="2.69"
+AUTOMAKE_VERSION="1.15"
+ACLOCAL_VERSION="$AUTOMAKE_VERSION"
+
+if [ $# -ne 1 ]; then
+   echo "Error: Path to gnulib repository missing. Aborting."
+   echo "Usage: update-gnulib.sh <path-to-gnulib-repository>"
+   exit 1
+fi
+gnulib_prefix=$1
+
+gnulib_tool="$gnulib_prefix/gnulib-tool"
+
+# Verify that the gnulib directory does exist...
+if [ ! -f "$gnulib_tool" ]; then
+   echo "Error: Invalid gnulib directory. Cannot find gnulib tool"
+   echo "       ($gnulib_tool)."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the right version of gnulib...
+gnulib_head_sha1=`cd $gnulib_prefix && git rev-parse HEAD`
+if [ "$gnulib_head_sha1" != "$GNULIB_COMMIT_SHA1" ]; then
+   echo "Error: Wrong version of gnulib: $gnulib_head_sha1"
+   echo "       (we expected it to be $GNULIB_COMMIT_SHA1)"
+   echo "Aborting."
+   exit 1
+fi
+
+ver=`autoconf --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOCONF_VERSION" ]; then
+   echo "Error: Wrong autoconf version: $ver. Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of automake.
+ver=`automake --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOMAKE_VERSION" ]; then
+   echo "Error: Wrong automake version ($ver), we need $AUTOMAKE_VERSION."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of aclocal.
+#
+# The grep below is needed because Perl >= 5.16 dumps a "called too
+# early to check prototype" warning when running aclocal 1.11.1.  This
+# causes trouble below, because the warning is the first line output
+# by aclocal, resulting in:
+#
+# $ sh ./update-gnulib.sh ~/src/gnulib/src/
+# Error: Wrong aclocal version: called too early to check prototype at /opt/automake-1.11.1/bin/aclocal line 617.. Aborting.
+#
+# Some distros carry an automake patch for that:
+#  https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=aclocal-function-prototypes.debdiff;att=1;bug=752784
+#
+# But since we prefer pristine FSF versions of autotools, work around
+# the issue here.  This can be removed later when we bump the required
+# automake version.
+#
+ver=`aclocal --version 2>&1 | grep -v "called too early to check prototype" | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$ACLOCAL_VERSION" ]; then
+   echo "Error: Wrong aclocal version: $ver. Aborting."
+   exit 1
+fi
+
+# Update our gnulib import.
+$gnulib_prefix/gnulib-tool --import --dir=. --lib=libgnu \
+  --source-base=import --m4-base=import/m4 --doc-base=doc \
+  --tests-base=tests --aux-dir=import/extra \
+  --no-conditional-dependencies --no-libtool --macro-prefix=gl \
+  --no-vc-files \
+  $IMPORTED_GNULIB_MODULES
+if [ $? -ne 0 ]; then
+   echo "Error: gnulib import failed.  Aborting."
+   exit 1
+fi
+
+# Regenerate all necessary files...
+aclocal -Iimport/m4 &&
+autoconf &&
+autoheader &&
+automake
+if [ $? -ne 0 ]; then
+   echo "Error: Failed to regenerate Makefiles and configure scripts."
+   exit 1
+fi
+

Property changes on: src/gnulib/update-gnulib.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-07 12:48   ` ayush goel
@ 2016-07-07 20:59     ` Manuel López-Ibáñez
  2016-07-08 19:30       ` ayush goel
  0 siblings, 1 reply; 13+ messages in thread
From: Manuel López-Ibáñez @ 2016-07-07 20:59 UTC (permalink / raw)
  To: ayush goel; +Cc: Joseph Myers, Gcc Patch List, Paolo Bonzini, DJ Delorie

On 7 July 2016 at 13:48, ayush goel <ayushgoel1610@gmail.com> wrote:
> In order to show the setup works, I’ve replaced libiberty’s version by obstack by gnulib’s. This was made possible by replacing the corresponding header file and then including gnulib headers and gnulib static library in the build path required to compile gcc files.

Hi Ayush,

I'm not an expert on the build machinery, so this question might be
misguided: How do you know it is using the version in gnulib rather
than the one in libiberty? I see it uses gnulib's header file but:

# Dependencies on the intl and portability libraries.
 LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
- $(LIBDECNUMBER) $(LIBBACKTRACE)
+ $(LIBDECNUMBER) $(LIBBACKTRACE) $(LIBGNU)

makes me think that the code in libiberty is found before the one in libgnu.

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-07 20:59     ` Manuel López-Ibáñez
@ 2016-07-08 19:30       ` ayush goel
  2016-07-10 16:05         ` Manuel López-Ibáñez
  0 siblings, 1 reply; 13+ messages in thread
From: ayush goel @ 2016-07-08 19:30 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

Yes, that’s correct. It has been moved before the libiberty library in the list now. Bootstrapped the system with the changes as well.

PFA the updated patch

--  
Thanks,  
Ayush Goel

On 8 July 2016 at 2:29:04 AM, Manuel López-Ibáñez (lopezibanez@gmail.com) wrote:
> On 7 July 2016 at 13:48, ayush goel wrote:
> > In order to show the setup works, I’ve replaced libiberty’s version by obstack by gnulib’s.  
> This was made possible by replacing the corresponding header file and then including  
> gnulib headers and gnulib static library in the build path required to compile gcc files.  
>  
> Hi Ayush,
>  
> I'm not an expert on the build machinery, so this question might be
> misguided: How do you know it is using the version in gnulib rather
> than the one in libiberty? I see it uses gnulib's header file but:
>  
> # Dependencies on the intl and portability libraries.
> LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
> - $(LIBDECNUMBER) $(LIBBACKTRACE)
> + $(LIBDECNUMBER) $(LIBBACKTRACE) $(LIBGNU)
>  
> makes me think that the code in libiberty is found before the one in libgnu.
>  
> Cheers,
>  
> Manuel.
>  

[-- Attachment #2: importgnulib_7_7 --]
[-- Type: application/octet-stream, Size: 19057 bytes --]

Index: src/Makefile.def
===================================================================
--- src/Makefile.def	(revision 237184)
+++ src/Makefile.def	(working copy)
@@ -25,6 +25,7 @@
 // that recursive target in its Makefile.
 
 build_modules= { module= libiberty; };
+build_modules= { module= gnulib; };
 build_modules= { module= bison; };
 build_modules= { module= flex; };
 build_modules= { module= m4; };
@@ -112,6 +113,8 @@
 host_modules= { module= zlib; no_install=true; no_check=true;
 		bootstrap=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
+host_modules= { module= gnulib;
+              bootstrap=true; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -342,6 +345,8 @@
 dependencies = { module=all-gcc; on=all-build-fixincludes; };
 dependencies = { module=all-gcc; on=all-build-libcpp; };
 dependencies = { module=all-gcc; on=all-zlib; };
+dependencies=  { module=all-gcc; on=all-gnulib; hard=true; };
+dependencies = { module=all-gcc; on=all-build-gnulib; };
 dependencies = { module=all-gcc; on=all-libbacktrace; hard=true; };
 dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
 dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
Index: src/configure.ac
===================================================================
--- src/configure.ac	(revision 237184)
+++ src/configure.ac	(working copy)
@@ -125,7 +125,7 @@
 # these library is used by various programs built for the build
 # environment
 #
-build_libs="build-libiberty build-libcpp"
+build_libs="build-libiberty build-libcpp build-gnulib"
 
 # these tools are built for the build environment
 build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
@@ -132,7 +132,7 @@
 
 # these libraries are used by various programs built for the host environment
 #f
-host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv"
+host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv gnulib"
 
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
Index: src/gcc/Makefile.in
===================================================================
--- src/gcc/Makefile.in	(revision 237184)
+++ src/gcc/Makefile.in	(working copy)
@@ -484,12 +484,14 @@
 
 # Where to find some libiberty headers.
 HASHTAB_H   = $(srcdir)/../include/hashtab.h
-OBSTACK_H   = $(srcdir)/../include/obstack.h
 SPLAY_TREE_H= $(srcdir)/../include/splay-tree.h
 MD5_H	    = $(srcdir)/../include/md5.h
 XREGEX_H    = $(srcdir)/../include/xregex.h
 FNMATCH_H   = $(srcdir)/../include/fnmatch.h
 
+# GNULIB headers
+OBSTACK_H   = $(srcdir)/../gnulib/import/obstack.h
+
 # Linker plugin API headers
 LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 
@@ -1022,9 +1024,13 @@
 BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
 endif
 
+# Where to find the gnulib library
+LIBGNU = ../gnulib/import/libgnu.a
+INCGNU = -I../gnulib -I$(srcdir)/../gnulib/import
+
 # Dependencies on the intl and portability libraries.
 LIBDEPS= libcommon.a $(CPPLIB) $(LIBGNU) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
-	$(LIBDECNUMBER) $(LIBBACKTRACE)
+	$(LIBDECNUMBER) $(LIBBACKTRACE)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -1066,7 +1072,7 @@
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
 	   -I$(srcdir)/../include @INCINTL@ \
 	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
-	   $(ISLINC)
+	   $(ISLINC) $(INCGNU)
 
 COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
 ifeq ($(CXXDEPMODE),depmode=gcc3)
Index: src/gnulib/Makefile.in
===================================================================
--- src/gnulib/Makefile.in	(nonexistent)
+++ src/gnulib/Makefile.in	(working copy)
@@ -0,0 +1,290 @@
+# Copyright (C) 1989-2016 Free Software Foundation, Inc.
+
+# This file is part of GCC.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(libdir)/$(target_alias)
+
+datadir = @datadir@
+localedir = @localedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+infodir = @infodir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+htmldir = @htmldir@
+pdfdir = @pdfdir@
+includedir = @includedir@
+
+SHELL = @SHELL@
+EXEEXT = @EXEEXT@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DESTDIR =
+
+AR = @AR@
+AR_FLAGS = qv
+RANLIB = @RANLIB@
+DLLTOOL = @DLLTOOL@
+
+SUBDIRS = import
+CLEANDIRS = $(SUBDIRS)
+REQUIRED_SUBDIRS = $(SUBDIRS)
+
+# If you are compiling with GCC, make sure that either 1) You have the
+# fixed include files where GCC can reach them, or 2) You use the
+# -traditional flag.  Otherwise the ioctl calls in inflow.c
+# will be incorrectly compiled.  The "fixincludes" script in the gcc
+# distribution will fix your include files up.
+CC=@CC@
+
+# Directory containing source files.
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC_LD=$(CC)
+
+# CFLAGS is specifically reserved for setting from the command line
+# when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
+CFLAGS = @CFLAGS@
+
+# LDFLAGS is specifically reserved for setting from the command line
+# when running make.
+LDFLAGS = @LDFLAGS@
+
+FLAGS_TO_PASS = \
+	"prefix=$(prefix)" \
+	"exec_prefix=$(exec_prefix)" \
+	"infodir=$(infodir)" \
+	"datarootdir=$(datarootdir)" \
+	"docdir=$(docdir)" \
+	"htmldir=$(htmldir)" \
+	"pdfdir=$(pdfdir)" \
+	"libdir=$(libdir)" \
+	"mandir=$(mandir)" \
+	"datadir=$(datadir)" \
+	"includedir=$(includedir)" \
+	"against=$(against)" \
+	"DESTDIR=$(DESTDIR)" \
+	"AR=$(AR)" \
+	"AR_FLAGS=$(AR_FLAGS)" \
+	"CC=$(CC)" \
+	"CFLAGS=$(CFLAGS)" \
+	"CXX=$(CXX)" \
+	"CXXFLAGS=$(CXXFLAGS)" \
+	"DLLTOOL=$(DLLTOOL)" \
+	"LDFLAGS=$(LDFLAGS)" \
+	"RANLIB=$(RANLIB)" \
+	"MAKEINFO=$(MAKEINFO)" \
+	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
+	"MAKEINFO_EXTRA_FLAGS=$(MAKEINFO_EXTRA_FLAGS)" \
+	"MAKEHTML=$(MAKEHTML)" \
+	"MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
+	"INSTALL=$(INSTALL)" \
+	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+	"INSTALL_DATA=$(INSTALL_DATA)" \
+	"RUNTEST=$(RUNTEST)" \
+	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
+
+all installcheck check info install-info clean-info dvi pdf install-pdf html install-html: force
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+# Traditionally "install" depends on "all".  But it may be useful
+# not to; for example, if the user has made some trivial change to a
+# source file and doesn't care about rebuilding or just wants to save the
+# time it takes for make to check that all is up to date.
+# install-only is intended to address that need.
+install: all
+	@$(MAKE) $(FLAGS_TO_PASS) install-only
+
+install-only: $(CONFIG_INSTALL)
+	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+uninstall: force $(CONFIG_UNINSTALL)
+	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+# Convenience rule to handle recursion.
+$(LIBGNU) $(GNULIB_H): all-lib
+all-lib: import/Makefile
+	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=import subdir_do
+.PHONY: all-lib
+
+clean mostlyclean: $(CONFIG_CLEAN)
+	@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
+
+distclean: clean
+	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
+	rm -f config.status config.h stamp-h
+	rm -f config.log config.cache
+	rm -f Makefile
+	rm -rf $(DEPDIR)
+
+maintainer-clean: local-maintainer-clean do-maintainer-clean distclean
+realclean: maintainer-clean
+
+local-maintainer-clean:
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+	rm -f config.status
+
+do-maintainer-clean:
+	@$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(CLEANDIRS)" \
+		subdir_do
+
+subdir_do: force
+	@for i in $(DODIRS); do \
+		case $$i in \
+		$(REQUIRED_SUBDIRS)) \
+			if [ ! -f ./$$i/Makefile ] ; then \
+				echo "Missing $$i/Makefile" >&2 ; \
+				exit 1 ; \
+			fi ;; \
+		esac ; \
+		if [ -f ./$$i/Makefile ] ; then \
+			if (cd ./$$i; \
+				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
+			else exit 1 ; fi ; \
+		else true ; fi ; \
+	done
+
+Makefile: Makefile.in config.status
+	# Regenerate the Makefile.
+	CONFIG_FILES="Makefile" \
+	  CONFIG_COMMANDS= \
+	  CONFIG_HEADERS= \
+	  $(SHELL) config.status
+
+gnulib/Makefile: gnulib/Makefile.in config.status
+	CONFIG_FILES="gnulib/Makefile" \
+	  CONFIG_COMMANDS="depfiles" \
+	  CONFIG_HEADERS= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.h: stamp-h ; @true
+stamp-h: $(srcdir)/config.in config.status
+	CONFIG_HEADERS=config.h:config.in \
+	  CONFIG_COMMANDS="default depdir" \
+	  CONFIG_FILES= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.status: $(srcdir)/configure
+	$(SHELL) config.status --recheck
+
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I import/m4 -I ../../config
+aclocal_m4_deps = \
+	configure.ac \
+	import/m4/00gnulib.m4 \
+	import/m4/alloca.m4 \
+	import/m4/codeset.m4 \
+	import/m4/configmake.m4 \
+	import/m4/extensions.m4 \
+	import/m4/fcntl-o.m4 \
+	import/m4/fnmatch.m4 \
+	import/m4/glibc21.m4 \
+	import/m4/gnulib-cache.m4 \
+	import/m4/gnulib-common.m4 \
+	import/m4/gnulib-comp.m4 \
+	import/m4/gnulib-tool.m4 \
+	import/m4/include_next.m4 \
+	import/m4/inttypes-pri.m4 \
+	import/m4/inttypes.m4 \
+	import/m4/localcharset.m4 \
+	import/m4/locale-fr.m4 \
+	import/m4/locale-ja.m4 \
+	import/m4/locale-zh.m4 \
+	import/m4/longlong.m4 \
+	import/m4/mbrtowc.m4 \
+	import/m4/mbsinit.m4 \
+	import/m4/mbsrtowcs.m4 \
+	import/m4/mbstate_t.m4 \
+	import/m4/memchr.m4 \
+	import/m4/memmem.m4 \
+	import/m4/mmap-anon.m4 \
+	import/m4/multiarch.m4 \
+	import/m4/off_t.m4 \
+	import/m4/pathmax.m4 \
+	import/m4/ssize_t.m4 \
+	import/m4/stdbool.m4 \
+	import/m4/stddef_h.m4 \
+	import/m4/stdint.m4 \
+	import/m4/obstack.m4 \
+	import/m4/strtok_r.m4 \
+	import/m4/sys_types_h.m4 \
+	import/m4/unistd_h.m4 \
+	import/m4/warn-on-use.m4 \
+	import/m4/wchar_h.m4 \
+	import/m4/wchar_t.m4 \
+	import/m4/wctype_h.m4 \
+	import/m4/wint_t.m4
+
+$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+AUTOCONF = autoconf
+configure_deps = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+
+AUTOHEADER = autoheader
+$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOHEADER)
+	rm -f stamp-h
+	touch $@
+
+# automatic rebuilding in automake-generated Makefiles requires
+# this rule in the toplevel Makefile, which, with GNU make, causes
+# the desired updates through the implicit regeneration of the Makefile
+# and all of its prerequisites.
+am--refresh:
+	@:
+
+force:
+
+force_update:
+
+# GNU Make has an annoying habit of putting *all* the Makefile variables
+# into the environment, unless you include this target as a circumvention.
+# Rumor is that this will be fixed (and this target can be removed)
+# in GNU Make 4.0.
+.NOEXPORT:
+
+# GNU Make 3.63 has a different problem: it keeps tacking command line
+# overrides onto the definition of $(MAKE).  This variable setting
+# will remove them.
+MAKEOVERRIDES=
+
+### end of the libgnu Makefile.in.
Index: src/gnulib/configure.ac
===================================================================
--- src/gnulib/configure.ac	(nonexistent)
+++ src/gnulib/configure.ac	(working copy)
@@ -0,0 +1,60 @@
+dnl Autoconf configure script for GCC.
+dnl Copyright (C) 1995-2016 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.64)dnl
+AC_INIT()
+AC_CONFIG_HEADER(config.h:config.in)
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_USE_SYSTEM_EXTENSIONS
+gl_EARLY
+AM_PROG_CC_STDC
+
+AC_CONFIG_AUX_DIR(..)
+AC_CANONICAL_SYSTEM
+
+gl_INIT
+
+# Gnulib uses automake.  This line lets gcc generate
+# its Makefile.in.
+AM_INIT_AUTOMAKE(libgnu, UNUSED-VERSION, [no-define])
+
+# --------------------- #
+# Checks for programs.  #
+# --------------------- #
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+
+AC_CHECK_TOOL(AR, ar)
+
+# ---------------------- #
+# Checks for libraries.  #
+# ---------------------- #
+
+AC_OUTPUT(Makefile import/Makefile,
+[
+case x$CONFIG_HEADERS in
+xconfig.h:config.in)
+echo > stamp-h ;;
+esac
+])
+
+exit 0
Index: src/gnulib/update-gnulib.sh
===================================================================
--- src/gnulib/update-gnulib.sh	(nonexistent)
+++ src/gnulib/update-gnulib.sh	(working copy)
@@ -0,0 +1,129 @@
+#! /bin/sh
+
+# Copyright (C) 2011-2016 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Usage: update-gnulib.sh <path-to-gnulib-repository>
+# Update our import of gnulib in the GCC source tree.
+#
+# This script assumes that it is being called from the gcc/gnulib
+# subdirectory.
+#
+# This script will also make a number of other verifications:
+#   . The gnulib version (it should match $GNULIB_COMMIT_SHA1).
+#   . The correct versions of the auto-tools that are used to
+#     regenerate the various scripts and Makefiles are on the PATH.
+
+# The list of gnulib modules we are importing in GCC.
+IMPORTED_GNULIB_MODULES="\
+    obstack \
+"
+
+# The gnulib commit ID to use for the update.
+GNULIB_COMMIT_SHA1="1029a8112290f6eee9d7878a391c49db42c999bd"
+
+# The expected version number for the various auto tools we will
+# use after the import.
+AUTOCONF_VERSION="2.69"
+AUTOMAKE_VERSION="1.15"
+ACLOCAL_VERSION="$AUTOMAKE_VERSION"
+
+if [ $# -ne 1 ]; then
+   echo "Error: Path to gnulib repository missing. Aborting."
+   echo "Usage: update-gnulib.sh <path-to-gnulib-repository>"
+   exit 1
+fi
+gnulib_prefix=$1
+
+gnulib_tool="$gnulib_prefix/gnulib-tool"
+
+# Verify that the gnulib directory does exist...
+if [ ! -f "$gnulib_tool" ]; then
+   echo "Error: Invalid gnulib directory. Cannot find gnulib tool"
+   echo "       ($gnulib_tool)."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the right version of gnulib...
+gnulib_head_sha1=`cd $gnulib_prefix && git rev-parse HEAD`
+if [ "$gnulib_head_sha1" != "$GNULIB_COMMIT_SHA1" ]; then
+   echo "Error: Wrong version of gnulib: $gnulib_head_sha1"
+   echo "       (we expected it to be $GNULIB_COMMIT_SHA1)"
+   echo "Aborting."
+   exit 1
+fi
+
+ver=`autoconf --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOCONF_VERSION" ]; then
+   echo "Error: Wrong autoconf version: $ver. Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of automake.
+ver=`automake --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOMAKE_VERSION" ]; then
+   echo "Error: Wrong automake version ($ver), we need $AUTOMAKE_VERSION."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of aclocal.
+#
+# The grep below is needed because Perl >= 5.16 dumps a "called too
+# early to check prototype" warning when running aclocal 1.11.1.  This
+# causes trouble below, because the warning is the first line output
+# by aclocal, resulting in:
+#
+# $ sh ./update-gnulib.sh ~/src/gnulib/src/
+# Error: Wrong aclocal version: called too early to check prototype at /opt/automake-1.11.1/bin/aclocal line 617.. Aborting.
+#
+# Some distros carry an automake patch for that:
+#  https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=aclocal-function-prototypes.debdiff;att=1;bug=752784
+#
+# But since we prefer pristine FSF versions of autotools, work around
+# the issue here.  This can be removed later when we bump the required
+# automake version.
+#
+ver=`aclocal --version 2>&1 | grep -v "called too early to check prototype" | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$ACLOCAL_VERSION" ]; then
+   echo "Error: Wrong aclocal version: $ver. Aborting."
+   exit 1
+fi
+
+# Update our gnulib import.
+$gnulib_prefix/gnulib-tool --import --dir=. --lib=libgnu \
+  --source-base=import --m4-base=import/m4 --doc-base=doc \
+  --tests-base=tests --aux-dir=import/extra \
+  --no-conditional-dependencies --no-libtool --macro-prefix=gl \
+  --no-vc-files \
+  $IMPORTED_GNULIB_MODULES
+if [ $? -ne 0 ]; then
+   echo "Error: gnulib import failed.  Aborting."
+   exit 1
+fi
+
+# Regenerate all necessary files...
+aclocal -Iimport/m4 &&
+autoconf &&
+autoheader &&
+automake
+if [ $? -ne 0 ]; then
+   echo "Error: Failed to regenerate Makefiles and configure scripts."
+   exit 1
+fi
+

Property changes on: src/gnulib/update-gnulib.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-08 19:30       ` ayush goel
@ 2016-07-10 16:05         ` Manuel López-Ibáñez
  2016-07-10 21:14           ` Manuel López-Ibáñez
  2016-07-16  9:54           ` ayush goel
  0 siblings, 2 replies; 13+ messages in thread
From: Manuel López-Ibáñez @ 2016-07-10 16:05 UTC (permalink / raw)
  To: ayush goel; +Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

Hi Ayush,

Some suggestions:

* When resubmitting a patch, also add again the Changelog.
* Use '.diff' or '.patch' as an extension, so that mail readers can
open the file as text.
* Mention that you have a copyright assignment in place already (I'm
assuming you have one already, no?).
* Mention how you regression tested your changes (on which targets?)
* In the case of these changes, and as further testing, it would be
good if you tried locally to remove obstack.[ch] from libiberty to
make sure nothing in GCC is using it. I don't think we can actually
remove it because it may be used by other projects using libiberty,
however, as your first submission showed, it is not always evident
that everything in GCC is using the gnulib version.

Cheers,

Manuel.


On 8 July 2016 at 20:30, ayush goel <ayushgoel1610@gmail.com> wrote:
> Yes, that’s correct. It has been moved before the libiberty library in the list now. Bootstrapped the system with the changes as well.
>
> PFA the updated patch
>
> --
> Thanks,
> Ayush Goel
>
> On 8 July 2016 at 2:29:04 AM, Manuel López-Ibáñez (lopezibanez@gmail.com) wrote:
>> On 7 July 2016 at 13:48, ayush goel wrote:
>> > In order to show the setup works, I’ve replaced libiberty’s version by obstack by gnulib’s.
>> This was made possible by replacing the corresponding header file and then including
>> gnulib headers and gnulib static library in the build path required to compile gcc files.
>>
>> Hi Ayush,
>>
>> I'm not an expert on the build machinery, so this question might be
>> misguided: How do you know it is using the version in gnulib rather
>> than the one in libiberty? I see it uses gnulib's header file but:
>>
>> # Dependencies on the intl and portability libraries.
>> LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
>> - $(LIBDECNUMBER) $(LIBBACKTRACE)
>> + $(LIBDECNUMBER) $(LIBBACKTRACE) $(LIBGNU)
>>
>> makes me think that the code in libiberty is found before the one in libgnu.
>>
>> Cheers,
>>
>> Manuel.
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-10 16:05         ` Manuel López-Ibáñez
@ 2016-07-10 21:14           ` Manuel López-Ibáñez
  2016-07-10 23:30             ` David Malcolm
  2016-07-16  9:54           ` ayush goel
  1 sibling, 1 reply; 13+ messages in thread
From: Manuel López-Ibáñez @ 2016-07-10 21:14 UTC (permalink / raw)
  To: ayush goel; +Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

On 10 July 2016 at 17:04, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> Hi Ayush,
>
> Some suggestions:

Also, it may be a good idea to configure with:

--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --enable-multilib

so that you get as much coverage as possible.

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-10 21:14           ` Manuel López-Ibáñez
@ 2016-07-10 23:30             ` David Malcolm
  0 siblings, 0 replies; 13+ messages in thread
From: David Malcolm @ 2016-07-10 23:30 UTC (permalink / raw)
  To: Manuel López-Ibáñez, ayush goel
  Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

On Sun, 2016-07-10 at 22:13 +0100, Manuel López-Ibáñez wrote:
> On 10 July 2016 at 17:04, Manuel López-Ibáñez <lopezibanez@gmail.com>
> wrote:
> > Hi Ayush,
> > 
> > Some suggestions:
> 
> Also, it may be a good idea to configure with:
> 
> --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --enable
> -multilib
> 
> so that you get as much coverage as possible.

Please add "jit" to the list of enabled languages when testing big
changes.  It requires --enable-host-shared.  It's probably worth
testing both with and without --enable-host-shared, for that matter...
(omitting jit for the latter).

Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-10 16:05         ` Manuel López-Ibáñez
  2016-07-10 21:14           ` Manuel López-Ibáñez
@ 2016-07-16  9:54           ` ayush goel
  2016-07-17 16:14             ` Manuel López-Ibáñez
  1 sibling, 1 reply; 13+ messages in thread
From: ayush goel @ 2016-07-16  9:54 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 5675 bytes --]

Hi,
Thanks for the feedbacks.

—> I’m already configuring gcc with multiple languages and multilib enabled

—> The changes have been bootstrapped and regression tested (complete check, make -k -j20 check).

—> As mentioned, I have locally removed obstack.[ch] from libiberty and built and tested the entire thing. 

PFA the patch

ChangeLog:

15-7-16 Ayush Goel <ayushgoel1610@gmail.com> 

* Makefile.def: Added gnulib as build & host library and dependency of all-gcc on gnulib 
* Makefile.in: regenerated 
* configure.ac: Added gnulib as build and host library 
* configure: regenerated 
* gcc/Makefile.in: Added path to gnulib static library (libgnu.a) and gnulib header files
* gnulib: created directory 
* gnulib/Makefile.in: new file 
* gnulib/configure.ac: new file 
* gnulib/update-gnulib.sh: script to import gnulib modules using gnulib-tool 
* gnulib/import: created by update-gnulib.sh 
* gnulib/import/Makefile.in: imported from gnulib  
* gnulib/import/alignof.h: Imported from gnulib  
* gnulib/import/exitfail.c: Imported from gnulib  
* gnulib/import/exitfail.h: Imported from gnulib  
* gnulib/import/extra: Imported from gnulib  
* gnulib/import/extra/snippet: Imported from gnulib  
* gnulib/import/extra/snippet/_Noreturn.h: Imported from gnulib  
* gnulib/import/extra/snippet/arg-nonnull.h: Imported from gnulib  
* gnulib/import/extra/snippet/c++defs.h: Imported from gnulib  
* gnulib/import/extra/snippet/warn-on-use.h: Imported from gnulib  
* gnulib/import/gettext.h: Imported from gnulib  
* gnulib/import/m4: Imported from gnulib  
* gnulib/import/m4/00gnulib.m4: Imported from gnulib  
* gnulib/import/m4/absolute-header.m4: Imported from gnulib  
* gnulib/import/m4/extern-inline.m4: Imported from gnulib  
* gnulib/import/m4/gnulib-cache.m4: Imported from gnulib  
* gnulib/import/m4/gnulib-common.m4: Imported from gnulib  
* gnulib/import/m4/gnulib-comp.m4: Imported from gnulib  
* gnulib/import/m4/gnulib-tool.m4: Imported from gnulib  
* gnulib/import/m4/include_next.m4: Imported from gnulib  
* gnulib/import/m4/longlong.m4: Imported from gnulib  
* gnulib/import/m4/multiarch.m4: Imported from gnulib  
* gnulib/import/m4/obstack.m4: Imported from gnulib  
* gnulib/import/m4/off_t.m4: Imported from gnulib  
* gnulib/import/m4/ssize_t.m4: Imported from gnulib  
* gnulib/import/m4/stddef_h.m4: Imported from gnulib  
* gnulib/import/m4/stdint.m4: Imported from gnulib  
* gnulib/import/m4/stdlib_h.m4: Imported from gnulib  
* gnulib/import/m4/sys_types_h.m4: Imported from gnulib  
* gnulib/import/m4/unistd_h.m4: Imported from gnulib  
* gnulib/import/m4/warn-on-use.m4: Imported from gnulib  
* gnulib/import/m4/wchar_t.m4: Imported from gnulib  
* gnulib/import/obstack.c: Imported from gnulib
* gnulib/import/obstack.h: Imported from gnulib  
* gnulib/import/stddef.in.h: Imported from gnulib  
* gnulib/import/stdint.in.h: Imported from gnulib  
* gnulib/import/stdlib.in.h: Imported from gnulib  
* gnulib/import/sys: Imported from gnulib  
* gnulib/import/sys_types.in.h: Imported from gnulib  
* gnulib/import/unistd.c: Imported from gnulib  
* gnulib/import/unistd.in.h: Imported from gnulib  
* gnulib/stamp-h1: generated 

Also note that I have a copyright assignment in place already.

--  
Thanks,  
Ayush Goel

On 10 July 2016 at 9:35:27 PM, Manuel López-Ibáñez (lopezibanez@gmail.com) wrote:
> Hi Ayush,
>  
> Some suggestions:
>  
> * When resubmitting a patch, also add again the Changelog.
> * Use '.diff' or '.patch' as an extension, so that mail readers can
> open the file as text.
> * Mention that you have a copyright assignment in place already (I'm
> assuming you have one already, no?).
> * Mention how you regression tested your changes (on which targets?)
> * In the case of these changes, and as further testing, it would be
> good if you tried locally to remove obstack.[ch] from libiberty to
> make sure nothing in GCC is using it. I don't think we can actually
> remove it because it may be used by other projects using libiberty,
> however, as your first submission showed, it is not always evident
> that everything in GCC is using the gnulib version.
>  
> Cheers,
>  
> Manuel.
>  
>  
> On 8 July 2016 at 20:30, ayush goel wrote:
> > Yes, that’s correct. It has been moved before the libiberty library in the list now.  
> Bootstrapped the system with the changes as well.
> >
> > PFA the updated patch
> >
> > --
> > Thanks,
> > Ayush Goel
> >
> > On 8 July 2016 at 2:29:04 AM, Manuel López-Ibáñez (lopezibanez@gmail.com) wrote:  
> >> On 7 July 2016 at 13:48, ayush goel wrote:
> >> > In order to show the setup works, I’ve replaced libiberty’s version by obstack by  
> gnulib’s.
> >> This was made possible by replacing the corresponding header file and then including  
> >> gnulib headers and gnulib static library in the build path required to compile gcc  
> files.
> >>
> >> Hi Ayush,
> >>
> >> I'm not an expert on the build machinery, so this question might be
> >> misguided: How do you know it is using the version in gnulib rather
> >> than the one in libiberty? I see it uses gnulib's header file but:
> >>
> >> # Dependencies on the intl and portability libraries.
> >> LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP)  
> \
> >> - $(LIBDECNUMBER) $(LIBBACKTRACE)
> >> + $(LIBDECNUMBER) $(LIBBACKTRACE) $(LIBGNU)
> >>
> >> makes me think that the code in libiberty is found before the one in libgnu.
> >>
> >> Cheers,
> >>
> >> Manuel.
> >>
>  

[-- Attachment #2: importgnulib_7_25.patch --]
[-- Type: application/octet-stream, Size: 19975 bytes --]

Index: src/Makefile.def
===================================================================
--- src/Makefile.def	(revision 237184)
+++ src/Makefile.def	(working copy)
@@ -25,6 +25,7 @@
 // that recursive target in its Makefile.
 
 build_modules= { module= libiberty; };
+build_modules= { module= gnulib; };
 build_modules= { module= bison; };
 build_modules= { module= flex; };
 build_modules= { module= m4; };
@@ -112,6 +113,8 @@
 host_modules= { module= zlib; no_install=true; no_check=true;
 		bootstrap=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
+host_modules= { module= gnulib;
+              bootstrap=true; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -342,6 +345,8 @@
 dependencies = { module=all-gcc; on=all-build-fixincludes; };
 dependencies = { module=all-gcc; on=all-build-libcpp; };
 dependencies = { module=all-gcc; on=all-zlib; };
+dependencies=  { module=all-gcc; on=all-gnulib; hard=true; };
+dependencies = { module=all-gcc; on=all-build-gnulib; };
 dependencies = { module=all-gcc; on=all-libbacktrace; hard=true; };
 dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
 dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
Index: src/configure.ac
===================================================================
--- src/configure.ac	(revision 237184)
+++ src/configure.ac	(working copy)
@@ -125,7 +125,7 @@
 # these library is used by various programs built for the build
 # environment
 #
-build_libs="build-libiberty build-libcpp"
+build_libs="build-libiberty build-libcpp build-gnulib"
 
 # these tools are built for the build environment
 build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
@@ -132,7 +132,7 @@
 
 # these libraries are used by various programs built for the host environment
 #f
-host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv"
+host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv gnulib"
 
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
Index: src/gcc/Makefile.in
===================================================================
--- src/gcc/Makefile.in	(revision 237184)
+++ src/gcc/Makefile.in	(working copy)
@@ -484,12 +484,14 @@
 
 # Where to find some libiberty headers.
 HASHTAB_H   = $(srcdir)/../include/hashtab.h
-OBSTACK_H   = $(srcdir)/../include/obstack.h
 SPLAY_TREE_H= $(srcdir)/../include/splay-tree.h
 MD5_H	    = $(srcdir)/../include/md5.h
 XREGEX_H    = $(srcdir)/../include/xregex.h
 FNMATCH_H   = $(srcdir)/../include/fnmatch.h
 
+# GNULIB headers
+OBSTACK_H   = $(srcdir)/../gnulib/import/obstack.h
+
 # Linker plugin API headers
 LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 
@@ -1022,18 +1024,23 @@
 BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
 endif
 
+# Where to find the gnulib library
+LIBGNU = ../gnulib/import/libgnu.a
+BUILD_LIBGNU= $(build_libobjdir)/gnulib/import/libgnu.a
+INCGNU = -I../gnulib -I$(srcdir)/../gnulib/import
+
 # Dependencies on the intl and portability libraries.
-LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
+LIBDEPS= libcommon.a $(CPPLIB) $(LIBGNU) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
 	$(LIBDECNUMBER) $(LIBBACKTRACE)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
-BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
+BUILD_LIBDEPS= $(BUILD_LIBGNU) $(BUILD_LIBIBERTY)
 
 # How to link with both our special library facilities
 # and the system's installed libraries.
 LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
-	$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
+	$(LIBGNU) $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
 BACKENDLIBS = $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
 	$(ZLIB)
 # Any system libraries needed just for GNAT.
@@ -1048,7 +1055,7 @@
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
-BUILD_LIBS = $(BUILD_LIBIBERTY)
+BUILD_LIBS = $(BUILD_LIBGNU) $(BUILD_LIBIBERTY)
 
 BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
 	    build/vec.o build/min-insn-modes.o build/gensupport.o \
@@ -1066,7 +1073,7 @@
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
 	   -I$(srcdir)/../include @INCINTL@ \
 	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
-	   $(ISLINC)
+	   $(ISLINC) $(INCGNU)
 
 COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
 ifeq ($(CXXDEPMODE),depmode=gcc3)
Index: src/gnulib/Makefile.in
===================================================================
--- src/gnulib/Makefile.in	(nonexistent)
+++ src/gnulib/Makefile.in	(working copy)
@@ -0,0 +1,290 @@
+# Copyright (C) 1989-2016 Free Software Foundation, Inc.
+
+# This file is part of GCC.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(libdir)/$(target_alias)
+
+datadir = @datadir@
+localedir = @localedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+infodir = @infodir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+htmldir = @htmldir@
+pdfdir = @pdfdir@
+includedir = @includedir@
+
+SHELL = @SHELL@
+EXEEXT = @EXEEXT@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DESTDIR =
+
+AR = @AR@
+AR_FLAGS = qv
+RANLIB = @RANLIB@
+DLLTOOL = @DLLTOOL@
+
+SUBDIRS = import
+CLEANDIRS = $(SUBDIRS)
+REQUIRED_SUBDIRS = $(SUBDIRS)
+
+# If you are compiling with GCC, make sure that either 1) You have the
+# fixed include files where GCC can reach them, or 2) You use the
+# -traditional flag.  Otherwise the ioctl calls in inflow.c
+# will be incorrectly compiled.  The "fixincludes" script in the gcc
+# distribution will fix your include files up.
+CC=@CC@
+
+# Directory containing source files.
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC_LD=$(CC)
+
+# CFLAGS is specifically reserved for setting from the command line
+# when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
+CFLAGS = @CFLAGS@
+
+# LDFLAGS is specifically reserved for setting from the command line
+# when running make.
+LDFLAGS = @LDFLAGS@
+
+FLAGS_TO_PASS = \
+	"prefix=$(prefix)" \
+	"exec_prefix=$(exec_prefix)" \
+	"infodir=$(infodir)" \
+	"datarootdir=$(datarootdir)" \
+	"docdir=$(docdir)" \
+	"htmldir=$(htmldir)" \
+	"pdfdir=$(pdfdir)" \
+	"libdir=$(libdir)" \
+	"mandir=$(mandir)" \
+	"datadir=$(datadir)" \
+	"includedir=$(includedir)" \
+	"against=$(against)" \
+	"DESTDIR=$(DESTDIR)" \
+	"AR=$(AR)" \
+	"AR_FLAGS=$(AR_FLAGS)" \
+	"CC=$(CC)" \
+	"CFLAGS=$(CFLAGS)" \
+	"CXX=$(CXX)" \
+	"CXXFLAGS=$(CXXFLAGS)" \
+	"DLLTOOL=$(DLLTOOL)" \
+	"LDFLAGS=$(LDFLAGS)" \
+	"RANLIB=$(RANLIB)" \
+	"MAKEINFO=$(MAKEINFO)" \
+	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
+	"MAKEINFO_EXTRA_FLAGS=$(MAKEINFO_EXTRA_FLAGS)" \
+	"MAKEHTML=$(MAKEHTML)" \
+	"MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
+	"INSTALL=$(INSTALL)" \
+	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+	"INSTALL_DATA=$(INSTALL_DATA)" \
+	"RUNTEST=$(RUNTEST)" \
+	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
+
+all installcheck check info install-info clean-info dvi pdf install-pdf html install-html: force
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+# Traditionally "install" depends on "all".  But it may be useful
+# not to; for example, if the user has made some trivial change to a
+# source file and doesn't care about rebuilding or just wants to save the
+# time it takes for make to check that all is up to date.
+# install-only is intended to address that need.
+install: all
+	@$(MAKE) $(FLAGS_TO_PASS) install-only
+
+install-only: $(CONFIG_INSTALL)
+	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+uninstall: force $(CONFIG_UNINSTALL)
+	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
+# Convenience rule to handle recursion.
+$(LIBGNU) $(GNULIB_H): all-lib
+all-lib: import/Makefile
+	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=import subdir_do
+.PHONY: all-lib
+
+clean mostlyclean: $(CONFIG_CLEAN)
+	@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
+
+distclean: clean
+	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
+	rm -f config.status config.h stamp-h
+	rm -f config.log config.cache
+	rm -f Makefile
+	rm -rf $(DEPDIR)
+
+maintainer-clean: local-maintainer-clean do-maintainer-clean distclean
+realclean: maintainer-clean
+
+local-maintainer-clean:
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+	rm -f config.status
+
+do-maintainer-clean:
+	@$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(CLEANDIRS)" \
+		subdir_do
+
+subdir_do: force
+	@for i in $(DODIRS); do \
+		case $$i in \
+		$(REQUIRED_SUBDIRS)) \
+			if [ ! -f ./$$i/Makefile ] ; then \
+				echo "Missing $$i/Makefile" >&2 ; \
+				exit 1 ; \
+			fi ;; \
+		esac ; \
+		if [ -f ./$$i/Makefile ] ; then \
+			if (cd ./$$i; \
+				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
+			else exit 1 ; fi ; \
+		else true ; fi ; \
+	done
+
+Makefile: Makefile.in config.status
+	# Regenerate the Makefile.
+	CONFIG_FILES="Makefile" \
+	  CONFIG_COMMANDS= \
+	  CONFIG_HEADERS= \
+	  $(SHELL) config.status
+
+gnulib/Makefile: gnulib/Makefile.in config.status
+	CONFIG_FILES="gnulib/Makefile" \
+	  CONFIG_COMMANDS="depfiles" \
+	  CONFIG_HEADERS= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.h: stamp-h ; @true
+stamp-h: $(srcdir)/config.in config.status
+	CONFIG_HEADERS=config.h:config.in \
+	  CONFIG_COMMANDS="default depdir" \
+	  CONFIG_FILES= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.status: $(srcdir)/configure
+	$(SHELL) config.status --recheck
+
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I import/m4 -I ../../config
+aclocal_m4_deps = \
+	configure.ac \
+	import/m4/00gnulib.m4 \
+	import/m4/alloca.m4 \
+	import/m4/codeset.m4 \
+	import/m4/configmake.m4 \
+	import/m4/extensions.m4 \
+	import/m4/fcntl-o.m4 \
+	import/m4/fnmatch.m4 \
+	import/m4/glibc21.m4 \
+	import/m4/gnulib-cache.m4 \
+	import/m4/gnulib-common.m4 \
+	import/m4/gnulib-comp.m4 \
+	import/m4/gnulib-tool.m4 \
+	import/m4/include_next.m4 \
+	import/m4/inttypes-pri.m4 \
+	import/m4/inttypes.m4 \
+	import/m4/localcharset.m4 \
+	import/m4/locale-fr.m4 \
+	import/m4/locale-ja.m4 \
+	import/m4/locale-zh.m4 \
+	import/m4/longlong.m4 \
+	import/m4/mbrtowc.m4 \
+	import/m4/mbsinit.m4 \
+	import/m4/mbsrtowcs.m4 \
+	import/m4/mbstate_t.m4 \
+	import/m4/memchr.m4 \
+	import/m4/memmem.m4 \
+	import/m4/mmap-anon.m4 \
+	import/m4/multiarch.m4 \
+	import/m4/off_t.m4 \
+	import/m4/pathmax.m4 \
+	import/m4/ssize_t.m4 \
+	import/m4/stdbool.m4 \
+	import/m4/stddef_h.m4 \
+	import/m4/stdint.m4 \
+	import/m4/obstack.m4 \
+	import/m4/strtok_r.m4 \
+	import/m4/sys_types_h.m4 \
+	import/m4/unistd_h.m4 \
+	import/m4/warn-on-use.m4 \
+	import/m4/wchar_h.m4 \
+	import/m4/wchar_t.m4 \
+	import/m4/wctype_h.m4 \
+	import/m4/wint_t.m4
+
+$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+AUTOCONF = autoconf
+configure_deps = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+
+AUTOHEADER = autoheader
+$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(configure_deps)
+	cd $(srcdir) && $(AUTOHEADER)
+	rm -f stamp-h
+	touch $@
+
+# automatic rebuilding in automake-generated Makefiles requires
+# this rule in the toplevel Makefile, which, with GNU make, causes
+# the desired updates through the implicit regeneration of the Makefile
+# and all of its prerequisites.
+am--refresh:
+	@:
+
+force:
+
+force_update:
+
+# GNU Make has an annoying habit of putting *all* the Makefile variables
+# into the environment, unless you include this target as a circumvention.
+# Rumor is that this will be fixed (and this target can be removed)
+# in GNU Make 4.0.
+.NOEXPORT:
+
+# GNU Make 3.63 has a different problem: it keeps tacking command line
+# overrides onto the definition of $(MAKE).  This variable setting
+# will remove them.
+MAKEOVERRIDES=
+
+### end of the libgnu Makefile.in.
Index: src/gnulib/configure.ac
===================================================================
--- src/gnulib/configure.ac	(nonexistent)
+++ src/gnulib/configure.ac	(working copy)
@@ -0,0 +1,60 @@
+dnl Autoconf configure script for GCC.
+dnl Copyright (C) 1995-2016 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.64)dnl
+AC_INIT()
+AC_CONFIG_HEADER(config.h:config.in)
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_USE_SYSTEM_EXTENSIONS
+gl_EARLY
+AM_PROG_CC_STDC
+
+AC_CONFIG_AUX_DIR(..)
+AC_CANONICAL_SYSTEM
+
+gl_INIT
+
+# Gnulib uses automake.  This line lets gcc generate
+# its Makefile.in.
+AM_INIT_AUTOMAKE(libgnu, UNUSED-VERSION, [no-define])
+
+# --------------------- #
+# Checks for programs.  #
+# --------------------- #
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+
+AC_CHECK_TOOL(AR, ar)
+
+# ---------------------- #
+# Checks for libraries.  #
+# ---------------------- #
+
+AC_OUTPUT(Makefile import/Makefile,
+[
+case x$CONFIG_HEADERS in
+xconfig.h:config.in)
+echo > stamp-h ;;
+esac
+])
+
+exit 0
Index: src/gnulib/update-gnulib.sh
===================================================================
--- src/gnulib/update-gnulib.sh	(nonexistent)
+++ src/gnulib/update-gnulib.sh	(working copy)
@@ -0,0 +1,129 @@
+#! /bin/sh
+
+# Copyright (C) 2011-2016 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Usage: update-gnulib.sh <path-to-gnulib-repository>
+# Update our import of gnulib in the GCC source tree.
+#
+# This script assumes that it is being called from the gcc/gnulib
+# subdirectory.
+#
+# This script will also make a number of other verifications:
+#   . The gnulib version (it should match $GNULIB_COMMIT_SHA1).
+#   . The correct versions of the auto-tools that are used to
+#     regenerate the various scripts and Makefiles are on the PATH.
+
+# The list of gnulib modules we are importing in GCC.
+IMPORTED_GNULIB_MODULES="\
+    obstack \
+"
+
+# The gnulib commit ID to use for the update.
+GNULIB_COMMIT_SHA1="1029a8112290f6eee9d7878a391c49db42c999bd"
+
+# The expected version number for the various auto tools we will
+# use after the import.
+AUTOCONF_VERSION="2.69"
+AUTOMAKE_VERSION="1.15"
+ACLOCAL_VERSION="$AUTOMAKE_VERSION"
+
+if [ $# -ne 1 ]; then
+   echo "Error: Path to gnulib repository missing. Aborting."
+   echo "Usage: update-gnulib.sh <path-to-gnulib-repository>"
+   exit 1
+fi
+gnulib_prefix=$1
+
+gnulib_tool="$gnulib_prefix/gnulib-tool"
+
+# Verify that the gnulib directory does exist...
+if [ ! -f "$gnulib_tool" ]; then
+   echo "Error: Invalid gnulib directory. Cannot find gnulib tool"
+   echo "       ($gnulib_tool)."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the right version of gnulib...
+gnulib_head_sha1=`cd $gnulib_prefix && git rev-parse HEAD`
+if [ "$gnulib_head_sha1" != "$GNULIB_COMMIT_SHA1" ]; then
+   echo "Error: Wrong version of gnulib: $gnulib_head_sha1"
+   echo "       (we expected it to be $GNULIB_COMMIT_SHA1)"
+   echo "Aborting."
+   exit 1
+fi
+
+ver=`autoconf --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOCONF_VERSION" ]; then
+   echo "Error: Wrong autoconf version: $ver. Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of automake.
+ver=`automake --version 2>&1 | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$AUTOMAKE_VERSION" ]; then
+   echo "Error: Wrong automake version ($ver), we need $AUTOMAKE_VERSION."
+   echo "Aborting."
+   exit 1
+fi
+
+# Verify that we have the correct version of aclocal.
+#
+# The grep below is needed because Perl >= 5.16 dumps a "called too
+# early to check prototype" warning when running aclocal 1.11.1.  This
+# causes trouble below, because the warning is the first line output
+# by aclocal, resulting in:
+#
+# $ sh ./update-gnulib.sh ~/src/gnulib/src/
+# Error: Wrong aclocal version: called too early to check prototype at /opt/automake-1.11.1/bin/aclocal line 617.. Aborting.
+#
+# Some distros carry an automake patch for that:
+#  https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=aclocal-function-prototypes.debdiff;att=1;bug=752784
+#
+# But since we prefer pristine FSF versions of autotools, work around
+# the issue here.  This can be removed later when we bump the required
+# automake version.
+#
+ver=`aclocal --version 2>&1 | grep -v "called too early to check prototype" | head -1 | sed 's/.*) //'`
+if [ "$ver" != "$ACLOCAL_VERSION" ]; then
+   echo "Error: Wrong aclocal version: $ver. Aborting."
+   exit 1
+fi
+
+# Update our gnulib import.
+$gnulib_prefix/gnulib-tool --import --dir=. --lib=libgnu \
+  --source-base=import --m4-base=import/m4 --doc-base=doc \
+  --tests-base=tests --aux-dir=import/extra \
+  --no-conditional-dependencies --no-libtool --macro-prefix=gl \
+  --no-vc-files \
+  $IMPORTED_GNULIB_MODULES
+if [ $? -ne 0 ]; then
+   echo "Error: gnulib import failed.  Aborting."
+   exit 1
+fi
+
+# Regenerate all necessary files...
+aclocal -Iimport/m4 &&
+autoconf &&
+autoheader &&
+automake
+if [ $? -ne 0 ]; then
+   echo "Error: Failed to regenerate Makefiles and configure scripts."
+   exit 1
+fi
+

Property changes on: src/gnulib/update-gnulib.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-16  9:54           ` ayush goel
@ 2016-07-17 16:14             ` Manuel López-Ibáñez
  2016-07-18 15:12               ` ayush goel
  0 siblings, 1 reply; 13+ messages in thread
From: Manuel López-Ibáñez @ 2016-07-17 16:14 UTC (permalink / raw)
  To: ayush goel; +Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

On 16 July 2016 at 10:54, ayush goel <ayushgoel1610@gmail.com> wrote:
> Hi,
> Thanks for the feedbacks.
>
> —> I’m already configuring gcc with multiple languages and multilib enabled
>
> —> The changes have been bootstrapped and regression tested (complete check, make -k -j20 check).
>
> —> As mentioned, I have locally removed obstack.[ch] from libiberty and built and tested the entire thing.
>
> PFA the patch

This sounds great to me, but I cannot approve it. I hope some of the
people who can will comment on it.

One thing that I miss is documenting gnulib in doc/sourcebuild.texi.
It would be good to document in particular how to add a new module.
GDB has: https://sourceware.org/gdb/wiki/DeveloperTips#Updating_GDB.27s_import_of_gnulib
but I think this info should be in sourcebuild.texi (or somewhere else
under doc/).

 I see several other mentions of libiberty in doc/, but some of them
may be just using libiberty as an example, thus not relevant.

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-17 16:14             ` Manuel López-Ibáñez
@ 2016-07-18 15:12               ` ayush goel
  2016-08-21 18:42                 ` Gerald Pfeifer
  0 siblings, 1 reply; 13+ messages in thread
From: ayush goel @ 2016-07-18 15:12 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Paolo Bonzini, DJ Delorie, Joseph Myers, Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]

Replies inline

--  
Thanks,  
Ayush Goel

On 17 July 2016 at 9:44:27 PM, Manuel López-Ibáñez (lopezibanez@gmail.com) wrote:
> On 16 July 2016 at 10:54, ayush goel wrote:
> > Hi,
> > Thanks for the feedbacks.
> >
> > —> I’m already configuring gcc with multiple languages and multilib enabled
> >
> > —> The changes have been bootstrapped and regression tested (complete check, make  
> -k -j20 check).
> >
> > —> As mentioned, I have locally removed obstack.[ch] from libiberty and built and tested  
> the entire thing.
> >
> > PFA the patch
>  
> This sounds great to me, but I cannot approve it. I hope some of the
> people who can will comment on it.
>  
> One thing that I miss is documenting gnulib in doc/sourcebuild.texi.

I’ve added gnulib as an entry in sourcebuild.texi

> It would be good to document in particular how to add a new module.
> GDB has: https://sourceware.org/gdb/wiki/DeveloperTips#Updating_GDB.27s_import_of_gnulib  
> but I think this info should be in sourcebuild.texi (or somewhere else
> under doc/).
> 

This wiki pages talks mostly of how to update the version of gnulib present inside the gdb directory.
I’ve instead created a gnulib-import.texi file inside /doc with bullet points on how to import a new module.

> I see several other mentions of libiberty in doc/, but some of them
> may be just using libiberty as an example, thus not relevant.
> 

Yes, there are several other mentions of libiberty (in contrib.texi, install.texi, invoke.texi etc) however these are not relevant to us.

I’m attaching a patch just containing the changes made in the /doc. Once these are approved by the community, I’ll add them to the main patch and resubmit it.

PFA


> Cheers,
>  
> Manuel.
>  

[-- Attachment #2: gcc_doc.patch --]
[-- Type: application/octet-stream, Size: 1108 bytes --]

Index: sourcebuild.texi
===================================================================
--- sourcebuild.texi	(revision 237184)
+++ sourcebuild.texi	(working copy)
@@ -97,6 +97,9 @@
 Introduction, libiberty, @sc{gnu} libiberty}, for more information
 about this library.
 
+@item libgnu
+Gnulib - The GNU portability library
+
 @item libitm
 The runtime support library for transactional memory.
 
Index: gnulib-import.texi
===================================================================
--- gnulib-import.texi	(nonexistent)
+++ gnulib-import.texi	(working copy)
@@ -0,0 +1,16 @@
+@c Copyright (C) 1988-2016 Free Software Foundation, Inc.
+@c This is part of the GCC manual.
+@c For copying conditions, see the file gcc.texi.
+
+@node Import gnulib modules
+
+In order to import a new module from gnulib, the following steps need to be executed, in order.
+
+@itemize @bullet
+@item
+Enter the name of the module to be imported in src/gnulib/update-gnulib.sh under IMPORTED_GNULIB_MODULES.
+
+@item
+Run the file update-gnulib.sh. Usage: update-gnulib.sh <path-to-gnulib-repository>  
+
+@end itemize

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Importing gnulib into the gcc tree
  2016-07-18 15:12               ` ayush goel
@ 2016-08-21 18:42                 ` Gerald Pfeifer
  0 siblings, 0 replies; 13+ messages in thread
From: Gerald Pfeifer @ 2016-08-21 18:42 UTC (permalink / raw)
  To: ayush goel
  Cc: Manuel López-Ibáñez, Paolo Bonzini, DJ Delorie,
	Joseph Myers, Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

Hi Ayush,

On Mon, 18 Jul 2016, ayush goel wrote:
> I’m attaching a patch just containing the changes made in the /doc. 

a couple of comments.
 
Index: gnulib-import.texi
===================================================================
--- gnulib-import.texi	(nonexistent)
+++ gnulib-import.texi	(working copy)
@@ -0,0 +1,16 @@
+@c Copyright (C) 1988-2016 Free Software Foundation, Inc.

For a new file, just 2016 should be fine.

+In order to import a new module from gnulib, the following steps need to be executed, in order.

This line is a bit long; try to avoid more than 78 columns (80 being the
strict maximum).  Same also below.

+Enter the name of the module to be imported in src/gnulib/update-gnulib.sh under IMPORTED_GNULIB_MODULES.

That is a filename, thus @file{src/gnulib/update-gnulib.sh}.

And @code{IMPORTED_GNULIB_MODULES}.

+@item
+Run the file update-gnulib.sh. Usage: update-gnulib.sh <path-to-gnulib-repository>  

I'm not completely sure whether @file{update-gnulib.sh} or
@command{update-gnulib.sh}; feels like a corner case.

And @var{path-to-gnulib-repository}.

Invocations usally are marked up as

  @smallexample
  gcc -o out -O2 in.c plus.c
  @end smallexample


With those changes, the documentation changes seem fine.

Gerald

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-08-21 18:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-25 15:02 Importing gnulib into the gcc tree ayush goel
2016-06-25 21:57 ` Jakub Sejdak
2016-06-27 18:02 ` Joseph Myers
2016-07-07 12:48   ` ayush goel
2016-07-07 20:59     ` Manuel López-Ibáñez
2016-07-08 19:30       ` ayush goel
2016-07-10 16:05         ` Manuel López-Ibáñez
2016-07-10 21:14           ` Manuel López-Ibáñez
2016-07-10 23:30             ` David Malcolm
2016-07-16  9:54           ` ayush goel
2016-07-17 16:14             ` Manuel López-Ibáñez
2016-07-18 15:12               ` ayush goel
2016-08-21 18:42                 ` Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).