Skip to contentSkip to conversation

non-gcc linux? (was Re: Where did kgcc go in 2.4.0-test10?)

DISCUSSION Russ Allbery 3 participants 4 messages Nov 4, 2000 – Nov 6, 2000 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 7 lines · Tim Riker

Agreed. C99 does not replace all the needed gcc features. We should start using the ones that make sense, and push for standardization/documentation on the rest.

I'm perfectly happy with this as a long term goal. I'll put what effort I can into moving that direction without breaking the existing world as we know it.

May I tentatively suggest that one point at which your resources could productively be applied is towards improving the C99 compliance in gcc? Clearly for the near to medium future the compiler that everyone will use to build the Linux kernel will be gcc, which means that in order to use any C99 syntax, it first has to be solid in gcc. That means the best way of introducing such things into the Linux kernel is to *first* get the C99 support solid, reliable, and efficient in gcc, then once a version of gcc is released with that support, help get Linux compiling with that version of gcc.

*Then*, when that version of gcc can be made a prerequisite for the kernel, you can start switching constructs over to the C99 syntax that gcc supports.

This is obviously a slow and drawn-out process, but in the end the free software community not only gets a better-documented syntax in the Linux kernel code that's more likely to be clearly supported and not broken by gcc in the future, but the broader community also gets a more closely conforming compiler that supports the latest C features.

<http://gcc.gnu.org/c99status.html> has the current status of the development versions of gcc. There are a lot of items listed as Broken or Missing that I'm sure the gcc developers would welcome volunteer help with.

(Note that there is not and quite likely never will be any standard syntax for in-line assembly, as the standardization committee considers it to be outside their scope, so I doubt you'll ever be completely successful. But I think your goal is one that can reap benefits even when only partially accomplished.)

Signature · 5 lines
Russ Allbery ([email protected])             <http://www.eyrie.org/~eagle/>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#2 lore raw
In reply to a message not in the archive
Quoted 20 lines · Russ Allbery
Quoted 7 lines · Tim Riker

Agreed. C99 does not replace all the needed gcc features. We should start using the ones that make sense, and push for standardization/documentation on the rest.

I'm perfectly happy with this as a long term goal. I'll put what effort I can into moving that direction without breaking the existing world as we know it.

May I tentatively suggest that one point at which your resources could productively be applied is towards improving the C99 compliance in gcc? Clearly for the near to medium future the compiler that everyone will use to build the Linux kernel will be gcc, which means that in order to use any C99 syntax, it first has to be solid in gcc. That means the best way of introducing such things into the Linux kernel is to *first* get the C99 support solid, reliable, and efficient in gcc, then once a version of gcc is released with that support, help get Linux compiling with that version of gcc.

Quoted 3 lines

*Then*, when that version of gcc can be made a prerequisite for the kernel, you can start switching constructs over to the C99 syntax that gcc supports.

Hmmmmm. Last month the compiler related thread on the kernel list was the kernel couldn't move to newer versions of the compiler because the compiler had changed things (where newer might mean either the latest snapshot de jour, or a tested/appropriately patched version based off of the snapshots, or even 2.95). Now people seem to be advocating moving the kernel to use features from C99 that haven't even been coded yet (which mean when coded using the latest codegen as well). Note, I seriously doubt Linus will want a flag day (ie, after a given kernel release, you must use revision n of the compiler, but before that release, you must use revision n-1 of the compiler), so you still have to maintain support for the old GCC way of doing things, in addition to the C99 way of doing things probably for a year or so.

Signature · 8 lines
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  [email protected]		phone: +1 978-486-9304
Non-work: [email protected]	fax:   +1 978-692-4482
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#3 lore raw

Michael Meissner <[email protected]> said:

[...]

Quoted 7 lines

Now people seem to be advocating moving the kernel to use features from C99 that haven't even been coded yet (which mean when coded using the latest codegen as well). Note, I seriously doubt Linus will want a flag day (ie, after a given kernel release, you must use revision n of the compiler, but before that release, you must use revision n-1 of the compiler), so you still have to maintain support for the old GCC way of doing things, in addition to the C99 way of doing things probably for a year or so.

The recommended compiler is changing, it is now up to egcs-1.1.2. There is a long lag, to be sure.

In any case, C99 _will_ come, so it is worthwhile to rewrite gcc-isms that C99 does differently and egcs-1.1.2 supports *if* it doesn't impose a penalty of some other sort. The point is that many gcc extensions are poorly documented and moreover their semantics have changed over time (The kernel is one of the main users of gcc extensions, other software has to cater for being compiled with other compilers, and is thus more restricted here. I'd guess glibc is second here. Little used extensions tend to be broken or wobbly.). C99 is well documented, but the implementation of its features might not be solid yet...

Named structure initializers and varargs macros come to mind. The code should also be checked for possible use of restrict parameters.

Signature · 12 lines
Dr. Horst H. von Brand                       mailto:[email protected]
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#4 lore raw
In reply to a message not in the archive
Quoted 16 lines · Michael Meissner
Quoted 10 lines · Russ Allbery

May I tentatively suggest that one point at which your resources could productively be applied is towards improving the C99 compliance in gcc? Clearly for the near to medium future the compiler that everyone will use to build the Linux kernel will be gcc, which means that in order to use any C99 syntax, it first has to be solid in gcc. That means the best way of introducing such things into the Linux kernel is to *first* get the C99 support solid, reliable, and efficient in gcc, then once a version of gcc is released with that support, help get Linux compiling with that version of gcc.

Quoted 3 lines

*Then*, when that version of gcc can be made a prerequisite for the kernel, you can start switching constructs over to the C99 syntax that gcc supports.

Quoted 5 lines

Hmmmmm. Last month the compiler related thread on the kernel list was the kernel couldn't move to newer versions of the compiler because the compiler had changed things (where newer might mean either the latest snapshot de jour, or a tested/appropriately patched version based off of the snapshots, or even 2.95).

That's why I have the bit above about "help get Linux compiling with that version of gcc." My understanding is that the Linux core developers want to support newer versions of gcc as they come out, but that it's a slow process and relies on volunteers tracking down what's changed in gcc and updating the kernel to either use coding constructs that work better with a newer gcc or to use appropriate flags to turn off new gcc features that don't work well with the kernel (like strict-aliasing).

Clearly people who have a strong interest in being able to use newer versions of gcc for kernel compiles (such as people who want to *eventually* be able to use some C99 features) are the best people to help do this work since they'll be scratching their own itch, so to speak.

Quoted 3 lines

Now people seem to be advocating moving the kernel to use features from C99 that haven't even been coded yet (which mean when coded using the latest codegen as well).

People may be advocating that, but I think that in my message above, I'm pretty clearly *not* advocating this. I'm saying that if the goal is to eventually be able to use C99 syntax in the Linux kernel, the obvious first step that has to be accomplished before that goal is even remotely possible is to make sure that the compiler that the kernel uses has good C99 support. And that achieving this goal has many benefits for the community as a whole at the same time.

We have to get to point A before we can get to point H. That doesn't mean that point A leads directly to point H without the intervening B-G. :)

Quoted 5 lines

Note, I seriously doubt Linus will want a flag day (ie, after a given kernel release, you must use revision n of the compiler, but before that release, you must use revision n-1 of the compiler), so you still have to maintain support for the old GCC way of doing things, in addition to the C99 way of doing things probably for a year or so.

It depends on the time scale. I don't believe compilers older than 2.7.2 are really supported any more, are they? And I would expect that before *too* much longer, compilers older than egcs 1.1 won't be supported any more, since some of the bugs in 2.7.2 are already raising their heads.

With time, the kernel does eventually change its minimum supported gcc version number. As soon as that minimum supported version number reaches a version of gcc that supports a C99 feature, that feature can then reasonably be used in the kernel. It's quite possible, even likely, that having the C99 feature isn't enough reason to move the minimum supported version number by itself, but with enough patience it will creep forward anyway.

Signature · 5 lines
Russ Allbery ([email protected])             <http://www.eyrie.org/~eagle/>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/