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: Merging of libc.a with static library

Part Number: TMS570LC4357

Tool/software: TI C/C++ Compiler

Hi Team,

For TMS570LC4357 Processor family. i am creating a CCS project to generate the static library; for e.g. Test.lib.

I am using the arm archiver (armar) with "r" flag to generate this library and i am including this library in the other executable; for e.g. Check.out.

Now, if i want to exclude the dependency of the libc.a from Check.out, and only want to have the dependency on the Test.lib, then how can i achieve that?

In short, Is there any possibility that with this arm archiver i can merge the libc.a in Test.lib itself, so that Check.out will be compiled properly just by linking Test.lib?

Can anyone help me in this?

Quick response will be appreciated.

Regards,

Shivam Kakad

  • Shivam Kakad said:
    if i want to exclude the dependency of the libc.a from Check.out, and only want to have the dependency on the Test.lib, then how can i achieve that?

    There is no straightforward way to do it.  First, you have to understand that libc.a is not an object file library, but an index library.  Once you are through that, then you could consider combining the correct RTS library with your Test.lib.  However, you would have to repeat this process every time you change the version of the compiler.

    It is much easier, and safer, to have the main application depend on both Test.lib and libc.a.  You must see some disadvantage in this approach.  What is it?

    Thanks and regards,

    -George

  • Thanks George for your response.

    Actually, we want to achieve it with the make file environment and i am sure, that the compiler version we are not going to change.(currently it is ti-cgt-arm_18.1.3.LTS). I would like to know, how can i generate the correct RTS library with my Test.lib so that i will not have any dependency to the libc.a?

    Also, is there any way to combine/merge the libraries into the single one. for eg. combining F021_API_CortexR4_BE_L2FMC.lib with Test.lib?

    Regards,

    Shivam Kakad

  • I continue to not understand why you want to combine libraries. Even though I will answer your questions, I remain concerned that you are making things worse, and not better.

    You need to understand two separate, but related, topics.  The first topic is an index library.  The second topic is how to combine two libraries which contain object files.  

    To understand the topic of an index library, please search the TI ARM assembly tools manual for the sub-chapter titled Library Information Archiver Description.  The key is to understand that libc.a is replaced with the RTS library that is the closest match to your compiler build options.  To see what RTS library is chosen, look in the linker map file.  If you choose to combine the RTS library with another library, this is the library to use, and not libc.a.

    Here is an example which shows how to combine two libraries.  Note that neither library can be an index library like libc.a.  In this example, the libraries one.lib and two.lib are combined into a new library named three.lib.  

    % mkdir empty_dir
    % cd empty_dir
    % armar -x \full\path\to\one.lib
    % armar -x \full\path\to\two.lib
    % armar -r three.lib *

    Lines 1 and 2 create an empty directory, then change into it.  Line 3 extracts all the object files in one.lib.  Line 4 does the same for two.lib.  Line 5 creates three.lib using all the object files from one.lib and two.lib.  

    The utility armar is the archiver.  It is documented in the same manual referenced earlier.

    Some limitations to consider ...

    • Inside three.lib, there is no way to know whether any object file came from one.lib or two.lib.  
    • If any files have the same name, the ones from two.lib get used.  The ones from one.lib are lost.

    Thanks and regards,

    -George