Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok lets give it a try</p> <p>// First section of code, declaring the main function that has to be align on a 32 bit boundary.</p> <p>UPDATE: My explanation of the .align directive may be wrong. See gas documentation below.</p> <pre><code>.section __TEXT,__text,regular,pure_instructions .globl _main .align 4, 0x90 _main: </code></pre> <p>Store the previous base pointer and allocate stack space for local variables.</p> <pre><code>Leh_func_begin1: pushq %rbp Ltmp0: movq %rsp, %rbp Ltmp1: subq $32, %rsp Ltmp2: </code></pre> <p>Push the arguments on the stack and call puts()</p> <pre><code>movl %edi, %eax movl %eax, -4(%rbp) movq %rsi, -16(%rbp) leaq L_.str(%rip), %rax movq %rax, %rdi callq _puts </code></pre> <p>Put return value on stack, free local memory, restore base pointer and return.</p> <pre><code>movl $0, -24(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -20(%rbp), %eax addq $32, %rsp popq %rbp ret Leh_func_end1: </code></pre> <p>Next section, also a code section, containing the string to print.</p> <pre><code>.section __TEXT,__cstring,cstring_literals L_.str: .asciz "Hello, World!" </code></pre> <p>The rest is unknown to me, could be data used be the c startup code and or debugging info.</p> <pre><code>.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support ... </code></pre> <p>UPDATE: Documentation on the .align directive from: <a href="http://sourceware.org/binutils/docs-2.23.1/as/Align.html#Align" rel="nofollow">http://sourceware.org/binutils/docs-2.23.1/as/Align.html#Align</a></p> <p>"The way the required alignment is specified varies from system to system. For the arc, hppa, i386 using ELF, i860, iq2000, m68k, or32, s390, sparc, tic4x, tic80 and xtensa, the first expression is the alignment request in bytes. For example `.align 8' advances the location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no change is needed. For the tic54x, the first expression is the alignment request in words. </p> <p>For other systems, including ppc, i386 using a.out format, arm and strongarm, it is the number of low-order zero bits the location counter must have after advancement. For example `.align 3' advances the location counter until it a multiple of 8. If the location counter is already a multiple of 8, no change is needed. </p> <p>This inconsistency is due to the different behaviors of the various native assemblers for these systems which GAS must emulate. GAS also provides .balign and .p2align directives, described later, which have a consistent behavior across all architectures (but are specific to GAS)."</p> <p>//jk</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload