Commit f0052887 by Richard Kenner

(build_objc_method_call, get_class_reference):

Call assemble_external on anything we are about to generate a call to.
(get_super_receiver): Likewise.
(handle_class_ref): Put constant in readonly-data section, not text.
(build_objc_symtab_template): Correctly build index type for 0-length array.

From-SVN: r3734
parent 74637033
...@@ -681,7 +681,9 @@ build_objc_symtab_template () ...@@ -681,7 +681,9 @@ build_objc_symtab_template ()
/* void *defs[cls_def_cnt + cat_def_cnt]; */ /* void *defs[cls_def_cnt + cat_def_cnt]; */
index = build_index_type (build_int_2 (imp_count + cat_count - 1, 0)); index = build_index_type (build_int_2 (imp_count + cat_count - 1,
imp_count == 0 && cat_count == 0
? -1 : 0));
field_decl = create_builtin_decl (FIELD_DECL, field_decl = create_builtin_decl (FIELD_DECL,
build_array_type (ptr_type_node, index), build_array_type (ptr_type_node, index),
"defs"); "defs");
...@@ -2858,6 +2860,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object, ...@@ -2858,6 +2860,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object,
{ {
method_params = tree_cons (NULLT, lookup_object, method_params = tree_cons (NULLT, lookup_object,
tree_cons (NULLT, selector, method_params)); tree_cons (NULLT, selector, method_params));
assemble_external (sender);
return build_function_call (sender, method_params); return build_function_call (sender, method_params);
} }
else else
...@@ -2885,6 +2888,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object, ...@@ -2885,6 +2888,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object,
This will do type checking using the arg types for this method. */ This will do type checking using the arg types for this method. */
method_params = tree_cons (NULLT, lookup_object, method_params = tree_cons (NULLT, lookup_object,
tree_cons (NULLT, selector, method_params)); tree_cons (NULLT, selector, method_params));
assemble_external (sender);
retval = build_function_call (sender, method_params); retval = build_function_call (sender, method_params);
/* Restore SENDER's return/argument types. */ /* Restore SENDER's return/argument types. */
...@@ -2902,6 +2906,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object, ...@@ -2902,6 +2906,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object,
object = save_expr (object); object = save_expr (object);
selector = save_expr (selector); selector = save_expr (selector);
assemble_external (sender);
method method
= build_function_call (sender, = build_function_call (sender,
tree_cons (NULLT, lookup_object, tree_cons (NULLT, lookup_object,
...@@ -2922,6 +2927,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object, ...@@ -2922,6 +2927,7 @@ build_objc_method_call (super_flag, method_prototype, lookup_object, object,
= build_pointer_type (build_function_type (ptr_type_node, NULLT)); = build_pointer_type (build_function_type (ptr_type_node, NULLT));
} }
/* Pass the object to the method. */ /* Pass the object to the method. */
assemble_external (method);
return build_function_call (method, return build_function_call (method,
tree_cons (NULLT, object, tree_cons (NULLT, object,
tree_cons (NULLT, selector, tree_cons (NULLT, selector,
...@@ -3405,6 +3411,7 @@ get_class_reference (interface) ...@@ -3405,6 +3411,7 @@ get_class_reference (interface)
my_build_string (IDENTIFIER_LENGTH (CLASS_NAME (interface)) + 1, my_build_string (IDENTIFIER_LENGTH (CLASS_NAME (interface)) + 1,
IDENTIFIER_POINTER (CLASS_NAME (interface)))); IDENTIFIER_POINTER (CLASS_NAME (interface))));
assemble_external (objc_getClass_decl);
return build_function_call (objc_getClass_decl, params); return build_function_call (objc_getClass_decl, params);
} }
...@@ -4355,9 +4362,15 @@ get_super_receiver () ...@@ -4355,9 +4362,15 @@ get_super_receiver ()
IDENTIFIER_POINTER (super_name))); IDENTIFIER_POINTER (super_name)));
if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL) if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL)
funcCall = build_function_call (objc_getClass_decl, params); {
assemble_external (objc_getClass_decl);
funcCall = build_function_call (objc_getClass_decl, params);
}
else else
funcCall = build_function_call (objc_getMetaClass_decl, params); {
assemble_external (objc_getMetaClass_decl);
funcCall = build_function_call (objc_getMetaClass_decl, params);
}
/* cast! */ /* cast! */
TREE_TYPE (funcCall) = TREE_TYPE (_clsSuper_ref); TREE_TYPE (funcCall) = TREE_TYPE (_clsSuper_ref);
...@@ -5122,7 +5135,7 @@ handle_class_ref (chain) ...@@ -5122,7 +5135,7 @@ handle_class_ref (chain)
rest_of_decl_compilation (decl, 0, 0, 0); rest_of_decl_compilation (decl, 0, 0, 0);
/* Make following constant read-only (why not)? */ /* Make following constant read-only (why not)? */
text_section (); readonly_data_section ();
/* Inform the assembler about this new external thing. */ /* Inform the assembler about this new external thing. */
assemble_external (decl); assemble_external (decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment