lto

C++11 enum with class members and constexpr link-time optimization

…衆ロ難τιáo~ 提交于 2019-12-18 08:35:46
问题 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 much as I know, this is not possible to have with the standard enum class MyItem {...}, so for each enum class in my project I have an auxiliary class MyItemEnum that encapsulates these auxiliary static methods and also instantiates auxiliary instances of itself, so that I can access their methods in

C++11 enum with class members and constexpr link-time optimization

╄→гoц情女王★ 提交于 2019-12-18 08:34:20
问题 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 much as I know, this is not possible to have with the standard enum class MyItem {...}, so for each enum class in my project I have an auxiliary class MyItemEnum that encapsulates these auxiliary static methods and also instantiates auxiliary instances of itself, so that I can access their methods in

C++11 enum with class members and constexpr link-time optimization

梦想与她 提交于 2019-12-18 08:34:13
问题 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 much as I know, this is not possible to have with the standard enum class MyItem {...}, so for each enum class in my project I have an auxiliary class MyItemEnum that encapsulates these auxiliary static methods and also instantiates auxiliary instances of itself, so that I can access their methods in

Mingw x64 Windows: plugin needed to handle lto object

你离开我真会死。 提交于 2019-12-14 00:18:46
问题 When I'm trying to compile my project with 64-bit mingw (x86_64-5.1.0-posix-seh-rt_v4-rev0) I got messages: BFD: my/project/dir/filename.cpp.obj: plugin needed to handle lto object for each source file. Yet when I compile with 32-bit mingw(i686-5.1.0-posix-dwarf-rt_v4-rev0), everething is OK. My flags are: CXX_FLAGS "-fno-exceptions -fno-rtti -std=c++14 -O3 -fstrict-aliasing -flto -fomit-frame-pointer -march=native -ffast-math -funroll-loops" LINKER_FLAGS "-O1 -s" I tried to add -fuse-linker

Prevent GCC LTO from deleting function

﹥>﹥吖頭↗ 提交于 2019-12-13 12:25:59
问题 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 the inline assembler code and thinks the function is not used, thus removes it. The linker then fails because the function call in the inline assembler code cannot be resolved. I would apply __attribute__((used)) but I don't want to touch the FreeRTOS code (it's generated by STM32CubeMX). I tried

Which is the correct way to build a static library with link time code generation on Linux?

时间秒杀一切 提交于 2019-12-10 10:11:43
问题 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 possibly to be achieved optimal performance. When library is compiled only with -flto the executable cannot be linked to it no matter whether it uses -flto or not. The error is: undefined reference to `hello' where hello is function defined in the library. According to the answer to this Stack

undefined reference cross compiling static libraries with LTO under GCC

坚强是说给别人听的谎言 提交于 2019-12-09 03:31:50
问题 I am attempting to use GCC 4.9.2 to cross compile an application from Linux (x86_64-pc-linux-gnu) for Windows (x86_64-w64-mingw32). When building targets that link against static libraries and also using link-time optimisation I get undefined reference errors from the linker for all symbols the target uses from the library. eg, building bar.a from bar.cpp int bar (void) {return 42;} and linking with foo.cpp extern int bar (void); int main (int, char**) {bar ();} using the command line x86_64

How to detect code compiled with LTO?

时光毁灭记忆、已成空白 提交于 2019-12-07 07:54:55
问题 Exist any way to detect if code is compiled with -flto? Example is classic library or executable under Linux compiled with GCC (4.9.1), without debugging. 回答1: Considering that LTO information is stored in several ELF sections inside object files (see LTO file sections), you could try and see what readelf returns (as used for instance in this answer). Look for .gnu.lto_.xxx entries. 来源: https://stackoverflow.com/questions/26322946/how-to-detect-code-compiled-with-lto

How to detect code compiled with LTO?

狂风中的少年 提交于 2019-12-05 18:53:19
Exist any way to detect if code is compiled with -flto? Example is classic library or executable under Linux compiled with GCC (4.9.1), without debugging. VonC Considering that LTO information is stored in several ELF sections inside object files (see LTO file sections ), you could try and see what readelf returns (as used for instance in this answer ). Look for .gnu.lto_.xxx entries. 来源: https://stackoverflow.com/questions/26322946/how-to-detect-code-compiled-with-lto

Prevent GCC LTO from deleting function

丶灬走出姿态 提交于 2019-12-05 01:23:02
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 the inline assembler code and thinks the function is not used, thus removes it. The linker then fails because the function call in the inline assembler code cannot be resolved. I would apply __attribute__((used)) but I don't want to touch the FreeRTOS code (it's generated by STM32CubeMX). I tried putting this in my code, but actually GCC is smart enough to not allow this to work: if(false)