>第 19 章 汇编与C之间的关系>main函数和启动例程

苏炳辉 CaptainBlack.Soul@gmail.com
2009-08-05 15:21:51

    最后那里,“注意,如果声明一个函数的返回值类型是int,函数中每个分支控制流程必须写return语句指定返回值,如果缺了return则返回值不确定(想想这是为什么)”。请问宋老师这是为什么呢?我想不明白哦!


宋劲杉 songjinshan@akaedu.org
2009-08-12 23:09:58

因为返回值是通过eax传的。


码匠 code_smtih@sohu.com
2009-09-18 15:34:27

Mr. Song,

May I ask you a question? Why can't I see calling exit() in or the similar thing int $0x80 in _start routine? 

All I see in _sart is:
push   $0x80483c4                        
call   80482c4 <__libc_start_main@plt>   
hlt                                     
nop 					
nop

Where is exit? I'm confused!
Thanks in advance!


宋劲杉 songjinshan@gmail.com
2009-09-24 21:09:05

That must be in the libc routine __libc_start_main. I think I have given enough hint for you to come up with this inference.


码匠 code_smith@sohu.com
2009-10-19 11:19:21

First of all, thanks to you for your patience. 

I find  U exit@@GLIBC_2.0 symbol in executable file if I use C.

How can I find _exit() symbol if I use assemble?

I have another question: how do you know which obj file a function lies in? such as exit() is in libc, and how do you know where _exit() is in?


如果您有建设性意见,哪怕只是纠正一个错别字,也请不吝赐教,您留下的姓名和email将会出现在本书前言的致谢中。再次感谢您的宝贵意见!