美文网首页
2018-11-25

2018-11-25

作者: 半步江南 | 来源:发表于2018-11-25 21:50 被阅读3次
        .section .data
        .section .text
        .globl _start
_start:
        pushl $2
        pushl $3
        call power
        
        popl %eax
        popl %eax
    pushl %edx
    pushl $5
    pushl $2
    call power
    addl 8(%esp),%edx
    movl %edx,%ebx

        
        jmp exit
.type power, @function
power:
        pushl %ebp
        movl %esp,%ebp
        subl $4,%esp
        movl 8(%ebp),%eax
        movl 12(%ebp),%ebx
        movl $1,%ecx
loop_power:
        cmpl $1,%eax
        jl loop_exit
        imull %ebx,%ecx
        decl %eax
        jmp loop_power
loop_exit:
        movl %ecx,%edx
        addl $4,%esp
        popl %ebp
        ret
exit:
        movl $1,%eax
        int $0x80
root@192:~/workdir/groundUp# readelf -a power.o
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          168 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         7
  Section header string table index: 4

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000047 00  AX  0   0  1
  [ 2] .data             PROGBITS        00000000 00007b 000000 00  WA  0   0  1
  [ 3] .bss              NOBITS          00000000 00007b 000000 00  WA  0   0  1
  [ 4] .shstrtab         STRTAB          00000000 00007b 00002c 00      0   0  1
  [ 5] .symtab           SYMTAB          00000000 0001c0 000090 10      6   8  4
  [ 6] .strtab           STRTAB          00000000 000250 000028 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

There are no program headers in this file.

There are no relocations in this file.

The decoding of unwind sections for machine type Intel 80386 is not currently supported.

Symbol table '.symtab' contains 9 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 SECTION LOCAL  DEFAULT    1 
     2: 00000000     0 SECTION LOCAL  DEFAULT    2 
     3: 00000000     0 SECTION LOCAL  DEFAULT    3 
     4: 0000001d     0 FUNC    LOCAL  DEFAULT    1 power
     5: 00000040     0 NOTYPE  LOCAL  DEFAULT    1 exit
     6: 0000002e     0 NOTYPE  LOCAL  DEFAULT    1 loop_power
     7: 00000039     0 NOTYPE  LOCAL  DEFAULT    1 loop_exit
     8: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _start

No version information found in this file.
00000000  7f 45 4c 46 01 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  01 00 03 00 01 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  a8 00 00 00 00 00 00 00  34 00 00 00 00 00 28 00  |........4.....(.|
00000030  07 00 04 00 6a 02 6a 03  e8 14 00 00 00 58 58 52  |....j.j......XXR|
00000040  6a 05 6a 02 e8 08 00 00  00 03 54 24 08 89 d3 eb  |j.j.......T$....|
00000050  23 55 89 e5 83 ec 04 8b  45 08 8b 5d 0c b9 01 00  |#U......E..]....|
00000060  00 00 83 f8 01 7c 06 0f  af cb 48 eb f5 89 ca 83  |.....|....H.....|
00000070  c4 04 5d c3 b8 01 00 00  00 cd 80 00 2e 73 79 6d  |..]..........sym|
00000080  74 61 62 00 2e 73 74 72  74 61 62 00 2e 73 68 73  |tab..strtab..shs|
00000090  74 72 74 61 62 00 2e 74  65 78 74 00 2e 64 61 74  |trtab..text..dat|
000000a0  61 00 2e 62 73 73 00 00  00 00 00 00 00 00 00 00  |a..bss..........|
000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000000d0  1b 00 00 00 01 00 00 00  06 00 00 00 00 00 00 00  |................|
000000e0  34 00 00 00 47 00 00 00  00 00 00 00 00 00 00 00  |4...G...........|
000000f0  01 00 00 00 00 00 00 00  21 00 00 00 01 00 00 00  |........!.......|
00000100  03 00 00 00 00 00 00 00  7b 00 00 00 00 00 00 00  |........{.......|
00000110  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00000120  27 00 00 00 08 00 00 00  03 00 00 00 00 00 00 00  |'...............|
00000130  7b 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |{...............|
00000140  01 00 00 00 00 00 00 00  11 00 00 00 03 00 00 00  |................|
00000150  00 00 00 00 00 00 00 00  7b 00 00 00 2c 00 00 00  |........{...,...|
00000160  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00000170  01 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  |................|
00000180  c0 01 00 00 90 00 00 00  06 00 00 00 08 00 00 00  |................|
00000190  04 00 00 00 10 00 00 00  09 00 00 00 03 00 00 00  |................|
000001a0  00 00 00 00 00 00 00 00  50 02 00 00 28 00 00 00  |........P...(...|
000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 03 00 01 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 03 00 02 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 03 00 03 00  |................|
00000200  01 00 00 00 1d 00 00 00  00 00 00 00 02 00 01 00  |................|
00000210  07 00 00 00 40 00 00 00  00 00 00 00 00 00 01 00  |....@...........|
00000220  0c 00 00 00 2e 00 00 00  00 00 00 00 00 00 01 00  |................|
00000230  17 00 00 00 39 00 00 00  00 00 00 00 00 00 01 00  |....9...........|
00000240  21 00 00 00 00 00 00 00  00 00 00 00 10 00 01 00  |!...............|
00000250  00 70 6f 77 65 72 00 65  78 69 74 00 6c 6f 6f 70  |.power.exit.loop|
00000260  5f 70 6f 77 65 72 00 6c  6f 6f 70 5f 65 78 69 74  |_power.loop_exit|
00000270  00 5f 73 74 61 72 74 00                           |._start.|
00000278

相关文章

网友评论

      本文标题:2018-11-25

      本文链接:https://www.haomeiwen.com/subject/qxgpqqtx.html