166 questions
0 votes
0 answers
34 views
avr-gcc: error: -fuse-linker-plugin is not supported in this configuration
I'm cross-compiling avr-gcc statically (in order not to depend on Android linker) to work on aarch64 android devices. gcc is compiled with the flags: generic_arm64:/data/data/myapp/files/sdk/hardware/...
-6 votes
1 answer
93 views
Can an executable call a static library's non-inline consteval function when using LTO?
Let's say I have the following function in a static library libutil (with the definition in one of the library's translation units, so it can't be inlined while compiling the caller's translation unit)...
1 vote
0 answers
21 views
Activate LTO in CMake on Windows/MSVC only for some Build Types [duplicate]
I want to activate LTO only outside my debug build in CMake. For Linux, this was as easy as if(${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "Deploy") ...
0 votes
1 answer
136 views
How to set LTO for Clang and GCC in CMake?
I want to use my CMake script to cover both GCC and Clang for LTO and function-level linking (or whatever it's called -fdata-sections/-ffunction-sections). I have: add_compile_options( $<$<...
6 votes
0 answers
171 views
How do I compile a .c program file with Clang and make sure that CFI is enabled for the generated .so file
I have tried using clang -fPIC -flto -fsanitize=cfi -fvisibility=hidden -shared add.c -o libadd.so but I see the generated .so file doesn't have any cfi related symbols when used readelf? Please ...
0 votes
0 answers
30 views
How to relocate .text sections when using LTO?
I have firmware a project that needs to have some .text sections split up into different memory areas. They are spilt using the names of the source-code files, or by function name wildcards in the ...
1 vote
1 answer
492 views
could not compile `rustls-platform-verifier` (lib) in LTO mode
Using lto RUSTFLAGS='-Clto' fails the build with the following error: error: lto can only be run for executables, cdylibs and static library outputs error: could not compile `rustls-platform-verifier` ...
1 vote
1 answer
282 views
How to do cross-language LTO (link time optimization) on Windows using clang-cl and Rust?
I am using nightly rustc and LLVM 19.1 using clang-cl. I also unsuccessfully tried stable rustc 1.81.0 and clang-cl 18.1.8. Versions > rustc +nightly --version --verbose rustc 1.83.0-nightly (...
0 votes
1 answer
148 views
Blink sample in DA14531 - Jlink errors
I am trying to build the Blink sample for the DA14531 with Jlink, but I get Error messages related to LTO. How to solve this error? use of LTO is disallowed in this variant of Arm Compiler for ...
0 votes
1 answer
198 views
How to redefine symbol in the object file created in clang llvm LTO? It seems be "LLVM IR bitcode" file
There's an old project which needs to redefine symbol in build progress. I want to enable -flto, but it seems unable to redefine symbol now. echo "int foo(){return 0;}" > foo.c clang -c ...
1 vote
0 answers
111 views
Deterministic (programmatic) guidline for function inlining when targetting modern x86 processors?
(IMO) Cons when not inlined: call is unconditional branch (jump) with stack manipulation, and the x86 instruction table specifies it needs 4 uops/inst. and has reciprocal throughput of 2 for Zen4 ...
1 vote
0 answers
100 views
undefined references using gcc link-time optimizer
I'm tring to use gcc link-time optimizer, but encounter some issue related to the gcc linker cannot correctly resolving references to symbols in 'newlib_syscalls.c'. However, same source code , ...
1 vote
0 answers
58 views
Can GCC use LTO to optimize MIPS load/store instruction pairs for linker-defined addresses that are close together
Problem Statement Assume 32-bit MIPS I, and code written in C for an embedded system. When loading from an externally defined variable (extern int myVar;) that comes from a symbol defined in a linker ...
2 votes
0 answers
60 views
GCC+MPICH Link-time optimization generates "inlining failed" warnings for compiler-generated functions
TL;DR: How do I fix* inline failures by LTO on compiler-generated functions? (* by "fix" I mean "eliminate warnings in a manner consistent with best practice." I want to remove the ...
0 votes
0 answers
81 views
Correct CMAKE arguments for custom LTO pass
I am trying to adapt the makefile presented here: https://github.com/EnzymeAD/Enzyme/issues/710 into a CMake file. Background: My library uses Enzyme AD system for lto generation of gradients. And on ...