gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Re: [Gcl-commits] gcl/cmpnew cmpmain.lsp


From: Camm Maguire
Subject: Re: [Gcl-devel] Re: [Gcl-commits] gcl/cmpnew cmpmain.lsp
Date: 24 Jul 2002 12:54:50 -0400

Greetings!

This is an interesting idea.  I have some qwestions:

1) Are these compiler flags portable to different
   compilers/assemblers?  Specifically solaris?

2) Having biased myself by getting accustomized to objdump output, I'd
   likt to hear what people think the advantages are of this output
   vis a vis objdump.  The obvious one is the interleaving of the C
   source.  But I wanted to know if people think relying on objedump
   in general is a problem.  Isn't it (at least) as widely available
   as the availability of the compiler flag combo used below?

3) We still need some kind of option to disassemble to turn on or off
   the -g, and restructure the output accordingly, I'd think.

Take care, 

"Mike Thomas" <address@hidden> writes:

> Hi Greg.
> 
> > You could try gcc -g -Wa,-anhl <filename>.c. This gets around using
> > objdump. But maybe it tickles the same mingw bug.
> 
> Brilliant thanks!   With a bit less information the output of that command
> from a simple test program I was using:
> 
> --------------------
> $ cat junk.c
> int plus (int i, int j)
> {
>     return i + j;
> }
> --------------------
> 
> would be excellent for our purposes I think.  As you say, it removes the
> dependency on objdump.  I have attached a series of outputs with
> progressively higher optimisation settings below.  We really just need to
> clip the first half of the output, stabs info and the line numbers at the
> start of each line to get nice output:
> 
> ---------------------------------------------
>    1:junk.c        **** int plus (int i, int j)
>    2:junk.c        **** {
>                       LM1:
>    3:junk.c        ****     return i + j;
>                       LM2:
>    0003 8B4508                movl 8(%ebp),%eax
>    0006 8B4D0C                movl 12(%ebp),%ecx
>    0009 8D1401                leal (%ecx,%eax),%edx
>    000c 89D0                  movl %edx,%eax
>    000e EB00                  jmp L2
>    4:junk.c        **** }
>                       LM3:
>                               .p2align 4,,7
>                       L2:
>    0010 89EC                  movl %ebp,%esp
>    0012 5D                    popl %ebp
>    0013 C3                    ret
>                       Lscope0:
>                               .text
>    0014 90909090      Letext:
>         90909090
>         90909090
> ---------------------------------------------
> 
> What say you Camm?
> 
> Cheers
> 
> Mike Thomas.
> 
> --------------------
> 
> $ gcc -g -Wa,-anhl -c junk.c
>    1                            .file   "junk.c"
>    2                    gcc2_compiled.:
>    3                    ___gnu_compiled_c:
>    4                    .stabs "//c/cvs/gcl/",100,0,0,Ltext0
>    5                    .stabs "junk.c",100,0,0,Ltext0
>    6                    .text
>    7                    Ltext0:
>    8                    .stabs
> "int:t(0,1)=r(0,1);0020000000000;0017777777777;",
> 128,0,0,0
>    9                    .stabs "char:t(0,2)=r(0,2);0;127;",128,0,0,0
>   10                    .stabs "long
> int:t(0,3)=r(0,1);0020000000000;00177777777
> 77;",128,0,0,0
>   11                    .stabs "unsigned
> int:t(0,4)=r(0,1);0000000000000;0037777
> 777777;",128,0,0,0
>   12                    .stabs "long unsigned
> int:t(0,5)=r(0,1);0000000000000;00
> 37777777777;",128,0,0,0
>   13                    .stabs "long long
> int:t(0,6)=r(0,1);01000000000000000000
> 000;0777777777777777777777;",128,0,0,0
>   14                    .stabs "long long unsigned
> int:t(0,7)=r(0,1);00000000000
> 00;01777777777777777777777;",128,0,0,0
>   15                    .stabs "short
> int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
> 
>   16                    .stabs "short unsigned
> int:t(0,9)=r(0,9);0;65535;",128,0
> ,0,0
>   17                    .stabs "signed
> char:t(0,10)=r(0,10);-128;127;",128,0,0,0
> 
>   18                    .stabs "unsigned
> char:t(0,11)=r(0,11);0;255;",128,0,0,0
>   19                    .stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,0
>   20                    .stabs "double:t(0,13)=r(0,1);8;0;",128,0,0,0
>   21                    .stabs "long double:t(0,14)=r(0,1);12;0;",128,0,0,0
>   22                    .stabs "complex
> int:t(0,15)=s8real:(0,1),0,32;imag:(0,1)
> ,32,32;;",128,0,0,0
>   23                    .stabs "complex
> float:t(0,16)=r(0,16);4;0;",128,0,0,0
>   24                    .stabs "complex
> double:t(0,17)=r(0,17);8;0;",128,0,0,0
>   25                    .stabs "complex long
> double:t(0,18)=r(0,18);12;0;",128,0
> ,0,0
>   26                    .stabs "void:t(0,19)=(0,19)",128,0,0,0
>   27                            .align 4
>   28                    .stabs "plus:F(0,1)",36,0,2,_plus
>   29                    .stabs "i:p(0,1)",160,0,1,8
>   30                    .stabs "j:p(0,1)",160,0,1,12
>   31                    .globl _plus
>   32                            .def    _plus;  .scl    2;      .type   32;
> .endef
>   33                    _plus:
>   34 0000 55                    pushl %ebp
>   35 0001 89E5                  movl %esp,%ebp
>    1:junk.c        **** int plus (int i, int j)
>    2:junk.c        **** {
>   36                    .stabn 68,0,2,LM1-_plus
>   37                    LM1:
>    3:junk.c        ****     return i + j;
>   38                    .stabn 68,0,3,LM2-_plus
>   39                    LM2:
>   40 0003 8B4508                movl 8(%ebp),%eax
>   41 0006 8B4D0C                movl 12(%ebp),%ecx
>   42 0009 8D1401                leal (%ecx,%eax),%edx
>   43 000c 89D0                  movl %edx,%eax
>   44 000e EB00                  jmp L2
>    4:junk.c        **** }
>   45                    .stabn 68,0,4,LM3-_plus
>   46                    LM3:
>   47                            .p2align 4,,7
>   48                    L2:
>   49 0010 89EC                  movl %ebp,%esp
>   50 0012 5D                    popl %ebp
>   51 0013 C3                    ret
>   52                    Lscope0:
>   53                    .stabs "",36,0,0,Lscope0-_plus
>   54                            .text
>   55                            .stabs "",100,0,0,Letext
>   56 0014 90909090      Letext:
>   56      90909090
>   56      90909090
> 
> ------------------------------------------------------------
> $ gcc -g -Wa,-anhl -c junk.c | fgrep -v .stab
>    1                            .file   "junk.c"
>    2                    gcc2_compiled.:
>    3                    ___gnu_compiled_c:
>    6                    .text
>    7                    Ltext0:
>   27                            .align 4
>   31                    .globl _plus
>   32                            .def    _plus;  .scl    2;      .type
> 32;.ende
> f
>   33                    _plus:
>   34 0000 55                    pushl %ebp
>   35 0001 89E5                  movl %esp,%ebp
>    1:junk.c        **** int plus (int i, int j)
>    2:junk.c        **** {
>   37                    LM1:
>    3:junk.c        ****     return i + j;
>   39                    LM2:
>   40 0003 8B4508                movl 8(%ebp),%eax
>   41 0006 8B4D0C                movl 12(%ebp),%ecx
>   42 0009 8D1401                leal (%ecx,%eax),%edx
>   43 000c 89D0                  movl %edx,%eax
>   44 000e EB00                  jmp L2
>    4:junk.c        **** }
>   46                    LM3:
>   47                            .p2align 4,,7
>   48                    L2:
>   49 0010 89EC                  movl %ebp,%esp
>   50 0012 5D                    popl %ebp
>   51 0013 C3                    ret
>   52                    Lscope0:
>   54                            .text
>   56 0014 90909090      Letext:
>   56      90909090
>   56      90909090
> -----------------------------------------------------
> $ gcc -g -O -Wa,-anhl -c junk.c | fgrep -v .stab
>    1                            .file   "junk.c"
>    2                    gcc2_compiled.:
>    3                    ___gnu_compiled_c:
>    6                    .text
>    7                    Ltext0:
>   27                            .align 4
>   31                    .globl _plus
>   32                            .def    _plus;  .scl    2;      .type
> 32;.ende
> f
>   33                    _plus:
>   34 0000 55                    pushl %ebp
>   35 0001 89E5                  movl %esp,%ebp
>    1:junk.c        **** int plus (int i, int j)
>    2:junk.c        **** {
>   37                    LM1:
>   38 0003 8B450C                movl 12(%ebp),%eax
>    3:junk.c        ****     return i + j;
>   40                    LM2:
>   41 0006 034508                addl 8(%ebp),%eax
>   42 0009 89EC                  movl %ebp,%esp
>   43 000b 5D                    popl %ebp
>   44 000c C3                    ret
>    4:junk.c        **** }
>   46                    LM3:
>   48                    Lscope0:
>   50                            .text
>   52 000d 909090        Letext:
> 
> -----------------------------------------------------
> $ gcc -g -O2 -Wa,-anhl -c junk.c | fgrep -v .stab
>    1                            .file   "junk.c"
>    2                    gcc2_compiled.:
>    3                    ___gnu_compiled_c:
>    6                    .text
>    7                    Ltext0:
>   27                            .align 4
>   31                    .globl _plus
>   32                            .def    _plus;  .scl    2;      .type
> 32;.ende
> f
>   33                    _plus:
>   34 0000 55                    pushl %ebp
>   35 0001 89E5                  movl %esp,%ebp
>    1:junk.c        **** int plus (int i, int j)
>    2:junk.c        **** {
>   37                    LM1:
>   38 0003 8B450C                movl 12(%ebp),%eax
>    3:junk.c        ****     return i + j;
>   40                    LM2:
>   41 0006 034508                addl 8(%ebp),%eax
>   42 0009 89EC                  movl %ebp,%esp
>   43 000b 5D                    popl %ebp
>   44 000c C3                    ret
>   46                    Lscope0:
>   48                            .text
>   50 000d 909090        Letext:
> -----------------------------------------------------
> 
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]