Skip to content

ld.bfd 2.25.51 packaged with NDK r11 produces unsupported R_ARM_COPY relocation #12

Closed
@joakim-noah

Description

@joakim-noah

I've been using ld.bfd 2.24.90 from NDK r10e without this issue, but after updating to r11 the new binutils consistently uses the R_ARM_COPY relocation for __sF. I'm building the object file that refers to __sF from D, using the llvm-based ldc compiler. However, the exact same object file is linked without R_ARM_COPY by both the older ld.bfd 2.24.90 or a newer 2.26.20160125 that I have locally installed, so this is probably a regression in ld.bfd 2.25.51. I don't have this issue with ld.gold in NDK r11, but I'm stuck with ld.bfd because I need a certain ELF section ordering.

For reference, here are the relocations in the stdio.o object file that refers to __sF:

Relocation section '.rel.data.stdin' at offset 0x800 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000000  00004602 R_ARM_ABS32       00000000   __sF
Relocation section '.rel.data.stdout' at offset 0x808 contains 1 entries:
Offset     Info    Type            Sym.Value  Sym. Name
00000000  00004602 R_ARM_ABS32       00000000   __sF
Relocation section '.rel.data.stderr' at offset 0x810 contains 1 entries:
Offset     Info    Type            Sym.Value  Sym. Name
00000000  00004602 R_ARM_ABS32       00000000   __sF

This produces the following relocation in the final command-line executable:

0178a1c0  0000b214 R_ARM_COPY        0178a1c0   __sF

Running that executable fails with an error about R_ARM_COPY not being supported. I'm unsure how to reproduce this using a C/C++ sample, but I'm guessing it might be a problem there too? I don't know enough about ELF relocations to say.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions