section _raw_size and _cooked_size

Bob Wilson bwilson@tensilica.com
Mon Jun 14 18:47:00 GMT 2004


Alan,

I don't think your change to remove the use of the reloc_done flag in 
elf32-xtensa.c will work.  The table section contents are cached the first time 
the table is read, and each table section is typically used multiple times, so 
checking the contents field doesn't seem like a reliable way of telling whether 
the section has been relocated.  When I changed the code to use the reloc_done 
field (just a few months ago: 
http://sources.redhat.com/ml/binutils/2004-04/msg00737.html), I was afraid that 
I might be misusing it.  Perhaps that is the case, but I couldn't find any other 
way to determine whether a section has been relocated.  Unless I'm missing 
something, I don't think the contents field works.  Any other ideas?

If necessary, I can come up with some totally Xtensa-specific hack to make it 
work (e.g., a hash table to record sections that have been relocated) but I'd 
rather not do that.  If there's a good alternative to the "reloc_done" flag, 
that would be fine.  Otherwise, maybe it wouldn't be so bad to keep "reloc_done"?

--Bob

> Index: bfd/elf32-xtensa.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 elf32-xtensa.c
> --- bfd/elf32-xtensa.c	17 May 2004 20:33:33 -0000	1.27
> +++ bfd/elf32-xtensa.c	12 Jun 2004 10:58:12 -0000
> @@ -524,7 +524,8 @@ xtensa_read_table_entries (abfd, section
>    /* If the file has not yet been relocated, process the relocations
>       and sort out the table entries that apply to the specified section.  */
>    internal_relocs = retrieve_internal_relocs (abfd, table_section, TRUE);
> -  if (internal_relocs && !table_section->reloc_done)
> +  if (internal_relocs
> +      && elf_section_data (table_section)->this_hdr.contents == NULL)
>      {
>        unsigned i;
>  
> @@ -2148,8 +2149,6 @@ elf_xtensa_relocate_section (output_bfd,
>    if (lit_table)
>      free (lit_table);
>  
> -  input_section->reloc_done = TRUE;
> -
>    return TRUE;
>  }
>  



More information about the Binutils mailing list