Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须创建一个 C 文件,该文件在编译时返回nm类型为A、B和V的符号输出。我已经阅读了手册页nm并在线搜索,但都没有帮助我弄清楚这些类型的符号是如何创建的。从编程的角度来看,这些符号是什么意思?还有我应该看的好的参考资料吗?
nm
在这 3 个中,我认为您只能B使用标准 C 代码创建。那只是一个初始化为零的全局变量,即。int foo = 0;. 要创建绝对对象或弱对象,您必须使用特定于编译器的扩展。
B
int foo = 0;
使用 gcc 的弱符号可以声明为:int bar __attribute__ ((weak));
int bar __attribute__ ((weak));
我现在想不出一种声明绝对符号的方法。