On Mon, Nov 20, 2023 at 5:33 PM Uros Bizjak <ubiz...@gmail.com> wrote:
>
> With the above two options, use a temporary register regno (as returned
> from split_stack_prologue_scratch_regno) as an indirect call scratch
> register to hold __morestack function address.  On 64-bit targets, two
> temporary registers are always available, so load the function address in
> %r11 and call __morestack_large_model with its one-argument-register value
> in %r10.  On 32-bit targets, bail out with a "sorry" if the temporary
> register can not be obtained.
>
> On 32-bit targets, also emit a PIC sequence that re-uses the obtained indirect
> call scratch register before moving the function address to it.  We can
> not set up %ebx PIC register in this case, but __morestack is prepared
> for this situation and sets it up by itself.
>
>     PR target/89316
>
> gcc/ChangeLog:
>
>     * config/i386/i386.cc (ix86_expand_split_stack_prologue): Obtain
>     scratch regno when flag_force_indirect_call is set.  On 64-bit
>     targets, call __morestack_large_model when flag_force_indirect_call
>     is set and on 32-bit targets with -fpic, manually expand PIC sequence
>     to call __morestack.  Move the function address to an indirect
>     call scratch register.
>
> gcc/testsuite/ChangeLog:
>
>     * g++.target/i386/pr89316.C: New test.
>     * gcc.target/i386/pr112605-1.c: New test.
>     * gcc.target/i386/pr112605-2.c: New test.
>     * gcc.target/i386/pr112605.c: New test.
>
> Jakub, I'm not entirely sure x86_32 PIC sequence is 100% correct
> (please note that the missing %ebx setup situation is handled in
> __morestack), so I'd be very grateful for your review of this part.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Pushed to master.

Uros.

Reply via email to