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/TMS320F28388D: How to remove errors and warning related to the helper function from run time libraries?

Part Number: TMS320F28388D

Tool/software: TI C/C++ Compiler

Hi TI,

We have been testing the customized run time library with our project. Since we started debugging, I could see the warning coming up for the sqrt function that, function declared implicitly.<a href="file:/C:/ti/ccs1000/ccs/tools/compiler/dmed/HTML/225.html">#225-D</a>  function "sqrtf" declared implicitly


and with each library function I could see these warnings coming up. initially we ignored, but I noticed it started creating issues in my project. It will give the undefined symbol linking issues which are mostly with respect to the helper functions.

Is there any way to mitigate this issue?

Also why I couldn't see the same issue, when calling libc.a(indexed library).

Could you please provide any optimum approach to avoid getting the linker issues? 

Note: we don't want to just suppress the warnings.

Regards

Gurusha

  • Be sure the source files that see diagnostics similar to ...

    gurusha nahar said:
    function "sqrtf" declared implicitly

    ... #include the RTS header file which contains the declaration of that function.  In this specific case, #include <math.h>

    Please let me know if this suggestion resolves the problem.

    Thanks and regards,

    -George

  • Hi George,

    Thank you for your response!

    I have included this header file while creating the run time library for which, everything is linked during the library creation.

    And also integrated this library in our project. When I call any of the rtl functions, for example, sqrtf(), I should not get the implicit function declaration warnings in my project, right?

    Could you please explain to me why this is happening. Are we missing any linker settings?

    Also, I am getting some C helper function linking issues, most of which are mention in the SPRAC71A, Table 5. Is there any rtl settings required so that these issues will be taken care while project linking.

    Thanks

    Gurusha

  • gurusha nahar said:
    When I call any of the rtl functions, for example, sqrtf(), I should not get the implicit function declaration warnings in my project, right?

    If you call a function, and no prototype is visible, then you will get the diagnostic about that function being declared implicitly.  This is true of both user functions and functions implemented in the compiler RTS library.

    gurusha nahar said:
    Are we missing any linker settings?

    The diagnostic is unrelated to the linker settings.

    gurusha nahar said:
    Also, I am getting some C helper function linking issues, most of which are mention in the SPRAC71A, Table 5.

    Please show an example of one of these issues.  Please show the full linker invocation, and all of the system response.  Please copy and paste the text, and do not use a screen shot.

    Thanks and regards,

    -George

  • Hi George,

    George Mock said:
    This is true of both user functions and functions implemented in the compiler RTS library.

    Then include heading file again in the project, wont make it redundant. Why we need to again include the rtl header files in our project code too? Is there any alternative approach we can use.

    George Mock said:
    Please show an example of one of these issues. 

    RIght now I have fixed those issues temporarily. But I have one concern.

    I was referring compiler manual spru514v, where I saw this point mentioned in the Section 8.1 C and C++ Run-Time Support Libraries:

    Compiler helper functions (to support language features that are not directly efficiently expressible in C/C++)

    How this can be implemented? Are there any settings to configure the helper function?

    Please help me to understand this.

    Thanks

    Regards

    Gurusha

  • Gurusha,

    George is out for the next week.  However I will attempt to help you with the first question.

    gurusha nahar said:
    George Mock
    This is true of both user functions and functions implemented in the compiler RTS library.

    Then include heading file again in the project, wont make it redundant. Why we need to again include the rtl header files in our project code too? Is there any alternative approach we can use.

    If you are calling a function that is part of a library (any library) or even in a different source file then you need to include the header file that has the function prototype.  If you don't then you will get that implicit declaration warning at build time.  If you ever see that warning you want to stop and fix it as your program is not going to work correctly.

    Here are a few links that explain this further.

    https://myeasytuts.com/solved-implicit-declaration-of-function-in-c/

    https://stackoverflow.com/questions/8440816/warning-implicit-declaration-of-function

    https://www.quora.com/What-is-the-implicit-declaration-of-function

    As far as the second question

    gurusha nahar said:

    I was referring compiler manual spru514v, where I saw this point mentioned in the Section 8.1 C and C++ Run-Time Support Libraries:

    Compiler helper functions (to support language features that are not directly efficiently expressible in C/C++)

    How this can be implemented? Are there any settings to configure the helper function?

    This is similar to above.  If you want to use any of the helper functions you will have to include the appropriate header file in your source file.

    Regards,

    John

  • Oh! But initially what we assuming is if the library function call is already linked with the application, then we shouldn't be getting this warning.

    But since you confirm it, then we will be including again the header file wherever we are calling the library function. 

    Also

    JohnS said:
    This is similar to above.  If you want to use any of the helper functions you will have to include the appropriate header file in your source file.

    NO, this is not the case!

    If you see the helper functions, mostly are the part of some asm file. We cannot include almost all the asm files in our RTL.

    There is for sure, some missing part in our RTL.

    As George knows our status, he could be able to help us!

    What I will do is attach the dummy project for which I am getting the helper function error.

    Kindly please check the issue and let us know what we are exactly missing here.

    If you build the dummy project, you will also get that linker error.

    Hope it will help you to understand my doubt!.

    Dummy_Proj.zip

    Thanks

    Regards

    Gurusha

  • To use logf() then include math.h

    You will also have to add the necessary path to the include search path here:

    I added ${CG_TOOL_ROOT}/include instead of using an absolute path.  ${CG_TOOL_ROOT} is resolved to the location where the compiler is installed and math.h is located in the /include folder under that.

    Regards,

    John

  • Hi,

    The intend for sharing this project is to show you the linker issues I am getting. For this project, we can resolve it by inserting the header file. But for our project when we tried in the same way but still getting the compilation issue. I am trying creating the same scenario. I will post the exact issue. My only concern is the statement in sprac71a.  In section 6.2, on page no.31 it states :

    "The compiler generates calls to helper functions to perform operations that need to be supported by the compiler, but are not supported directly by the architecture, such as floating-point operations on devices that lack dedicated hardware. These helper functions must be implemented in the RTS library of any toolchain that conforms to the ABI"

     

  • Gurusha,

    George will be back on Monday and can respond then.

    Regards,

    John

  • Thank you for submitting a test case project.  

    Code in the project includes no header files and declares no function prototypes.  It includes a line similar to ...

    float_var1 = logf(float_var2);

    Because there is no prototype for logf visible, the compiler does not know that the argument logf expects is of type float.  Instead, the compiler uses the default conventions for passing a float expression to a function, which is to convert it to type double.  Thus, the compiler generates code to convert float_var2 from float to double.  This generated code calls a function in the RTS named __c28xabi_ftod. Note this is not a user level function like strcpy, but a helper function called by the compiler as needed.  None of the libraries in the project supply the function __c28xabi_ftod.  Therefore the project fails to successfully link.

    By adding this line ...

    #include <math.h>

    ... a prototype for logf is made visible.  This means the compiler knows the argument to logf is of type float, and not type double.  Therefore, it does not generate code to convert float_var2 from float to double.  Because no call to the function __c28xabi_ftod is present, the project builds successfully.

    This situation is a good example of why it is necessary to insure every function call, both to user functions and RTS functions, has a valid function prototype visible.

    Thanks and regards,

    -George