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: RFC: Allow STT_SECTION + offset for SHF_MERGE sections


On Fri, Nov 16, 2001 at 08:20:27PM +0100, Jakub Jelinek wrote:
> What do you think?

Looks good to me.

> --- bfd/elf32-i386.c.jj	Tue Nov 13 18:25:56 2001
> +++ bfd/elf32-i386.c	Fri Nov 16 20:16:57 2001
> @@ -1770,6 +1770,32 @@ elf_i386_relocate_section (output_bfd, i
>  	  relocation = (sec->output_section->vma
>  			+ sec->output_offset
>  			+ sym->st_value);
> +	  if ((sec->flags & SEC_MERGE)
> +	      && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
> +	    {
> +	      asection *msec;
> +	      bfd_vma addend;
> +
> +	      if (howto->src_mask != 0xffffffff)
> +		{
> +		  (*_bfd_error_handler)
> +		    (_("%s(%s+0x%lx): non-32bit relocation against SEC_MERGE section"),
> +		     bfd_archive_filename (input_bfd),
> +		     bfd_get_section_name (input_bfd, input_section),
> +		     (long) rel->r_offset);
> +		  return false;
> +		}
> +
> +	      addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
> +	      msec = sec;
> +	      addend =
> +		_bfd_merged_section_offset (output_bfd, &msec,
> +					    elf_section_data (sec)->merge_info,
> +					    sym->st_value + addend, (bfd_vma) 0)
> +		- relocation;
> +	      addend += msec->output_section->vma + msec->output_offset;
> +	      bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
> +	    }
>  	}
>        else
>  	{

How about putting all the above into a function that is called instead of
_bfd_final_link_relocate (and itself calls _bfd_final_link_relocate)?

Alan


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