[Bug libstdc++/105810] __glibcxx_assert can be improved greatly.
unlvsur at live dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 8 08:53:53 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105810
--- Comment #8 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jonathan Wakely from comment #7)
> Right, but that function doesn't even exist today, so there's nothing to
> merge today. This change adds new symbols (one for every assertion in the
> library) which must be assembled and then merged by the linker.
>
> I'm just not sure why you're pointing this out in comment 4 like it's an
> advantage of the change. Of course there's only one copy of the function,
> otherwise it would be an ODR violation, or a linker error. But it's still
> one more function for every assertion in the library.
the thing is that.
if I ca(In reply to Jonathan Wakely from comment #7)
> Right, but that function doesn't even exist today, so there's nothing to
> merge today. This change adds new symbols (one for every assertion in the
> library) which must be assembled and then merged by the linker.
>
> I'm just not sure why you're pointing this out in comment 4 like it's an
> advantage of the change. Of course there's only one copy of the function,
> otherwise it would be an ODR violation, or a linker error. But it's still
> one more function for every assertion in the library.
The thing is that:
https://godbolt.org/z/85M1PE9Te
The compiler has to generate
subq $8, %rsp
leaq .LC0(%rip), %rcx
leaq .LC1(%rip), %rdx
movl $278, %esi
leaq .LC2(%rip), %rdi
call std::__glibcxx_assert_fail(char const*, int, char const*, char
const*)@PLT
for every function when we use them.
while for the 2nd case
https://godbolt.org/z/TjP7YxYcT
will only generate once for the assertion part.
More information about the Gcc-bugs
mailing list