This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFC PATCH] Avoid emitting TEXTREL marker for R_ARM_NONE relocs.
- From: Alan Modra <amodra at gmail dot com>
- To: Roland McGrath <mcgrathr at google dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 13 Mar 2014 09:22:42 +1030
- Subject: Re: [RFC PATCH] Avoid emitting TEXTREL marker for R_ARM_NONE relocs.
- Authentication-results: sourceware.org; auth=none
- References: <CAB=4xhr7yOFiFByCMieKYoNsGe3ZaMb5cj0GL4K3CFUTJf6fTw at mail dot gmail dot com>
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