|
|
发表于 2004-6-10 10:56:14
|
显示全部楼层
回复: 在“章 5. 创建临时系统“的"锁定(Locking in)" Glibc的一
最初由 syzfeng 发表
echo 'main(){}' > dummy.c
gcc dummy.c
readelf -l a.out | grep ': /tools'
要改为
$echo 'main(){}' > dummy.c
$gcc -g -o a.out dummy.c
$readelf -1 a.out | grep ': /tools'
运行后的结果就是
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
晕,这是千锤百炼的教程,怎会轻易出错?
相反,你的说法却是如此错漏二出。
1.gcc无须加上-g选项,没必要附上gdb调试信息,因为查看文件头不需要gdb的支持。
- [code]
- -l
- --program-headers
- --segments
- Displays the information contained in the file's segment headers, if it has any.
复制代码
也无须加上-o选项,因为默认输出文件就是a.out
2.readelf没有-1选项,只有-l选项,相信这是你的笔误吧。
你的写法固然也能得出库信息,但却增加了命令的冗余度,画蛇添足之举。 |
|