This is the mail archive of the binutils@sourceware.org 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 PATCH] Avoid emitting TEXTREL marker for R_ARM_NONE relocs.


On Wed, Mar 12, 2014 at 10:17:32AM -0700, Roland McGrath wrote:
> I have a dim memory of someone explaining that emitting R_ARM_NONE dynamic
> relocs was intractable to avoid in some cases.  But I don't understand what
> situations cause that to happen.  Nor could I figure out today where in the
> code it actually happens.

One case that springs to mind is .eh_frame editing, which happens
after dynamic relocations have been allocated.  If you require dynamic
relocations in .eh_frame CIEs (say due to using absolute encoding for
some field) and CIEs are merged, then you can end up needing fewer
dynamic relocations than allocated.

Do you know where the R_ARM_NONE dynamic reloc came from?  Tip:
-z nocombreloc helps in answering that question.

> @@ -13766,8 +13766,13 @@ elf32_arm_size_dynamic_sections (bfd *
> output_bfd ATTRIBUTE_UNUSED,
>  		{
>  		  srel = elf_section_data (p->sec)->sreloc;
>  		  elf32_arm_allocate_dynrelocs (info, srel, p->count);
> -		  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
> -		    info->flags |= DF_TEXTREL;
> +                  /* It would appear that we could check for the output
> +                     section being SEC_READONLY and set DF_TEXTREL here.
> +                     But these relocs might be morphed into R_ARM_NONE
> +                     later, making the test here false-positive.
> +                     Instead, we'll just let the scan at the end of the
> +                     function (using elf32_arm_readonly_dynrelocs) catch
> +                     any that survive.  */

No, this is wrong.  The code you're touching here deals with 
relocations for local symbols, elf32_arm_readonly_dynrelocs scans
global symbols.

-- 
Alan Modra
Australia Development Lab, IBM


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