This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Allow STT_SECTION + offset for SHF_MERGE sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 19 Nov 2001 19:06:55 +1030
- Subject: Re: RFC: Allow STT_SECTION + offset for SHF_MERGE sections
- References: <20011116202027.K527@sunsite.ms.mff.cuni.cz>
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