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

From: Helge Hafting
Date: Mon Sep 08 2003 - 04:42:27 EST


Andreas Jaeger wrote:
[...]
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,

Seems to me that a better solution is to mark the assembly code
in question so gcc knows that is somehow calls the function.
That still allows optimizing away the function whenever the
assembly itself is left out. (Module not compiled or similiar)
Marking the function "used" includes it anyway.

I realize this way probably isn' supported right now,
but people are talking about changing gcc so I
mentioned it as an ideal way.

Helge Hafting


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/