On 2010-01-11 11:04, Walter Bright wrote:
bearophile wrote:
I don't remember what --gc-sections is, but I guess it's something
different. The code removed during the LTO is for example unreachable
functions, or functions/methods, that once inlined are called from
nowhere else, unused constants, etc. Here you can see an example on C
code (in D1 it's the same):
http://llvm.org/docs/LinkTimeOptimization.html Anyway, currently the
LDC project is mostly sleeping.
Optlink does this too. It's oooollldd technology, been around since the
80's. Consider the following program:
========================
int x;
void foo() { x++; }
int main() { return 0; }
========================
Compile it,
dmd foo -L/map
<snip>
Now look at the map file with:
grep foo foo.map
=========================
0004:00000090 _D3foo12__ModuleInfoZ 00434090
0003:00000004 _D3foo1xi 00433004
0003:00000004 _D3foo1xi 00433004
0004:00000090 _D3foo12__ModuleInfoZ 00434090
=========================
and we see that _D3foo3fooFZv does not appear in it. Optlink does this
by default, you don't even have to throw a switch.
_D3foo1xi, however, does appear in it, even though it's just as unused
as _D3foo3fooFZv. Why doesn't Optlink remove that? LLVM's LTO does.
--
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi