https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386
--- Comment #24 from Ard Biesheuvel <ardb at kernel dot org> --- (In reply to Alexander Monakov from comment #23) > That's probably just copying existing behavior from 32-bit x86. > > Can we preserve previous behavior that under -fpic -mno-direct-extern-access > mcount is called via GOT (and else emit mcount@PLT if -fpic > -mdirect-extern-access)? I think -fno-plt should be factored in as well if we are going to emit mcount@PLT. So what I'd propose is, for CM_SMALL_PIC and CM_MEDIUM_PIC: - never emit 'call mcount' - emit 'call *mcount@GOTPCREL(%rip)' if -fno-plt or -mno-direct-extern-access - emit 'call mcount@PLT' otherwise In hindsight, I think keying this off of -mno-direct-extern-access was a mistake and only -fno-plt should have been taken into account here, given that we are dealing with a function symbol. So what we might do is - never emit 'call mcount' - emit 'call *mcount@GOTPCREL(%rip)' if -fno-plt - emit 'call mcount@PLT' otherwise Votes please?