lkml.org 
[lkml]   [2000]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjecthello world module no longer compiles?!
Hi guys,

I always test new ideas or learn about things by writing a little module
that does what I want to explore. But today I discovered that on a Red Hat
6.9 system (running test10-pre3 with everything correctly upgraded) I can
no longer compile a trivial skeleton hello.c unless I use the latest gcc
instead of kgcc (which I don't really want to use); any idea why?

(my /usr/include/linux of course pointd to the kernel src's
/usr/src/linux/include/linux and the same for asm). Maybe kgcc is told to
use the headers in some hardcoded _wrong_ location and so can't
understand __exit?

# cat hello.c
#define __KERNEL__
#define MODULE
#define __SMP__

#include <linux/module.h>
#include <linux/init.h>

static int __init test_init(void)
{
return 0;
}

static void __exit test_exit(void)
{
return;
}

module_init(test_init);
module_exit(test_exit);
# kgcc -Wall -O2 -g -c -o hello.o hello.c
hello.c:13: parse error before `test_exit'
hello.c:14: warning: return-type defaults to `int'
hello.c: In function `test_exit':
hello.c:15: warning: `return' with no value, in function returning
non-void
hello.c: At top level:
hello.c:18: warning: type defaults to `int' in declaration of
`module_init'
hello.c:18: warning: parameter names (without types) in function
declaration
hello.c:18: warning: data definition has no type or storage class
hello.c:19: warning: type defaults to `int' in declaration of
`module_exit'
hello.c:19: warning: parameter names (without types) in function
declaration
hello.c:19: warning: data definition has no type or storage class
hello.c:9: warning: `test_init' defined but not used
# gcc -Wall -O2 -g -c -o hello.o hello.c
/tmp/ccSldzhv.s: Assembler messages:
/tmp/ccSldzhv.s:54: Warning: Ignoring changed section attributes for
.modinfo
# l hello.o
-rw-r--r-- 1 root root 4360 Oct 16 15:24 hello.o


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

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.042 / U:24.336 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site