https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82920
--- Comment #21 from Iain Sandoe <iains at gcc dot gnu.org> --- Author: iains Date: Sat Sep 28 19:54:00 2019 New Revision: 276257 URL: https://gcc.gnu.org/viewcvs?rev=276257&root=gcc&view=rev Log: [X86, Darwin] Backport fix for pr82920 (part 1). The various thunks output codes have inconsistent output mechanisms. The patch factors out some common code that writes out the jumps and uses the regular output scheme that accounts for __USER_LABEL_PREFIX__. The testsuite changes are largely mechanical compensation for the revised output (and the fact that Darwin doesn't use non-PIC by default). gcc/ 2019-09-28 Iain Sandoe <i...@sandoe.co.uk> Backport from mainline. 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-09-28 Iain Sandoe <i...@sandoe.co.uk> Backport from mainline. 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. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/i386/i386.c branches/gcc-7-branch/gcc/testsuite/ChangeLog branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-1.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-10.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-11.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-12.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-13.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-14.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-15.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-16.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-2.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-22.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-23.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-24.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-3.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-4.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-5.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-6.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-7.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-8.c branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/ret-thunk-9.c