在GCC编译中隐藏函数名称 [英] Hide function name in GCC compilation

查看:250
本文介绍了在GCC编译中隐藏函数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编译一个c"hello world"程序,该程序只包含一个简单函数和一个主要函数.

I am compiling a c "hello world" program that juste include one simple function and a main function.

我正在Linux下使用GCC.

I am using GCC under Linux.

在二进制文件上运行readelf命令时,我可以看到符号表,并且可以清楚地看到函数名称.

When I run readelf command on the binary, I can see symbol table and I can see function names in clear.

  • 是否可以告诉GCC(或链接器)不生成此符号表?

  • Is there a way to tell GCC (or the linker) to not generate this symbol table?

是否可以告诉GCC仅存储函数地址,而不用明文存储函数名称?

Is it possible to tell GCC to store only functions addresses, without storing function names in clear?

推荐答案

使用-s选项剥离符号表:

gcc -s -o hello hello.c

这篇关于在GCC编译中隐藏函数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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