Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
42 user(s) are online (33 user(s) are browsing Forums)

Members: 0
Guests: 42

more...
Support us!
Recent OS4 Files
OS4Depot.net





GCC: obtaining asm + source
Just popping in
Joined:
2011/6/3 12:49
Posts: 237
Hello

I was used to do that (on classic 68k) to obtain an asm source from a C sources that is mixed with the original C source

gcc -noixemul -O3 -S fillpoly.c
gcc -Wa,-adhln -g -noixemul -O3 -c fillpoly.c > fillpoly-mixed.c


So I can read the C instruction and how it was converted to asm

But this syntax dont seems to works for GCC/ppc/OS4
Do you know a gcc version that still support this ?

Thanks

For information it was giving a "mixed" source like that

271:fillpoly.c **** Frag[1].L.u=Frag->L.u + du;
1209 .stabd 68,0,271
1210 039a 2428 000C movel a0@(12),d2
1211 039e D48C addl a4,d2
1212 03a0 2142 003C movel d2,a0@(60)

272:fillpoly.c **** Frag[1].L.v=Frag->L.v + dv;
1213 .stabd 68,0,272
1214 03a4 2428 0010 movel a0@(16),d2
1215 03a8 D487 addl d7,d2
1216 03aa 2142 0040 movel d2,a0@(64)


   Report Go to top

Re: GCC: obtaining asm + source
Home away from home
Joined:
2006/12/4 23:15
Posts: 2132
Actuall seems to work here.

test.c
int foobar()
{
    
int foo 8;
    
int bar 9;
    
    return 
foo bar;
}


gcc -Wa,-adhln -g -O3 -c test.c > test-mixed.c

1                      .file    "test.c"
   
9                  .Ltext0:
  
10                      .align 2
  11                      
.globl foobar
  13                  foobar
:
  
14                  .LFB2:
  
15                      .file 1 "test.c"
   
1:test.c        **** int foobar()
   
2:test.c        **** {
  
16                      .loc 1 2 0
   3
:test.c        ****     int foo 8;
   
4:test.c        ****     int bar 9;
   
5:test.c        ****     
   
6:test.c        ****     return foo bar;
   
7:test.c        **** }
  
17                      .loc 1 7 0
  18 0000 38600011         li 
%r3,17
  19 0004 4E800020         blr
  20                  
.LFE2:
  
46                  .Letext0:


Or is that not what you expect?

[edit]
My exsmple was abit trivial so the optimiser removed most of the code with no optrimsiation you get

1                      .file    "test.c"
   
9                  .Ltext0:
  
10                      .align 2
  11                      
.globl foobar
  13                  foobar
:
  
14                  .LFB2:
  
15                      .file 1 "test.c"
   
1:test.c        **** int foobar()
   
2:test.c        **** {
  
16                      .loc 1 2 0
  17 0000 9421FFE0         stwu 
%r1,-32(%r1)
  
18                  .LCFI0:
  
19 0004 93E1001C         stw %r31,28(%r1)
  
20                  .LCFI1:
  
21 0008 7C3F0B78         mr %r31,%r1
  22                  
.LCFI2:
   
3:test.c        ****     int foo 8;
  
23                      .loc 1 3 0
  24 000c 38000008         li 
%r0,8
  25 0010 901F000C         stw 
%r0,12(%r31)
   
4:test.c        ****     int bar 9;
  
26                      .loc 1 4 0
  27 0014 38000009         li 
%r0,9
  28 0018 901F0008         stw 
%r0,8(%r31)
   
5:test.c        ****     
   
6:test.c        ****     return foo bar;
  
29                      .loc 1 6 0
  30 001c 813F000C         lwz 
%r9,12(%r31)
  
31 0020 801F0008         lwz %r0,8(%r31)
  
32 0024 7C090214         add %r0,%r9,%r0
   7
:test.c        **** }
  
33                      .loc 1 7 0
  34 0028 7C030378         mr 
%r3,%r0
  35 002c 81610000         lwz 
%r11,0(%r1)
  
36 0030 83EBFFFC         lwz %r31,-4(%r11)
  
37 0034 7D615B78         mr %r1,%r11
  38 0038 4E800020         blr
  39                  
.LFE2:
  
77                  .Letext0:


This was with gcc 4.2.4 from the SDK.

_________________
Blender For OS4.x : Blues : Walker Broad
   Report Go to top

Re: GCC: obtaining asm + source
Home away from home
Joined:
2006/12/4 23:15
Posts: 2132
Also worked with GCC 5.4.0

_________________
Blender For OS4.x : Blues : Walker Broad
   Report Go to top

Re: GCC: obtaining asm + source
Just popping in
Joined:
2011/6/3 12:49
Posts: 237

So it works too
Thanks


   Report Go to top





[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project