[PATCH] ld: warn about PE base relocations to sections above .reloc

Jan Beulich jbeulich@suse.com
Fri Mar 12 11:27:15 GMT 2021


On 11.03.2021 17:50, Jan Beulich via Binutils wrote:
> --- a/ld/pe-dll.c
> +++ b/ld/pe-dll.c
> @@ -1627,6 +1627,15 @@ generate_reloc (bfd *abfd, struct bfd_li
>  		  reloc_data[total_relocs].vma = sec_vma + relocs[i]->address;
>  		  reloc_data[total_relocs].idx = total_relocs;
>  
> +		  /* Since we're only about to determine .reloc's size,
> +		     subsequent output section VMA calculations will shift up
> +		     sections at this or higher addresses.  Relocations for
> +		     such sections would hence end up not being correct.  */
> +		  if (reloc_data[total_relocs].vma
> +		      >= reloc_s->output_section->vma)
> +		    einfo ("%P: base relocation for section `%s' above "
> +			   ".reloc section\n", s->output_section->name);

I realize I ought to wrap the string literal in _(). Corrected
locally. I notice I similarly omitted the wrapping in
"bfd: don't silently wrap or truncate PE image section RVAs";
I'll send a patch in due course.

Jan


More information about the Binutils mailing list