https://sourceware.org/bugzilla/show_bug.cgi?id=31047

            Bug ID: 31047
           Summary: relocation R_X86_64_NONE against absolute symbol
                    `__dtrace_test_prov___place' in section
                    `.text.startup' is disallowed
           Product: binutils
           Version: 2.42 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: kris.van.hees at oracle dot com
  Target Milestone: ---

We ran into a problem with how DTrace processes relocations to determine the
location of probe points in an ELF object.  USDT probe points are just calls
to (undefined) functions of a specific name, and when we process the ELF object
we look for relocations to such symbols.  We patch the text for the function
at the call site with NOPs, and generate meta-data for this probe in a
separate ELF object.  We then change the type of the reloc to be R_X86_64_NONE,
so that it will be ignored when the ELF object is linked into its target (so
the linker won't overwrite our carefully placed NOPs).

The reason why we don't just remove the reloc is that sometimes builds end
up re-processing the ELF object and we want it to be able to regenerate the
meta-data for the probes in that case.

This does not work on x86 with PIC/PIE because the relocation validation in
382aae063227 ("x86: Only allow S + A relocations against absolute symbol") is
not allowing R_X86_64_NONE relocations even though they have no functional
purpose, i.e. they should be ignored.

I realize that the use of the relocation type R_X86_64_NONE is perhaps a bit
unusual but it does support the need here in a quite elegant manner.

It would seem that allowing R_X86_64_NONE (and R_386_NONE) relocations in
bfd_elf_x86_valid_reloc_p() would be the correct action?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to