/* Target definitions for Darwin (Mac OS X) systems.
- Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004,
+ 2005
Free Software Foundation, Inc.
Contributed by Apple Computer Inc.
{ "-dynamic", "-Zdynamic" }, \
{ "-dynamiclib", "-Zdynamiclib" }, \
{ "-exported_symbols_list", "-Zexported_symbols_list" }, \
+ { "-gfull", "-g -fno-eliminate-unused-debug-symbols" }, \
+ { "-gused", "-g -feliminate-unused-debug-symbols" }, \
{ "-segaddr", "-Zsegaddr" }, \
{ "-segs_read_only_addr", "-Zsegs_read_only_addr" }, \
{ "-segs_read_write_addr", "-Zsegs_read_write_addr" }, \
{ "-unexported_symbols_list", "-Zunexported_symbols_list" }, \
SUBTARGET_OPTION_TRANSLATE_TABLE
-/* Nonzero if the user has chosen to force sizeof(bool) to be 1
- by providing the -mone-byte-bool switch. It would be better
- to use SUBTARGET_SWITCHES for this instead of SUBTARGET_OPTIONS,
- but there are no more bits in rs6000 TARGET_SWITCHES. Note
- that this switch has no "no-" variant. */
-extern const char *darwin_one_byte_bool;
-
-extern int darwin_fix_and_continue;
-extern const char *darwin_fix_and_continue_switch;
-
-#undef SUBTARGET_OPTIONS
-#define SUBTARGET_OPTIONS \
- {"one-byte-bool", &darwin_one_byte_bool, N_("Set sizeof(bool) to 1"), 0 }, \
- {"fix-and-continue", &darwin_fix_and_continue_switch, \
- N_("Generate code suitable for fast turn around debugging"), 0}, \
- {"no-fix-and-continue", &darwin_fix_and_continue_switch, \
- N_("Don't generate code suitable for fast turn around debugging"), 0}
-
/* These compiler options take n arguments. */
#undef WORD_SWITCH_TAKES_ARG
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
- %{!Zdynamiclib:-arch %(darwin_arch)} \
- %{Zdynamiclib:-arch_only %(darwin_arch)} \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
%{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
- %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} \
+ %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
%{!nostdlib:%{!nodefaultlibs:%G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"
"%{static}%{!static:-dynamic} \
%{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)}\
%{!Zdynamiclib: \
+ %{Zforce_cpusubtype_ALL:-arch %(darwin_arch) -force_cpusubtype_ALL} \
+ %{!Zforce_cpusubtype_ALL:-arch %(darwin_subarch)} \
%{Zbundle:-bundle} \
%{Zbundle_loader*:-bundle_loader %*} \
%{client_name*} \
%{compatibility_version*:%e-compatibility_version only allowed with -dynamiclib\
} \
%{current_version*:%e-current_version only allowed with -dynamiclib} \
- %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{Zforce_flat_namespace:-force_flat_namespace} \
%{Zinstall_name*:%e-install_name only allowed with -dynamiclib} \
%{keep_private_externs} \
%{client_name*:%e-client_name not allowed with -dynamiclib} \
%{compatibility_version*} \
%{current_version*} \
- %{Zforce_cpusubtype_ALL:%e-force_cpusubtype_ALL not allowed with -dynamiclib} \
+ %{Zforce_cpusubtype_ALL:-arch_only %(darwin_arch)} \
+ %{!Zforce_cpusubtype_ALL: -arch_only %(darwin_subarch)} \
%{Zforce_flat_namespace:%e-force_flat_namespace not allowed with -dynamiclib} \
%{Zinstall_name*:-install_name %*} \
%{keep_private_externs:%e-keep_private_externs not allowed with -dynamiclib} \
#define LIB_SPEC "%{!static:-lSystem}"
#endif
+/* -dynamiclib implies -shared-libgcc just like -shared would on linux. */
+#define REAL_LIBGCC_SPEC \
+ "%{static|static-libgcc:-lgcc -lgcc_eh}\
+ %{!static:%{!static-libgcc:\
+ %{!Zdynamiclib:%{!shared-libgcc:-lgcc -lgcc_eh}\
+ %{shared-libgcc:-lgcc_s -lgcc}} %{Zdynamiclib:-lgcc_s -lgcc}}}"
+
/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
+/* We don't want anything to do with crt2.o in the 64-bit case;
+ testing the PowerPC-specific -m64 flag here is a little irregular,
+ but it's overkill to make copies of this spec for each target
+ arch. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
- %{!preload:-lgcrt1.o crt2.o%s}}}} \
+ %{!preload:-lgcrt1.o %{!m64: crt2.o%s}}}}} \
%{!pg:%{static:-lcrt0.o} \
%{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \
- %{!preload:-lcrt1.o crt2.o%s}}}}}}"
+ %{!preload:-lcrt1.o %{!m64: crt2.o%s}}}}}}}"
/* The native Darwin linker doesn't necessarily place files in the order
that they're specified on the link line. Thus, it is pointless
/* #define ENDFILE_SPEC "" */
/* Default Darwin ASM_SPEC, very simple. */
-#define ASM_SPEC "-arch %(darwin_arch)"
+#define ASM_SPEC "-arch %(darwin_arch) \
+ %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL}"
/* We use Dbx symbol format. */
do { \
if (ALIAS) \
{ \
- warning ("alias definitions not supported in Mach-O; ignored"); \
+ warning (0, "alias definitions not supported in Mach-O; ignored"); \
break; \
} \
\
targetm.asm_out.globalize_label (FILE, NAME); \
if (DECL_EXTERNAL (DECL)) \
fputs ("\t.weak_reference ", FILE); \
+ else if (! lookup_attribute ("weak", DECL_ATTRIBUTES (DECL)) \
+ && lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL))) \
+ break; \
else if (TREE_PUBLIC (DECL)) \
fputs ("\t.weak_definition ", FILE); \
else \
links to, so there's no need for weak-ness for that. */
#define GTHREAD_USE_WEAK 0
-/* We support hidden visibility */
-#undef TARGET_SUPPORTS_HIDDEN
-#define TARGET_SUPPORTS_HIDDEN 1
-
/* The Darwin linker imposes two limitations on common symbols: they
can't have hidden visibility, and they can't appear in dylibs. As
a consequence, we should never use common symbols to represent
machopic_validate_stub_or_non_lazy_ptr (xname); \
else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
machopic_validate_stub_or_non_lazy_ptr (xname); \
- fputs (&xname[1], FILE); \
+ else if (len > 15 && !strcmp ("$non_lazy_ptr\"", xname + len - 14)) \
+ machopic_validate_stub_or_non_lazy_ptr (xname); \
+ if (xname[1] != '"' && name_needs_quotes (&xname[1])) \
+ fprintf (FILE, "\"%s\"", &xname[1]); \
+ else \
+ fputs (&xname[1], FILE); \
} \
else if (xname[0] == '+' || xname[0] == '-') \
fprintf (FILE, "\"%s\"", xname); \
fprintf (FILE, "L%s", xname); \
else if (!strncmp (xname, ".objc_class_name_", 17)) \
fprintf (FILE, "%s", xname); \
+ else if (xname[0] != '"' && name_needs_quotes (xname)) \
+ fprintf (FILE, "\"%s\"", xname); \
else \
asm_fprintf (FILE, "%U%s", xname); \
} while (0)
#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
do { \
+ unsigned HOST_WIDE_INT _new_size = SIZE; \
fputs (".lcomm ", (FILE)); \
assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), \
+ if (_new_size == 0) _new_size = 1; \
+ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", _new_size, \
floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
if ((DECL) && ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
if (asm_out_file) \
fputs ("\t" DIRECTIVE "\n", asm_out_file); \
in_section = SECTION; \
+ if ((SECTION == in_text_coal) \
+ || (SECTION == in_text_unlikely) \
+ || (SECTION == in_text_unlikely_coal)) \
+ last_text_section = SECTION; \
} \
} \
in_text_coal, \
".section __TEXT,__textcoal_nt,coalesced," \
"pure_instructions", 0) \
-SECTION_FUNCTION (text_unlikely_section, \
- in_text_unlikely, \
- ".section __TEXT,__text_unlikely,coalesced," \
- "pure_instructions", 0) \
SECTION_FUNCTION (text_unlikely_coal_section, \
in_text_unlikely_coal, \
".section __TEXT,__text_unlikely_coal," \
#undef TARGET_ASM_ASSEMBLE_VISIBILITY
#define TARGET_ASM_ASSEMBLE_VISIBILITY darwin_assemble_visibility
+/* Extra attributes for Darwin. */
+#define SUBTARGET_ATTRIBUTE_TABLE \
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \
+ { "weak_import", 0, 0, true, false, false, \
+ darwin_handle_weak_import_attribute }
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
#undef ASM_PREFERRED_EH_DATA_FORMAT
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
(((CODE) == 2 && (GLOBAL) == 1) \
- ? (DW_EH_PE_pcrel | DW_EH_PE_indirect) : \
+ ? (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) : \
((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
#define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2) \
goto DONE; \
}
+/* Experimentally, putting jump tables in text is faster on SPEC.
+ Also this is needed for correctness for coalesced functions. */
+
+#ifndef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+#endif
#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false