public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685
@ 2022-12-08 13:43 sam at gentoo dot org
  2022-12-08 13:44 ` [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6 sam at gentoo dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2022-12-08 13:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

            Bug ID: 108022
           Summary: [11/12/13 regression] -frecord-gcc-switches doesn't
                    record preprocessor macros since
                    7caa49706316e650fb67719e1a1bf3a35054b685
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

-frecord-gcc-switches seems to have stopped recording preprocessor flags passed
on the command line between GCC 10 and GCC 11.

```
$ cat test.c
#include <stdio.h>

int main(void) {
        printf("%s", "hi\n");
}
$ gcc-10 -frecord-gcc-switches -D_TEST_SAVE_CPPFLAGS test.c -o ~/test &&
objdump -s test | grep -i TEST_SAVE
 0000 2d44205f 54455354 5f534156 455f4350  -D _TEST_SAVE_CP
$ gcc-11 -frecord-gcc-switches -D_TEST_SAVE_CPPFLAGS test.c -o ~/test &&
objdump -s test | grep -i TEST_SAVE
```

10.4.1 (20221201) is fine
11.3.1 (20221202) is not

gcc 12 and gcc 13 also have the same regression from gcc 10 (they don't work).
Manually inspecting 'objdump -s test' doesn't show -DD_TEST_SAVE_CPPFLAGS
either (it's not an issue with how the string is chunked).

I ran a bisect overnight and it looks like the culprit is:
```
7caa49706316e650fb67719e1a1bf3a35054b685 is the first bad commit
commit 7caa49706316e650fb67719e1a1bf3a35054b685
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 23 13:40:04 2020 +0100

    Refactor -frecord-gcc-switches.

    gcc/ChangeLog:

            * doc/tm.texi: Change argument of the record_gcc_switches
            hook and remove SWITCH_TYPE_* enum values.
            * dwarf2out.c (gen_producer_string): Move to opts.c and remove
            handling of the dwarf_record_gcc_switches option.
            (dwarf2out_early_finish): Use moved gen_producer_string
            function.
            * opts.c (gen_producer_string): New.
            * opts.h (gen_producer_string): New.
            * target.def: Change type of record_gcc_switches.
            * target.h (enum print_switch_type): Remove.
            (elf_record_gcc_switches): Change first argument.
            * toplev.c (MAX_LINE): Remove.
            (print_to_asm_out_file):  Likewise.
            (print_to_stderr): Likewise.
            (print_single_switch): Likewise.
            (print_switch_values): Likewise.
            (init_asm_output): Use new gen_producer_string function.
            (process_options): Likewise.
            * varasm.c (elf_record_gcc_switches): Just save the string argument
            to the ELF container.

 gcc/doc/tm.texi |  38 +-----------
 gcc/dwarf2out.c | 118 +++----------------------------------
 gcc/opts.c      | 119 ++++++++++++++++++++++++++++++++++++++
 gcc/opts.h      |   6 ++
 gcc/target.def  |  38 +-----------
 gcc/target.h    |  14 +----
 gcc/toplev.c    | 176 ++++++--------------------------------------------------
 gcc/varasm.c    |  48 ++++------------
 8 files changed, 166 insertions(+), 391 deletions(-)
```

I haven't tried reverting it yet as it doesn't revert cleanly on master.

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
@ 2022-12-08 13:44 ` sam at gentoo dot org
  2022-12-08 14:38 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2022-12-08 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 regression]       |[11/12/13 regression]
                   |-frecord-gcc-switches       |-frecord-gcc-switches
                   |doesn't record preprocessor |doesn't record preprocessor
                   |macros since                |macros since
                   |7caa49706316e650fb67719e1a1 |r11-5739-g7caa49706316e6
                   |bf3a35054b685               |

--- Comment #1 from Sam James <sam at gentoo dot org> ---
(it's r11-5739-g7caa49706316e6).

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
  2022-12-08 13:44 ` [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6 sam at gentoo dot org
@ 2022-12-08 14:38 ` marxin at gcc dot gnu.org
  2022-12-08 15:03 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-08 14:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, the change was intentional as we merged what we produce for both
-frecord-gcc-switches and -grecord-gcc-switches.

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
  2022-12-08 13:44 ` [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6 sam at gentoo dot org
  2022-12-08 14:38 ` marxin at gcc dot gnu.org
@ 2022-12-08 15:03 ` jakub at gcc dot gnu.org
  2022-12-08 15:05 ` soap at gentoo dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-08 15:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
-frecord-gcc-switches is a totally useless option btw, just forget it exists
and use -grecord-gcc-switches instead.

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
                   ` (2 preceding siblings ...)
  2022-12-08 15:03 ` jakub at gcc dot gnu.org
@ 2022-12-08 15:05 ` soap at gentoo dot org
  2022-12-09 10:02 ` marxin at gcc dot gnu.org
  2023-07-17 20:23 ` sjames at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: soap at gentoo dot org @ 2022-12-08 15:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

David Seifert <soap at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |soap at gentoo dot org

--- Comment #4 from David Seifert <soap at gentoo dot org> ---
(In reply to Jakub Jelinek from comment #3)
> -frecord-gcc-switches is a totally useless option btw, just forget it exists
> and use -grecord-gcc-switches instead.

The problem is, the UX isn't exactly helpful. The only way I managed to extract
the macro definition was

gcc -ggdb3 -grecord-gcc-switches -D_TEST_SAVE_CPPFLAGS test.c -o ~/test &&
objdump -s -j .debug_str test | grep SAVE

which doesn't make our use case any easier really (since it requires heavy
debug flags).

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
                   ` (3 preceding siblings ...)
  2022-12-08 15:05 ` soap at gentoo dot org
@ 2022-12-09 10:02 ` marxin at gcc dot gnu.org
  2023-07-17 20:23 ` sjames at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-09 10:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, -ggdb3 seems to me like a reasonable solution. Note you can always strip
the debuginfo into a separate file.

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

* [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6
  2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
                   ` (4 preceding siblings ...)
  2022-12-09 10:02 ` marxin at gcc dot gnu.org
@ 2023-07-17 20:23 ` sjames at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-07-17 20:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108022

--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #5)
> Yes, -ggdb3 seems to me like a reasonable solution. Note you can always
> strip the debuginfo into a separate file.

This doesn't really work for us, as building with (a lot of) debug info
requires a lot more build-time resources (disk and RAM, mainly).

We want to do these checks for everybody building things - keeping in mind
we're a source-based distribution, and we don't make everyone build with
debugging symbols.

Building with -ggdb3 for everybody is not really an option.

The existing behaviour has been pretty useful for us for many years, and we
were hoping to extend it to CPPFLAGS too.

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

end of thread, other threads:[~2023-07-17 20:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 13:43 [Bug driver/108022] New: [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since 7caa49706316e650fb67719e1a1bf3a35054b685 sam at gentoo dot org
2022-12-08 13:44 ` [Bug driver/108022] [11/12/13 regression] -frecord-gcc-switches doesn't record preprocessor macros since r11-5739-g7caa49706316e6 sam at gentoo dot org
2022-12-08 14:38 ` marxin at gcc dot gnu.org
2022-12-08 15:03 ` jakub at gcc dot gnu.org
2022-12-08 15:05 ` soap at gentoo dot org
2022-12-09 10:02 ` marxin at gcc dot gnu.org
2023-07-17 20:23 ` sjames at gcc dot gnu.org

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