zoukankan      html  css  js  c++  java
  • Hello World

    /*TinyHelloWorld.c    */

      1 char * str = "Hello world!\n";                                                                             
          2
          3 void print()
          4 {
          5     asm( "movl $13, %%edx \n\t"
          6          "movl %0, %%ecx \n\t"
          7          "movl $0, %%ebx \n\t"
          8          "movl $4, %%eax \n\t"
          9          "int $0x80      \n\t"
         10          ::"r"(str):"edx", "ecx", "ebx");
         11 }
         12
         13 void exit()
         14 {
         15     asm("movl $42, %ebx \n\t"
         16         "movl $1, %eax  \n\t"
         17         "int $0x80      \n\t");
         18 }
         19
         20 void nomain()
         21 {
         22     print();
         23     exit();
         24 }

    /*TinyHelloWorld.lds*/

          1 ENTRY(nomain)                                                                                              
          2
          3 SECTIONS
          4 {
          5     . = 0X08408000 + SIZEOF_HEADERS;
          6
          7     tinytext : { *(.text) *(.data) *(.rodata) }
          8
          9     /DISCARD/ : { *(.comment) }
         10 }

          1 /*fisrt*/
          2 gcc -c -fno-builtin TinyHelloWorld.c
          3
          4 ld -static -e nomain -o TinyHelloWorld TinyHelloWorld.o
          5
          6 /*second*/
          7 gcc -c -fno-builtin TinyHelloWorld.c
          8
          9 ld -static -T TinyHelloWorld.lds -o TinyHelloWorld TinyHelloWorld.o
         10
         11 /*third*/
         12 gcc -c -fno-builtin TinyHelloWorld.c
         13
         14 ld -s -static -T TinyHelloWorld.lds -o TinyHelloWorld TinyHelloWorld.o   

  • 相关阅读:
    在你想要放弃的那一刻,想想为什么当初坚持走到了这里
    将来的你一定会感谢现在奋斗的自己
    学习改变命运,拼搏成就未来
    springmvc的DispatcherServlet源码——doDispatch方法解析
    SpringMVC02 AbstractController And MultiActionController
    SpringMVC简介01
    NIO
    数据库的锁机制
    Spring和MyBatis环境整合
    事务的隔离级别和mysql事务隔离级别修改
  • 原文地址:https://www.cnblogs.com/openix/p/2835568.html
Copyright © 2011-2022 走看看