This is the mail archive of the gcc@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 withhpux10.20


On Fri, Jun 15, 2001 at 11:15:01PM -0700, H . J . Lu wrote:
> Before I was just about sending in this patch noticed while working on
> Linux/mips, I found this thread:
> 
> http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01101.html
> 

It turns out I need this patch for Linux/mips. The SVR4 MIPS ABI only
has one relocation section for DSOs. That means why don't want to put
any symbols which need relocation in the .rodata section. The C
compiler does the right thing. But the Objective C compiler is wrong.
I believe John's patch is correct for all platforms.



H.J.
----
2001-06-15  H.J. Lu <hjl@gnu.org>

	* objc/objc-act.c (handle_class_ref): Remove `#ifdef __hpux__'.
	(handle_impent): Likewise.

2001-06-14  John David Anglin  <dave@hiauly1.hia.nrc.ca>

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

--- gcc/objc/objc-act.c.objc	Fri Jun 15 23:11:00 2001
+++ gcc/objc/objc-act.c	Fri Jun 15 23:34:25 2001
@@ -8402,8 +8402,8 @@ handle_class_ref (chain)
       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);
 
@@ -8456,6 +8456,7 @@ handle_impent (impent)
 	{
 	  sprintf (string, "%sobjc_class_name_%s",
 		   (flag_next_runtime ? "." : "__"), class_name);
+	  readonly_data_section ();
 	  assemble_global (string);
 	  assemble_label (string);
 	}
@@ -8490,6 +8491,7 @@ handle_impent (impent)
 	  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]