Re: deadcode optimization

Hans-Bernhard Broeker <>
22 Mar 2001 01:15:38 -0500

          From comp.compilers

Related articles
[9 earlier articles]
Re: deadcode optimization (Norman Black) (2001-03-10)
Re: deadcode optimization (Norman Black) (2001-03-10)
Re: deadcode optimization (2001-03-10)
Re: deadcode optimization (2001-03-12)
Re: deadcode optimization (Norman Black) (2001-03-14)
Re: deadcode optimization (Norman Black) (2001-03-14)
Re: deadcode optimization (Hans-Bernhard Broeker) (2001-03-22)
Re: deadcode optimization (Marco van de Voort) (2001-04-04)
Re: deadcode optimization (Norman Black) (2001-04-10)
Re: deadcode optimization (2001-04-12)
| List of all articles for this month |

From: Hans-Bernhard Broeker <>
Newsgroups: comp.compilers
Date: 22 Mar 2001 01:15:38 -0500
Organization: Aachen University of Technology (RWTH)
References: 01-03-012 01-03-022 01-03-034 01-03-060 01-03-075 01-03-091
Keywords: optimize, linker
Posted-Date: 22 Mar 2001 01:15:38 EST

Norman Black <> wrote:
> I understand the legacy of C compilers back to the original. They have
> global and local symbols in the object format. A static in a file
> would use a local symbol. As a non C user I could care less about that
> and have no use for it. The languages I use all support compilation
> units and the C "symbol issues"(namespace stuff) disappear with the
> existence of compilation units. Even so I still do not see the need,
> other than legacy, to use local symbols in a C compiler.

I think you may have overlooked one central point, here. First of all,
C does support compilation units. Syntactic details vary wildly
between C and the somewhat stricter languages , but the concept is

But talking about dead code elimination, previous articles in this
thread had pointed out that the compilation units have to be *broken
apart* before they are presented to a usual Unix-type linker. And in
this cracking-open process it is that variables local to the
compilation unit will cause problems, since the compilation unit is no
longer the same as the linkage unit.

This problem is, AFAICS, completely independent of whether you call
these variables 'static', in C parlance, or define them in the
'implementation part' of a more strongly modularized language. It's
rather caused by the concept of an monolithic compilation unit
(i.e. an 'object file) being presented to a linker that has no way of
isolating individual functions or data objects from such a monolithic

I.e. it's the linker that makes this hard, not the compiler, nor the
language it compiles.
Hans-Bernhard Broeker (

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.