Use -flto instead of -flto=N in DWARF producer string.

Message ID ceb03d47-7e13-6d5c-c8d3-9c9bb4cb929c@suse.cz
State New
Headers show
Series
  • Use -flto instead of -flto=N in DWARF producer string.
Related show

Commit Message

Martin Liška July 10, 2019, 11:08 a.m.
Hi.

We're using LTO in openSUSE package builds and we use -flto=N based on number
of CPU that a builder machine has. That leads to debug info divergence and
so that I would like to canonize the option in producer string.

Ready to be installed after tests & bootstrap?
Thanks,
Martin

gcc/ChangeLog:

2019-07-10  Martin Liska  <mliska@suse.cz>

	* dwarf2out.c (gen_producer_string): Canonize -flto=N
	to -flto in dwarf producer string.
---
 gcc/dwarf2out.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jakub Jelinek July 10, 2019, 11:15 a.m. | #1
On Wed, Jul 10, 2019 at 01:08:52PM +0200, Martin Liška wrote:
> --- a/gcc/dwarf2out.c

> +++ b/gcc/dwarf2out.c

> @@ -24460,6 +24460,13 @@ gen_producer_string (void)

>        case OPT_fchecking_:

>  	/* Ignore these.  */

>  	continue;

> +      case OPT_flto_:

> +	  {

> +	    const char *lto_canonical = "-flto";

> +	    switches.safe_push (lto_canonical);

> +	    len += strlen (lto_canonical) + 1;

> +	    break;

> +	  }


The indentation looks off, when case is indented by 6 columns,
{ should be by 8 (i.e. a tab) and const by 10 (i.e. a tab + 2 spaces).

	Jakub
Martin Liška July 10, 2019, 11:16 a.m. | #2
On 7/10/19 1:15 PM, Jakub Jelinek wrote:
> On Wed, Jul 10, 2019 at 01:08:52PM +0200, Martin Liška wrote:

>> --- a/gcc/dwarf2out.c

>> +++ b/gcc/dwarf2out.c

>> @@ -24460,6 +24460,13 @@ gen_producer_string (void)

>>        case OPT_fchecking_:

>>  	/* Ignore these.  */

>>  	continue;

>> +      case OPT_flto_:

>> +	  {

>> +	    const char *lto_canonical = "-flto";

>> +	    switches.safe_push (lto_canonical);

>> +	    len += strlen (lto_canonical) + 1;

>> +	    break;

>> +	  }

> 

> The indentation looks off, when case is indented by 6 columns,

> { should be by 8 (i.e. a tab) and const by 10 (i.e. a tab + 2 spaces).

> 

> 	Jakub

> 


You are right, sorry for that.

Martin
From eda41b25bf8b91412683ad542074724c872b18a4 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>

Date: Wed, 10 Jul 2019 13:05:19 +0200
Subject: [PATCH] Use -flto instead of -flto=N in DWARF producer string.

gcc/ChangeLog:

2019-07-10  Martin Liska  <mliska@suse.cz>

	* dwarf2out.c (gen_producer_string): Canonize -flto=N
	to -flto in dwarf producer string.
---
 gcc/dwarf2out.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0449c2b2912..aa7fd7eb465 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24460,6 +24460,13 @@ gen_producer_string (void)
       case OPT_fchecking_:
 	/* Ignore these.  */
 	continue;
+      case OPT_flto_:
+	{
+	  const char *lto_canonical = "-flto";
+	  switches.safe_push (lto_canonical);
+	  len += strlen (lto_canonical) + 1;
+	  break;
+	}
       default:
         if (cl_options[save_decoded_options[j].opt_index].flags
 	    & CL_NO_DWARF_RECORD)
-- 
2.22.0
Martin Liška July 15, 2019, 11:35 a.m. | #3
On 7/10/19 1:16 PM, Martin Liška wrote:
> On 7/10/19 1:15 PM, Jakub Jelinek wrote:

>> On Wed, Jul 10, 2019 at 01:08:52PM +0200, Martin Liška wrote:

>>> --- a/gcc/dwarf2out.c

>>> +++ b/gcc/dwarf2out.c

>>> @@ -24460,6 +24460,13 @@ gen_producer_string (void)

>>>        case OPT_fchecking_:

>>>  	/* Ignore these.  */

>>>  	continue;

>>> +      case OPT_flto_:

>>> +	  {

>>> +	    const char *lto_canonical = "-flto";

>>> +	    switches.safe_push (lto_canonical);

>>> +	    len += strlen (lto_canonical) + 1;

>>> +	    break;

>>> +	  }

>>

>> The indentation looks off, when case is indented by 6 columns,

>> { should be by 8 (i.e. a tab) and const by 10 (i.e. a tab + 2 spaces).

>>

>> 	Jakub

>>

> 

> You are right, sorry for that.

> 

> Martin

> 


May I please ping this?

Thanks,
Martin

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0449c2b2912..dccfe088de2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24460,6 +24460,13 @@  gen_producer_string (void)
       case OPT_fchecking_:
 	/* Ignore these.  */
 	continue;
+      case OPT_flto_:
+	  {
+	    const char *lto_canonical = "-flto";
+	    switches.safe_push (lto_canonical);
+	    len += strlen (lto_canonical) + 1;
+	    break;
+	  }
       default:
         if (cl_options[save_decoded_options[j].opt_index].flags
 	    & CL_NO_DWARF_RECORD)