[Bug middle-end/103762] [12 Regression] glibc master branch is miscompiled by r12-897
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Dec 18 15:17:22 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103762
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Good __tunables_init code:
.L35:
movq $-88, %rax
leaq tunable_list(%rip), %rbx
movq %r8, %r12
subq %rbx, %rax
movq %rax, %r15
Bad __tunables_init code:
.L34:
movq $-88, %rax
subq .LC3(%rip), %rax
movq %r8, %rbx
movq %rax, 8(%rsp)
...
.section .data.rel.ro.local,"aw"
.align 8
.LC3:
.quad tunable_list
The bad code requires run-time relocation and a memory load. But this piece
of code is called from
__tunables_init (__environ);
ARCH_INIT_CPU_FEATURES ();
/* Do static pie self relocation after tunables and cpu features
are setup for ifunc resolvers. Before this point relocations
must be avoided. */
_dl_relocate_static_pie ();
For __tunables_init isn't good for performance and fails to run before
static PIE has been relocated.
More information about the Gcc-bugs
mailing list