This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem in generating position independent code with out TEXTREL

Note: This was originally posted on 12th August 2010 at http://forums.arm.com

Hi Experts,

Issue:Not able to remove TEXTREL from our static library generated with --apcs /fpic option using armcc(RVCT 4.0 build 771  tool chain)

Description:
    We compiled our codebase(some modules with handwritten assembly) using armcc(RVCT 4.0 build 771  tool chain) to get static libraries, and then these are used by gstreamer module which further compiles using the above generated libraries with wrappers using GCC tool chain and creates shared objects(.so).

Even though we use equivalent --apcs /fpic compile time option during static library creation to remove position independent code, the TEXTREL are not going from library.
When we disable the (handwritten assembly) in the above mentioned codebase, TEXTRELs go away.
As there are lot of handwritten ARM assembly functions,its difficult to enable one by one and compile and check. :unsure:

So,Experts please throw some light on this issue.


Thanks In Advance,
satish
Parents
  • Note: This was originally posted on 4th January 2011 at http://forums.arm.com

    You show inline asm:

    void foo {
    __asm {
       ...
    }


    but I think you must actually be using embedded asm.


    __asm void foo() {
      ...
    }



    The embedded assembler (or normal assembler) can't add the code needed to use a PC-relative relocation, you have to write it yourself.  For example, building with 'armcc -c --apcs /fpic':

    extern int table[] = { 1, 2, 3 };
    __asm void *foo() {
      import table /* should not really be needed, but is */
      ldr r0, lbl
      add r0, r0, pc
      bx lr
    lbl
      dcd table - .
    }


    If you're really using inline asm, please post a small example that compiles and and the compile options you are using.
Reply
  • Note: This was originally posted on 4th January 2011 at http://forums.arm.com

    You show inline asm:

    void foo {
    __asm {
       ...
    }


    but I think you must actually be using embedded asm.


    __asm void foo() {
      ...
    }



    The embedded assembler (or normal assembler) can't add the code needed to use a PC-relative relocation, you have to write it yourself.  For example, building with 'armcc -c --apcs /fpic':

    extern int table[] = { 1, 2, 3 };
    __asm void *foo() {
      import table /* should not really be needed, but is */
      ldr r0, lbl
      add r0, r0, pc
      bx lr
    lbl
      dcd table - .
    }


    If you're really using inline asm, please post a small example that compiles and and the compile options you are using.
Children
No data