gcc - .comm? -


Text after "

I just translate this program,

  # include & lt; Stdio.h & gt; Int Dam [1000] [1000]; Int main (int argc, const char * argv []) {// insert code here ... printf ("hello, world! \ N"); Return 0; }  

Using assembly GCC construction,

  .cstring LC0: .ascii "Hello, world \ 0!" .text .globl _main _main: pushl% EBP movl% esp,% EBP pushl% EBX subl $ 20,% esp Phone L3 "L00000000001 $ PB": L3: popl% EBX Lil LC0- "L00000000001 $ PB" (% EBX ),% Eax movl% eax, (% esp) Phone L_puts $ stub $ 0 movl,% eax upper $ 20,% esp popl% EBX leave retired .comm _dam, 1000000,5 .section __IMPORT, __ jump_table, symbol_stubs, self_modifying_code + Pure_instructions, 5 L_puts $ Stub: .indirect_symbol _puts hlt; HLT; HLT; HLT; Hlt .subsections_via_symbols  

.What does the .comm means? Does the dam use stack space, stack space or data space?

P> ..com declares the named symbol a common symbol, while linking, a common symbol in an object file can merge into another object file with a defined or normal symbol of the same name. If the LD does not see any definition for the symbol - only one or more common symbols - so this will allot the length of unpublished memory bytes. Length should be a complete expression if the LD sees many common symbols with the same name, and they do not have the same size, then it will allocate the space using the largest size.

When using ALF, .comm directive is an optional third argument. The desired alignment of this symbol is specified as a byte limit (for example, an alignment of 16 years means that the least important 4 address pieces should be zero). Alignment should be a complete expression, and it should have the power of two. If ld allocates uninitialized memory for the common symbol, it will use alignment while placing this symbol. If no alignment is specified, then the alignment will be equal to the size of the symbols, or up to maximum of two equal to maximum power of up to 16.


Comments