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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,249 次查看
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

标签 (1)
标记 (2)
1 解答
2,168 次查看
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

在原帖中查看解决方案

3 回复数
2,168 次查看
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 项奖励
回复
2,168 次查看
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 项奖励
回复
2,169 次查看
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