Re: compiling the kernel not using (linux, gcc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-11-22 at 06:46 +0200, MHD.Tayseer wrote:
[...]
> well .. the "unraliable guide to kernel hacking" sais that there are the 
> following gnu extentions in the linux kernel:
> 
>     * Inline functions
Std C as such. But the kernel needs certain inline functions to be
always inlined (or reported as an error). And this is then also a
gcc-ism.
>     * Statement expressions (ie. the ({ and }) constructs).
Are they always necessary or could it be solved with inline functions, functions,
do { ... } while(0) constructs?
>     * Declaring attributes of a function / variable / type (__attribute__)
`#define __attribute__(x)` kills it. If killing is always a solution, is
another question (for functions, it is always a solution, for struct's
probably not).
>     * Labeled elements
C99
>     * typeof
gcc-ism
>     * Zero length arrays
C99
>     * Macro varargs
ANSI-C since ages
>     * Arithmetic on void pointers
I believe C99, common since ages
>     * Non-Constant initializers
I believe C99
>     * Assembler Instructions (not outside arch/ and include/asm/)
Always AFICS compiler-specific.
>     * Function names as strings (__FUNCTION__)
Std C sionce ages.
>     * __builtin_constant_p()
gcc-ism - IOW Compiler-specific.
> is there more/less of those extensions now ? the document mentioned 
> above is dated 2000 and i think life has changed so much inside the 
> linux kernel since then...

Yes. Also the (newly at that time) C-99 standard is quite complete in
gcc-3.latest and gcc-4.*

> another question ..  is there a known work around of those extensions to 
> turn them into Ansi C?, or such an extensions are hard to be done under 

Yes: Look at the code and what it should do, reformulate it, test it and
sent it as patch to lkml.

> ansi C .. i mean that it may be trivial to move a declaration or an 
> expression two or three lines before .. is it trivial as text/syntax 

Some probably yes.

> modifications or there are extensions that are based on a special gcc logic?

Also some of this type - see above.

> and if i wanna use cygwin .. i know that this question may now be asked 
> here but can i call windows executable (the compiler in my case) from 
> cygwin without recompiling/modifying it ?

In practice, you can only look which parts bite you and investigate if
it makes sense to fix them for your project or in general.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux