* [Patch, darwin] do not generate branch islands when the linker can do it.
@ 2010-07-15 17:10 IainS
2010-07-15 17:38 ` Richard Henderson
0 siblings, 1 reply; 10+ messages in thread
From: IainS @ 2010-07-15 17:10 UTC (permalink / raw)
To: gcc-patches List; +Cc: mrs, Uros Bizjak, David Edelsohn
[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]
Hi,
This hugely tidies up *-*-darwin{9,10} asm by omitting the branch
islands where they are not needed.
I've had it in my local tree for a month or so .. and it's been
bootstrapped on x86_64-unknown-linux-gnu as well as a number of cross-
targets.
I don't have a second rs6000 target but, by inspection, the changes
are within code already wrapped by #ifdef MACH_O.
We must not put the "darwin_emit_branch_islands" declaration into
darwin.h or I think it will mess up the (small amount of) binutils
stuff that currently works for darwin. Hence the reason it appears in
both i386/darwin.h and rs6000/darwin.h
OK for trunk?
Iain
* config/i386/darwin.h: Define darwin_emit_branch_islands.
(FUNCTION_PROFILER): Do not emit branch islands unless
darwin_emit_branch_islands is set.
* config/i386/i386.c (output_pic_addr_const): Do not emit
branch islands unless darwin_emit_branch_islands is set.
(x86_output_mi_thunk): Adjust symbol creation.
* config/rs6000/darwin.h: Define darwin_emit_branch_islands.
Remove out of date comment.
* config/rs6000/rs6000.c (print_operand): Adjust symbol.
DARWIN_LINKER_GENERATES_ISLANDS: Remove.
DARWIN_GENERATE_ISLANDS: Ditto.
(output_call): Do not emit branch islands unless
darwin_emit_branch_islands is set.
* config/darwin.c: Declare darwin_emit_branch_islands.
(machopic_indirect_data_reference): Do not emit unless
darwin_emit_branch_islands is set.
(darwin_override_options): Set darwin_emit_branch_islands
where it is needed.
* config/darwin9.h
DARWIN_LINKER_GENERATES_ISLANDS: Remove.
[-- Attachment #2: 162209-darwin-branch-islands.txt --]
[-- Type: text/plain, Size: 6427 bytes --]
Index: gcc/config/i386/darwin.h
===================================================================
--- gcc/config/i386/darwin.h (revision 162209)
+++ gcc/config/i386/darwin.h (working copy)
@@ -60,6 +60,9 @@ along with GCC; see the file COPYING3. If not see
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
+/* Generate branch islands stubs if this is true. */
+extern int darwin_emit_branch_islands;
+
#undef MAX_BITS_PER_WORD
#define MAX_BITS_PER_WORD 64
@@ -225,7 +228,7 @@ along with GCC; see the file COPYING3. If not see
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
- if (MACHOPIC_INDIRECT && !TARGET_64BIT) \
+ if (darwin_emit_branch_islands && MACHOPIC_INDIRECT && !TARGET_64BIT) \
{ \
const char *name = machopic_mcount_stub_name (); \
fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 162209)
+++ gcc/config/i386/i386.c (working copy)
@@ -11510,7 +11510,11 @@ output_pic_addr_const (FILE *file, rtx x, int code
break;
case SYMBOL_REF:
- if (! TARGET_MACHO || TARGET_64BIT)
+ if (! TARGET_MACHO ||
+#if TARGET_MACHO
+ ! darwin_emit_branch_islands ||
+#endif
+ TARGET_64BIT)
output_addr_const (file, x);
else
{
@@ -27230,10 +27234,11 @@ x86_output_mi_thunk (FILE *file,
if (TARGET_MACHO)
{
rtx sym_ref = XEXP (DECL_RTL (function), 0);
- tmp = (gen_rtx_SYMBOL_REF
+ if (darwin_emit_branch_islands)
+ sym_ref = (gen_rtx_SYMBOL_REF
(Pmode,
machopic_indirection_name (sym_ref, /*stub_p=*/true)));
- tmp = gen_rtx_MEM (QImode, tmp);
+ tmp = gen_rtx_MEM (QImode, sym_ref);
xops[0] = tmp;
output_asm_insn ("jmp\t%0", xops);
}
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h (revision 162209)
+++ gcc/config/rs6000/darwin.h (working copy)
@@ -65,6 +65,9 @@
} \
while (0)
+/* Generate branch islands stubs if this is true. */
+extern int darwin_emit_branch_islands;
+
#define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options ()
#define C_COMMON_OVERRIDE_OPTIONS do { \
@@ -385,8 +388,6 @@
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
-/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
- support 64 bit PowerPC either, so this just keeps things happy. */
#define DOUBLE_INT_ASM_OP "\t.quad\t"
/* For binary compatibility with 2.95; Darwin C APIs use bool from
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 162209)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -15392,7 +15392,8 @@ print_operand (FILE *file, rtx x, int code)
{
const char *name = XSTR (x, 0);
#if TARGET_MACHO
- if (MACHOPIC_INDIRECT
+ if (darwin_emit_branch_islands
+ && MACHOPIC_INDIRECT
&& machopic_classify_symbol (x) == MACHOPIC_UNDEFINED_FUNCTION)
name = machopic_indirection_name (x, /*stub_p=*/true);
#endif
@@ -24513,14 +24514,6 @@ get_prev_label (tree function_name)
return 0;
}
-#ifndef DARWIN_LINKER_GENERATES_ISLANDS
-#define DARWIN_LINKER_GENERATES_ISLANDS 0
-#endif
-
-/* KEXTs still need branch islands. */
-#define DARWIN_GENERATE_ISLANDS (!DARWIN_LINKER_GENERATES_ISLANDS \
- || flag_mkernel || flag_apple_kext)
-
/* INSN is either a function call or a millicode call. It may have an
unconditional jump in its delay slot.
@@ -24531,7 +24524,7 @@ output_call (rtx insn, rtx *operands, int dest_ope
int cookie_operand_number)
{
static char buf[256];
- if (DARWIN_GENERATE_ISLANDS
+ if (darwin_emit_branch_islands
&& GET_CODE (operands[dest_operand_number]) == SYMBOL_REF
&& (INTVAL (operands[cookie_operand_number]) & CALL_LONG))
{
Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c (revision 162209)
+++ gcc/config/darwin.c (working copy)
@@ -79,6 +79,12 @@ along with GCC; see the file COPYING3. If not see
of MACHO_SYMBOL_STATIC for the code that handles @code{static}
symbol indirection. */
+/* For darwin >= 9 (OSX 10.5) the linker is capable of making the necessary
+ branch islands and we no longer need to emit darwin stubs.
+ However, if we are generating code for earlier systems (or for use in the
+ kernel) the stubs might still be required, and this will be set true. */
+int darwin_emit_branch_islands = false;
+
/* Section names. */
section * darwin_sections[NUM_DARWIN_SECTIONS];
@@ -625,6 +631,9 @@ machopic_indirect_data_reference (rtx orig, rtx re
rtx
machopic_indirect_call_target (rtx target)
{
+ if (! darwin_emit_branch_islands)
+ return target;
+
if (GET_CODE (target) != MEM)
return target;
@@ -1888,12 +1917,19 @@ darwin_override_options (void)
flag_exceptions = 0;
/* No -fnon-call-exceptions data in kexts. */
flag_non_call_exceptions = 0;
+ /* We still need to emit branch islands for kernel context. */
+ darwin_emit_branch_islands = true;
}
if (flag_var_tracking
&& strverscmp (darwin_macosx_version_min, "10.5") >= 0
&& debug_info_level >= DINFO_LEVEL_NORMAL
&& debug_hooks->var_location != do_nothing_debug_hooks.var_location)
flag_var_tracking_uninit = 1;
+
+ /* It is assumed that branch island stubs are needed for earlier systems. */
+ if (darwin_macosx_version_min
+ && strverscmp (darwin_macosx_version_min, "10.5") < 0)
+ darwin_emit_branch_islands = true;
}
/* Add $LDBL128 suffix to long double builtins. */
Index: gcc/config/darwin9.h
===================================================================
--- gcc/config/darwin9.h (revision 162209)
+++ gcc/config/darwin9.h (working copy)
@@ -44,9 +44,6 @@ along with GCC; see the file COPYING3. If not see
/* libSystem contains unwind information for signal frames. */
#define DARWIN_LIBSYSTEM_HAS_UNWIND
-/* The linker can generate branch islands. */
-#define DARWIN_LINKER_GENERATES_ISLANDS 1
-
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \
[-- Attachment #3: Type: text/plain, Size: 2 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-15 17:10 [Patch, darwin] do not generate branch islands when the linker can do it IainS
@ 2010-07-15 17:38 ` Richard Henderson
2010-07-15 18:27 ` IainS
0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2010-07-15 17:38 UTC (permalink / raw)
To: IainS; +Cc: gcc-patches List, mrs, Uros Bizjak, David Edelsohn
On 07/15/2010 10:10 AM, IainS wrote:
> - if (! TARGET_MACHO || TARGET_64BIT)
> + if (! TARGET_MACHO ||
> +#if TARGET_MACHO
> + ! darwin_emit_branch_islands ||
> +#endif
> + TARGET_64BIT)
I'd really like to avoid the #if mid if. Perhaps
if (TARGET_64BIT || !TARGET_MACHO_BRANCH_ISLANDS)
with
#if TARGET_MACHO
#define TARGET_MACHO_BRANCH_ISLANDS darwin_emit_branch_islands
#else
#define TARGET_MACHO_BRANCH_ISLANDS 0
#endif
or similar via #undef.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-15 17:38 ` Richard Henderson
@ 2010-07-15 18:27 ` IainS
2010-07-15 18:44 ` Richard Henderson
0 siblings, 1 reply; 10+ messages in thread
From: IainS @ 2010-07-15 18:27 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc-patches List, mrs, Uros Bizjak, David Edelsohn
On 15 Jul 2010, at 18:38, Richard Henderson wrote:
> On 07/15/2010 10:10 AM, IainS wrote:
>> - if (! TARGET_MACHO || TARGET_64BIT)
>> + if (! TARGET_MACHO ||
>> +#if TARGET_MACHO
>> + ! darwin_emit_branch_islands ||
>> +#endif
>> + TARGET_64BIT)
>
> I'd really like to avoid the #if mid if. Perhaps
>
> if (TARGET_64BIT || !TARGET_MACHO_BRANCH_ISLANDS)
>
> with
>
> #if TARGET_MACHO
> #define TARGET_MACHO_BRANCH_ISLANDS darwin_emit_branch_islands
> #else
> #define TARGET_MACHO_BRANCH_ISLANDS 0
> #endif
>
> or similar via #undef
(I almost did that anyway .. not quite sure why I didn't now.. )
Iain
----
amendment (changes since first patch only);
Index: gcc/config/i386/darwin.h
===================================================================
--- gcc/config/i386/darwin.h (revision 162209)
+++ gcc/config/i386/darwin.h (working copy)
@@ -60,6 +60,9 @@ along with GCC; see the file COPYING3. If not see
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
+/* Generate branch islands stubs if this is true. */
+extern int darwin_emit_branch_islands;
+
#undef MAX_BITS_PER_WORD
#define MAX_BITS_PER_WORD 64
@@ -225,7 +228,7 @@ along with GCC; see the file COPYING3. If not see
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
- if (MACHOPIC_INDIRECT && !TARGET_64BIT) \
+ if (darwin_emit_branch_islands && MACHOPIC_INDIRECT && !
TARGET_64BIT) \
{ \
const char *name = machopic_mcount_stub_name (); \
fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
@@ -300,3 +303,7 @@ along with GCC; see the file COPYING3. If not see
#define MACHO_SYMBOL_FLAG_VARIABLE ((SYMBOL_FLAG_MACH_DEP) << 3)
#define SUBTARGET32_DEFAULT_CPU "i686"
+
+#undef TARGET_MACHO_BRANCH_ISLANDS
+#define TARGET_MACHO_BRANCH_ISLANDS darwin_emit_branch_islands
+
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 162209)
+++ gcc/config/i386/i386.c (working copy)
@@ -2206,6 +2206,10 @@ static const char *const
cpu_names[TARGET_CPU_DEFA
"amdfam10",
"bdver1"
};
+
+#ifndef TARGET_MACHO_BRANCH_ISLANDS
+# define TARGET_MACHO_BRANCH_ISLANDS 0
+#endif
\f
/* Implement TARGET_HANDLE_OPTION. */
@@ -11510,7 +11514,7 @@ output_pic_addr_const (FILE *file, rtx x, int
code
break;
case SYMBOL_REF:
- if (! TARGET_MACHO || TARGET_64BIT)
+ if (! TARGET_MACHO || ! TARGET_MACHO_BRANCH_ISLANDS ||
TARGET_64BIT)
output_addr_const (file, x);
else
{
@@ -27230,10 +27234,11 @@ x86_output_mi_thunk (FILE *file,
if (TARGET_MACHO)
{
rtx sym_ref = XEXP (DECL_RTL (function), 0);
- tmp = (gen_rtx_SYMBOL_REF
+ if (TARGET_MACHO_BRANCH_ISLANDS)
+ sym_ref = (gen_rtx_SYMBOL_REF
(Pmode,
machopic_indirection_name (sym_ref, /*stub_p=*/true)));
- tmp = gen_rtx_MEM (QImode, tmp);
+ tmp = gen_rtx_MEM (QImode, sym_ref);
xops[0] = tmp;
output_asm_insn ("jmp\t%0", xops);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-15 18:27 ` IainS
@ 2010-07-15 18:44 ` Richard Henderson
2010-07-15 19:34 ` IainS
0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2010-07-15 18:44 UTC (permalink / raw)
To: IainS; +Cc: gcc-patches List, mrs, Uros Bizjak, David Edelsohn
On 07/15/2010 11:27 AM, IainS wrote:
> +#ifndef TARGET_MACHO_BRANCH_ISLANDS
> +# define TARGET_MACHO_BRANCH_ISLANDS 0
> +#endif
This could go next to the TARGET_MACHO definition in i386.h, for consistency.
From a i386 maintainer perspective, I think this is ok. I'll defer
for ppc and darwin knowledge.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-15 18:44 ` Richard Henderson
@ 2010-07-15 19:34 ` IainS
2010-07-17 18:10 ` IainS
0 siblings, 1 reply; 10+ messages in thread
From: IainS @ 2010-07-15 19:34 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc-patches List, mrs, Uros Bizjak, David Edelsohn
On 15 Jul 2010, at 19:44, Richard Henderson wrote:
> On 07/15/2010 11:27 AM, IainS wrote:
>> +#ifndef TARGET_MACHO_BRANCH_ISLANDS
>> +# define TARGET_MACHO_BRANCH_ISLANDS 0
>> +#endif
>
> This could go next to the TARGET_MACHO definition in i386.h, for
> consistency.
>
> From a i386 maintainer perspective, I think this is ok. I'll defer
> for ppc and darwin knowledge.
FWIW: At your suggestion,
since then I've built powerpc-unknown-linux-gnu (crossed from i6868-
darwin9) and proved it can compile a trivial source file.
(of course, the patch was already tested on powerpc-apple-darwin9 as
well)
Iain
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-15 19:34 ` IainS
@ 2010-07-17 18:10 ` IainS
2010-07-18 13:08 ` David Edelsohn
2010-07-18 18:18 ` Mike Stump
0 siblings, 2 replies; 10+ messages in thread
From: IainS @ 2010-07-17 18:10 UTC (permalink / raw)
To: gcc-patches List; +Cc: mrs, Uros Bizjak, David Edelsohn, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 798 bytes --]
On 15 Jul 2010, at 20:34, IainS wrote:
> On 15 Jul 2010, at 19:44, Richard Henderson wrote:
>
>> On 07/15/2010 11:27 AM, IainS wrote:
>>> +#ifndef TARGET_MACHO_BRANCH_ISLANDS
>>> +# define TARGET_MACHO_BRANCH_ISLANDS 0
>>> +#endif
>>
>> This could go next to the TARGET_MACHO definition in i386.h, for
>> consistency.
>>
>> From a i386 maintainer perspective, I think this is ok. I'll defer
>> for ppc and darwin knowledge.
>
> FWIW: At your suggestion,
> since then I've built powerpc-unknown-linux-gnu (crossed from i6868-
> darwin9) and proved it can compile a trivial source file.
>
> (of course, the patch was already tested on powerpc-apple-darwin9
> as well)
consolidated patch with the amendments suggested by Richard, ...
... still needs rs6000 and darwin reviews.
thanks,
Iain
[-- Attachment #2: 162275-darwin-branch-islands.txt --]
[-- Type: text/plain, Size: 7012 bytes --]
Index: gcc/config/i386/darwin.h
===================================================================
--- gcc/config/i386/darwin.h (revision 162275)
+++ gcc/config/i386/darwin.h (working copy)
@@ -60,6 +60,12 @@ along with GCC; see the file COPYING3. If not see
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
+/* Generate branch islands stubs if this is true. */
+extern int darwin_emit_branch_islands;
+
+#undef TARGET_MACHO_BRANCH_ISLANDS
+#define TARGET_MACHO_BRANCH_ISLANDS darwin_emit_branch_islands
+
#undef MAX_BITS_PER_WORD
#define MAX_BITS_PER_WORD 64
@@ -225,7 +231,7 @@ along with GCC; see the file COPYING3. If not see
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
- if (MACHOPIC_INDIRECT && !TARGET_64BIT) \
+ if (TARGET_MACHO_BRANCH_ISLANDS && MACHOPIC_INDIRECT && !TARGET_64BIT) \
{ \
const char *name = machopic_mcount_stub_name (); \
fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 162275)
+++ gcc/config/i386/i386.c (working copy)
@@ -11513,7 +11513,7 @@ output_pic_addr_const (FILE *file, rtx x, int code
break;
case SYMBOL_REF:
- if (! TARGET_MACHO || TARGET_64BIT)
+ if (TARGET_64BIT || ! TARGET_MACHO_BRANCH_ISLANDS)
output_addr_const (file, x);
else
{
@@ -27233,10 +27233,11 @@ x86_output_mi_thunk (FILE *file,
if (TARGET_MACHO)
{
rtx sym_ref = XEXP (DECL_RTL (function), 0);
- tmp = (gen_rtx_SYMBOL_REF
+ if (TARGET_MACHO_BRANCH_ISLANDS)
+ sym_ref = (gen_rtx_SYMBOL_REF
(Pmode,
machopic_indirection_name (sym_ref, /*stub_p=*/true)));
- tmp = gen_rtx_MEM (QImode, tmp);
+ tmp = gen_rtx_MEM (QImode, sym_ref);
xops[0] = tmp;
output_asm_insn ("jmp\t%0", xops);
}
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h (revision 162275)
+++ gcc/config/i386/i386.h (working copy)
@@ -477,6 +477,11 @@ extern tree x86_mfence;
redefines this to 1. */
#define TARGET_MACHO 0
+/* This is a options flag on darwin systems. */
+#ifndef TARGET_MACHO_BRANCH_ISLANDS
+#define TARGET_MACHO_BRANCH_ISLANDS 0
+#endif
+
/* Likewise, for the Windows 64-bit ABI. */
#define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h (revision 162275)
+++ gcc/config/rs6000/darwin.h (working copy)
@@ -65,6 +65,9 @@
} \
while (0)
+/* Generate branch islands stubs if this is true. */
+extern int darwin_emit_branch_islands;
+
#define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options ()
#define C_COMMON_OVERRIDE_OPTIONS do { \
@@ -385,8 +388,6 @@
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
-/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
- support 64 bit PowerPC either, so this just keeps things happy. */
#define DOUBLE_INT_ASM_OP "\t.quad\t"
/* For binary compatibility with 2.95; Darwin C APIs use bool from
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 162275)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -15392,7 +15392,8 @@ print_operand (FILE *file, rtx x, int code)
{
const char *name = XSTR (x, 0);
#if TARGET_MACHO
- if (MACHOPIC_INDIRECT
+ if (darwin_emit_branch_islands
+ && MACHOPIC_INDIRECT
&& machopic_classify_symbol (x) == MACHOPIC_UNDEFINED_FUNCTION)
name = machopic_indirection_name (x, /*stub_p=*/true);
#endif
@@ -24482,14 +24483,6 @@ get_prev_label (tree function_name)
return 0;
}
-#ifndef DARWIN_LINKER_GENERATES_ISLANDS
-#define DARWIN_LINKER_GENERATES_ISLANDS 0
-#endif
-
-/* KEXTs still need branch islands. */
-#define DARWIN_GENERATE_ISLANDS (!DARWIN_LINKER_GENERATES_ISLANDS \
- || flag_mkernel || flag_apple_kext)
-
/* INSN is either a function call or a millicode call. It may have an
unconditional jump in its delay slot.
@@ -24500,7 +24493,7 @@ output_call (rtx insn, rtx *operands, int dest_ope
int cookie_operand_number)
{
static char buf[256];
- if (DARWIN_GENERATE_ISLANDS
+ if (darwin_emit_branch_islands
&& GET_CODE (operands[dest_operand_number]) == SYMBOL_REF
&& (INTVAL (operands[cookie_operand_number]) & CALL_LONG))
{
Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c (revision 162275)
+++ gcc/config/darwin.c (working copy)
@@ -79,6 +79,12 @@ along with GCC; see the file COPYING3. If not see
of MACHO_SYMBOL_STATIC for the code that handles @code{static}
symbol indirection. */
+/* For darwin >= 9 (OSX 10.5) the linker is capable of making the necessary
+ branch islands and we no longer need to emit darwin stubs.
+ However, if we are generating code for earlier systems (or for use in the
+ kernel) the stubs might still be required, and this will be set true. */
+int darwin_emit_branch_islands = false;
+
/* Section names. */
section * darwin_sections[NUM_DARWIN_SECTIONS];
@@ -625,6 +631,9 @@ machopic_indirect_data_reference (rtx orig, rtx re
rtx
machopic_indirect_call_target (rtx target)
{
+ if (! darwin_emit_branch_islands)
+ return target;
+
if (GET_CODE (target) != MEM)
return target;
@@ -1888,12 +1897,19 @@ darwin_override_options (void)
flag_exceptions = 0;
/* No -fnon-call-exceptions data in kexts. */
flag_non_call_exceptions = 0;
+ /* We still need to emit branch islands for kernel context. */
+ darwin_emit_branch_islands = true;
}
if (flag_var_tracking
&& strverscmp (darwin_macosx_version_min, "10.5") >= 0
&& debug_info_level >= DINFO_LEVEL_NORMAL
&& debug_hooks->var_location != do_nothing_debug_hooks.var_location)
flag_var_tracking_uninit = 1;
+
+ /* It is assumed that branch island stubs are needed for earlier systems. */
+ if (darwin_macosx_version_min
+ && strverscmp (darwin_macosx_version_min, "10.5") < 0)
+ darwin_emit_branch_islands = true;
}
/* Add $LDBL128 suffix to long double builtins. */
Index: gcc/config/darwin9.h
===================================================================
--- gcc/config/darwin9.h (revision 162275)
+++ gcc/config/darwin9.h (working copy)
@@ -44,9 +44,6 @@ along with GCC; see the file COPYING3. If not see
/* libSystem contains unwind information for signal frames. */
#define DARWIN_LIBSYSTEM_HAS_UNWIND
-/* The linker can generate branch islands. */
-#define DARWIN_LINKER_GENERATES_ISLANDS 1
-
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-17 18:10 ` IainS
@ 2010-07-18 13:08 ` David Edelsohn
2010-07-18 13:20 ` Iain Sandoe
2010-07-18 18:18 ` Mike Stump
1 sibling, 1 reply; 10+ messages in thread
From: David Edelsohn @ 2010-07-18 13:08 UTC (permalink / raw)
To: IainS; +Cc: gcc-patches List, mrs, Uros Bizjak, Richard Henderson
Iain,
The rs6000 changes are very Darwin-specific and should be reviewed by
a Darwin maintainer.
Why are you removing the comment from rs6000/darwin.h?
-/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
- support 64 bit PowerPC either, so this just keeps things happy. */
#define DOUBLE_INT_ASM_OP "\t.quad\t"
Thanks, David
> consolidated patch with the amendments suggested by Richard, ...
> ... still needs rs6000 and darwin reviews.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-18 13:08 ` David Edelsohn
@ 2010-07-18 13:20 ` Iain Sandoe
0 siblings, 0 replies; 10+ messages in thread
From: Iain Sandoe @ 2010-07-18 13:20 UTC (permalink / raw)
To: David Edelsohn; +Cc: gcc-patches List, mrs, Richard Henderson
On 18 Jul 2010, at 14:08, David Edelsohn wrote:
> Why are you removing the comment from rs6000/darwin.h?
>
> -/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't
> - support 64 bit PowerPC either, so this just keeps things happy.
> */
> #define DOUBLE_INT_ASM_OP "\t.quad\t"
I've been building powerpc64-apple-darwin for a long time, support
for 64 bit ppc appeared (partially) in darwin8.
It is fully operational in darwin9, so the comment seems somewhat out
of date and possibly misleading.
(or I misunderstand what the comment is about, in which case it needs
revision, please).
thanks for reviewing,
cheers
Iain
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-17 18:10 ` IainS
2010-07-18 13:08 ` David Edelsohn
@ 2010-07-18 18:18 ` Mike Stump
2010-07-19 9:13 ` IainS
1 sibling, 1 reply; 10+ messages in thread
From: Mike Stump @ 2010-07-18 18:18 UTC (permalink / raw)
To: IainS
Cc: gcc-patches List, mrs, Uros Bizjak, David Edelsohn, Richard Henderson
On Jul 17, 2010, at 11:09 AM, IainS wrote:
> consolidated patch with the amendments suggested by Richard, ...
> ... still needs rs6000 and darwin reviews.
Ok. Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch, darwin] do not generate branch islands when the linker can do it.
2010-07-18 18:18 ` Mike Stump
@ 2010-07-19 9:13 ` IainS
0 siblings, 0 replies; 10+ messages in thread
From: IainS @ 2010-07-19 9:13 UTC (permalink / raw)
To: gcc-patches List; +Cc: mrs, David Edelsohn, Richard Henderson
On 18 Jul 2010, at 19:18, Mike Stump wrote:
> On Jul 17, 2010, at 11:09 AM, IainS wrote:
>> consolidated patch with the amendments suggested by Richard, ...
>> ... still needs rs6000 and darwin reviews.
>
> Ok. Thanks.
r162299
cheers,
Iain
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-07-19 9:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15 17:10 [Patch, darwin] do not generate branch islands when the linker can do it IainS
2010-07-15 17:38 ` Richard Henderson
2010-07-15 18:27 ` IainS
2010-07-15 18:44 ` Richard Henderson
2010-07-15 19:34 ` IainS
2010-07-17 18:10 ` IainS
2010-07-18 13:08 ` David Edelsohn
2010-07-18 13:20 ` Iain Sandoe
2010-07-18 18:18 ` Mike Stump
2010-07-19 9:13 ` IainS
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).