[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Do not put static variables into a common section.
From: |
Rob Landley |
Subject: |
Re: [Tinycc-devel] Do not put static variables into a common section. |
Date: |
Mon, 27 Aug 2007 03:37:52 -0500 |
User-agent: |
KMail/1.9.6 |
On Monday 27 August 2007 1:29:32 am Simon 'corecode' Schubert wrote:
> Rob Landley wrote:
> > I'm confused: it looks like (at a quick glance, which is all I'm up for
> > at the moment with this cold) that the patch makes it put the static
> > variables into bss, which is _not_ a common section...?
>
> Exactly. At least only OS (DragonFly) this is necessary. Gcc does this on
> Linux as well, so I figured that should at least not be wrong.
>
> I'm no expert in linking, but it occured to me that the common section is
> only for global symbols which in the end get merged to one, i.e. the same
> global symbol defined in multiple objects. Obviously, this is never the
> case for static symbols: they all need to be created and may never be
> merged.
Ah, when you said "don't put them in a common section" I parsed that as "put
each static variable into its own section".
Right, "put static variables in bss, which gcc does and fixes a bug I hit on
DragonFly" makes much more sense. (Since a static variable is essentially
just a global with a weird naming convention, this works fine for me.)
Query: is this just _uninitialized_ static variables? What happens to ones
initialized to a default value? If it's a global, those don't go in .bss,
they go in... Darn it, .data?
When in doubt, go back to ancient half-remembered references:
http://www.linuxjournal.com/article/1059
http://www.linuxjournal.com/article/1060
> cheers
> simon
Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.