Hi,
On 2025-09-26 21:55, Aurelien Jarno wrote:
Hi,
On 2025-09-24 15:22, Adrian Bunk wrote:
Hi,
is it a known issue that with the change from GCC 14 to 15 the build
time of many package increased a lot with C++ code?
I am talking about an increase in the build time of many packages
between 20% and over 100%.
Yes GCC 15 is definitely slower than GCC 14 in some cases, but at this
stage I don't know the reason.
After digging a bit more, the increased time is due to the following
upstream commit:
| commit 76c29548b3de8bd06c3eef6084c19696019a7a2f
| Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
| Date: Mon Aug 19 07:11:18 2024 +0200
|
| RISC-V: Enable -gvariable-location-views by default
|
| This affects only the RISC-V targets, where the compiler options
| -gvariable-location-views and consequently also -ginline-points
| are disabled by default, which is unexpected and disables some
| useful features of the generated debug info.
|
| Due to a bug in the gas assembler the .loc statement
| is not usable to generate location view debug info.
| That is detected by configure:
|
| configure:31500: checking assembler for dwarf2 debug_view support
| configure:31509: .../riscv-unknown-elf/bin/as -o conftest.o conftest.s >&5
| conftest.s: Assembler messages:
| conftest.s:5: Error: .uleb128 only supports constant or subtract expressions
| conftest.s:6: Error: .uleb128 only supports constant or subtract expressions
| configure:31512: $? = 1
| configure: failed program was
| .file 1 "conftest.s"
| .loc 1 3 0 view .LVU1
| nop
| .data
| .uleb128 .LVU1
| .uleb128 .LVU1
|
| configure:31523: result: no
|
| This results in dwarf2out_as_locview_support being set to false,
| and that creates a sequence of events, with the end result that
| most inlined functions either have no DW_AT_entry_pc, or one
| with a wrong entry pc value.
|
| But the location views can also be generated without using any
| .loc statements, therefore we should enable the option
| -gvariable-location-views by default, regardless of the status
| of -gas-locview-support.
|
| Note however, that the combination of the following compiler options
| -g -O2 -gvariable-location-views -gno-as-loc-support
| turned out to create invalid assembler intermediate files,
| with lots of assembler errors like:
| Error: leb128 operand is an undefined symbol: .LVU3
|
| This affects all targets, except RISC-V of course ;-)
| and is fixed by the changes in dwarf2out.cc
|
| Finally the .debug_loclists created without assembler locview support
| did contain location view pairs like v0000000ffffffff v000000000000000
| which is the value from FORCE_RESET_NEXT_VIEW, but that is most likely
| not as expected either, so change that as well.
|
| gcc/ChangeLog:
|
| * dwarf2out.cc (dwarf2out_maybe_output_loclist_view_pair,
| output_loc_list): Correct handling of -gno-as-loc-support,
| use ZERO_VIEW_P to output view number as zero value.
| * toplev.cc (process_options): Do not automatically disable
| -gvariable-location-views when -gno-as-loc-support or
| -gno-as-locview-support is used, instead do automatically
| disable -gas-locview-support if -gno-as-loc-support is used.
|
| gcc/testsuite/ChangeLog:
|
| * gcc.dg/debug/dwarf2/inline2.c: Add checks for inline entry_pc.
| * gcc.dg/debug/dwarf2/inline6.c: Add -gno-as-loc-support and check
| the resulting location views.
This is confirmed by using -gno-variable-location-views with GCC 15,
which brings down compilation time and memory usage close to GCC 14
levels. Note that 90% of the additional time is actually consumed by as
rather than gcc, the output source file being around twice as large.
This also means that when not using -g, there is no significant
difference in compilation time and memory usage between GCC 14 and GCC
15.
Overall, while this is quite unfortunate, this doesn't look like a
regression, this is just about bringing RISC-V to the same feature level
than other architectures. We will need to compensate that by using
faster hardware.
On the positive side, there is no significant compilation time or memory
usage difference between the current releases/gcc-15 and master
branches.
Regards
Aurelien