lto和fat-lto-objects之间的gcc有什么区别 [英] What is the difference in gcc between lto and fat-lto-objects

查看:1554
本文介绍了lto和fat-lto-objects之间的gcc有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用下面的标志编译我的源代码:

1. -flto

2。 -flto -ffat -lto-objects

3. -flto -fno-fat-lto-objects $ b

第三个提供优化 slim LTO代码,如文档中所写,但我没有看到任何为什么?在输出程序集文件中的第一个和第二个不同,为什么?

操作系统:linux

编译器: GCC 4.7

解决方案

胖和非胖对象文件的区别在于胖对象文件包含中间语言以及正常编译的代码。在链接时,如果你调用没有-flto的编译器,胖对象将作为正常的对象文件处理(而LTO信息被丢弃),而细长对象将创建LTO优化器,因为如果没有它,就无法处理它们。

b
$ b

如果你编译并链接到-flto,胖胖的对象应该给你相同的二进制文件,只是苗条的对象会更小,编译速度更快,因为你可以避免冗余代码生成。


I have tried to compile to assembler my source code with next flags:
1. -flto
2. -flto -ffat-lto-objects
3. -flto -fno-fat-lto-objects

Third one provides optimized slim LTO code as written in documentation, but I don't see any difference in the output assembly file between first and second, why?

OS: linux
Compiler: GCC 4.7

解决方案

The difference between fat and non-fat object files is that fat object files contains both intermediate language as well as the normally compiled code. At linktime, if you invoke compiler without -flto, fat objects will be handled as normal object files (and LTO information discarded), while slim objects will inovke LTO optimizers because there is no way to handle them without it.

If you both compile and link with -flto, both fat and slim objects ought to give you the same binary, just slim objects will be smaller and faster to compile, because you will avoid the redundant code generation.

这篇关于lto和fat-lto-objects之间的gcc有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆