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]

Re: PROVIDE keyword not working


Hi Alan,

> On Mon, Sep 02, 2002 at 03:47:37PM +0100, Nick Clifton wrote:
> > 	* 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.
> 
> This can't be correct.  The whole point of PROVIDE is to only define 
> the symbol when it is referenced and not otherwise defined.

> If PROVIDE isn't working for v850, something else is wrong.  Is
> lang_do_assignments being called?

> Hmm, no TEMPLATE_NAME in emulparams/v850.sh!

True - although that is not the problem.  (I will fix it anyway).

The problem is that the v850 linker, when it is trying to resolve the
R_V850_CALLT_6_7_OFFSET reloc (for example) needs to find the value of
the symbol __ctbp.  This symbol needs to be provided by the linker
script if the user has not defined it, but the value is *not*
referenced by the relocation itself.  (The reloc references a
different value - the function that is being called).

I had assumed therefore that the PROVIDE keyword would furnish a
definition of a symbol unless the user or input files provided their
own definition.  I see now that I am wrong and that I needed to add
some EXTERN references to the v850 linker script.  Hence I am applying
the patch below and reverting my bogus change to ldexp.c.

I apologise for being so stupid, and breaking the linker.  Sorry guys.

Cheers
        Nick


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

	* scripttempl/v850.sc: Add EXTERN references to __ctbp __gp and
	__ep.
	* emulparams/v850.sh (TEMPLATE_NAME): Define.

Index: scripttempl/v850.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/v850.sc,v
retrieving revision 1.6
diff -c -3 -p -w -r1.6 v850.sc
*** scripttempl/v850.sc	12 Sep 2001 14:09:18 -0000	1.6
--- scripttempl/v850.sc	2 Sep 2002 17:00:15 -0000
*************** OUTPUT_FORMAT("elf32-v850", "elf32-v850"
*** 4,9 ****
--- 4,10 ----
  OUTPUT_ARCH(v850)
  ENTRY(_start)
  SEARCH_DIR(.);
+ EXTERN(__ctbp __ep __gp);
  SECTIONS
  {
    /* This saves a little space in the ELF file, since the zda starts

Index: emulparams/v850.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/v850.sh,v
retrieving revision 1.1.1.1
diff -c -3 -p -w -r1.1.1.1 v850.sh
*** emulparams/v850.sh	3 May 1999 07:29:07 -0000	1.1.1.1
--- emulparams/v850.sh	2 Sep 2002 17:00:15 -0000
*************** ARCH=v850
*** 12,14 ****
--- 12,15 ----
  MAXPAGESIZE=256
  ENTRY=_start
  EMBEDDED=yes
+ TEMPLATE_NAME=elf32


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