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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
1,520件の閲覧回数
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 解決策
1,439件の閲覧回数
ErichStyger
Senior Contributor V

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 返答(返信)
1,439件の閲覧回数
ErichStyger
Senior Contributor V

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 件の賞賛
1,439件の閲覧回数
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 件の賞賛
1,440件の閲覧回数
ErichStyger
Senior Contributor V

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