> On 10 May 2019, at 22:22, Uros Bizjak <ubiz...@gmail.com> wrote:
> 
> On Fri, May 10, 2019 at 11:03 PM Iain Sandoe <idsan...@googlemail.com> wrote:
>> 

>> PR82920 is about CET fails on Darwin.
>> 
>> Initially, this was expected to be just a testsuite issue, however it turns 
>> out that the indirection thunks code has inconsistent handling of the output 
>> of labels.  Thus some of the output is missing the leading “_” on Darwin, 
>> which breaks ABI and won’t link.
>> 
>> Since most of the tests are scan-asms that check for what’s expected, they 
>> currently pass on Darwin but will begin failing when the codegen is fixed.  
>> Thus there is  larger, but mechanical, testsuite change needed to deal with 
>> this.   I will post that if anyone’s interested, but otherwise will just 
>> apply it once the codgen fix is agreed.
>> 
>> The patch factors out some common code that writes out the jumps and uses 
>> the regular output scheme that accounts for __USER_LABEL_PREFIX__.
>> 
>> I will note in passing that there’s very little PIC test coverage for the 
>> indirection thunks code, although Darwin is PIC-only for m64 - Linux has 
>> only a few tests.
>> 
>> OK for trunk?
> 
> OK for trunk if the patch doesn't regress x86_64-linux.

tested on x86_64-linux-gnu and x86_64-darwin (m32 and m64 in both cases).
Applied to trunk.

Many thanks to Dominique for working though some of the many testsuite changes 
needed.
There’s a second set of test changes needed to fix the PR completely, but those 
are disjoint
to the ones below which result from the codegen changes.

thanks
Iain

gcc/

2019-05-12  Iain Sandoe  <i...@sandoe.co.uk>

        PR target/82920
        * config/i386/i386.c (ix86_output_jmp_thunk_or_indirect): New.
        (ix86_output_indirect_branch_via_reg): Use output mechanism
        accounting for __USER_LABEL_PREFIX__.
        (ix86_output_indirect_branch_via_push): Likewise.
        (ix86_output_function_return): Likewise.
        (ix86_output_indirect_function_return): Likewise.

gcc/testsuite/

2019-05-12  Iain Sandoe  <i...@sandoe.co.uk>
            Dominique d'Humieres  <domi...@gcc.gnu.org>

        PR target/82920
        * gcc.target/i386/indirect-thunk-1.c: Adjust scan-asms for Darwin,
        do not use -fno-pic on Darwin.
        * gcc.target/i386/indirect-thunk-2.c: Likewise.
        * gcc.target/i386/indirect-thunk-3.c: Likewise.
        * gcc.target/i386/indirect-thunk-4.c: Likewise.
        * gcc.target/i386/indirect-thunk-7.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
        * gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
        * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
        * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
        * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
        * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
        * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
        * gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
        * gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
        * gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
        * gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
        * gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
        * gcc.target/i386/indirect-thunk-register-1.c: Likewise.
        * gcc.target/i386/indirect-thunk-register-2.c: Likewise.
        * gcc.target/i386/indirect-thunk-register-3.c: Likewise.
        * gcc.target/i386/indirect-thunk-register-4.c: Likewise.
        * gcc.target/i386/ret-thunk-1.c: Likewise.
        * gcc.target/i386/ret-thunk-10.c: Likewise.
        * gcc.target/i386/ret-thunk-11.c: Likewise.
        * gcc.target/i386/ret-thunk-12.c: Likewise.
        * gcc.target/i386/ret-thunk-13.c: Likewise.
        * gcc.target/i386/ret-thunk-14.c: Likewise.
        * gcc.target/i386/ret-thunk-15.c: Likewise.
        * gcc.target/i386/ret-thunk-16.c: Likewise.
        * gcc.target/i386/ret-thunk-2.c: Likewise.
        * gcc.target/i386/ret-thunk-22.c: Likewise.
        * gcc.target/i386/ret-thunk-23.c: Likewise.
        * gcc.target/i386/ret-thunk-24.c: Likewise.
        * gcc.target/i386/ret-thunk-3.c: Likewise.
        * gcc.target/i386/ret-thunk-4.c: Likewise.
        * gcc.target/i386/ret-thunk-5.c: Likewise.
        * gcc.target/i386/ret-thunk-6.c: Likewise.
        * gcc.target/i386/ret-thunk-7.c: Likewise.
        * gcc.target/i386/ret-thunk-8.c: Likewise.
        * gcc.target/i386/ret-thunk-9.c: Likewise.


Attachment: pr82920-code-part.diff
Description: pr82920-code-part.diff

Attachment: pr82920-testsuite-1.diff
Description: pr82920-testsuite-1.diff

Reply via email to