[CMake] TI-C CMAKE_C_LINK_EXECUTABLE order

Florian Reinhard florian.reinhard at googlemail.com
Sun May 31 09:40:08 EDT 2015


Hi Falk!

I've read through the cl6x linker docs once again  [1] SPRU187V Chapter 5, 
page 137 and following.

>From my experience and the docs i'd say, yes you're right.

To prove the solution to your problem, see page 138:
"When you specify a library as linker input, the linker includes and links 
only those library members that resolve undefined references."

Current cmake behaviour:
Library functions are favored over user functions.

Desired behaviour:
User functions are favored library functions.

Before proposing a change in cmake, i'd like to check how our cmake/ti project 
(>200k lines) behaves and if it still links. Unfortunately i'll not be able to 
do this before 15.6.2015.

Regards,
Florian

[1] http://www.ti.com/lit/ug/spru187v/spru187v.pdf

On Thursday 28 May 2015 08:15:09 Tristram, Falk wrote:
> Hi all,
> 
> before creating a bug report about this problem, I first want to get
> feedback here. I have created a CMake build system for a whole bunch of
> embedded targets all working fine.
> 
> Now I ran into a strange problem related to the tms470_5.0.1.
> Some of the symbols are just dropped by linker (optimized out).
> I pinned down the problem to the "TI-C.cmake".
> 
> set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker
> --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS>
> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
> 
> <OBJECTS> is the last entry.
> In my case OBJECTS just consists out of one file "main.c.obj".
> 
> Changing the order just works fine, as follows:
> set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker
> --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS>
> <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS>")
> 
> Now here is my question:
> Is there any specific reason why <OBJECTS> comes as last parameter?
> Could you change the order for future versions?
> 
> Note: I am still checking/testing the impact of the changed order to our
> other TI-C build systems.
> 
> Best regards,
> Falk



More information about the CMake mailing list