https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386
--- Comment #26 from Ard Biesheuvel <ardb at kernel dot org> --- (In reply to Alexander Monakov from comment #25) > (In reply to Ard Biesheuvel from comment #24) > > - never emit 'call mcount' > > - emit 'call *mcount@GOTPCREL(%rip)' if -fno-plt > > - emit 'call mcount@PLT' otherwise > > As discussed, gcc was always using GOT indirection for mcount since the > beginning, so the above would be a substantial change. The substantial change has already been made in 2023, which is to use 'call mcount', and only now, we're finding out that this a problem, but only with a patched downstream GAS that decorates CALL instructions with R_X86_64_PC32 rather than R_X86_64_PLT32. So I'd argue that there is room here to do the correct thing.