- 浏览: 279093 次
文章分类
- 全部博客 (276)
- burp+hydra暴力破解 (1)
- kali linux工具集 (6)
- kali (59)
- linux (54)
- password (14)
- web (63)
- 渗透测试 (50)
- windows (40)
- metasploit (9)
- 信息收集 (32)
- burp suit (4)
- 安全审计 (9)
- https://github.com/secretsquirrel/the-backdoor-factory (0)
- nmap (4)
- arachni (2)
- 工具 (5)
- sql (3)
- 网络 (2)
- 后渗透测试 (10)
- 内网 (5)
- 无线 (2)
- C (3)
- bios (1)
- RoR (12)
- mongodb (1)
- linxu (1)
- gdb (1)
- linux,虚拟化 (1)
- python (4)
最新评论
使用GCC/GNU-ld删除dead code
- 博客分类:
- linux
[url]
https://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
https://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/
[/url]
Hi Dr. Rupp,
I was just looking into this very thing!
Do this in your Makefile...
--------8<--------
DEADCODESTRIP := -Wl,-static -fvtable-gc -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s
foo : foo.c
g++ $(DEADCODESTRIP) $< -o $@
--------8<--------
Step by step...
-Wl,-static
Link against static libraries. Required for dead-code elimination.
-fvtable-gc
C++ virtual method table instrumented with garbage collection information for the linker.
-fdata-sections
Keeps data in separate data sections, so they can be discarded if unused.
-ffunction-sections
Keeps funcitons in separate data sections, so they can be discarded if unused.
-Wl,--gc-sections
Tell the linker to garbage collect and discard unused sections.
-s
Strip the debug information, so as to make the code as small as possible. (I presume that you'd want to do this in a dead-code removal build.)
The requirement to link against the static libraries was surprising to me. But there you go.
HTH,
https://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
https://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/
[/url]
引用
Hi Dr. Rupp,
I was just looking into this very thing!
Do this in your Makefile...
--------8<--------
DEADCODESTRIP := -Wl,-static -fvtable-gc -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s
foo : foo.c
g++ $(DEADCODESTRIP) $< -o $@
--------8<--------
Step by step...
-Wl,-static
Link against static libraries. Required for dead-code elimination.
-fvtable-gc
C++ virtual method table instrumented with garbage collection information for the linker.
-fdata-sections
Keeps data in separate data sections, so they can be discarded if unused.
-ffunction-sections
Keeps funcitons in separate data sections, so they can be discarded if unused.
-Wl,--gc-sections
Tell the linker to garbage collect and discard unused sections.
-s
Strip the debug information, so as to make the code as small as possible. (I presume that you'd want to do this in a dead-code removal build.)
The requirement to link against the static libraries was surprising to me. But there you go.
HTH,
发表评论
-
python 修饰器
2016-02-05 15:11 380def wrapper1(function): ... -
ubuntu 14.04 install e431 wifi driver
2016-01-25 20:59 418引用 sudo apt-get install linu ... -
git
2016-01-07 12:01 413http://finalshares.cn/attachmen ... -
嵌入式中使用gdb
2016-01-06 17:38 3638编译 For gdb: /path/to/gdb-sr ... -
linux change boot image
2016-01-02 00:55 5091. change grub2 引用vim /etc/defa ... -
binwalk --dd
2015-12-28 21:51 1361http://www.devttys0.com/2012/12 ... -
embeded LD_PRELOAD
2015-12-28 00:17 515引用 eve@eve:~/squashfs-root$ sud ... -
hardware hacking
2015-12-27 01:32 662For video stuff: https://www.yo ... -
ubuntu support kindle
2015-12-20 23:13 336引用apt-get install mtpfs -
linux 备份系统
2015-12-05 22:22 390引用备份 dd if=/dev/sda > myimag ... -
[译]root权限运行vlc
2015-11-30 22:19 1272原文地址:http://www.blackmoreops.co ... -
【转】关闭TCP Timestamps来节省一点带宽
2015-10-15 23:29 1586http://highscalability.com/blog ... -
[转]Terminal escape sequences – the new XSS for Linux sysadmins
2015-09-25 23:58 405https://ma.ttias.be/terminal-es ... -
ipython basic
2015-09-25 11:31 425Introspection引用 Using a questio ... -
static in C
2015-09-22 11:35 285jason@ubuntu:~/test$ cat a.c ... -
lxc重命名容器名
2015-09-20 00:25 774lxc-ls 使用文件夹名作为容器名。所以可以更改文件夹名称来 ... -
lxc更新apt源
2015-09-18 11:49 721最近一直在使用lxc创建容器,每次创建一个容器都需要把apt源 ... -
wireshark:Couldn't run /usr/bin/dumpcap in child process: Permission denied
2015-09-11 10:26 3234When start wireshark, I met an ... -
[转]调试python内存泄漏
2015-09-09 00:48 331http://chase-seibert.github.io/ ... -
[转]Python @classmethod and @staticmethod for beginner?
2015-09-07 16:59 342http://stackoverflow.com/questi ...
相关推荐
解决mtk6737平台modem编译错误! Please install the GCC Cross-Compiler on correct path: tools/GCC/4.6.2/linux/bin/arm-none-eabi-gcc
It includes the GNU Compiler (GCC) and is available free of charge directly from Arm for embedded software development on Windows, Linux and Mac OS X operating systems. Follow the links on this page ...
解决mtk6572平台modem编译错误! Please install the GCC Cross-Compiler on correct path: tools/GCC/4.6.2/linux/bin/arm-none-eabi-gcc
mips-linux-gnu-ingenic-gcc7.2.0-glibc2.29-fp64-r5.1.1.tar.bz2
下载后,上传到centos中,执行如下命令:rpm -Uvh ./*.rpm --nodeps --force
It includes the GNU Compiler (GCC) and is available free of charge directly from Arm for embedded software development on Windows, Linux and Mac OS X operating systems. Follow the links on this page ...
Configured with: /opt/crosstool/crosstool-0.28/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/opt/crosstool/arm-linux/gcc-3.4.1-...
gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.tar是由 Linaro 公司基于GCC推出的的ARM交叉编译工具。可用于交叉编译64-bit Armv8 Cortex-A, little-endian目标中的裸机程序、u-boot、Linux kernel、...
It includes the GNU Compiler (GCC) and is available free of charge directly from Arm for embedded software development on Windows, Linux and Mac OS X operating systems. Follow the links on this page ...
Configured with: /opt/crosstool/crosstool-0.28/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/opt/crosstool/arm-linux/gcc-3.4.1-...
centos7 安装negix需要的rpm 放到一个文件夹 执行 rpm -Uvh ./*.rpm --nodeps --force
aarch64-linux-gnu-gcc gcc version 7.5.0 (Linaro GCC 7.5-2019.12) openssl-1.1.1g
aarch64-linux-gnu-gcc是由 Linaro 公司基于GCC推出的的ARM交叉编译工具。可用于交叉编译ARMv8 64位目标中的裸机程序、u-boot、Linux kernel、filesystem和App应用程序。aarch64-linux-gnu-gcc交叉编译器必须安装在...
gcc-buildroot-9.3.0-2020.03-x86_64_aarch64-rockchip-linux-gnu
binary/mingw32/native/x86_32/gcc/4.4.0 --with-gcc --with-gnu-ld --with-gnu-as -- disable-shared --disable-nls --disable-tls --with-gmp=/home/gfortran/gcc-home/bi nary/mingw32/native/x86_32/gmp --with-...
用于交叉编译linux内核 请自行解压 7z格式 适用于jetson板子gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
AARCH64 交叉编译工具链 gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.tar是由 Linaro 公司基于GCC推出的的ARM交叉编译工具。可用于交叉编译32-bit Armv7 Cortex-A, hard-float, little-endian目标中的裸机程序、u-boot、Linux...
gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.gz
Configured with: /opt/crosstool/crosstool-0.28/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/opt/crosstool/arm-linux/gcc-3.4.1-...