Re: Comments in assember output

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

 



> I don't think there is any simple way to do this without using the -g
> option.
>
> Note that the -g option does not affect code generation in any way.
> You can use -O3 with or without -g, and you will get the same code.
>

Will the -g -O3 option truly give me code that executed at the same speed 
as -O3? I was not aware of that. In that case -g is fine. But even with -g I 
am not getting the result I want. I guess it is time for a specific example:
Lets say I have the fillowing code in test.cxx

float func(float a, float b)
{
	return a * b;
}

and try to generate the assembly with

g++ -g -O3 -Wa,-addhls test.cxx -S

I would get the following (This output is truncated, I left out all the debug 
symbols at the end):

# ... bla bla bla...
.LFB2:
	.file 1 "test.cxx"
	.loc 1 3 0
.LVL0:
	pushl	%ebp
.LCFI0:
	movl	%esp, %ebp
.LCFI1:
	.loc 1 3 0
	flds	12(%ebp)
.LBB2:
	.loc 1 4 0
	fmuls	8(%ebp)
.LBE2:
	.loc 1 5 0
	leave
	ret
.LFE2:
	.size	_Z4funcff, .-_Z4funcff
# ... etc ...


And I dont see any comments containing my c++ source lines. I would have 
expected something like:

# ... bla bla bla...
.LFB2:
	.file 1 "test.cxx"
	.loc 1 3 0
#                     float func(float a, float b)
#                     {
.LVL0:
	pushl	%ebp
#                              return a * b;
.LCFI0:
	movl	%esp, %ebp
.LCFI1:
	.loc 1 3 0
	flds	12(%ebp)
.LBB2:
	.loc 1 4 0
	fmuls	8(%ebp)
.LBE2:
	.loc 1 5 0
	leave
	ret
#                       }
.LFE2:
	.size	_Z4funcff, .-_Z4funcff
# ... etc ...


Any ideas how to get his kind of output?

-- 

Artur Szostak

Tel. +27 21 650 3356
Mobile: +27 82 297 9502
Emails: artur@xxxxxxxxxxxxxxxxxxx  artursz@xxxxxxxxxxx
AIM: artiblot
Skype: artiblot
Room: 4T6
Address:
R.W. James Building,
Rondebosch, 7701
Cape Town, South Africa

Physics Department
University of Cape Town

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux