SHARE
TWEET

Untitled

a guest Jun 26th, 2016 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extern int __start[];
  2. extern int __end[];
  3.  
  4. extern void bar(int *);
  5.  
  6. void foo()
  7. {
  8.     for (int *x = __start; x != __end; ++x)
  9.         bar(x);
  10. }
  11.  
  12. /*
  13.  * $ gcc -O3 -c arrays.c && objdump -d arrays.o
  14.  *
  15.  * arrays.o:     file format elf64-x86-64
  16.  *
  17.  *
  18.  * Disassembly of section .text:
  19.  *
  20.  * 0000000000000000 <foo>:
  21.  *    0:   53                      push   %rbx
  22.  *    1:   bb 00 00 00 00          mov    $0x0,%ebx
  23.  *    6:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  24.  *    d:   00 00 00
  25.  *   10:   48 89 df                mov    %rbx,%rdi
  26.  *   13:   48 83 c3 04             add    $0x4,%rbx
  27.  *   17:   e8 00 00 00 00          callq  1c <foo+0x1c>
  28.  *   1c:   eb f2                   jmp    10 <foo+0x10>
  29. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top