https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63534
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Double set_got doesn't make sense, if you want to keep the current model, I'd emit a set_got insn forced into %ebx before the mcount call in the prologue and see if early after the prologue isn't a set_got insn, if there is, see if %ebx isn't clobbered in between the second set_got and end of prologue (or the reg in that second set_got), and if it isn't, just replace the second set_got with a move from %ebx to the reg used there (or, if %ebx is clobbered and the second reg isn't, move in the prologue into that register). Keep the double set_got only in uncommon case where you don't find it or both regs are clobbered early.