This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: G++ static assignment / initialization


>>>>> "David" == David Edelsohn <dje@watson.ibm.com> writes:

    David> 	For instance on AIX, gcc places all of the following
    David> into BSS but g++ places it all into initialized data:

    David> int a; float b; char buf[32]; struct { double x; short y;
    David> long z; } S;

OK, so we put all of this in BSS.  As Jason explains, this is the
right thing to do.  For example, on Linux we have:

  .bss
	  .align 4
	  .type	 a,@object
	  .size	 a,4
  a:
	  .zero	4
  .globl b
	  .align 4
	  .type	 b,@object
	  .size	 b,4
  b:
	  .zero	4
  .globl buf
	  .align 32
	  .type	 buf,@object
	  .size	 buf,32
  buf:
	  .zero	32
  .globl S
	  .align 8
	  .type	 S,@object
	  .size	 S,16
  S:
	  .zero	16

Is this a lot different than what we see on AIX?  Myself, I didn't see
any dynamic initialization of these things in the assembly file.
David, what's an example where something that used to be initialized
statically is now initialized dynamically?

Jason, it's difficult to avoid all of the redundant functions, but
you're right that we should be able to do a little better than we do.
Correctness was my first objective; we know handle arbitrarily complex
dependencies and do not mess up where vtables go, etc.  Since these
issues seem to have stabilized, I'll look at optimization a little.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


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