Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-10-11 Thread Simon Marchi via Gcc-patches
Hi gcc-patches,

I had applied the patch below to binutils-gdb, but it recently got wiped
out by a gcc -> binutils-gdb configure.ac sync.  Would it be possible to
apply it to the gcc repo so this doesn't happen again?

Thanks,

Simon

On 2022-03-15 17:26, Simon Marchi via Gdb-patches wrote:
> From: Simon Marchi 
> 
> [Sending to binutils, gdb-patches and gcc-patches, since it touches the
> top-level Makefile/configure]
> 
> I have my debuginfod library installed in a non-standard location
> (/opt/debuginfod), which requires me to set
> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
> configure:
> 
> $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
> --with-debuginfod
> $ make
> 
> or
> 
> $ ./configure --with-debuginfod 
> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
> $ make
> 
> Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
> configure.  When running make (which runs gdb's and binutils'
> configure), PKG_CONFIG_PATH is not set, which results in their configure
> script not finding the library:
> 
> checking for libdebuginfod >= 0.179... no
> configure: error: "--with-debuginfod was given, but libdebuginfod is 
> missing or unusable."
> 
> Change the top-level configure/Makefile system to capture the value
> passed when configuring the top-level and pass it down to
> subdirectories (similar to CFLAGS, LDFLAGS, etc).
> 
> I don't know much about the top-level build system, so I really don't
> know if I did this correctly.  The changes are:
> 
>  - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
>@PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
>in config files (i.e. Makefile)
>  - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
>to @PKG_CONFIG_PATH@
>  - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
>variables set when running the sub-configures
> 
> I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
> I don't think it's needed.  AFAIU, this defines the flags to pass down
> when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
> be passed down during configure.  After that, it's captured in
> gdb/config.status, so even if a "make" causes a re-configure later
> (because gdb/configure has changed, for example), the PKG_CONFIG_PATH
> value will be remembered.
> 
> ChangeLog:
> 
>   * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
>   * configure: Re-generate.
>   * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
>   (PKG_CONFIG_PATH): New.
>   * Makefile.in: Re-generate.
> 
> Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
> ---
>  Makefile.in  | 3 +++
>  Makefile.tpl | 3 +++
>  configure| 2 ++
>  configure.ac | 1 +
>  4 files changed, 9 insertions(+)
> 
> diff --git a/Makefile.in b/Makefile.in
> index 3aacd2daac9c..cb39e4790d69 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -218,6 +218,7 @@ HOST_EXPORTS = \
>   OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>   OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>   OTOOL="$(OTOOL)"; export OTOOL; \
> + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>   READELF="$(READELF)"; export READELF; \
>   AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>   AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
> @@ -444,6 +445,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
>  
> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
> +
>  # Pass additional PGO and LTO compiler options to the PGO build.
>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>  override CFLAGS += $(BUILD_CFLAGS)
> diff --git a/Makefile.tpl b/Makefile.tpl
> index 9df77788345a..88db8f44d53f 100644
> --- a/Makefile.tpl
> +++ b/Makefile.tpl
> @@ -221,6 +221,7 @@ HOST_EXPORTS = \
>   OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>   OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>   OTOOL="$(OTOOL)"; export OTOOL; \
> + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>   READELF="$(READELF)"; export READELF; \
>   AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>   AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
> @@ -447,6 +448,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
>  
> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
> +
>  # Pass additional PGO and LTO compiler options to the PGO build.
>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>  override CFLAGS += $(BUILD_CFLAGS)
> diff --git a/configure b/configure
> index 26935ebda249..1badcb314f8f 100755
> --- a/configure
> +++ b/configure
> @@ -618,6 +618,7 @@ CXX_FOR_TARGET
>  CC_FOR_TARGET
>  RANLIB_PLUGIN_OPTION
>  AR_PLUGIN_OPTION
> +PKG_CONFIG_PATH
>  READELF
>  OBJDUMP
>  OBJCOPY
> @@ -10310,6 +10311,7 @@ fi
>  
>  
>  
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin 

[PATCH] libiberty: add AC_CONFIG_MACRO_DIRS

2022-04-08 Thread Simon Marchi via Gcc-patches
Add

  AC_CONFIG_MACRO_DIRS([../config])

So that just running:

  $ autoreconf -vf

... does the right thing (no need to specify -I ../config).

Note: I don't have access to the gcc repo, so if this patch is approved,
can somebody push it there on my behalf?  I can push it to binutils-gdb.

libiberty/ChangeLog:

* configure.ac: Add AC_CONFIG_MACRO_DIRS call.
* configure: Re-generate.

Change-Id: Ic600481d03b36c95aacc555300b78d9cc0ef06bc
---
 libiberty/configure| 1 +
 libiberty/configure.ac | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libiberty/configure b/libiberty/configure
index e09ddd91e584..306c07bd37e9 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -2461,6 +2461,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index f59f35e1f208..6c1ff9c60933 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure 
script
 
 AC_INIT
 AC_CONFIG_SRCDIR([xmalloc.c])
+AC_CONFIG_MACRO_DIRS([../config])
 
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
-- 
2.26.2



Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-04-08 Thread Simon Marchi via Gcc-patches
On 2022-04-08 10:32, Nick Clifton wrote:
> Hi Simon,
> 
>> Ping.
> 
> Patch approved - please apply.
> 
> I appreciate that modifying these top level files is a bit nerve
> wracking, but I think that you have done a good job in this case. :-)
> 
> Cheers
>   Nick
> 

Thanks Nick, pushed.

Simon


Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-04-07 Thread Simon Marchi via Gcc-patches
Ping.

On 2022-03-29 16:04, Simon Marchi wrote:
> Ping!
> 
> On 2022-03-15 17:26, Simon Marchi wrote:
>> From: Simon Marchi 
>>
>> [Sending to binutils, gdb-patches and gcc-patches, since it touches the
>> top-level Makefile/configure]
>>
>> I have my debuginfod library installed in a non-standard location
>> (/opt/debuginfod), which requires me to set
>> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
>> configure:
>>
>> $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
>> --with-debuginfod
>> $ make
>>
>> or
>>
>> $ ./configure --with-debuginfod 
>> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
>> $ make
>>
>> Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
>> configure.  When running make (which runs gdb's and binutils'
>> configure), PKG_CONFIG_PATH is not set, which results in their configure
>> script not finding the library:
>>
>> checking for libdebuginfod >= 0.179... no
>> configure: error: "--with-debuginfod was given, but libdebuginfod is 
>> missing or unusable."
>>
>> Change the top-level configure/Makefile system to capture the value
>> passed when configuring the top-level and pass it down to
>> subdirectories (similar to CFLAGS, LDFLAGS, etc).
>>
>> I don't know much about the top-level build system, so I really don't
>> know if I did this correctly.  The changes are:
>>
>>  - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
>>@PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
>>in config files (i.e. Makefile)
>>  - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
>>to @PKG_CONFIG_PATH@
>>  - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
>>variables set when running the sub-configures
>>
>> I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
>> I don't think it's needed.  AFAIU, this defines the flags to pass down
>> when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
>> be passed down during configure.  After that, it's captured in
>> gdb/config.status, so even if a "make" causes a re-configure later
>> (because gdb/configure has changed, for example), the PKG_CONFIG_PATH
>> value will be remembered.
>>
>> ChangeLog:
>>
>>  * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
>>  * configure: Re-generate.
>>  * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
>>  (PKG_CONFIG_PATH): New.
>>  * Makefile.in: Re-generate.
>>
>> Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
>> ---
>>  Makefile.in  | 3 +++
>>  Makefile.tpl | 3 +++
>>  configure| 2 ++
>>  configure.ac | 1 +
>>  4 files changed, 9 insertions(+)
>>
>> diff --git a/Makefile.in b/Makefile.in
>> index 3aacd2daac9c..cb39e4790d69 100644
>> --- a/Makefile.in
>> +++ b/Makefile.in
>> @@ -218,6 +218,7 @@ HOST_EXPORTS = \
>>  OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>>  OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>>  OTOOL="$(OTOOL)"; export OTOOL; \
>> +PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>>  READELF="$(READELF)"; export READELF; \
>>  AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>>  AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
>> @@ -444,6 +445,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>>  GOCFLAGS = $(CFLAGS)
>>  GDCFLAGS = $(CFLAGS)
>>  
>> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
>> +
>>  # Pass additional PGO and LTO compiler options to the PGO build.
>>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>>  override CFLAGS += $(BUILD_CFLAGS)
>> diff --git a/Makefile.tpl b/Makefile.tpl
>> index 9df77788345a..88db8f44d53f 100644
>> --- a/Makefile.tpl
>> +++ b/Makefile.tpl
>> @@ -221,6 +221,7 @@ HOST_EXPORTS = \
>>  OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>>  OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>>  OTOOL="$(OTOOL)"; export OTOOL; \
>> +PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>>  READELF="$(READELF)"; export READELF; \
>>  AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>>  AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
>> @@ -447,6 +448,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>>  GOCFLAGS = $(CFLAGS)
>>  GDCFLAGS = $(CFLAGS)
>>  
>> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
>> +
>>  # Pass additional PGO and LTO compiler options to the PGO build.
>>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>>  override CFLAGS += $(BUILD_CFLAGS)
>> diff --git a/configure b/configure
>> index 26935ebda249..1badcb314f8f 100755
>> --- a/configure
>> +++ b/configure
>> @@ -618,6 +618,7 @@ CXX_FOR_TARGET
>>  CC_FOR_TARGET
>>  RANLIB_PLUGIN_OPTION
>>  AR_PLUGIN_OPTION
>> +PKG_CONFIG_PATH
>>  READELF
>>  OBJDUMP
>>  OBJCOPY
>> @@ -10310,6 +10311,7 @@ fi
>>  
>>  
>>  
>> +
>>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
>>  $as_echo_n "checking for -plugin option... " >&6; }
>>  
>> diff --git 

Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-03-29 Thread Simon Marchi via Gcc-patches
Ping!

On 2022-03-15 17:26, Simon Marchi wrote:
> From: Simon Marchi 
> 
> [Sending to binutils, gdb-patches and gcc-patches, since it touches the
> top-level Makefile/configure]
> 
> I have my debuginfod library installed in a non-standard location
> (/opt/debuginfod), which requires me to set
> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
> configure:
> 
> $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
> --with-debuginfod
> $ make
> 
> or
> 
> $ ./configure --with-debuginfod 
> PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
> $ make
> 
> Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
> configure.  When running make (which runs gdb's and binutils'
> configure), PKG_CONFIG_PATH is not set, which results in their configure
> script not finding the library:
> 
> checking for libdebuginfod >= 0.179... no
> configure: error: "--with-debuginfod was given, but libdebuginfod is 
> missing or unusable."
> 
> Change the top-level configure/Makefile system to capture the value
> passed when configuring the top-level and pass it down to
> subdirectories (similar to CFLAGS, LDFLAGS, etc).
> 
> I don't know much about the top-level build system, so I really don't
> know if I did this correctly.  The changes are:
> 
>  - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
>@PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
>in config files (i.e. Makefile)
>  - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
>to @PKG_CONFIG_PATH@
>  - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
>variables set when running the sub-configures
> 
> I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
> I don't think it's needed.  AFAIU, this defines the flags to pass down
> when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
> be passed down during configure.  After that, it's captured in
> gdb/config.status, so even if a "make" causes a re-configure later
> (because gdb/configure has changed, for example), the PKG_CONFIG_PATH
> value will be remembered.
> 
> ChangeLog:
> 
>   * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
>   * configure: Re-generate.
>   * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
>   (PKG_CONFIG_PATH): New.
>   * Makefile.in: Re-generate.
> 
> Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
> ---
>  Makefile.in  | 3 +++
>  Makefile.tpl | 3 +++
>  configure| 2 ++
>  configure.ac | 1 +
>  4 files changed, 9 insertions(+)
> 
> diff --git a/Makefile.in b/Makefile.in
> index 3aacd2daac9c..cb39e4790d69 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -218,6 +218,7 @@ HOST_EXPORTS = \
>   OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>   OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>   OTOOL="$(OTOOL)"; export OTOOL; \
> + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>   READELF="$(READELF)"; export READELF; \
>   AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>   AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
> @@ -444,6 +445,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
>  
> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
> +
>  # Pass additional PGO and LTO compiler options to the PGO build.
>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>  override CFLAGS += $(BUILD_CFLAGS)
> diff --git a/Makefile.tpl b/Makefile.tpl
> index 9df77788345a..88db8f44d53f 100644
> --- a/Makefile.tpl
> +++ b/Makefile.tpl
> @@ -221,6 +221,7 @@ HOST_EXPORTS = \
>   OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
>   OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
>   OTOOL="$(OTOOL)"; export OTOOL; \
> + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
>   READELF="$(READELF)"; export READELF; \
>   AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
>   AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
> @@ -447,6 +448,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
>  
> +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
> +
>  # Pass additional PGO and LTO compiler options to the PGO build.
>  BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
>  override CFLAGS += $(BUILD_CFLAGS)
> diff --git a/configure b/configure
> index 26935ebda249..1badcb314f8f 100755
> --- a/configure
> +++ b/configure
> @@ -618,6 +618,7 @@ CXX_FOR_TARGET
>  CC_FOR_TARGET
>  RANLIB_PLUGIN_OPTION
>  AR_PLUGIN_OPTION
> +PKG_CONFIG_PATH
>  READELF
>  OBJDUMP
>  OBJCOPY
> @@ -10310,6 +10311,7 @@ fi
>  
>  
>  
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
>  $as_echo_n "checking for -plugin option... " >&6; }
>  
> diff --git a/configure.ac b/configure.ac
> index da4e41d72479..5b6e20485143 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3465,6 +3465,7 @@ AC_SUBST(CC)
>  

[PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-03-15 Thread Simon Marchi via Gcc-patches
From: Simon Marchi 

[Sending to binutils, gdb-patches and gcc-patches, since it touches the
top-level Makefile/configure]

I have my debuginfod library installed in a non-standard location
(/opt/debuginfod), which requires me to set
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
configure:

$ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
--with-debuginfod
$ make

or

$ ./configure --with-debuginfod 
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
$ make

Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
configure.  When running make (which runs gdb's and binutils'
configure), PKG_CONFIG_PATH is not set, which results in their configure
script not finding the library:

checking for libdebuginfod >= 0.179... no
configure: error: "--with-debuginfod was given, but libdebuginfod is 
missing or unusable."

Change the top-level configure/Makefile system to capture the value
passed when configuring the top-level and pass it down to
subdirectories (similar to CFLAGS, LDFLAGS, etc).

I don't know much about the top-level build system, so I really don't
know if I did this correctly.  The changes are:

 - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
   @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
   in config files (i.e. Makefile)
 - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
   to @PKG_CONFIG_PATH@
 - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
   variables set when running the sub-configures

I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
I don't think it's needed.  AFAIU, this defines the flags to pass down
when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
be passed down during configure.  After that, it's captured in
gdb/config.status, so even if a "make" causes a re-configure later
(because gdb/configure has changed, for example), the PKG_CONFIG_PATH
value will be remembered.

ChangeLog:

* configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
* configure: Re-generate.
* Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
(PKG_CONFIG_PATH): New.
* Makefile.in: Re-generate.

Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
---
 Makefile.in  | 3 +++
 Makefile.tpl | 3 +++
 configure| 2 ++
 configure.ac | 1 +
 4 files changed, 9 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 3aacd2daac9c..cb39e4790d69 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -218,6 +218,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -444,6 +445,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 GOCFLAGS = $(CFLAGS)
 GDCFLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/Makefile.tpl b/Makefile.tpl
index 9df77788345a..88db8f44d53f 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -221,6 +221,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -447,6 +448,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 GOCFLAGS = $(CFLAGS)
 GDCFLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/configure b/configure
index 26935ebda249..1badcb314f8f 100755
--- a/configure
+++ b/configure
@@ -618,6 +618,7 @@ CXX_FOR_TARGET
 CC_FOR_TARGET
 RANLIB_PLUGIN_OPTION
 AR_PLUGIN_OPTION
+PKG_CONFIG_PATH
 READELF
 OBJDUMP
 OBJCOPY
@@ -10310,6 +10311,7 @@ fi
 
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
 $as_echo_n "checking for -plugin option... " >&6; }
 
diff --git a/configure.ac b/configure.ac
index da4e41d72479..5b6e20485143 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3465,6 +3465,7 @@ AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
+AC_SUBST(PKG_CONFIG_PATH)
 
 GCC_PLUGIN_OPTION(PLUGIN_OPTION)
 AR_PLUGIN_OPTION=

base-commit: 6aa03e9c1769c8d925f4d23d72af93483bfd31f3
-- 
2.35.1



Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-04 Thread Simon Marchi via Gcc-patches



On 2021-05-04 8:42 a.m., Nick Clifton wrote:
> Hi Guys,
> 
> On 4/30/21 7:36 PM, Simon Marchi wrote:
>> I think this fix is obvious enough, I encourage you to push it,
> 
> OK - I have pushed the patch to the mainline branches of both
> the gcc and binutils-gfdb repositories.
> 
> Cheers
>   Nick
> 

Thanks Nick!

Simon


Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-03 Thread Simon Marchi via Gcc-patches
On 2021-05-03 5:51 p.m., Alan Modra wrote:
> I wasn't talking about running configure, I was talking about running
> make.  For example, you configure and make binutils as usual, then
> after making a change to ld/ files, run make in the ld build dir.  I
> don't tend to do that myself but I do run "make check" sometimes in a
> subdir expecting to get the same results in that subdir as if "make
> check" was run from the top level.

Ah yeah, that works just fine.  During my edit-build-cycle, I typically
only "make" in gdb/, or whatever I'm working on at the moment.  It saves
some precious milliseconds!

> But I should have just tried it myself rather than asking.  CC, CPP
> and others are inherited from the top level and appear with -std=gnu99
> in the subdir Makefiles.  So it seems all the AC_PROG_CC in subdir
> configure.ac can stay as they are.

Yes, the top-level passes CC=... and others when it configures the
subdirectories.  The subdirectories remember how they were configures
(in config.status), so that even if a "make" in the subdirectory ends up
re-running configure (because configure changed), the CC value will be
remembered.

Simon


Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-03 Thread Simon Marchi via Gcc-patches
> Yes, I prefer the configure fix too.  If we state we require C99 in
> binutils then we ought to be able to use C99..
> 
> Nick, does the configure.ac change also need to go in all subdirs, to
> support people running make in say ld/ rather than running make in the
> top build dir?

For GDB, it's not supported to run gdb/configure directly, you need to
use the top-level configure.  Is it supported from some of the other
projects in the repo?

I just tried with ld, it doesn't work since it depends on bfd also being
built.  I tried with just bfd, it doesn't work (with the default
configure options at least) because it requires zlib being built.

So if all projects need to go through the top-level configure script
anyway, and C99 is a baseline for all projects, then having the check
only in the top-level makes sense to me.  Projects that have more
specific requirements can have their own checks.  For example, sim/
requires C11 now.  Unless the C99 check at top-level somehow does not
play well with the C11 check in sim/?  Like if that would cause CC to be
set to "gcc -std=gnu99 -std=gnu11" or something like that.

Simon


Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-04-30 Thread Simon Marchi via Gcc-patches
On 2021-04-26 7:32 a.m., Nick Clifton via Gdb-patches wrote:> Hi Guys,
> 
>   Given that gcc, gdb and now binutils are all now requiring C99 as a
>   minimum version of C, are there any objections to updating
>   configure.ac to reflect this ?
> 
> Cheers
>   Nick
> 
> diff --git a/configure.ac b/configure.ac
> index a721316d07b..59b4194fb24 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1278,7 +1278,7 @@ else
>WINDMC_FOR_BUILD="\$(WINDMC)"
>  fi
> 
> -AC_PROG_CC
> +AC_PROG_CC_C99
>  AC_PROG_CXX
> 
>  # We must set the default linker to the linker used by gcc for the correct

Hi Nick,

I think this fix is obvious enough, I encourage you to push it, that
will fix the build failure many people get in opcodes/ppc-dis.c.  We'll
just remove the line later when we upgrade to Autoconf 2.71, as simple
as that.  For now we use 2.69.  If that matters, you have my OK for the
GDB side of things.

Simon


[PATCH] Sync .gitignore with binutils-gdb

2020-12-02 Thread Simon Marchi via Gcc-patches
Bring in a few lines that are in binutils-gdb's .gitignore but not
gcc's.

Note that I don't have push access to gcc, so I would appreciate
if somebody could push it for me.

ChangeLog:

* .gitignore: Sync with binutils-gdb.
---
 .gitignore | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/.gitignore b/.gitignore
index 1a29029895aa..382e2def731e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
 *.o
 *.pyc
 *.tmp
+*.a
 
 .deps
 .libs
@@ -44,6 +45,9 @@ compile_commands.json
 .gdbinit
 .gdb_history
 
+perf.data
+perf.data.old
+
 # ignore core files, but not java/net/protocol/core/
 core
 !core/
@@ -54,6 +58,9 @@ lost+found
 LAST_UPDATED
 REVISION
 
+stamp-*
+*.stamp
+
 # ignore in-tree prerequisites
 /mpfr*
 /mpc*
-- 
2.29.2



Split DWARF and rnglists, gcc vs clang

2020-11-05 Thread Simon Marchi via Gcc-patches
Hi,

I'm currently squashing some bugs related to .debug_rnglists in GDB, and
I happened to notice that clang and gcc do different things when
generating rnglists with split DWARF.  I'd like to know if the two
behaviors are acceptable, and therefore if we need to make GDB accept
both.  Or maybe one of them is not doing things correctly and would need
to be fixed.

clang generates a .debug_rnglists.dwo section in the .dwo file.  Any
DW_FORM_rnglistx attribute in the DWO refers to that section.  That
section is not shared with any other object, so DW_AT_rnglists_base is
never involved for these attributes.  Note that there might still be a
DW_AT_rnglists_base on the DW_TAG_skeleton_unit, in the linked file,
used if the skeleton itself has an attribute of form DW_FORM_rnglistx.
This rnglist would be found in a .debug_rnglists section in the linked
file, shared with the other units of the linked file.

gcc generates a single .debug_rnglists in the linked file and no
.debug_rnglists.dwo in the DWO files.  So when an attribute has form
DW_FORM_rnglistx in a DWO file, I presume we need to do the lookup in
the .debug_rnglists section in the linked file, using the
DW_AT_rnglists_base attribute found in the corresponding skeleton unit.
This looks vaguely similar to how it was done pre-DWARF 5, with
DW_AT_GNU_ranges base.

So, is gcc wrong here?  I don't see anything in the DWARF 5 spec
prohibiting to do it like gcc does, but clang's way of doing it sounds
more in-line with the intent of what's described in the DWARF 5 spec.
So I wonder if it's maybe an oversight or a misunderstanding between the
two compilers.

But if both ways are correct, then we just need to know so we can
implement it in GDB.  Although we'll probably need to implement reading
what gcc currently produces, since it's already in the wild.

Simon