This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: way to produce assembly file with C comments


Scott A Sumner wrote:
> 
> Hi,
> 
> I know I can compile C source files and output an assembly file using -S
> on the gcc command line.  But can I produce the assembly file with the C
> source lines as comments?  If so, how?
> 
> I looked thru the docs but didn't see anything on this.
> 
> A true, non-assemble-able listing file would be ok, too.  I just need
> something that correlates the source to the assembly.

Hi,
You can use
ppc-eabi-gcc  -Wa,-ahls=mixt.lst -c -g ....
              ^^^^^^^^^^^^^^^^^^


I have this in my makefile which is quite handy when you like to
generate a "mixt C-ASM list file"

mixtlst: $(LSTDIR)
	$(ECHO) "mixt.lst! CF=file.c"
	$(CC)  -Wa,-ahls=$(LSTDIR)/$(basename $(CF)).lst  $(CFLAGS) -o $(LSTDIR)/lst.o 
$(CF)
	$(ECHO) "mixt.lst file: $(LSTDIR)/$(basename $(CF)).lst"

Then I can do something like this to produce a "mixt list file"

%261> make mixtlst CF=task.c
mixt.lst! CF=file.c
ppc-eabi-gcc  -Wa,-ahls=lst/task.lst  -c -g -mpowerpc -memb -DOSE_DELTA 
-DBIG_ENDIAN -DUSE_XX=init_task_ -I../h -I../oseppc/krn-82xx/include -I../cmn -o
lst/lst.o  task.c
mixt.lst file: lst/task.lst
%262> 

And the task.lst file looks like this..

 291:task.c        **** 
 292:task.c        **** 
 293:task.c        **** 
 294:task.c        **** /*===================================================
 295:task.c        ****  *	wf_tick
 296:task.c        ****  *===================================================
 297:task.c        ****  * Wait for next second to pass
 298:task.c        ****  *
 299:task.c        ****  *  input:  pid = 
 300:task.c        ****  *
 301:task.c        ****  *  output: # seconds or NOK
 302:task.c        ****  *
 303:task.c        ****  */
 304:task.c        **** LOCAL U32 wf_tick( PID pid )
 305:task.c        **** {
 419              	.stabn 68,0,305,.LM48-wf_tick
 420              	.LM48:
 421 0280 9421FFE0 		stwu 1,-32(1)
 422 0284 7C0802A6 		mflr 0
 423 0288 93810010 		stw 28,16(1)
 424 028c 93A10014 		stw 29,20(1)
 425 0290 93C10018 		stw 30,24(1)
 426 0294 93E1001C 		stw 31,28(1)
 427 0298 90010024 		stw 0,36(1)
 428 029c 7C3F0B78 		mr 31,1
 429 02a0 907F0008 		stw 3,8(31)
 306:task.c        ****   REG SIGP *sp;
 430              	.stabn 68,0,306,.LM49-wf_tick
 431              	.LM49:
 432              	.LBB5:
 307:task.c        ****   REG U32 r;
GAS LISTING /var/tmp/ccOy9tKR.s 			page 14


 308:task.c        ****   
 309:task.c        ****   /* save --> signalbuffer, will be sent by time_int
 310:task.c        ****    * to wake me up when next second has passed.
 311:task.c        ****    */
 312:task.c        ****   wf_tick_pid = pid;
 433              	.stabn 68,0,312,.LM50-wf_tick
 434              	.LM50:
 435 02a4 3D200000 		lis 9,wf_tick_pid@ha
 436 02a8 801F0008 		lwz 0,8(31)
 437 02ac 90090000 		stw 0,wf_tick_pid@l(9)
 313:task.c        ****   
 314:task.c        ****   sp = ose_receive_w_tmo( 2*SEC, 1, T_TICK );
 438              	.stabn 68,0,314,.LM51-wf_tick
 439              	.LM51:
 440 02b0 386007D0 		li 3,2000
 441 02b4 38800001 		li 4,1
 442 02b8 38A04004 		li 5,16388
 443 02bc 4CC63182 		crxor 6,6,6
 444 02c0 48000001 		bl ose_receive_w_tmo
 445 02c4 7C7D1B78 		mr 29,3
 315:task.c        ****   if ( sp != NULL )
 446              	.stabn 68,0,315,.LM52-wf_tick
 447              	.LM52:
 448 02c8 2C1D0000 		cmpwi 0,29,0
 449 02cc 41820014 		bc 12,2,.L25
 316:task.c        ****   {
 317:task.c        ****     /* GOOD! we have the tick signal from time_int */
 318:task.c        ****     r = sp->st.sec;
 450              	.stabn 68,0,318,.LM53-wf_tick
 451              	.LM53:
 452 02d0 839D0008 		lwz 28,8(29)
 319:task.c        ****     ose_free( sp );
 453              	.stabn 68,0,319,.LM54-wf_tick
 454              	.LM54:
 455 02d4 7FA3EB78 		mr 3,29
 456 02d8 48000001 		bl ose_free
 320:task.c        ****   }
 457              	.stabn 68,0,320,.LM55-wf_tick
 458              	.LM55:
 459 02dc 48000014 		b .L26
 460              	.L25:
 321

	..........


:) Janne
begin:vcard 
n:Andersson;Jan
tel;work:+46 8 585 34130
x-mozilla-html:FALSE
org:Wireless LAN Systems
adr:;;Esplanaden 3C ;SUNDBYBERG;STOCKHOLM;SE-164 80;Sweden
version:2.1
email;internet:Janh.Andersson@ericsson.com
x-mozilla-cpt:;17232
fn:Jan H Andersson
end:vcard

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]