This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS570LC4357: TI Compiler built-in functions override

Part Number: TMS570LC4357
Other Parts Discussed in Thread: CODECOMPOSER

Tool/software: TI C/C++ Compiler

Hello,

I need to implement my own version of one of these TI compiler's built-in functions (see below section from UG). I have my implementation of "fabsf" in my static library. However, when the final binary is linked by TI linker, it never calls my version of function. It calls the built-in funtion. I have my library on the first position in my linker command line, it's before libc.a (TI library).

Should I use some special Linker options? 

Any ideas?

Note: FROM TIUSER GUIDE:

ARM Optimizing C/C++ Compiler, v18.1.0.LTS, User's Guide

5.16.5 Built-In Functions
The following built-in functions are supported: __builtin_abs, __builtin_classify_type, __builtin_constant_p,
__builtin_expect, __builtin_fabs, __builtin_fabsf, __builtin_frame_address, __builtin_labs, __builtin_llabs,
__builtin_sqrt, __builtin_sqrtf, __builtin_memcpy, and __builtin_return_address.
The __builtin_frame_address function returns zero unless the argument is a constant zero.
The __builtin_return_address function always returns zero.

  • If you use the linker option --reread_libs (or the equivalent -x), then remove it.  Add the linker option --priority.  Specify the libraries in the order they should be used.

    To learn more about these options, please search for them in the ARM assembly tools manual.

    Thanks and regards,

    -George

  • I've removed --reread_libs, I already had --priority there.  It still doesn't work, it uses TI Compiler's built in function fabsf, instead of my implementation.

    Here is my linker command:

    "C:/ti/ccs920/ccs/tools/compiler/ti-cgt-arm_18.12.3.LTS/bin/armcl" -mv7R5 --code_state=32 --float_support=VFPv3D16 --fp_mode=relaxed --define=_ARCH_Av7_ --define=UINT_SIZE=32 -g --diag_warning=225 --diag_wrap=off --display_error_number --verbose_diagnostics --enum_type=packed --abi=eabi --asm_listing --c_src_interlist -z --heap_size=0x4000 --stack_size=0x2000 --priority --diag_wrap=off --display_error_number --warn_sections --rom_model --be32 --zero_init=on -o "PROGRAM.out"   "../sys_linker.cmd" -lSW_Components.lib -llibc.a "./Source/my_code.obj"  

    • SW_Components.lib defines my version of fabsf function.
    • SW_Components.lib is specified before libc.a 

    Probably related, In CodeComposer studio, when I open my declaration of fabsf function, I see pop-up warning: #1853-D declaration hides built-in function "fabsf" 

    Any ideas?

  • I apologize.  I overlooked the fact that you call fabsf.  The compiler always inlines the operation of that function.  It never calls a function.  Therefore, there is no method by which you can replace it with your own function.

    Thanks and regards,

    -George