+
+ /* Darwin weird special cases. */
+ if (TREE_CODE (decl) == CONSTRUCTOR
+ && TREE_TYPE (decl)
+ && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
+ && TYPE_NAME (TREE_TYPE (decl)))
+ {
+ tree name = TYPE_NAME (TREE_TYPE (decl));
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
+ if (!strcmp (IDENTIFIER_POINTER (name), "__builtin_ObjCString"))
+ {
+ if (flag_next_runtime)
+ return darwin_sections[objc_constant_string_object_section];
+ else
+ return darwin_sections[objc_string_object_section];
+ }
+ else
+ return base_section;
+ }
+ else if (TREE_CODE (decl) == VAR_DECL
+ && DECL_NAME (decl)
+ && TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE
+ && IDENTIFIER_POINTER (DECL_NAME (decl))
+ && !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "_OBJC_", 6))
+ {
+ const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
+
+ if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20))
+ return darwin_sections[objc_cls_meth_section];
+ else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23))
+ return darwin_sections[objc_inst_meth_section];
+ else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20))
+ return darwin_sections[objc_cat_cls_meth_section];
+ else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23))
+ return darwin_sections[objc_cat_inst_meth_section];
+ else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22))
+ return darwin_sections[objc_class_vars_section];
+ else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25))
+ return darwin_sections[objc_instance_vars_section];
+ else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22))
+ return darwin_sections[objc_cat_cls_meth_section];
+ else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17))
+ return darwin_sections[objc_class_names_section];
+ else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20))
+ return darwin_sections[objc_meth_var_names_section];
+ else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20))
+ return darwin_sections[objc_meth_var_types_section];
+ else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22))
+ return darwin_sections[objc_cls_refs_section];
+ else if (!strncmp (name, "_OBJC_CLASS_", 12))
+ return darwin_sections[objc_class_section];
+ else if (!strncmp (name, "_OBJC_METACLASS_", 16))
+ return darwin_sections[objc_meta_class_section];
+ else if (!strncmp (name, "_OBJC_CATEGORY_", 15))
+ return darwin_sections[objc_category_section];
+ else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25))
+ return darwin_sections[objc_selector_refs_section];
+ else if (!strncmp (name, "_OBJC_SELECTOR_FIXUP", 20))
+ return darwin_sections[objc_selector_fixup_section];
+ else if (!strncmp (name, "_OBJC_SYMBOLS", 13))
+ return darwin_sections[objc_symbols_section];
+ else if (!strncmp (name, "_OBJC_MODULES", 13))
+ return darwin_sections[objc_module_info_section];
+ else if (!strncmp (name, "_OBJC_IMAGE_INFO", 16))
+ return darwin_sections[objc_image_info_section];
+ else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32))
+ return darwin_sections[objc_cat_inst_meth_section];
+ else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29))
+ return darwin_sections[objc_cat_cls_meth_section];
+ else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20))
+ return darwin_sections[objc_cat_cls_meth_section];
+ else if (!strncmp (name, "_OBJC_PROTOCOL_", 15))
+ return darwin_sections[objc_protocol_section];
+ else
+ return base_section;
+ }
+
+ return base_section;
+}
+
+/* This can be called with address expressions as "rtx".
+ They must go in "const". */
+
+section *
+machopic_select_rtx_section (enum machine_mode mode, rtx x,
+ unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
+{
+ if (GET_MODE_SIZE (mode) == 8
+ && (GET_CODE (x) == CONST_INT
+ || GET_CODE (x) == CONST_DOUBLE))
+ return darwin_sections[literal8_section];
+ else if (GET_MODE_SIZE (mode) == 4
+ && (GET_CODE (x) == CONST_INT
+ || GET_CODE (x) == CONST_DOUBLE))
+ return darwin_sections[literal4_section];
+ else if (HAVE_GAS_LITERAL16
+ && TARGET_64BIT
+ && GET_MODE_SIZE (mode) == 16
+ && (GET_CODE (x) == CONST_INT
+ || GET_CODE (x) == CONST_DOUBLE
+ || GET_CODE (x) == CONST_VECTOR))
+ return darwin_sections[literal16_section];
+ else if (MACHOPIC_INDIRECT
+ && (GET_CODE (x) == SYMBOL_REF
+ || GET_CODE (x) == CONST
+ || GET_CODE (x) == LABEL_REF))
+ return darwin_sections[const_data_section];