New yocto versions compiler options

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

New yocto versions compiler options

1,520 Views
AngelF
Contributor III

Hello,
We have our own custom design based on imx8mp, and so far we have worked with various yocto versions from NXP. We also need to generate the toolchain using the populate_sdk command as we have some customers who need to cross compile their applications outside of yocto.
We have used the following versions
5.4.70-2.3.2 (gcc 9.2)
5.15.32-2.0.0 (gcc 11.2)
6.1.22_2.0.0 (gcc 12.2)
6.6.23-2.0.0 (gcc 13.2)

We see that the same source code compiled with gcc 12.2 and 13.2 (same compile and strip options) produces binary files that are considerably larger than before.

Do you know if there is anything new we need to consider with these new compiler versions to avoid this problem?

Kind regards and thanks

 

0 Kudos
Reply
4 Replies

1,414 Views
AngelF
Contributor III

Hello Chavira,

Thank you for your help.

Best regards

0 Kudos
Reply

1,485 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @AngelF!

Thank you for contacting NXP Support!

 

Are you trying to compile using Optimization flags?

 

 

0 Kudos
Reply

1,450 Views
AngelF
Contributor III

Hi Chavira,

We are using same options than with other compiler versions

COLLECT_GCC_OPTIONS='-march=armv8-a+crc+crypto' '-fstack-protector-strong' '-O2' '-D' '_FORTIFY_SOURCE=2' '-Wformat=1' '-Wformat-security' '-Werror=format-security' '--sysroot=/opt/crosstool/gcc-12.2/sysroots/armv8a-poky-linux' '-Wall' '-v' '-o' 'dist/CC-12.2/main' '-I' 'inc' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'dist/CC-12.2/main.'
 
Could this issue be related to this new feature?
 
 
Best regards
 
0 Kudos
Reply

1,421 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @AngelF!
After talking with the internal team we conclude the next:

Enabling the shadow call stack feature in GCC 12 (when used with the AArch64 architecture) can increase the final binary size. This happens because additional instructions are needed to handle and verify return addresses, which takes up more space in the binary. Additionally, extra memory is required to store the shadow stack itself, contributing further to the increase in size. However, the impact on binary size will depend on factors such as the number of functions in the program and the complexity of the code.

Best Regards!

Chavira

0 Kudos
Reply