Re: kernel-2.2.1-undefined references.

Matthias Urlichs (smurf@noris.de)
8 Feb 1999 18:06:21 +0100


[ This should probably be continued in the egcs mailing list;
I've set an appropriate Reply-To: header ]

hpa@transmeta.com (H. Peter Anvin) writes:
> Alan Cox:
> >
> > At this point egcs really needs to invent a new "common inline" of some
> > sort. There are kernel cases where you need to force inlining and where
> > you don't want duplicated code all over the place caused by compiler
> > weaknesses.
>
Why is that a weakness? If the compiler's optimizer says "this code runs
faster when not inlined" (I can think of a couple of reasons why it would
even be right doing that...), I'm not qualified to contradict it.

> "extern inline" is what you want. The problem is that it doesn't work
> without -O (*this* is the compiler misfeature!) but the Linux kernel
> won't compile that way, either...

"extern inline" is defined by ISO C 9x (AFAIR) to behave exactly like it
does with current EGCS snapshots, i.e. either somebody needs to define a
non-inlined version somewhere OR the thing needs to be "static inline".

I don't think the EGCS people are going to like a new "force inlining"
keyword. I could be wrong, though...

Therefore, I can think of four possible solutions (though I don't really
like the first one ;-) :
1- Annoy the EGCS people until they revert to the previous behavior
1- Annoy the EGCS people until they implement __attribute__((always_inline))
(or implement it yourself)
2- s/extern inline/static inline
3- enclose all the "extern inline"s in

#ifndef DO_EXTERN_FOO
extern inline
#endif
int foo(bar) {
baz
}

so that the kernel Makefiles can compile the functions by doing a
#define DO_EXTERN_FOO
#include "linux/file_with_foo.h"

for each affected FOO, and then link with an archive of these, comparable
to the way libgcc.a is built.

Obviously, the last two are not mutually exclusive.

-- 
Matthias Urlichs  |  noris network GmbH   |   smurf@noris.de  |  ICQ: 20193661
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
A free society is one where it is safe to be unpopular.
                                -- Adlai Stevenson

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