March 16th Friday (三月 十六日 金曜日)

来源:互联网 发布:mac怎么玩lol国服 编辑:程序博客网 时间:2024/04/19 06:40

  Today I wrote a function in assembly language.  I wrote a test program in C language to call that
function.  I used "ld -dynamic-linker /lib/ld-linux.so.2 ...".  I got a warning report.  After running
the binary program I got a "segment fault" message.  For this quesion I tried other ways to link these
two program together.  Finally, I found I can used "gcc" to make a correct binary program.  Why I can
use a linker tool to make?

  After trial again and again, and many thought, I found the answer.  I used "gcc -S ..." to produce
a assembly program from the original C program.  From the assembly source, I found "gcc" made a "main"
label for main() funciton in the C source file.  But the "ld", a linker tool, must consided "_start"
label as a entry point.  In other words, it can not find out a correct entry point in that there is not a "_start" label in main program.  So, although I loaded the ".so" library there is still a run error.

  今日白さんの彼の卓球試合があります。