mcuxpresso: How to disable -flto only for some files?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mcuxpresso: How to disable -flto only for some files?

Jump to solution
2,313 Views
v_canoz
Contributor III

I am using mcuxpresso v11.2.0.

I have enabled -flto for C++, C compilers and for the linker. I am using an external library which causes the link time optimization to fail Error: invalid offset, value too big (0x00002C90)

I've narrowed down the issue to an external lib that I cannot modify. Therefore, I would like to enable -flto for everything except this external library.

pastedImage_1.png

Is this possible?

Thanks,

Victor

Labels (1)
Tags (2)
1 Solution
2,232 Views
ErichStyger
Specialist I

Hi Victor,

simply right-click on a file or folder and set the compiler/etc options.

The fact that you have per-file or per-folder options is marked with an icon decorator:

pastedImage_1.png

See Icon and Label Decorators in Eclipse | MCU on Eclipse .

(the above shows as well how to restore it it to the defaults)

I hope this helps,

Erich

View solution in original post

3 Replies
2,232 Views
ErichStyger
Specialist I

Is the library compiled or provided as archive?

There are basically two things:

a) compiling the sources with LTO

b) linking with LTO

b) requires a), but it should be possible compile some source files with or without LTO. Simply do not set that option for these files or folders.

0 Kudos
Reply
2,232 Views
v_canoz
Contributor III

Hello Erich,

Compiling the source of the libs is not possible, the sources are closed. However my code could result in a smaller binary if I could enable the option for my source files.

Is it possible to select what files we want to compile with and without -flto in Mcuxpresso? If so, how?

Given I'm using a code base mixing C and C++, the workaround I'm using is to enable -flto for the C++ compiler and the linker, but not the C compiler, and it works.

However I would really like to compile the open source C files with -flto too.

0 Kudos
Reply
2,233 Views
ErichStyger
Specialist I

Hi Victor,

simply right-click on a file or folder and set the compiler/etc options.

The fact that you have per-file or per-folder options is marked with an icon decorator:

pastedImage_1.png

See Icon and Label Decorators in Eclipse | MCU on Eclipse .

(the above shows as well how to restore it it to the defaults)

I hope this helps,

Erich