+ sprintf (string, ".objc_class_name_%s",
+ IDENTIFIER_POINTER (TREE_VALUE (chain)));
+
+ /* Make a decl for this name, so we can use its address in a tree. */
+ decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
+ TREE_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+
+ pushdecl (decl);
+ rest_of_decl_compilation (decl, 0, 0, 0);
+
+ /* Make following constant read-only (why not)? */
+ text_section ();
+
+ /* Output a constant to reference this address. */
+ output_constant (build1 (ADDR_EXPR, string_type_node, decl),
+ int_size_in_bytes (string_type_node));
+}
+
+handle_impent (impent)
+ struct imp_entry *impent;
+{
+ implementation_context = impent->imp_context;
+ implementation_template = impent->imp_template;
+
+ if (TREE_CODE (impent->imp_context) == IMPLEMENTATION_TYPE)
+ {
+ char *string
+ = (char *) alloca (strlen (IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))) + 30);
+
+ sprintf (string, ".objc_class_name_%s",
+ IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)));
+ assemble_global (string);
+ assemble_label (string);
+ }
+ else if (TREE_CODE (impent->imp_context) == CATEGORY_TYPE)
+ {
+ char *string
+ = (char *) alloca (strlen (IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)))
+ + strlen (IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context)))
+ + 30);
+
+ /* Do the same for categories. Even though no references to these
+ symbols are generated automatically by the compiler, it gives
+ you a handle to pull them into an archive by hand. */
+ sprintf (string, ".objc_category_name_%s_%s",
+ IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)),
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context)));
+ assemble_global (string);
+ assemble_label (string);
+ }
+}
+\f