lto

Generated with LTO version 6.0 instead of the expected 8.1

☆樱花仙子☆ 提交于 2021-01-29 11:47:59
问题 I’ve followed the setup instructions for movesense for windows [1] and run the below cmake command, which seem to work okay. However, when I run the ninja command it fails on step 9/9 complaining that the LTO version doesn’t match the configuration. Any advice? $ cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/blinky_app/ Error: [9/9] Linking CXX executable Movesense FAILED: Movesense cmd.exe /C "cd .

LTO causes crash in standard library

北战南征 提交于 2021-01-28 07:54:17
问题 Consider the following program: #include <iostream> #include <string> int main() { std::string s; std::getline(std::cin, s); return 0; } I try to build it with various flags and run as echo foo | ./prog . If I build it with clang 5.0 or gcc 7.1 (or 7.2) with optimization from -O0 to -O3 , it works as expected. But if I add -flto to any of these configurations, it crashes immediately with the following backtrace: /lib64/libc.so.6(+0x721af)[0x7f596b08e1af] /lib64/libc.so.6(+0x77706)

Enabling link-time optimizations causes a linker error?

耗尽温柔 提交于 2020-03-19 02:41:09
问题 I have code which compiles and links fine. I'm now trying to enable link-time optimizations, but adding -flto to my compiler and linker flags is causing a linker error: /usr/local/lib/libboost_thread.a(thread.o): \ In function `void boost::throw_exception<boost::bad_lexical_cast>(boost::bad_lexical_cast const&)': thread.cpp:(.text._ZN5boost15throw_exceptionINS_16bad_lexical_castEEEvRKT_[_ZN5boost15throw_exceptionINS_16bad_lexical_castEEEvRKT_]+0x124): \ undefined reference to `vtable for

Enabling link-time optimizations causes a linker error?

不打扰是莪最后的温柔 提交于 2020-03-19 02:41:05
问题 I have code which compiles and links fine. I'm now trying to enable link-time optimizations, but adding -flto to my compiler and linker flags is causing a linker error: /usr/local/lib/libboost_thread.a(thread.o): \ In function `void boost::throw_exception<boost::bad_lexical_cast>(boost::bad_lexical_cast const&)': thread.cpp:(.text._ZN5boost15throw_exceptionINS_16bad_lexical_castEEEvRKT_[_ZN5boost15throw_exceptionINS_16bad_lexical_castEEEvRKT_]+0x124): \ undefined reference to `vtable for

Interoperability between Clang, GCC and LTO

帅比萌擦擦* 提交于 2020-01-14 16:46:26
问题 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 with one compiler and linking them with objects created by the other is actually pretty easy (at least on x86). Here is a little test project doing exactly that: https://gitlab.com/higaski/Interoperability I was wondering however if Link Time Optimization (LTO) could somehow work across compilers? I

ARM + gcc: don't use one big .rodata section

对着背影说爱祢 提交于 2019-12-23 19:40:50
问题 I want to compile a program with gcc with link time optimization for an ARM processor. When I compile without LTO, the system gets compiled. When I enable LTO (with -flto), I get the following assembler-error: Error: invalid literal constant: pool needs to be closer Looking around the web I found out that this has something to do with the constants in my system, which are placed in a special section called .rodata, which is called a constant pool and is placed right after the .text section in

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

笑着哭i 提交于 2019-12-23 04:57:15
问题 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 #include d in both: // dep.hpp, declaration #ifndef _DEP_HPP_ #define _DEP_HPP_ inline void sayHello(); #endif // dep.cpp, definition #include "dep.hpp" #include <iostream> inline void sayHello() { std::cout << "Hello World!" << std::endl; } // main

How to write a custom intermodular pass in LLVM?

邮差的信 提交于 2019-12-18 13:09:02
问题 I've written a standard Analysis pass in LLVM, by extending the FunctionPass class. Everything seems to make sense. Now what I'd like to do is write a couple of intermodular passes, that is, passes that allows me to analyze more than one module at a time. The purpose of one such pass is to construct a call graph of the entire application. The purpose of the other such pass is that I have an idea for an optimization involving function calls and their parameters. I know about interprocedural

How to write a custom intermodular pass in LLVM?

别来无恙 提交于 2019-12-18 13:08:03
问题 I've written a standard Analysis pass in LLVM, by extending the FunctionPass class. Everything seems to make sense. Now what I'd like to do is write a couple of intermodular passes, that is, passes that allows me to analyze more than one module at a time. The purpose of one such pass is to construct a call graph of the entire application. The purpose of the other such pass is that I have an idea for an optimization involving function calls and their parameters. I know about interprocedural