public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix UBSAN bootstrap
@ 2021-01-11 10:26 Martin Liška
  2021-01-11 10:38 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2021-01-11 10:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Nathan Sidwell, Jakub Jelinek

Hi.

Problem here was that GCC-related options are not applied in stage2 (and later stages).
It's caused by fact that CXX is xg++ in stage2 (and later stages).
Fixed with the following patch.

Ready to be installed?
Thanks,
Martin

libcody/ChangeLog:

	PR bootstrap/98414
	* Makefile.in: In stage2 in UBSAN bootstrap the CXX is called
	xg++, so findstring g++ should be used instead of exact string
	comparison.
---
  libcody/Makefile.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcody/Makefile.in b/libcody/Makefile.in
index 6e38d51516f..1945dc95f14 100644
--- a/libcody/Makefile.in
+++ b/libcody/Makefile.in
@@ -55,7 +55,7 @@ INSTALL := $(srcdir)/build-aux/install-sh
  CXXFLAGS := @CXXFLAGS@
  CXXINC := $(filter -I%,@CXX@)
  CXXOPTS := $(CXXFLAGS) @PICFLAG@
-ifeq ($(notdir $(firstword $(CXX))),g++)
+ifneq (,$(findstring g++, $(notdir $(firstword $(CXX)))))
  # It's GCC, or pretending to be it -- so it better smell like it!
  # Code generation
  CXXOPTS += -fno-enforce-eh-specs
-- 
2.29.2


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

* Re: [PATCH] Fix UBSAN bootstrap
  2021-01-11 10:26 [PATCH] Fix UBSAN bootstrap Martin Liška
@ 2021-01-11 10:38 ` Jakub Jelinek
  2021-01-11 12:58   ` Nathan Sidwell
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2021-01-11 10:38 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Nathan Sidwell

On Mon, Jan 11, 2021 at 11:26:42AM +0100, Martin Liška wrote:
> Problem here was that GCC-related options are not applied in stage2 (and later stages).
> It's caused by fact that CXX is xg++ in stage2 (and later stages).
> Fixed with the following patch.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> libcody/ChangeLog:
> 
> 	PR bootstrap/98414
> 	* Makefile.in: In stage2 in UBSAN bootstrap the CXX is called
> 	xg++, so findstring g++ should be used instead of exact string
> 	comparison.

I think better would be to follow gcc/{configure*,Make*} practice and don't
judge compilers based on names, but on what they actually are and test
perhaps not each individual flag separately, but their whole sets together.
gcc/configure* also has:
ACX_PROG_CXX_WARNING_OPTS(
        m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
                       [-Wcast-qual -Wno-error=format-diag $wf_opt])),
                       [loose_warn])
ACX_PROG_CC_WARNING_OPTS(
        m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ],
                       [-Wno-error=format-diag])), [c_loose_warn])
etc. and then the Makefile.in just uses those @...@s.

It is true that your findstring g++ will handle this xg++ case as well as
g++-6.2.1 or redhat-linux-gnu-6.2.1-g++, but it isn't bulletproof.

Anyway, will defer to Nathan.

> ---
>  libcody/Makefile.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libcody/Makefile.in b/libcody/Makefile.in
> index 6e38d51516f..1945dc95f14 100644
> --- a/libcody/Makefile.in
> +++ b/libcody/Makefile.in
> @@ -55,7 +55,7 @@ INSTALL := $(srcdir)/build-aux/install-sh
>  CXXFLAGS := @CXXFLAGS@
>  CXXINC := $(filter -I%,@CXX@)
>  CXXOPTS := $(CXXFLAGS) @PICFLAG@
> -ifeq ($(notdir $(firstword $(CXX))),g++)
> +ifneq (,$(findstring g++, $(notdir $(firstword $(CXX)))))
>  # It's GCC, or pretending to be it -- so it better smell like it!
>  # Code generation
>  CXXOPTS += -fno-enforce-eh-specs
> -- 
> 2.29.2

	Jakub


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

* Re: [PATCH] Fix UBSAN bootstrap
  2021-01-11 10:38 ` Jakub Jelinek
@ 2021-01-11 12:58   ` Nathan Sidwell
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Sidwell @ 2021-01-11 12:58 UTC (permalink / raw)
  To: Jakub Jelinek, Martin Liška; +Cc: gcc-patches

On 1/11/21 5:38 AM, Jakub Jelinek wrote:
> On Mon, Jan 11, 2021 at 11:26:42AM +0100, Martin Liška wrote:
>> Problem here was that GCC-related options are not applied in stage2 (and later stages).
>> It's caused by fact that CXX is xg++ in stage2 (and later stages).
>> Fixed with the following patch.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>> libcody/ChangeLog:
>>
>> 	PR bootstrap/98414
>> 	* Makefile.in: In stage2 in UBSAN bootstrap the CXX is called
>> 	xg++, so findstring g++ should be used instead of exact string
>> 	comparison.
> 
> I think better would be to follow gcc/{configure*,Make*} practice and don't
> judge compilers based on names, but on what they actually are and test
> perhaps not each individual flag separately, but their whole sets together.

Just so you know, it checks the name, because Clang identifies as GCC, 
but can be insufficiently GCC-like at times (not here though).

I think replacing more bits with libcpp configure goup is probably the 
better.

nathan

-- 
Nathan Sidwell

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

end of thread, other threads:[~2021-01-11 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 10:26 [PATCH] Fix UBSAN bootstrap Martin Liška
2021-01-11 10:38 ` Jakub Jelinek
2021-01-11 12:58   ` Nathan Sidwell

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).