On 10/4/21 14:37, Iain Sandoe wrote:
Hi Jason,
On 4 Oct 2021, at 19:27, Jason Merrill via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
When r12-4038 introduced the global auto_vec save_opt_decoded_options, it broke
compilers configured with --enable-gather-detailed-mem-stats, due to the memory
descriptors getting discarded before the auto_vec was destroyed. Attached
below are two approaches to making this work, either by using the init_priority
attribute, or turning vec_mem_desc into a singleton function. I prefer the
first one, primarily because it doesn't require auto_vec variables to force
immediate allocation. It relies on a G++ extension, but I figure that's OK for
code that is only exercised with a debugging configure flag.
I suspect the problem is not necessarily that it’s a G++ extension, (init
priority has some support elsewhere) - but that some targets (with non-binutils
ld) cannot support it [between multiple TUs at least] even with a native G++
(Darwin at least cannot). OTOH, there are worse broken things from this than a
gathering of stats…
Hmm, that was previously handled for other linkers with the collect2
wrapper. I haven't followed what has happened with collect2 in recent
years, does Darwin not use it?
Jason