Re: [PATCH] Use -fno-unit-at-a-time if gcc supports it

From: Andreas Jaeger
Date: Fri Sep 05 2003 - 10:18:33 EST


Linus Torvalds <torvalds@xxxxxxxx> writes:

> On Fri, 5 Sep 2003, Andi Kleen wrote:
>>
>> Unfortunately the kernel doesn't compile with unit-at-a-time currently,
>> it cannot tolerate the reordering of functions in relation to inline
>> assembly.
>
> What is the problem exactly? Is it the exception table getting unordered?
> We _could_ just sort it at boot-time (or, even better, at build time after
> the final link) instead...

The problem is that unit-at-a-time sees all functions used and finds
some static functions/variables that are not called anywhere and
therefore drops them, making a smaller binary. Since GCC does not
look into inline assembler, anything referenced from inline assembler
only, will be treated as not used and therefore removed.

You have to options:
- use attribute ((used)) (implemented since GCC 3.2) to tell GCC that
a function/variable should never be removed
- use -fno-unit-at-a-time.

Since unit-at-a-time has better inlining heuristics the better way is
to add the used attribute - but that takes some time. The short-term
solution would be to add the compiler flag,

Andreas
--
Andreas Jaeger, aj@xxxxxxx, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126

Attachment: pgp00001.pgp
Description: PGP signature