https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105980
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If we follow what other backends do in *_output_mi_thunk, it would be
--- gcc/config/i386/i386.cc.jj 2022-07-26 10:32:23.373275765 +0200
+++ gcc/config/i386/i386.cc 2022-07-29 15:25:26.023555541 +0200
@@ -21396,6 +21396,7 @@ x86_output_mi_thunk (FILE *file, tree th
tmp_regno = CX_REG;
}
+ reload_completed = 1;
emit_note (NOTE_INSN_PROLOGUE_END);
/* CET is enabled, insert EB instruction. */
@@ -21561,6 +21562,9 @@ x86_output_mi_thunk (FILE *file, tree th
final (insn, file, 1);
final_end_function ();
assemble_end_function (thunk_fndecl, fnname);
+
+ /* Stop pretending to be a post-reload pass. */
+ reload_completed = 0;
}
static void
Unfortunately, that doesn't help much, the next problem is that it needs
pic_offset_table_rtx as a hard register, so we probably before
tmp = gen_rtx_REG (word_mode, tmp_regno);
if (GET_MODE (fnaddr) != word_mode)
fnaddr = gen_rtx_ZERO_EXTEND (word_mode, fnaddr);
emit_move_insn (tmp, fnaddr);
fnaddr = tmp;
in the above mentioned snippet need to do something like:
if (flag_pic && !TARGET_64BIT && !TARGET_MACHO && SYMBOLIC_CONST
(fnaddr))
{
pic_offset_table_rtx = gen_reg_RTX (Pmode, some_suitable_reg);
ix86_init_pic_reg ();
}
or something similar. But unsure about the exact conditions,
insert_insn_on_edge will likely not work either etc.
So it likely needs emit_insn (gen_set_got (reg)) etc. directly.
}