Skip to content
Snippets Groups Projects
Commit 404ea4c1 authored by Uros Bizjak's avatar Uros Bizjak
Browse files

i386: Fix ICE with -fsplit-stack -mcmodel=large [PR112686]

For -mcmodel=large, we have to load function address to a register.

	PR target/112686

gcc/ChangeLog:

	* config/i386/i386.cc (ix86_expand_split_stack_prologue): Load
	function address to a register for ix86_cmodel == CM_LARGE.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr112686.c: New test.
parent 449b6b81
No related branches found
No related tags found
No related merge requests found
...@@ -10481,6 +10481,8 @@ ix86_expand_split_stack_prologue (void) ...@@ -10481,6 +10481,8 @@ ix86_expand_split_stack_prologue (void)
SYMBOL_REF_FLAGS (split_stack_fn_large) |= SYMBOL_FLAG_LOCAL; SYMBOL_REF_FLAGS (split_stack_fn_large) |= SYMBOL_FLAG_LOCAL;
} }
   
fn = split_stack_fn_large;
if (ix86_cmodel == CM_LARGE_PIC) if (ix86_cmodel == CM_LARGE_PIC)
{ {
rtx_code_label *label; rtx_code_label *label;
...@@ -10494,16 +10496,15 @@ ix86_expand_split_stack_prologue (void) ...@@ -10494,16 +10496,15 @@ ix86_expand_split_stack_prologue (void)
emit_insn (gen_set_rip_rex64 (reg10, label)); emit_insn (gen_set_rip_rex64 (reg10, label));
emit_insn (gen_set_got_offset_rex64 (reg11, label)); emit_insn (gen_set_got_offset_rex64 (reg11, label));
emit_insn (gen_add2_insn (reg10, reg11)); emit_insn (gen_add2_insn (reg10, reg11));
x = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, split_stack_fn_large), x = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, fn), UNSPEC_GOT);
UNSPEC_GOT);
x = gen_rtx_CONST (Pmode, x); x = gen_rtx_CONST (Pmode, x);
emit_move_insn (reg11, x); emit_move_insn (reg11, x);
x = gen_rtx_PLUS (Pmode, reg10, reg11); x = gen_rtx_PLUS (Pmode, reg10, reg11);
x = gen_const_mem (Pmode, x); x = gen_const_mem (Pmode, x);
fn = copy_to_suggested_reg (x, reg11, Pmode); fn = copy_to_suggested_reg (x, reg11, Pmode);
} }
else else if (ix86_cmodel == CM_LARGE)
fn = split_stack_fn_large; fn = copy_to_suggested_reg (fn, reg11, Pmode);
   
/* When using the large model we need to load the address /* When using the large model we need to load the address
into a register, and we've run out of registers. So we into a register, and we've run out of registers. So we
......
/* PR target/112686 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-fsplit-stack -mcmodel=large" } */
void foo (void) {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment