This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Fix invalid loader fixups from shared libobjc with hpux10.20


> law@redhat.com wrote:
> > 
> >   > 2001-05-31  John David Anglin  <dave@hiauly1.hia.nrc.ca>
> >   >
> >   >     * objc/objc-act.c (handle_class_ref): Use rest_of_decl_compilation
> >   >     so that CHOOSE_SECTION gets used.
> >   >     (handle_impent): Use assemble_variable to put the global objc class
> >   >     and category name labels in the readonly data section.
> > It's certainly wrong for a front-end to blindly dump something into the
> > readonly_data_section.  At the least it should be deferring to the routines
> > in varasm.c to select the proper section.
> 
> It's kind of cheesy, but hardly noticeable in the mega-cheesiness of
> objc-act.c. :-) :-(  A number of the ObjC actions synthesize tables
> and data objects, and output them directly.  Many times there's not
> even a decl on which to set TREE_READONLY.  So it's not something to
> be real proud of, but until someone rewrites the ObjC frontend to
> build trees for these things as C++ does for vtables, I think we're
> stuck with calling section functions directly.

I want to be pragmatic here.  Without a patch of some kind, the shared
libobjc for the 3.0 release built for hpux is not useable because the
name labels go into the wrong section (text section).  You can see
from the testresults list that the problem is not restricted to hpux.

I am not sure whether your comments apply to the first part of the
patch or to the latter part, or both.  The first part of the above patch
is just a rework a patch Gerald Pfeifer installed on the main.  You
mentioned this in your first review.

Do you want to go back to my original patch (see below)?  It is simple
and does the job directly.

This is the last major issue concerning building and using gcc 3.0 on
hpux that I am aware of.  So, I hope something can be done to resolve it.

OK.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-05-29  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* objc-act.c (handle_class_ref): Put the class reference in the
	variable section.
	(handle_impent): Put the objc class and category name labels in
	the readonly data section.

--- objc-act.c.orig	Tue May  1 19:06:28 2001
+++ objc-act.c	Tue May 29 11:17:35 2001
@@ -8362,8 +8362,8 @@
       pushdecl (decl);
       rest_of_decl_compilation (decl, 0, 0, 0);
 
-      /* Make following constant read-only (why not)?  */
-      readonly_data_section ();
+      /* Put the decl in the variable section.  It may need relocation.  */
+      variable_section (decl, 1);
 
       exp = build1 (ADDR_EXPR, string_type_node, decl);
 
@@ -8416,6 +8416,7 @@
 	{
 	  sprintf (string, "%sobjc_class_name_%s",
 		   (flag_next_runtime ? "." : "__"), class_name);
+	  readonly_data_section ();
 	  assemble_global (string);
 	  assemble_label (string);
 	}
@@ -8450,6 +8451,7 @@
 	  sprintf (string, "%sobjc_category_name_%s_%s",
 		   (flag_next_runtime ? "." : "__"),
 		   class_name, class_super_name);
+	  readonly_data_section ();
 	  assemble_global (string);
 	  assemble_label (string);
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]