IA-64 gp problem with PROVIDE and linker relaxation conflict

H . J . Lu hjl@valinux.com
Tue Feb 13 08:37:00 GMT 2001


On Mon, Feb 12, 2001 at 11:52:34PM -0800, Jim Wilson wrote:
> Changing the tree node_class didn't occur to me.  If the trees aren't shared

I only change it from etree_provide to etree_provided. I don't see
it should be a problem.

> then this could work, though it seems a little inelegant.  I don't see anyplace
> else that changes the tree node_class after a tree is created.

Then, it is the first one.

> 
> I was thinking of maybe putting something in the h->u.def structure to
> indicate that this was a "provided" value, and thus should be overriden by
> another provide, but I didn't see anyplace convenient.
> 
> I did confirm that the patch works for my testcase.
> 

Here is an update. I should check if a node is etree_provide before
change it to etree_provided.

-- 
H.J. Lu (hjl@valinux.com)
---
2001-02-12  H.J. Lu  <hjl@gnu.org>

	* ldexp.h (node_type): Add etree_provided.
	* ldexp.c (exp_fold_tree): Handle etree_provided. Set the node
	type to etree_provided if defined by PROVIDE. Allow updating
	for etree_provided. 
	(exp_print_tree): Handle etree_provided.
	* mpw-elfmips.c (gldelf32ebmip_find_exp_assignment): Handle
	etree_provided.

Index: ldexp.h
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ldexp.h,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 ldexp.h
--- ldexp.h	2000/10/10 19:44:17	1.1.1.3
+++ ldexp.h	2001/02/13 07:01:19
@@ -37,6 +37,7 @@ typedef struct {
 	   etree_name,
 	   etree_assign,
 	   etree_provide,
+	   etree_provided,
 	   etree_undef,
 	   etree_unspec,
 	   etree_value,
Index: ldexp.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ldexp.c,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 ldexp.c
--- ldexp.c	2000/10/10 19:44:17	1.1.1.6
+++ ldexp.c	2001/02/13 16:34:11
@@ -593,10 +593,11 @@ exp_fold_tree (tree, current_section, al
 
     case etree_assign:
     case etree_provide:
+    case etree_provided:
       if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0)
 	{
 	  /* Assignment to dot can only be done during allocation */
-	  if (tree->type.node_class == etree_provide)
+	  if (tree->type.node_class != etree_assign)
 	    einfo (_("%F%S can not PROVIDE assignment to location counter\n"));
 	  if (allocation_done == lang_allocating_phase_enum
 	      || (allocation_done == lang_final_phase_enum
@@ -666,6 +667,8 @@ exp_fold_tree (tree, current_section, al
 		  h->type = bfd_link_hash_defined;
 		  h->u.def.value = result.value;
 		  h->u.def.section = result.section->bfd_section;
+		  if (tree->type.node_class == etree_provide)
+		    tree->type.node_class = etree_provided;
 		}
 	    }
 	}
@@ -880,6 +883,7 @@ exp_print_tree (tree)
       exp_print_tree (tree->assign.src);
       break;
     case etree_provide:
+    case etree_provided:
       fprintf (config.map_file, "PROVIDE (%s, ", tree->assign.dst);
       exp_print_tree (tree->assign.src);
       fprintf (config.map_file, ")");
Index: mpw-elfmips.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/mpw-elfmips.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 mpw-elfmips.c
--- mpw-elfmips.c	2000/07/13 15:57:18	1.1.1.2
+++ mpw-elfmips.c	2001/02/13 07:05:18
@@ -522,6 +522,7 @@ gldelf32ebmip_find_exp_assignment (exp)
   switch (exp->type.node_class)
     {
     case etree_provide:
+    case etree_provided:
       h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
 				false, false, false);
       if (h == NULL)
@@ -541,7 +542,7 @@ gldelf32ebmip_find_exp_assignment (exp)
 	{
 	  if (! (bfd_elf32_record_link_assignment
 		 (output_bfd, &link_info, exp->assign.dst,
-		  exp->type.node_class == etree_provide ? true : false)))
+		  exp->type.node_class != etree_assign ? true : false)))
 	    einfo (_("%P%F: failed to record assignment to %s: %E\n"),
 		   exp->assign.dst);
 	}



More information about the Binutils mailing list