https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386
--- Comment #53 from Ard Biesheuvel <ardb at kernel dot org> --- (In reply to Alexander Monakov from comment #51) > Michael, can you give your ack/nack for Ard's proposal in comment #24 (the > second variant, I guess keying off -m[no-]direct-extern-access doesn't make > sense here). I think it properly addresses what you said in comment #12, > considering how the motivation for PLT avoidance seems lost to history. > > (mcount doesn't follow the usual psABI, it must preserve all registers, but > even considering that I still fail to see why it was necessary to avoid PLT > for it) Are there cases where a PLT might clobber any registers? I know this is the case on AArch64 (x16 and x17 are intended for this) but I would expect that on x86_64 the PLT logic would rely on memory operands instead. And if so, does that happen under a condition we can test for? I.e, use a PLT unless -fno-plt was passed, or the condition in question holds.