This is the mail archive of the binutils@sourceware.cygnus.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]

Re: Unique section ids


Hi Alan,

: I'd like to add another field to the asection structure to uniquely
: identify input sections.  The reason for this is that the hppa port needs
: to create long branch stubs to local symbols, and some means is needed to
: make local symbols globally unique so we can use a hash lookup.  I'm
: currently using the following:
:  
: 	  if (h == NULL)
: 	    sprintf (stub_name + len - 10, "_%08x",
: 		     (int) sym_sec & 0xffffffff);
: 
: ie.  We just tack on the address of the asection structure.  This works
: quite well, but it has the drawback that the memory address of the
: structure is fairly random.  For exactly the same input files, stubs
: output via bfd_hash_traverse come in a different order for different
: linker builds.  This makes comparison of output files (and debugging the
: linker) more difficult.
: 
: Has anyone a better idea?  Or can point me to an existing way of uniquely
: identifying input sections short of enumerating over input bfds?

Why can't you append the section name and input file name ?  That way
the (extended) local names would stay the same even if the link order
is changed on the command line, something that would not happen with
your unique section id scheme...

Mind you I have no real objections to your suggestion, if that is how
you want to proceed.  I would suggest renaming the new field to
'unique_id' just to make its purpose clear.

Cheers
	Nick

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