lto Questions

1

Solved

I have a project where I use -flto=thin for my main targets, but I don't want to apply LTO to my tests since it slows compilation down (full context: lld runs LTO even if -fno-lto is passed). As it...
Infundibulum asked 16/5, 2022 at 13:50

5

Solved

I have the most recent cmake build and trying all build configurations (Debug, MinSizeRel, RelWithDebugInfo, Release, General) I see nowhere (text search) in generated makefiles the string -lto, so...
Inaugural asked 11/7, 2015 at 9:37

1

Example: notmain.c int __attribute__ ((noinline)) notmain(int i) { return i + 1; } int notmain2(int i) { return i + 2; } main.c int notmain(int); int main(int argc, char **argv) { return notm...
Nichrome asked 17/7, 2023 at 7:59

2

Solved

Say I have a function void do_something() { //.... #ifdef FEATURE_X feature_x(); #endif //.... } I can compile and run this with no problems; if I want the feature I can pass -D FEATURE_X a...
Nebo asked 3/10, 2012 at 19:16

1

Solved

I am seeing LTO optimize some global objects out from a TU if there are no functions in that TU that are being explicitly from another TU. The following excerpt attempts to describe the key classes...
Variole asked 12/7, 2022 at 20:55

2

In my project I have a lot of enumerations that need to have additional attributes associated with the enumeration members and auxiliary static methods associated with the enumeration type. As muc...
Entertaining asked 30/12, 2012 at 12:8

1

Solved

I have a CMake project with several subprojects that create static libraries built with -flto=thin. The project has a lot of tests that are linked against the aforementioned libraries. With LTO it ...
Hepzi asked 10/5, 2022 at 17:2

1

Solved

Normally, one can get GCC's optimized assembler output from a source file using the -S flag in GCC and Clang, as in the following example. gcc -O3 -S -c -o foo.s foo.c But suppose I compile all ...
Blakely asked 31/10, 2019 at 1:22

2

Solved

I'm trying to use link-time optimizations with the -flto flag of GCC (6.1.1). While it works fine with my code, it doesn't link with a static linked library I'm also building and linking with my p...
Powerful asked 30/8, 2016 at 20:53

4

Solved

I work with GCC-ARM-Embedded and FreeRTOS. FreeRTOS has the function vTaskSwitchContext() which is used only in some inline assembler code. The problem is: When I use LTO, GCC does not consider th...
Stem asked 15/7, 2016 at 6:56

1

I'm compiling some binaries on Mac, but the compiled size has become huge with more recent compiler (up to ~20MB from ~5MB before). I think it's related to LTO (link time optimization) that was not...
Dastard asked 27/1, 2021 at 18:3

1

Solved

I'm trying to cram a lot of code into a reasonably small ARM microcontroller. I've done a massive amount of work on size optimisation already, and I'm down to the point where I need double arithmet...
Mooring asked 20/9, 2018 at 15:49

1

Solved

Clang allows to use a thin lto to speed up compilation time while still keeping most of the advantages of using lto with the option -flto=thin. Does gcc have an equivalent of clang's thin lto?
Roentgenograph asked 22/11, 2020 at 13:10

2

I've the following project in CMake 3.14.0, that builds a project for Visual Studio 2017 64 bit generator (minimum version is 3.10.0 because other developer can have previous versions of CMake, but...
Momentary asked 6/6, 2019 at 7:49

3

Solved

I would like to compile a shared library using both symbol versioning and link-time optimization (LTO). However, as soon as I turn on LTO, some of the exported symbols vanish. Here is a minimal exa...
Jewess asked 19/9, 2017 at 15:47

2

Solved

When I try to build static libraries with -flto, I get undefined reference errors: library.cpp: #include <iostream> void foo() { std::cout << "Test!" << std::endl; } main.cp...
Uniflorous asked 16/9, 2014 at 21:5

3

Solved

I have project, running on an ARM Cortex-M4 processor, where I'm trying to include the gcc link-time optimization (LTO) feature. Currently my compilation and linking flags are: CFLAGS = -ggdb -ff...
Wolsey asked 22/11, 2016 at 13:40

1

Solved

I know that Clang and GCC are more or less compatible C/C++ compilers as long as one takes care of things like architecture flags, predefines and linking the right libraries. Creating libraries wit...
Vizor asked 10/7, 2018 at 7:21

2

Solved

Introduction I finished a small Rust project (about 300 lines of code) with the following dependencies: rumqtt signal log env_logger Problem When using cargo build --release without further c...
Outbalance asked 12/9, 2018 at 8:43

3

Solved

An LTO build of a rather large shared library (many template instantiations) takes rather long (>10min). Now I know a few things about the library, and could specify some kind of "blacklist" in the...
Fornax asked 27/2, 2018 at 22:5

0

Code: #include <iostream> #include <string> #include <fstream> int main(int argc, char *argv[]) { std::string filename = "dummyfile"; std::ifstream infile(filename); std::str...
Indefatigable asked 29/1, 2018 at 16:21

3

Solved

I am trying to apply Link Time Optimization with LLVM on a CMake Project, that creates a shared library. My question is pretty much the same as this one: Switching between GCC and Clang/LLVM using...
Semiprofessional asked 10/3, 2016 at 17:12

2

Solved

I'm wandering which is the right way to compile static library on Linux with GCC in such way that when link time optimizations (LTO) be applied to the executable the library to be consumable and po...
Concoff asked 25/10, 2017 at 13:44

1

Solved

I'm doing a gcc compile with -Wlto-type-mismatch and -Werror set (for the good of the rest of the project). I have an extern struct with a flexible array that is provoking an lto-type-mismatch warn...
Acinaciform asked 12/7, 2017 at 3:27

1

What are the caveats and gotchas needed to keep in mind when writing code or build scripts for compilation with LTO? The motivation behind this question is to understand better why some projects d...
Sheridansherie asked 14/2, 2017 at 15:33

© 2022 - 2024 — McMap. All rights reserved.