This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH build/doc] Replacing libiberty with gnulib


Hi there,

On 08/15/2016 01:50 PM, ayush goel wrote:

> +# Where to find the gnulib library
> +LIBGNU = ../gnulib/import/libgnu.a
> +BUILD_LIBGNU= $(build_libobjdir)/gnulib/import/libgnu.a
> +INCGNU = -I$(srcdir)/../gnulib/import
> +

I may be missing something, but I don't understand how can this be
right.  AFAICS, this is still not pointing the include directory search
path at the "gnulib/import/" subdirectory found inside the gnulib
build directory.

If gnulib decides to create a replacement header for e.g., unistd.h,
then any '#include <unistd.h>' throughout gcc's sources (except
target libraries) should result in gnulib's replacement header
being included.

We're talking about a one-line change, but this is absolutely
crucial and central to use of gnulib.  Until this is correct,
any previous host-specific testing is invalid, unfortunately.

In the previous revision, you had:

 INCGNU = -I../gnulib -I$(srcdir)/../gnulib/import

and I was expecting to see in the new revision something
like:

 INCGNU = -I../gnulib/import -I$(srcdir)/../gnulib/import

or perhaps even better:

 INCGNU = -I$(build_libobjdir)/gnulib/import -I$(srcdir)/../gnulib/import

Try hacking one of the generated replacement headers, one that gcc
is sure to include, to cause a compilation error.  E.g. add an #error call
to the generated gnulib/import/unistd.h.  If a gcc build, from scratch since
there are no Makefile dependencies, still compiles with that, then we're
still not picking the right headers.

> Index: src/gcc/mkconfig.sh
> ===================================================================
> --- src/gcc/mkconfig.sh	(revision 237184)
> +++ src/gcc/mkconfig.sh	(working copy)
> @@ -43,6 +43,7 @@
>  # A special test to ensure that build-time files don't blindly use
>  # config.h.
>  if test x"$output" = x"config.h"; then
> +  echo '#include "../gnulib/config.h"' >> ${output}T
>    echo "#ifdef GENERATOR_FILE" >> ${output}T
>    echo "#error config.h is for the host, not build, machine." >> ${output}T
>    echo "#endif" >> ${output}T

Hmm, this looks incorrect/incomplete, for not considering the generator
programs that are built for the "build" machine.  AFAICS, those include
"bconfig.h" instead of "config.h".  Note the GENERATOR_FILE check above.  

My recollection is that those build-machine programs link with libiberty
too today, and should thus switch to gnulib as well, right?

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]