__attribute__((used)) issue

I defined function as below in library object , 

int test_func() __attribute__((used))

{

 ....

}

and this function has no non-weak reference in my project, when I compiled the project, it gives the warning "L6418W tagging symbol __tagsym$$used.0 defined in xxx.obj is not recognized", and I find the symbol test_func is removed by armlinker, I am amazing since I used "__attribute__((used))" to tell linker not remove the symbol test_func but failed.  I donot know why, can anyone help to explain it? 

my toolchain version is Arm Compiler 6.12 ( Armclang V6.12, armliner V6.12 )

Parents
  • Hi Tim

    I tested with a trivial example, but could not replicate this (though with the latest Arm Compiler 6.16)., test_func is indeed kept by the linker, and there are no link time warnings.

        main
            0x00008124:    2000        .       MOVS     r0,#0
            0x00008126:    4770        pG      BX       lr
        __tagsym$$used.0
        test_func
            0x00008128:    2000        .       MOVS     r0,#0
            0x0000812a:    4770        pG      BX       lr

    I'm not sure if there was an issue with the compiler version you have, which is ~18 months old. Can you try the latest version? You can access the latest compiler by updating your MDK or Arm Development Studio install, else you can download and use stand alone:

    https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads/version-6

    If you still have problems, I recommend raising an official support case from the Support menu above.

Reply
  • Hi Tim

    I tested with a trivial example, but could not replicate this (though with the latest Arm Compiler 6.16)., test_func is indeed kept by the linker, and there are no link time warnings.

        main
            0x00008124:    2000        .       MOVS     r0,#0
            0x00008126:    4770        pG      BX       lr
        __tagsym$$used.0
        test_func
            0x00008128:    2000        .       MOVS     r0,#0
            0x0000812a:    4770        pG      BX       lr

    I'm not sure if there was an issue with the compiler version you have, which is ~18 months old. Can you try the latest version? You can access the latest compiler by updating your MDK or Arm Development Studio install, else you can download and use stand alone:

    https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads/version-6

    If you still have problems, I recommend raising an official support case from the Support menu above.

Children
No data
More questions in this forum