From 2188f1093be549bb86799876306803630a2089c4 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Wed, 30 Oct 2019 19:56:41 +0000 Subject: [Darwin] Use of symbol stubs should depend on the linker in use. This is a combination of two patches that prevents a bootstrap fail when a modern assembler/linker pair are used that don't support the JBSR reloc (but don't require it for long calls). 272356 The need for picsym stubs is dependent on linker used, not OS rev. For very old toolchains, the compiler generated pic symbol stubs that provide the necessary indirections. We no longer need this (since xcode 3 era) and it's more efficient for the linker to make one stub when it knows a symbol is needed that for us to emit them speculatively in every object. Our current codegen is making the assumption that a specific OS version uses a specific linker version - and therefore the presence of support could be based on the target OS rev. Of course, that's way too simplistic (most likely bogus for cross-toolchains) and we want to make things explict. Since we have detection of the linker version, we can use that directly (A config test for support for stub-less linking might also be feasible but much more involved). Finally, should the user wish to generate code that caters for export to use in an environment with an older toolchain, the generation of stubs can be forced from the command line. In addition to the points above, branch islanding and a long branch opt for PowerPC Darwin has become conflated with the emission of these stubs (which is confusing, and will be rectified in a following patch). 274397 There is no need to distinguish PIC/non-PIC symbol stubs. So we can use a single flag for both. 2019-10-30 Iain Sandoe Backport from mainline 2019-08-13 Iain Sandoe * config/darwin.c (machopic_indirect_call_target): Rename symbol stub flag. (darwin_override_options): Likewise. * config/darwin.h: Likewise. * config/darwin.opt: Likewise. * config/i386/i386.c (output_pic_addr_const): Likewise. * config/rs6000/darwin.h: Likewise. * config/rs6000/rs6000.c (rs6000_call_darwin_1): Likewise. * config/i386/darwin.h (TARGET_MACHO_PICSYM_STUBS): Rename to ... ... this TARGET_MACHO_SYMBOL_STUBS. (FUNCTION_PROFILER):Likewise. * config/i386/i386.h: Likewise. Backport from mainline 2019-06-16 Iain Sandoe * config/darwin.c (machopic_indirect_call_target): Use renamed darwin_picsymbol_stubs to decide on output. (darwin_override_options): Handle darwin_picsymbol_stubs. * config/darwin.h (MIN_LD64_OMIT_STUBS): New. (LD64_VERSION): Revise default. * config/darwin.opt: (mpic-symbol-stubs): New option. (darwin_picsymbol_stubs): New variable. * config/i386/darwin.h (TARGET_MACHO_BRANCH_ISLANDS): rename to TARGET_MACHO_PICSYM_STUBS. * config/i386/i386.c (output_pic_addr_const): Likewise. * config/i386/i386.h Likewise. * config/rs6000/darwin.h: Likewise. * config/rs6000/rs6000.c (rs6000_call_darwin_1): Use renamed darwin_picsymbol_stubs. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277638 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/objc.dg/stubify-2.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite/objc.dg/stubify-2.m') diff --git a/gcc/testsuite/objc.dg/stubify-2.m b/gcc/testsuite/objc.dg/stubify-2.m index eaf4b964e4b..a07992a5a9e 100644 --- a/gcc/testsuite/objc.dg/stubify-2.m +++ b/gcc/testsuite/objc.dg/stubify-2.m @@ -4,7 +4,7 @@ /* { dg-do compile { target powerpc*-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4" } */ +/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; -- cgit v1.2.3 From 0a0823de0e601fd52101fce151a7487f93c08ec0 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Mon, 4 Nov 2019 23:06:21 +0000 Subject: [objective-c/c++, testsuite] Fix stubify tests for -fnext-runtime. Fixed to work for x86 as well as powerpc (use the final assembler output instead of the jump rtl which varies between X86 and PPC). Amended the options to reflect this change. gcc/testsuite/ Backport from mainline. 2019-06-20 Iain Sandoe * obj-c++.dg/stubify-1.mm: Adjust options and scan-asm checks. * obj-c++.dg/stubify-2.mm: Likewise. * objc.dg/stubify-1.m: Likewise. * objc.dg/stubify-2.m: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277800 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/objc.dg/stubify-2.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite/objc.dg/stubify-2.m') diff --git a/gcc/testsuite/objc.dg/stubify-2.m b/gcc/testsuite/objc.dg/stubify-2.m index a07992a5a9e..2930e46fc13 100644 --- a/gcc/testsuite/objc.dg/stubify-2.m +++ b/gcc/testsuite/objc.dg/stubify-2.m @@ -1,10 +1,10 @@ /* All calls must be properly stubified, m32 only. */ /* Testcase extracted from TextEdit:Document.m. */ -/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -msymbol-stubs" } */ +/* { dg-options "-mdynamic-no-pic -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; @@ -30,4 +30,9 @@ extern int bogonic (int, int, int) ; /* Any symbol_ref of an un-stubified objc_msgSend is an error; look for "objc_msgSend" in quotes, without the $stub suffix. */ -/* { dg-final { scan-rtl-dump-not "symbol_ref.*\"objc_msgSend\"" "jump" } } */ + +/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_objc_msgSend\n} } } */ +/* { dg-final { scan-assembler {(bl|call)[ \t]+L_objc_msgSend\$stub\n} } } */ +/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_bogonic\n} } } */ +/* { dg-final { scan-assembler {(bl|call)[ \t]+L_bogonic\$stub\n} } } */ +/* { dg-final { scan-assembler-not {\$non_lazy_ptr} } } */ -- cgit v1.2.3