<div class="gmail_quote"><ol><li><dl><dd><pre>I would like to know why there is a difference in function prologue generated for same function with clang and gcc. </pre><pre>Compiler options used for gcc were as follows:
arm-linux-gnueabi-gcc all-types.c  -w -march=armv7-a -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=vfp -g -lm -o all-types_gcc

Compiler options used for clang were as follows:
/usr/local/bin/clang all-types.c -w -ccc-gcc-name arm-linux-gnueabi-gcc -ccc-host-triple arm-linux-gnueabi -ccc-clang-archs arm -march=armv7-a -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=vfp -g -lm -o all-types

Dissassembly of main() from all-types.c compiled with GCC. 
00008448 <main>:

float           v_float;
double          v_double;

int main ()
{
    8448:       e92d4800        push    {fp, lr}
    844c:       e28db004        add     fp, sp, #4
    extern void dummy();
#ifdef usestubs
    set_debug_traps();
    breakpoint();
#endif
    dummy();
    8450:       eb000002        bl      8460 <dummy>
    return 0;
    8454:       e3a03000        mov     r3, #0

}
    8458:       e1a00003        mov     r0, r3
    845c:       e8bd8800        pop     {fp, pc}

00008460 <dummy>:

void dummy()
{
    8460:       e52db004        push    {fp}            ; (str fp, [sp, #-4]!)
    8464:       e28db000        add     fp, sp, #0
  /* Some linkers (e.g. on AIX) remove unreferenced variables,
     so make sure to reference them. */
  v_char = 'A';</pre><pre><br></pre><pre><p>Raw dump of debug contents of section .debug_line:</p><p>  Offset:                      0x0<br>
  Length:                      74<br>  
<strong>DWARF Version:                 2<br></strong>  Prologue Length:             34<br>  Minimum Instruction Length:  2<br>  Initial value of 'is_stmt':  1<br>  Line Base:                   -5<br>  Line Range:                  14<br>

  Opcode Base:                 13</p>

###################################################################################################################################

Dissassembly of main() from all-types.c compiled with CLANG. 
00008444 <main>:

float           v_float;
double          v_double;

int main ()
{
    8444:       e92d4800        push    {fp, lr}
    8448:       e1a0b00d        mov     fp, sp
    844c:       e24dd008        sub     sp, sp, #8
    8450:       e3a00000        mov     r0, #0
    8454:       e58d0004        str     r0, [sp, #4]
    extern void dummy();
#ifdef usestubs
    set_debug_traps();
    breakpoint();
#endif
    dummy();
    8458:       e58d0000        str     r0, [sp]
    845c:       eb000002        bl      846c <dummy>
    return 0;
    8460:       e59d0000        ldr     r0, [sp]
    8464:       e1a0d00b        mov     sp, fp
    8468:       e8bd8800        pop     {fp, pc}

0000846c <dummy>:

}

void dummy()
{
    846c:       e3a00006        mov     r0, #6
  /* Some linkers (e.g. on AIX) remove unreferenced variables,
     so make sure to reference them. */
  v_char = 'A';</pre><pre><br></pre><pre><br></pre><pre><p>Raw dump of debug contents of section .debug_line:</p>
<p>  Offset:                      0x0</p><p>  Length:                      206<br> <strong> <span style="COLOR:#ff0000">DWARF Version:               2<br></span></strong>  Prologue Length:             157<br>  Minimum Instruction Length:  2<br>

  Initial value of 'is_stmt':  1<br>  Line Base:                  -5<br>  Line Range:                  14<br>  Opcode Base:                 13<br></p>

The prologue length in .debug_line is 157 for clang generated one, whereas it is 34 for gcc generated one. I am curious about the results of making prologue generated by clang look similar with one generated by gcc.
Could anyone let me know why this difference exists and if it is for good /better purposes than for gcc. ?</pre></dd></dl></li></ol>
</div><br>