gpt4 book ai didi

linux - native GCC 5 二进制文件太大 (libexec)

转载 作者:太空狗 更新时间:2023-10-29 11:12:58 28 4
gpt4 key购买 nike

所以我在旧的 CentOS 6.6 发行版上,并从源代码编译了 GCC 5.2。当我安装它时,它会在 libexec 下创建它的 5.2.0 子文件夹,但是二进制文件 cc1 和 cc1 plus 是巨大的!

我是这样设计的

Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/usr2/libexec/gcc/i686-redhat-linux-gnu/5.2.0/lto-wrapper
Target: i686-redhat-linux-gnu
Configured with: ../configure
--prefix=/usr2
--disable-multilib
--enable-languages=c,c++
--enable-gnu-unique-object
--disable-dssi
--enable-libstdcxx-threads
--enable-libstdcxx-time
--enable-shared
--enable-__cxa_atexit
--disable-libunwind-exceptions
--disable-libada
--host=i686-redhat-linux-gnu
--build=i686-redhat-linux-gnu
--target=i686-redhat-linux-gnu
--with-default-libstdcxx-abi=gcc4-compatible
--with-arch=i686
--enable-linker-build-id
--with-system-zlib
--with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.2.0 (GCC)

这是发行版中 4.4.7 的 ls

-rwxr-xr-x  1 root root 8566416 Jul 23 00:19 cc1
-rwxr-xr-x 1 root root 9574772 Jul 23 00:19 cc1plus
-rwxr-xr-x 1 root root 101596 Jul 23 00:19 collect2
-rwxr-xr-x 1 root root 9419280 Jul 23 00:19 f951

这里和新编译的 5.2.0 一样

-rwxr-xr-x 1 root root 102532928 Dec 11 16:48 cc1
-rwxr-xr-x 1 root root 109000772 Dec 11 16:48 cc1plus
-rwxr-xr-x 1 root root 2033844 Dec 11 16:48 collect2
drwxr-xr-x 2 root root 4096 Dec 11 16:48 install-tools
-rwxr-xr-x 1 root root 995 Dec 11 16:48 liblto_plugin.la
lrwxrwxrwx 1 root root 22 Dec 11 16:48 liblto_plugin.so -> liblto_plugin.so.0.0.0
lrwxrwxrwx 1 root root 22 Dec 11 16:48 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0
-rwxr-xr-x 1 root root 235508 Dec 11 16:48 liblto_plugin.so.0.0.0
-rwxr-xr-x 1 root root 98350432 Dec 11 16:48 lto1
-rwxr-xr-x 1 root root 2288396 Dec 11 16:48 lto-wrapper

cc1、cc1plus 和 lto1 各为 100MB。这对 5.2 来说是正常的吗?为什么会这样?

感谢@Marc Glisse 的评论,我在两个二进制文件上运行了一个文件

5.2.0/cc1: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

4.4.7/cc1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

剥离 有区别吗?我缺少什么配置标志?

最佳答案

感谢@MarcGlisse 为我指明了正确的方向。

无论你如何配置GCC,除非你安装

make install-strip

二进制文件将充满符号。安装精简版后,大小减少了 70%。

-rwxr-xr-x 1 root root 19749196 Dec 14 13:01 cc1
-rwxr-xr-x 1 root root 21057676 Dec 14 13:01 cc1plus
-rwxr-xr-x 1 root root 507336 Dec 14 13:01 collect2
drwxr-xr-x 2 root root 4096 Dec 14 13:01 install-tools
-rwxr-xr-x 1 root root 995 Dec 14 13:01 liblto_plugin.la
lrwxrwxrwx 1 root root 22 Dec 14 13:01 liblto_plugin.so -> liblto_plugin.so.0.0.0
lrwxrwxrwx 1 root root 22 Dec 14 13:01 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0
-rwxr-xr-x 1 root root 76972 Dec 14 13:01 liblto_plugin.so.0.0.0
-rwxr-xr-x 1 root root 18930924 Dec 14 13:01 lto1
-rwxr-xr-x 1 root root 693024 Dec 14 13:01 lto-wrapper
drwxr-xr-x 2 root root 4096 Dec 14 13:01 plugin

关于linux - native GCC 5 二进制文件太大 (libexec),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34262665/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com