This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PROVIDE keyword not working


Hi Guys,

  It appears that the action of the PROVIDE keyword has been broken.

  The current code does not enable the 'create' flag to
  bfd_link_hash_lookup for PROVIDEd symbols, so they are never created
  unless the user provides them.

  The patch below fixes this by adding a second call to
  bfd_link_hash_lookup with the 'create' flag set, but only if the
  first lookup failed to find the symbol, and only if we are
  PROVIDEing the symbol.

  This patch fixes failures with the linker testsuite for the v850
  toolchain, which were due to the linker being unable to find the
  PROVIDEd __ctbp symbol.

Cheers
        Nick


2002-09-02  Nick Clifton  <nickc@redhat.com>

	* ldexp.c (exp_fold_tree): If the first attempt to lookup a
	PROVIDEd symbol fails, look it up again, but this time with
	the 'create' flag set.

Index: ldexp.c
===================================================================
RCS file: /cvs/src/src/ld/ldexp.c,v
retrieving revision 1.17
diff -c -3 -p -w -r1.17 ldexp.c
*** ldexp.c	13 Aug 2002 02:08:25 -0000	1.17
--- ldexp.c	2 Sep 2002 14:41:30 -0000
*************** exp_fold_tree (tree, current_section, al
*** 729,747 ****
  		create = false;
  	      h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
  					create, false, false);
  	      if (h == (struct bfd_link_hash_entry *) NULL)
- 		{
- 		  if (tree->type.node_class == etree_assign)
  		    einfo (_("%P%F:%s: hash creation failed\n"),
  			   tree->assign.dst);
- 		}
- 	      else if (tree->type.node_class == etree_provide
- 		       && h->type != bfd_link_hash_undefined
- 		       && h->type != bfd_link_hash_common)
- 		{
- 		  /* Do nothing.  The symbol was defined by some
- 		     object.  */
- 		}
  	      else
  		{
  		  /* FIXME: Should we worry if the symbol is already
--- 729,745 ----
  		create = false;	      
  	      h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
  					create, false, false);
+ 	      
+ 	      if (tree->type.node_class == etree_provide
+ 		  && (h == NULL
+ 		      || h->type == bfd_link_hash_undefined
+ 		      || h->type == bfd_link_hash_common))
+ 		h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
+ 					  true, false, false);
+ 
  	      if (h == (struct bfd_link_hash_entry *) NULL)
  		einfo (_("%P%F:%s: hash creation failed\n"),
  		       tree->assign.dst);
  	      else
  		{
  		  /* FIXME: Should we worry if the symbol is already


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