Re: inline assembly as PIC code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Marshall <jim.marshall@xxxxxxxxxxxxxxxxx> writes:

> Both of these functions are declared with inline assembly (see
> below). When I force the compiler to use the GNU ld it compiles fine
> with out error. I was wondering if anyone here could tell me if there
> is a way to make the compiler generate PIC code for the asm, or is
> this something that has to be done to the asm code for that?

>      asm( ".global sparc_atomic_add_32");
>      asm( ".type sparc_atomic_add_32, #function");
>      asm( "sparc_atomic_add_32:");
>      asm( "    membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad");
>      asm( "    ld [%o0], %l0");
>      asm( "    add %l0, %o1, %l2");
>      asm( "    cas [%o0], %l0, %l2");
>      asm( "    cmp %l0, %l2");
>      asm( "    bne sparc_atomic_add_32");

Instead of branching to a global symbol, branch to a local one.
E.g. put a local label after the global one, and use that as the
branch target.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux