Questions tagged [lto]

LTO abbreviates Link-Time Optimization. LTO is a phase of optimization applied to a compiled program at the linkage step, with the advantage that all of the compiled object files comprising the program can then be analysed together. Conventional optimization is performed by the compiler alone, which can generate and optimize only one object file at a time.

156 questions
0
votes
0 answers

How to enable whole program optimization with g++ and CMake

What's the correct way to enable whole program optimization with CMake and g++? I know about CMake's INTERPROCEDURAL_OPTIMIZATION variable, but it looks like there are additional optimizations available if I specify -fuse-linker-plugin,…
Thomas Johnson
  • 10,776
  • 18
  • 60
  • 98
0
votes
1 answer

after upgrade to gcc9.3 linking segfaults in lto-wrapper but LTO is disabled

I just upgraded gcc form 7.5 to 9.3 and started to have gcc linker segfaults - but only on armv7 target (the same all sources are building/linking OK for aarch64/x86_64 targets). Segfault is in lto-wrapper - but I disabled LTO so I'm a bit…
user81604
  • 21
  • 1
  • 8
0
votes
1 answer

GCC flags to get LTO bitcode

I have been using LLVM/Clang and its Intermediate Representation(IR) for a while now. I have recently started working with GCC. I want to dump IR bitcode to a file, similar to (-flto -save-temps flag) in LLVM. I can get gimple IR using…
kshh23
  • 36
  • 6
0
votes
1 answer

G++ and LTO: how to separate declaration and definition?

Since LTO can resolve inline symbols from other object files, I tried to separate declaration and definition for inline functions. Here is the 3 files, dep.hpp, dep.cpp and main.cpp, where main.cpp and dep.cpp are linked together and dep.hpp is…
Kotauskas
  • 1,239
  • 11
  • 31
0
votes
0 answers

Stripping out static global objects with LLVM LTO

I am working on a static library which gets linked into multiple binaries. My objective is to reduce the memory footprint of my library when it gets linked in. The users of my library require certain global objects that I create in a cpp file in my…
Virag Doshi
  • 109
  • 4
0
votes
1 answer

LLVM 3.3 with a TileGX toolchain and LTO not working

I have a simple HelloWorld.c program (so, I'm put putting it here), that I am trying to build with clang version 3.3 with LTO enabled that is throwing strange errors. I am building it with cmake using the -DCMAKE_TOOLCHAIN_FILE. I can successfully…
JonBelanger
  • 150
  • 3
  • 12
0
votes
0 answers

Cannot enable LTO when linking against pcre

I'm contributing to one open-source project named AMX Mod X. It uses really simple, custom-made build system (called AMBuild). Project is built using Clang on Linux. I tried to enable LTO for it, just by passing compile-time and link-time…
Inline
  • 2,566
  • 1
  • 16
  • 32
0
votes
0 answers

GCC LTO - fno-fat-lto-objects are supported only with linker plugin

I am trying to use LTO in my code base. I used -flto flag during compile and link time both. It created fat objects but the binary generated after linking remained same as was without using LTO (No difference is size or performance). Then I decided…
0
votes
1 answer

How to enable CFI in LLVM

I want to compile nginx with CFI enforced by LLVM. I modify the Makefile in the objs directory. The modification includs: 1. change the compiler:cc--> clang 2. add parameters related with CFI: -flto -fvisibility=hidden -fsanitize=cfi The modified…
Rambo
  • 53
  • 6
0
votes
0 answers

Firefox build with LTO failure

I was trying to build firefox with lto, but the building is failed due to a linker error. This is the error I am getting: 0:01.34 DEBUG: /tmp/conftest-79f19c.o: file not recognized: File format not recognized 0:01.34 DEBUG: clang-3.9: error: linker…
JhiJhi
  • 11
  • 5
0
votes
0 answers

cmake link time optimisation with clang

I'm trying to use LTO in clang (with cmake): flag -emit-llvm set in compile time, output generated with -c flag, so LLVM bitcode is the result. The problem is, cmake give me result with ".o" suffix, but i need ".bc". I found other codes that used…
bsz
  • 61
  • 8
0
votes
2 answers

How to automatically merge C source files?

I have a single executable which consist of many .c source files across several directories. Currently I need to run static analysis on the whole source code, not on each files separately. I just found gcc ʟᴛᴏ (link time optimisation) works by…
user2284570
  • 2,891
  • 3
  • 26
  • 74
0
votes
1 answer

Possibility of an LLVM LTO Pass plugin?

I was wondering if it's currently possible to have an 'external' (.so/.dylib) LLVM plugin (module) pass scheduled at LTO time? The reason for wanting this is a inter-modular optimization I want to add. I also found this topic; How to write a custom…
dzan
  • 425
  • 3
  • 14
0
votes
0 answers

Linking fails when Link Time Optimisation is enabled

I have a (large) wxWidgets project, that compiles smoothly also in higher optimisation levels. Now I enabled Whole Program Optimisation (/GL) for building objects and Link Time Code Generation (/LTCG) in settings of this project. This leads to an…
Elmi
  • 5,899
  • 15
  • 72
  • 143
0
votes
1 answer

How to get gcc LTO work with library archives?

gcc experts, I'm trying to use gcc lto with library archives, as the gcc comes with my system (RedHat Enterprise Linux 5.7) doesn't work with -flto (neither for my Ubuntu 14.10), so I build binutils && gcc from scratch. Here is what I did: 1. Build…
Cheng
  • 11
  • 1
1 2 3
10
11