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

Linker throws L6200E while linking a SYMDEFS generated file and other *.o files

I am trying to do the following with Armlink 5.03

1) Compile and link certain part of code and create a "symdefs file" with option --symdefs FileA

2) Then I compile and link rest of the code (I will call it FileB) along with FileA (as I understand linker treats the symdefs file like any other object file)

3) ARM library functions "srand", "rand" are called in both FileA and FileB.

4) Somehow ARM runtime library is getting included for both FileA and FileB

5) the functions srand and rand internally use some  "_rt_lib_init_rand_2"  function which gets included and defined in both FileA and FileB linked files.

   The linker throws error L6200E for multiple definition of "_rt_lib_init_rand_2"

How do I resolve this?

Thanks

M

Parents
  • Some update- I resolved the issue using a linker steer file.

    In my usage, I always use srand( ) before rand( ).

    Hence I do not really need seed / rand initialization by runtime library ( which is what _rt_lib_init_rand_2 does - it executes _rand_init-> srand(1) ..peeked into the object dump for this)

    Solution:

    So I created a steer file for my ROM image with the following-

    HIDE _rt_lib_init_rand_2. and used the --edit <file> option. Finally it works! The object dumps look fine.

    This should have theoretically created 2 copies of _rt_lib_init_rand_2 (1 in ROM, 1 in RAM)..but my runtime init call only happens / links in RAM..hence ROM copy is never used.

    However what happens is - _rt_lib_init_rand_2 is only a label to pull in _rand_init from rt lib. Hence after using the steer file, NO symbol called _rt_lib_init_rand_2 is created in either ROM/RAM image ! (although _rand_init is still called in my RAM image where my runtime init happens)

    Note; This solution is ok specifically for my case ( cannot be applied to ALL scenarios)

Reply
  • Some update- I resolved the issue using a linker steer file.

    In my usage, I always use srand( ) before rand( ).

    Hence I do not really need seed / rand initialization by runtime library ( which is what _rt_lib_init_rand_2 does - it executes _rand_init-> srand(1) ..peeked into the object dump for this)

    Solution:

    So I created a steer file for my ROM image with the following-

    HIDE _rt_lib_init_rand_2. and used the --edit <file> option. Finally it works! The object dumps look fine.

    This should have theoretically created 2 copies of _rt_lib_init_rand_2 (1 in ROM, 1 in RAM)..but my runtime init call only happens / links in RAM..hence ROM copy is never used.

    However what happens is - _rt_lib_init_rand_2 is only a label to pull in _rand_init from rt lib. Hence after using the steer file, NO symbol called _rt_lib_init_rand_2 is created in either ROM/RAM image ! (although _rand_init is still called in my RAM image where my runtime init happens)

    Note; This solution is ok specifically for my case ( cannot be applied to ALL scenarios)

Children
No data