readonly_dynrelocs

H.J. Lu hjl.tools@gmail.com
Fri Dec 1 12:11:00 GMT 2017


On Thu, Nov 30, 2017 at 10:52 PM, Alan Modra <amodra@gmail.com> wrote:
> In early October, HJ Lu added support for a number of targets to "Dump
> dynamic relocation in read-only section with minfo".  This extends
> that support to more targets, displays the symbol involved, and splits
> the existing function that sets TEXTREL into a "readonly_dynrelocs"
> and "maybe_set_textrel" function.  I'll need "readonly_dynrelocs" if I
> ever get around to fixing "pr22374 function pointer initialization"
> fails.
>
> am33_2.0, arc, bfin, hppa64, mn10300, and nios2 fail to mark a binary
> needing text relocations with DT_TEXTREL.  That's not good.  xtensa also
> fails to do so but complains about "dangerous relocation: dynamic
> relocation in read-only section" so I reckon that is fine and have
> marked the test as an xfail.  The other targets need maintainer
> attention.
>
> Curiously, the map file dump wasn't added for x86, so the map test
> currently fail on x86.  (I can add the x86 support if you like HJ?)

x86 has

          if ((info->warn_shared_textrel && bfd_link_pic (info))
              || info->error_textrel)
            /* xgettext:c-format */
            info->callbacks->einfo (_("%P: %B: warning: relocation
against `%s' in readonly section `%A'\n"),
                                    p->sec->owner, h->root.root.string,
                                    p->sec);

It warns about relocation in read-only section when --warn-shared-textrel
is used.  I checked in this patch to fix it on x86.

> It also fails on alpha, am33_2.0, arc, bfin, hppa64, ia64, m68k, mips,
> mn10300, nios2, score and vax.  cris complains with "tmpdir/textrel.o,
> section .rodata: relocation R_CRIS_32 should not be used in a shared
> object; recompile with -fPIC" so I've marked it as an xfail.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Print-dynreloc-in-readonly-section-for-map-file-.patch
Type: text/x-patch
Size: 1554 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171201/bde2c63c/attachment.bin>


More information about the Binutils mailing list