From: Guo H. <hon...@ro...> - 2006-01-09 08:12:27
|
Hi,cil-mail-list: =09What I send before can not display correctly, resend again.= Sorry =09I try to compiler Linux-2.6.12 kernel using cil. The following= is the difference between stand kernel and our kernel. Note that: I change include/linux/compiler-gcc3.h because cil can= not process the __attribute__ option of gcc. -----------------------------------------------------------------= ---------------------------------------------------- Index: Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D RCS file: /home/cvsroot/V-Linux2/Code/linux/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -r1.1.1.1 -r1.2 351c351,354 < CFLAGS :=3D -Wall -Wstrict-prototypes= -Wno-trigraphs \ --- > #CFLAGS :=3D -Wall -Wstrict-prototypes= -Wno-trigraphs \ > -fno-strict-aliasing -fno-common \ > -ffreestanding > CFLAGS :=3D -Wstrict-prototypes -Wno-trigraphs \ 972,973c975,976 < \( -name '*.[oas]' -o -name '*.ko' -o -name= '.*.cmd' \ < -o -name '.*.d' -o -name '.*.tmp' -o -name= '*.mod.c' \) \ --- > \( -name '*.[oasi]' -o -name '*.ko' -o -name= '.*.cmd' \ > -o -name '.*.d' -o -name '.*.tmp' -o -name= '*.mod.c' -o -name '*.cil.c' \) \ cvs diff: cannot find arch/pnx1500/kernel/entry.s Index: include/linux/compiler-gcc3.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D RCS file:= /home/cvsroot/V-Linux2/Code/linux/include/linux/compiler-gcc3.h,= v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -r1.1.1.1 -r1.2 5a6 > #if 0 31a33 > #endif Index: scripts/Makefile.build =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D RCS file:= /home/cvsroot/V-Linux2/Code/linux/scripts/Makefile.build,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -r1.1.1.1 -r1.2 146c146,147 < cmd_cc_o_c =3D $(CC) $(c_flags) -c -o $@ $< --- > > cmd_cc_o_c =3D $(CC) $(c_flags) -E -o $(patsubst %.c,%.i,$<) $<;= cilly.asm.exe --keepunused --out $(patsubst %.c,%.cil.c,$<)= $(patsubst %.c,%.i,$<); $(CC) $(c_flags) -c -o $@ $(patsubst= %.c,%.cil.c,$<) -----------------------------------------------------------------= -----------------------------------------------------------------= -------- When I compiler kernel, the following error ocurred: -----------------------------------------------------------------= -----------------------------------------------------------------= -------- init/initramfs.c:35: warning: `__section__' attribute does not= apply to types init/initramfs.c:112: parse error before '{' token init/initramfs.c: In function `error': init/initramfs.c:14: `x' undeclared (first use in this function) init/initramfs.c:14: (Each undeclared identifier is reported only= once init/initramfs.c:14: for each function it appears in.) init/initramfs.c: At top level: init/initramfs.c:142: warning: parameter has incomplete type init/initramfs.c:143: parameter `next' has incomplete type init/initramfs.c: In function `read_into': init/initramfs.c:147: `state' has an incomplete type init/initramfs.c:151: `next_state' has an incomplete type init/initramfs.c:152: `state' has an incomplete type init/initramfs.c: In function `do_start': init/initramfs.c:160: type of formal parameter 3 is incomplete init/initramfs.c: In function `do_collect': init/initramfs.c:174: `state' has an incomplete type init/initramfs.c: In function `do_header': init/initramfs.c:189: type of formal parameter 3 is incomplete init/initramfs.c:191: `state' has an incomplete type init/initramfs.c:199: `next_state' has an incomplete type init/initramfs.c:200: `state' has an incomplete type init/initramfs.c:205: type of formal parameter 3 is incomplete init/initramfs.c:205: type of formal parameter 3 is incomplete init/initramfs.c: In function `do_skip': init/initramfs.c:215: `state' has an incomplete type init/initramfs.c: In function `do_name': init/initramfs.c:243: `state' has an incomplete type init/initramfs.c:244: `next_state' has an incomplete type init/initramfs.c:257: `state' has an incomplete type init/initramfs.c: In function `do_copy': init/initramfs.c:281: `state' has an incomplete type init/initramfs.c: In function `do_symlink': init/initramfs.c:296: `state' has an incomplete type init/initramfs.c:297: `next_state' has an incomplete type init/initramfs.c: In function `write_buffer': init/initramfs.c:317: conversion to incomplete type init/initramfs.c:317: conversion to incomplete type init/initramfs.c: In function `flush_buffer': init/initramfs.c:332: `state' has an incomplete type init/initramfs.c:336: `state' has an incomplete type init/initramfs.c: In function `unpack_to_rootfs': init/initramfs.c:426: `state' has an incomplete type init/initramfs.c:432: `state' has an incomplete type init/initramfs.c: At top level: init/initramfs.c:112: storage size of `state' isn't known init/initramfs.c:112: storage size of `next_state' isn't known -----------------------------------------------------------------= ----------------------------------------------------- It is obvious that cil can not process the following code= correctly: --------------------------------------- static __initdata enum state { Start, Collect, GotHeader, SkipIt, GotName, CopyFile, GotSymlink, Reset } state, next_state; --------------------------------------- When I remove the __initdata before "enum state", the output is= the following: --------------------------------------- init/initramfs.c:35: warning: `__section__' attribute does not= apply to types init/initramfs.c: In function `error': init/initramfs.c:14: `x' undeclared (first use in this function) init/initramfs.c:14: (Each undeclared identifier is reported only= once init/initramfs.c:14: for each function it appears in.) make[1]: *** [init/initramfs.o] Error 1 --------------------------------------- When I read the init/initramfs.cil.c, I find the following code= in init/initramfs.c: ------------------------------------------ static __initdata char *message; static void __init error(char *x) { if (!message) message =3D x; } ------------------------------------------ has been translated into the following: ------------------------------------------ #line 10 "init/initramfs.c" static char *message __attribute__((__section__(".init.data"))) = ; #line 11 static void error(char *m ) = __attribute__((__section__(".init.text"))) ; #line 11 "init/initramfs.c" static void error(char *m ) { { #line 13 if (! message) { #line 14 message =3D x; } #line 15 return; } } #line 17 ------------------------------------------ It is obvious that: The cil changed the praramter of error from= "x" to "m" But it SHOULD NOT be changed. Thanks a lot! camelguo Cheer! =09=09=09=09 =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1Guo Hongruan =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1h...@ro... =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A12006-01-09 |