raiden00pl opened a new pull request, #17444:
URL: https://github.com/apache/nuttx/pull/17444

   ## Summary
   
   Mark memset as used_code to fix issues with GCC LTO and CMake which throws 
many "undefined reference to memset" errors.
   used_code force the compiler to emit the memset symbol under LTO.
   
   Example error for libcxxabi:
   
   ```
   /usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld: 
/tmp/ccFKUV08.ltrans1.ltrans.o: in function `__dynamic_cast.constprop.0':
   
external/nuttx/libs/libxx/libcxxabi/libcxxabi/src/private_typeinfo.cpp:655:(.text.__dynamic_cast.constprop.0+0x20):
 undefined reference to `memset'
   /usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld: 
external/nuttx/libs/libxx/libcxxabi/libcxxabi/src/private_typeinfo.cpp:736:(.text.__dynamic_cast.constprop.0+0x4e):
 undefined reference to `memset'
   /usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld: 
/tmp/ccFKUV08.ltrans1.ltrans.o: in function 
`__cxxabiv1::__class_type_info::can_catch(__cxxabiv1::__shim_type_info const*, 
void*&) const':
   
external/nuttx/libs/libxx/libcxxabi/libcxxabi/src/private_typeinfo.cpp:236:(.text._ZNK10__cxxabiv117__class_type_info9can_catchEPKNS_16__shim_type_infoERPv+0x28):
 undefined reference to `memset'
   /usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld: 
/tmp/ccFKUV08.ltrans1.ltrans.o: in function 
`__cxxabiv1::__pointer_type_info::can_catch(__cxxabiv1::__shim_type_info 
const*, void*&) const':
   
external/nuttx/libs/libxx/libcxxabi/libcxxabi/src/private_typeinfo.cpp:434:(.text._ZNK10__cxxabiv119__pointer_type_info9can_catchEPKNS_16__shim_type_infoERPv+0x12c):
 undefined reference to `memset'
   
   ```
   
   ## Impact
   fix LTO compilation
   
   ## Testing
   local build with LTO enabled


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to