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

--- Comment #54 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I think the x86_64 behavior is simply copied as-is from i386.

On i386, there was a time when Glibc wouldn't preserve eax+ecx+edx in the PLT
trampoline, but preserving those became necessary when GCC exposed -mregparm
and the corresponding function attribute.

https://sourceware.org/cgit/glibc/diff/sysdeps/i386/dl-machine.h?id=831372e7c1bb907f9f2c3d78909b15717b8ac095

It doesn't really explain to me why PLT avoidance for mcount was necessary
(cross-DSO regparm calls with unfixed Glibc would be buggy for everything, not
just mcount), and apparently the avoidance goes back even further than that, to
a.out times. So the relevance to the matter at hand is unclear.

On amd64, PLT trampolines may clobber r11 (and lazy resolution trampolines
always do). So, yeah, looks like inherited PLT avoidance plays some role now
(even if by accident).

Reply via email to