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]

How to use an R_ARM_GOT32 symbol in a S file?


I'm having a heck of a time accessing a symbol in a project built with -fPIC.

The symbol of interest is in a.c:

    extern "C" unsigned int my_symbol;
    unsigned int my_symbol = 0;

Then, in b.S:

    .extern my_symbol
    ...
    ldr    r12,=my_symbol
    ldr    r12,[r12]

Or:

    .extern my_symbol
    ...
    adr    r12,my_symbol
    ldr    r12,[r12]

Or:

    <other variations, including literal pool tricks>

I can provide a bunch of different variations in b.S. Some of the
failed attempts result in my_symbol as R_ARM_REL32 (which fails to
runtime link in a shared object), R_ARM_ABS32 (which lacks position
independence), or fails to compile/assemble.

I'm not sure if this is an AS issue, and LD issue, or a combination of
both (modulo the intersection of my ignorance).

How do I use my_symbol in b.S as a R_ARM_GOT32 symbol?


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