public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Dwarf in assembler file
@ 2006-11-30 16:10 Fabian Cenedese
  2006-11-30 17:12 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Cenedese @ 2006-11-30 16:10 UTC (permalink / raw)
  To: gcc-help

Hi

I use a gcc 4.1.0 on cygwin, cross compiled for ppc -> generates elf.
I use the -S to see what assembler code got generated and for this
I need the line info (.loc). I have a simple file when compiled gives
more than one symbol for constructor or destructor. The output is
like this:

	.globl _ZN17_TASK_CLASS_NAME_D0Ev
	.type	_ZN17_TASK_CLASS_NAME_D0Ev, @function
_ZN17_TASK_CLASS_NAME_D0Ev:
.LFB601:
	.loc 3 120 0
	stwu 1,-24(1)	 #,,
...(snip) ...
	blr	 #
.LFE601:
	.size	_ZN17_TASK_CLASS_NAME_D0Ev, .-_ZN17_TASK_CLASS_NAME_D0Ev
	.align 2
	.globl _ZN17_TASK_CLASS_NAME_D1Ev
	.type	_ZN17_TASK_CLASS_NAME_D1Ev, @function
_ZN17_TASK_CLASS_NAME_D1Ev:
.LFB600:
	.loc 3 120 0
	stwu 1,-24(1)	 #,,
...(snip) ...
	blr	 #
.LFE600:
	.size	_ZN17_TASK_CLASS_NAME_D1Ev, .-_ZN17_TASK_CLASS_NAME_D1Ev
	.align 2
	.globl _ZN17_TASK_CLASS_NAME_D2Ev
	.type	_ZN17_TASK_CLASS_NAME_D2Ev, @function
_ZN17_TASK_CLASS_NAME_D2Ev:
.LFB599:
	.loc 3 120 0
	stwu 1,-24(1)	 #,,
...(snip) ...
	blr	 #
.LFE599:
	.size	_ZN17_TASK_CLASS_NAME_D2Ev, .-_ZN17_TASK_CLASS_NAME_D2Ev

Why are there three symbols _ZN17_TASK_CLASS_NAME_D{0,1,2}Ev? They're all
placed on the same source line .loc 3 120 0, contain exactly the same code. So what
is the meaning/difference between these three? I also get two symbols for the constructor,
also only differing in the last number.

How does the assembler know that it shouldn't do three times the same code but that
this is three times the same?

Thanks

bye   Fabi


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Dwarf in assembler file
  2006-11-30 16:10 Dwarf in assembler file Fabian Cenedese
@ 2006-11-30 17:12 ` Ian Lance Taylor
  2006-12-01  7:30   ` Fabian Cenedese
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2006-11-30 17:12 UTC (permalink / raw)
  To: Fabian Cenedese; +Cc: gcc-help

Fabian Cenedese <Cenedese@indel.ch> writes:

> Why are there three symbols _ZN17_TASK_CLASS_NAME_D{0,1,2}Ev? They're all
> placed on the same source line .loc 3 120 0, contain exactly the same code. So what
> is the meaning/difference between these three? I also get two symbols for the constructor,
> also only differing in the last number.

These are required by the C++ ABI:
    http://codesourcery.com/cxx-abi/

base object destructor of a class T
    A function that runs the destructors for non-static data members
    of T and non-virtual direct base classes of T.

complete object destructor of a class T
    A function that, in addition to the actions required of a base
    object destructor, runs the destructors for the virtual base
    classes of T.

deleting destructor of a class T
    A function that, in addition to the actions required of a complete
    object destructor, calls the appropriate deallocation function
    (i.e,. operator delete) for T.

The compiler should do a better job of combining them, since they are
often the same.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Dwarf in assembler file
  2006-11-30 17:12 ` Ian Lance Taylor
@ 2006-12-01  7:30   ` Fabian Cenedese
  0 siblings, 0 replies; 3+ messages in thread
From: Fabian Cenedese @ 2006-12-01  7:30 UTC (permalink / raw)
  To: gcc-help

At 09:12 30.11.2006 -0800, Ian Lance Taylor wrote:
>Fabian Cenedese <Cenedese@indel.ch> writes:
>
>> Why are there three symbols _ZN17_TASK_CLASS_NAME_D{0,1,2}Ev? They're all
>> placed on the same source line .loc 3 120 0, contain exactly the same code. So what
>> is the meaning/difference between these three? I also get two symbols for the constructor,
>> also only differing in the last number.
>
>These are required by the C++ ABI:
>    http://codesourcery.com/cxx-abi/

Thanks for the link, I will have a look at it.

>base object destructor of a class T
>complete object destructor of a class T
>deleting destructor of a class T
>
>The compiler should do a better job of combining them, since they are
>often the same.

This was compiled unoptimized, I'm sure with some -O option it could
optimize them. I can try and see what changes.

Thanks

bye   Fabi


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-01  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30 16:10 Dwarf in assembler file Fabian Cenedese
2006-11-30 17:12 ` Ian Lance Taylor
2006-12-01  7:30   ` Fabian Cenedese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).