pending kbuild updates
Subsystems (4)
Following is the next batch queued up for merging. Highlights:
o improved userspace header checks (spawns a lot of warnings now!)
o some kconfig improvements for check of recursive dependencies
o drop retrun of void warning from sparse
Sam
Hannes Eder (1):
kbuild: disable sparse warning "returning void-valued expression"
Mike Frysinger (2):
headers_check.pl: disallow extern's
kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__
Randy Dunlap (1):
kbuild: make *config usage docs
Sam Ravnborg (9):
m68k: fix recursive dependency in Kconfig
kconfig: explain symbol value defaults
kconfig: add comments to symbol flags
kconfig: struct property commented
kconfig: improve readout when we hit recursive dependencies
kconfig: print all locations when we see a recursive dependency
kconfig: improve error messages for bad source statements
kbuild: check for leaked CONFIG_ symbols to userspace
kbuild: document environment variables
Documentation/kbuild/00-INDEX | 6 +- Documentation/kbuild/kbuild.txt | 126 +++++++++++++++++++++++ Documentation/kbuild/kconfig.txt | 188 +++++++++++++++++++++++++++++++++++ Makefile | 3 +- README | 32 ++++--- arch/m68k/Kconfig | 1 - scripts/headers_check.pl | 21 ++++- scripts/headers_install.pl | 3 + scripts/kconfig/expr.h | 83 ++++++++++----- scripts/kconfig/lex.zconf.c_shipped | 7 +- scripts/kconfig/menu.c | 2 + scripts/kconfig/symbol.c | 27 ++++- scripts/kconfig/zconf.l | 7 +- 13 files changed, 453 insertions(+), 53 deletions(-)
PATCH 1/13 m68k: fix recursive dependency in Kconfig
We had a recursive dependency between MMU_MOTOROLA and MMU_SUN3 Fix it by dropping the unused dependencies on MMU_MOTOROLA.
MMU_MOTOROLA is set to y only using select so any dependencies are anyway ignored.
--- arch/m68k/Kconfig | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/m68k/Kconfig +0 -1
@@ -280,7 +280,6 @@ config M68060 config MMU_MOTOROLA bool - depends on MMU && !MMU_SUN3 config MMU_SUN3 bool
Signature · 1 line
1.6.0.2.GIT
PATCH 2/13 kconfig: explain symbol value defaults
In reply to Sam RavnborgAdded a few comments - no functional change.
--- scripts/kconfig/expr.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/kconfig/expr.h +6 -2
@@ -65,9 +65,13 @@ enum symbol_type {S_UNKNOWN ,S_BOOLEAN ,S_TRISTATE ,S_INT ,S_HEX ,S_STRING ,S_OTHER }; +/* enum values are used as index to symbol.def[] */ enum {S_DEF_USER ,/* main user value */ -S_DEF_AUTO , +S_DEF_AUTO ,/* values read from auto.conf */ +S_DEF_DEF3 ,/* Reserved for UI usage */ +S_DEF_DEF4 ,/* Reserved for UI usage */ +S_DEF_COUNT }; struct symbol {
@@ -75,7 +79,7 @@ struct symbol {char *name;enum symbol_type type;struct symbol_value curr; -struct symbol_value def[4 ]; +struct symbol_value def[S_DEF_COUNT ];tristate visible;int flags;struct property *prop;
Signature · 1 line
1.6.0.2.GIT
PATCH 3/13 kconfig: add comments to symbol flags
In reply to Sam RavnborgNo functional changes - only comments.
--- scripts/kconfig/expr.h | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-)
scripts/kconfig/expr.h +18 -16
@@ -88,22 +88,24 @@ struct symbol {#define for_all_symbols (i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) -#define SYMBOL_CONST 0x0001 -#define SYMBOL_CHECK 0x0008 -#define SYMBOL_CHOICE 0x0010 -#define SYMBOL_CHOICEVAL 0x0020 -#define SYMBOL_VALID 0x0080 -#define SYMBOL_OPTIONAL 0x0100 -#define SYMBOL_WRITE 0x0200 -#define SYMBOL_CHANGED 0x0400 -#define SYMBOL_AUTO 0x1000 -#define SYMBOL_CHECKED 0x2000 -#define SYMBOL_WARNED 0x8000 -#define SYMBOL_DEF 0x10000 -#define SYMBOL_DEF_USER 0x10000 -#define SYMBOL_DEF_AUTO 0x20000 -#define SYMBOL_DEF3 0x40000 -#define SYMBOL_DEF4 0x80000 +#define SYMBOL_CONST 0x0001/* symbol is const */ +#define SYMBOL_CHECK 0x0008/* used during dependency checking */ +#define SYMBOL_CHOICE 0x0010/* start of a choice block (null name) */ +#define SYMBOL_CHOICEVAL 0x0020/* used as a value in a choice block */ +#define SYMBOL_VALID 0x0080/* set when symbol.curr is calculated */ +#define SYMBOL_OPTIONAL 0x0100/* choice is optional - values can be 'n' */ +#define SYMBOL_WRITE 0x0200/* ? */ +#define SYMBOL_CHANGED 0x0400/* ? */ +#define SYMBOL_AUTO 0x1000/* value from environment variable */ +#define SYMBOL_CHECKED 0x2000/* used during dependency checking */ +#define SYMBOL_WARNED 0x8000/* warning has been issued */ + +/* Set when symbol.def[] is used */ +#define SYMBOL_DEF 0x10000/* First bit of SYMBOL_DEF */ +#define SYMBOL_DEF_USER 0x10000/* symbol.def[S_DEF_USER] is valid */ +#define SYMBOL_DEF_AUTO 0x20000/* symbol.def[S_DEF_AUTO] is valid */ +#define SYMBOL_DEF3 0x40000/* symbol.def[S_DEF_3] is valid */ +#define SYMBOL_DEF4 0x80000/* symbol.def[S_DEF_4] is valid */ #define SYMBOL_MAXLENGTH 256#define SYMBOL_HASHSIZE 257
Signature · 1 line
1.6.0.2.GIT
PATCH 4/13 kconfig: struct property commented
In reply to Sam RavnborgNo functional changes
--- scripts/kconfig/expr.h | 40 ++++++++++++++++++++++++++++++---------- 1 files changed, 30 insertions(+), 10 deletions(-)
scripts/kconfig/expr.h +30 -10
@@ -111,21 +111,41 @@ struct symbol {#define SYMBOL_HASHSIZE 257#define SYMBOL_HASHMASK 0xff +/* A property represent the config options that can be associated +* with a config "symbol". +* Sample: +* config FOO +* default y +* prompt "foo prompt" +* select BAR +* config BAZ +* int "BAZ Value" +* range 1..255 +*/ enum prop_type { -P_UNKNOWN ,P_PROMPT ,P_COMMENT ,P_MENU ,P_DEFAULT ,P_CHOICE , -P_SELECT ,P_RANGE ,P_ENV +P_UNKNOWN , +P_PROMPT ,/* prompt "foo prompt" or "BAZ Value" */ +P_COMMENT ,/* text associated with a comment */ +P_MENU ,/* prompt associated with a menuconfig option */ +P_DEFAULT ,/* default y */ +P_CHOICE ,/* choice value */ +P_SELECT ,/* select BAR */ +P_RANGE ,/* range 7..100 (for a symbol) */ +P_ENV ,/* value from environment variable */ };struct property { -struct property *next; -struct symbol *sym; -enum prop_type type; -const char *text; +struct property *next;/* next property - null if last */ +struct symbol *sym;/* the symbol for which the property is associated */ +enum prop_type type;/* type of property */ +const char *text;/* the prompt value - P_PROMPT, P_MENU, P_COMMENT */ struct expr_value visible; -struct expr *expr; -struct menu *menu; -struct file *file; -int lineno; +struct expr *expr;/* the optional conditional part of the property */ +struct menu *menu;/* the menu the property are associated with +* valid for: P_SELECT, P_RANGE, P_CHOICE, +* P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */ +struct file *file;/* what file was this property defined */ +int lineno;/* what lineno was this property defined */ };#define for_all_properties (sym, st, tok) \
Signature · 1 line
1.6.0.2.GIT
PATCH 5/13 kconfig: improve readout when we hit recursive dependencies
In reply to Sam RavnborgFollowing sample:
config TEST1
bool
depends on TEST2 && PCI
select TEST2
config TEST2
boolWill result in the following output:
Kconfig:1:error: found recursive dependency:
TEST1
-> TEST2 (arch/x86/Kconfig:6)
-> TEST1 (arch/x86/Kconfig:1)The sample above gave a segmentation fault
which is also fixed by this patch.
--- scripts/kconfig/expr.h | 1 + scripts/kconfig/menu.c | 2 ++ scripts/kconfig/symbol.c | 11 ++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-)
scripts/kconfig/expr.h +1 -0
@@ -132,6 +132,7 @@ enum prop_type {P_SELECT ,/* select BAR */ P_RANGE ,/* range 7..100 (for a symbol) */ P_ENV ,/* value from environment variable */ + P_SYMBOL, /* where a symbol is defined */ }; struct property {
scripts/kconfig/menu.c +2 -0
@@ -55,6 +55,8 @@ void menu_add_entry(struct symbol *sym) *last_entry_ptr = menu; last_entry_ptr = &menu->next; current_entry = menu; +if (sym) +menu_add_prop (P_SYMBOL ,NULL ,NULL ,NULL ); }void menu_end_entry (void )
scripts/kconfig/symbol.c +8 -3
@@ -856,8 +856,9 @@ struct symbol *sym_check_deps(struct symbol *sym)struct property *prop;if (sym->flags &SYMBOL_CHECK ) { -fprintf (stderr,"%s:%d:error: found recursive dependency: %s" , - sym->prop->file->name, sym->prop->lineno, +fprintf (stderr,"%s:%d:error: found recursive dependency:\n" , + sym->prop->file->name, sym->prop->lineno); +fprintf (stderr,"\t %s\n" , sym->name ? sym->name :"<choice>" );return sym; }
@@ -877,7 +878,9 @@ struct symbol *sym_check_deps(struct symbol *sym) }if (sym2) { -fprintf (stderr," -> %s" , sym->name ? sym->name :"<choice>" ); +fprintf (stderr,"\t -> %s (%s:%d)\n" , + sym->name ? sym->name :"<choice>" , + sym->prop->file->name, sym->prop->lineno);if (sym2 == sym) {fprintf (stderr,"\n" ); zconfnerrs++;
@@ -937,6 +940,8 @@ const char *prop_get_type_name(enum prop_type type)return "select" ;case P_RANGE :return "range" ; +case P_SYMBOL : +return "symbol" ;case P_UNKNOWN :break ; }
Signature · 1 line
1.6.0.2.GIT
PATCH 6/13 kconfig: print all locations when we see a recursive dependency
In reply to Sam RavnborgIt is nessesary to know all locations when trying to track a recursive dependency. So print out all locations for each symbol.
Sample output:
Kconfig:1: found recursive dependency:
TEST1
-> TEST2 (Kconfig:4),(Kconfig:12)
-> TEST1 (Kconfig:1),(Kconfig:7)In a more complex example the symbols can be defined in different files thus making it harder to track.
--- scripts/kconfig/symbol.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-)
scripts/kconfig/symbol.c +18 -6
@@ -790,6 +790,21 @@ static struct symbol *sym_check_expr_deps(struct expr *e)return NULL ; } +static void print_symbol_location (struct symbol *sym) +{ +struct property *prop; +int comma =0 ; + +fprintf (stderr,"\t -> %s " , sym->name ? sym->name :"<choice>" ); +for (prop = sym->prop; prop; prop = prop->next) { +if (prop->type ==P_SYMBOL ) { +fprintf (stderr,"%s(%s:%d)" , + comma ?"," :"" , prop->file->name, prop->lineno); + comma =1 ; + } + } +fprintf (stderr,"\n" ); +}/* return NULL when dependencies are OK */ static struct symbol *sym_check_sym_deps (struct symbol *sym) {
@@ -835,7 +850,7 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice)expr_list_for_each_sym (prop->expr, e, sym) { sym2 =sym_check_sym_deps (sym);if (sym2) { -fprintf (stderr," -> %s" , sym->name); +print_symbol_location (sym);break ; } }
@@ -856,7 +871,7 @@ struct symbol *sym_check_deps(struct symbol *sym)struct property *prop;if (sym->flags &SYMBOL_CHECK ) { -fprintf (stderr,"%s:%d:error: found recursive dependency:\n" , +fprintf (stderr,"%s:%d: found recursive dependency:\n" , sym->prop->file->name, sym->prop->lineno);fprintf (stderr,"\t %s\n" , sym->name ? sym->name :"<choice>" );
@@ -878,11 +893,8 @@ struct symbol *sym_check_deps(struct symbol *sym) }if (sym2) { -fprintf (stderr,"\t -> %s (%s:%d)\n" , - sym->name ? sym->name :"<choice>" , - sym->prop->file->name, sym->prop->lineno); +print_symbol_location (sym);if (sym2 == sym) { -fprintf (stderr,"\n" ); zconfnerrs++; sym2 =NULL ; }
Signature · 1 line
1.6.0.2.GIT
Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
Hi,
Quoted 2 lines · Sam Ravnborg
It is nessesary to know all locations when trying to track a recursive dependency. So print out all locations for each symbol.
The problem is that this is little more than a better grep, although kconfig knows exactly what went wrong, but this info is scattered all over the stack.
We could either return more info to print more than just the symbol or maintain more info while traversing the tree. The patch below does the latter. The patch could use some small cleanups, so it's not final yet.
bye, Roman
--- scripts/kconfig/symbol.c | 139 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 124 insertions(+), 15 deletions(-)
scripts/kconfig/symbol.c +124 -15
@@ -760,6 +760,107 @@ struct symbol **sym_re_search(const char } +static struct dep_stack { +struct dep_stack *prev, *next; +struct symbol *sym; +struct property *prop; +struct expr *expr; +} *check_top; + +static void dep_stack_insert (struct dep_stack *stack,struct symbol *sym) +{ +memset (stack,0 ,sizeof (*stack)); +if (check_top) + check_top->next = stack; + stack->prev = check_top; + stack->sym = sym; + check_top = stack; +} + +static void dep_stack_remove (void ) +{ + check_top = check_top->prev; +if (check_top) + check_top->next =NULL ; +} + +static void sym_check_print_recursive (struct symbol *last_sym) +{ +struct dep_stack *stack; +struct symbol *sym, *next_sym; +struct menu *menu =NULL ; +struct property *prop; +struct dep_stack cv_stack; + + zconfnerrs++; +if (sym_is_choice_value (last_sym)) { +dep_stack_insert (&cv_stack, last_sym); + last_sym =prop_get_symbol (sym_get_choice_prop (last_sym)); + } + +for (stack = check_top; stack; stack = stack->prev) +if (stack->sym == last_sym) +break ; +if (!stack) { +fprintf (stderr,"unexpected recursive dependency error\n" ); +return ; + } + +for (; stack; stack = stack->next) { + sym = stack->sym; + next_sym = stack->next ? stack->next->sym : last_sym; + prop = stack->prop; +if (sym_is_choice (sym) ||sym_is_choice_value (sym)) { +for (prop = sym->prop; prop; prop = prop->next) { + menu = prop->menu; +if (prop->menu) +break ; + } + }else if (!prop) { +for (prop = next_sym->prop; prop; prop = prop->next) { +if (prop->type !=P_SELECT ) +continue ; +if (prop->expr->left.sym == sym) +break ; + } + } +if (stack->sym == last_sym) +fprintf (stderr,"%s:%d:error: recursive dependency detected!\n" , + prop->file->name, prop->lineno); +if (stack->expr) { +fprintf (stderr,"%s:%d:\tsymbol %s %s value contains %s\n" , + prop->file->name, prop->lineno, + sym->name ? sym->name :"<choice>" , +prop_get_type_name (prop->type), + next_sym->name ? next_sym->name :"<choice>" ); + }else if (stack->prop) { +fprintf (stderr,"%s:%d:\tsymbol %s %s depends on %s\n" , + prop->file->name, prop->lineno, + sym->name ? sym->name :"<choice>" , +prop_get_type_name (prop->type), + next_sym->name ? next_sym->name :"<choice>" ); + }else if (sym_is_choice (sym)) { +fprintf (stderr,"%s:%d:\tchoice %s contains symbol %s\n" , + menu->file->name, menu->lineno, + sym->name ? sym->name :"<choice>" , + next_sym->name ? next_sym->name :"<choice>" ); + }else if (sym_is_choice_value (sym)) { +fprintf (stderr,"%s:%d:\tsymbol %s is part of choice %s\n" , + menu->file->name, menu->lineno, + sym->name ? sym->name :"<choice>" , + next_sym->name ? next_sym->name :"<choice>" ); + }else { +fprintf (stderr,"%s:%d:\tsymbol %s is selected by %s\n" , + prop->file->name, prop->lineno, + sym->name ? sym->name :"<choice>" , + next_sym->name ? next_sym->name :"<choice>" ); + } + } + +if (check_top == &cv_stack) +dep_stack_remove (); +} +static struct symbol *sym_check_expr_deps (struct expr *e) {struct symbol *sym;
@@ -795,24 +896,33 @@ static struct symbol *sym_check_sym_deps {struct symbol *sym2;struct property *prop; +struct dep_stack stack; + +dep_stack_insert (&stack, sym); sym2 =sym_check_expr_deps (sym->rev_dep.expr);if (sym2) -return sym2; + goto out;for (prop = sym->prop; prop; prop = prop->next) {if (prop->type ==P_CHOICE || prop->type ==P_SELECT )continue ; + stack.prop = prop; sym2 =sym_check_expr_deps (prop->visible.expr);if (sym2)break ;if (prop->type !=P_DEFAULT ||sym_is_choice (sym))continue ; + stack.expr = prop->expr; sym2 =sym_check_expr_deps (prop->expr);if (sym2)break ; + stack.expr =NULL ; } +out: +dep_stack_remove (); +return sym2; }
@@ -821,6 +931,9 @@ static struct symbol *sym_check_choice_dstruct symbol *sym, *sym2;struct property *prop;struct expr *e; +struct dep_stack stack; + +dep_stack_insert (&stack, choice); prop =sym_get_choice_prop (choice);expr_list_for_each_sym (prop->expr, e, sym)
@@ -834,10 +947,8 @@ static struct symbol *sym_check_choice_dexpr_list_for_each_sym (prop->expr, e, sym) { sym2 =sym_check_sym_deps (sym); -if (sym2) { -fprintf (stderr," -> %s" , sym->name); +if (sym2)break ; - } } out:expr_list_for_each_sym (prop->expr, e, sym)
@@ -847,6 +958,8 @@ out: prop_get_symbol(sym_get_choice_prop(sym2)) == choice) sym2 = choice; +dep_stack_remove (); +return sym2; }
@@ -856,18 +969,20 @@ struct symbol *sym_check_deps(struct symstruct property *prop;if (sym->flags &SYMBOL_CHECK ) { -fprintf (stderr,"%s:%d:error: found recursive dependency: %s" , - sym->prop->file->name, sym->prop->lineno, - sym->name ? sym->name :"<choice>" ); +sym_check_print_recursive (sym);return sym; }if (sym->flags &SYMBOL_CHECKED )return NULL ;if (sym_is_choice_value (sym)) { +struct dep_stack stack; +/* for choice groups start the check with main choice symbol */ +dep_stack_insert (&stack, sym); prop =sym_get_choice_prop (sym); sym2 =sym_check_deps (prop_get_symbol (prop)); +dep_stack_remove (); }else if (sym_is_choice (sym)) { sym2 =sym_check_choice_deps (sym); }else {
@@ -876,14 +991,8 @@ struct symbol *sym_check_deps(struct sym sym->flags &= ~SYMBOL_CHECK ; } -if (sym2) { -fprintf (stderr," -> %s" , sym->name ? sym->name :"<choice>" ); -if (sym2 == sym) { -fprintf (stderr,"\n" ); - zconfnerrs++; - sym2 =NULL ; - } - } +if (sym2 && sym2 == sym) + sym2 =NULL ;return sym2; }
Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
Quoted 7 lines · Roman Zippel
Hi,
Quoted 2 lines · Sam Ravnborg
It is nessesary to know all locations when trying to track a recursive dependency. So print out all locations for each symbol.
Quoted 6 lines
The problem is that this is little more than a better grep, although kconfig knows exactly what went wrong, but this info is scattered all over the stack.
We could either return more info to print more than just the symbol or maintain more info while traversing the tree. The patch below does the latter. The patch could use some small cleanups, so it's not final yet.
Hi Roman.
I will drop
"[PATCH 05/13] kconfig: improve readout when we hit recursive dependencies" "[PATCH 06/13] kconfig: print all locations when we see a recursive dependency"
and will await an updated version of the patch below.
Notice that with your patch below we still hit the segmentation fault with the small test sample included in the description of 05/13:
config TEST1
bool
depends on TEST2 && PCI
select TEST2
config TEST2
boolI guess this was one of the cleanups you had in mind. I added a promt and then I got the following error message:
Kconfig:2:error: recursive dependency detected!
Kconfig:2: symbol TEST1 prompt depends on TEST2
Kconfig:4: symbol TEST2 is selected by TEST1
This is indeed better than before.
Kconfig:2: symbol TEST1 prompt depends on TEST2
should read:
Kconfig:2: symbol TEST1 depends on TEST2
As it just confuses with the "prompt" in the text.
It would be good to have the final patch ready soon so we can include it in 2.6.29.
Thanks,
Sam
Re: [PATCH 06/13] kconfig: print all locations when we see a recursive dependency
In reply to Roman ZippelQuoted 7 lines · Roman Zippel
Hi,
Quoted 2 lines · Sam Ravnborg
It is nessesary to know all locations when trying to track a recursive dependency. So print out all locations for each symbol.
Quoted 6 lines
The problem is that this is little more than a better grep, although kconfig knows exactly what went wrong, but this info is scattered all over the stack.
We could either return more info to print more than just the symbol or maintain more info while traversing the tree. The patch below does the latter. The patch could use some small cleanups, so it's not final yet.
Hi Roman.
Have you had time to look more into this?
Sam
PATCH 7/13 kconfig: improve error messages for bad source statements
In reply to Sam RavnborgWe now say where we detect the second source of a file, and where we detect a recursively source of the same file. This makes it easier to fix such errors.
--- scripts/kconfig/lex.zconf.c_shipped | 7 +++++-- scripts/kconfig/zconf.l | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
scripts/kconfig/lex.zconf.c_shipped +5 -2
@@ -2370,11 +2370,14 @@ void zconf_nextfile(const char *name) current_buf = buf; if (file->flags & FILE_BUSY) { - printf("recursive scan (%s)?\n", name); + printf("%s:%d: do not source '%s' from itself\n", + zconf_curname(), zconf_lineno(), name); exit(1); } if (file->flags & FILE_SCANNED) { - printf("file %s already scanned?\n", name); + printf("%s:%d: file '%s' is already sourced from '%s'\n", + zconf_curname(), zconf_lineno(), name, + file->parent->name); exit(1); } file->flags |= FILE_BUSY;
scripts/kconfig/zconf.l +5 -2
@@ -314,11 +314,14 @@ void zconf_nextfile(const char *name) current_buf = buf; if (file->flags & FILE_BUSY) { - printf("recursive scan (%s)?\n", name); + printf("%s:%d: do not source '%s' from itself\n", + zconf_curname(), zconf_lineno(), name); exit(1); } if (file->flags & FILE_SCANNED) { - printf("file %s already scanned?\n", name); + printf("%s:%d: file '%s' is already sourced from '%s'\n", + zconf_curname(), zconf_lineno(), name, + file->parent->name); exit(1); } file->flags |= FILE_BUSY;
Signature · 1 line
1.6.0.2.GIT
PATCH 8/13 headers_check.pl: disallow extern's
In reply to Sam RavnborgFrom: Mike Frysinger <[email protected]>
Since prototypes with "extern" refer to kernel functions, they make no sense in userspace, so reject them automatically.
--- scripts/headers_check.pl | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
scripts/headers_check.pl +11 -1
@@ -14,7 +14,9 @@ # Only include files located in asm* and linux* are checked. # The rest are assumed to be system include files. # -# 2) TODO: check for leaked CONFIG_ symbols +# 2) It is checked that prototypes does not use "extern" +# +# 3) TODO: check for leaked CONFIG_ symbols use strict;
@@ -33,6 +35,7 @@ foreach my $file (@files) { while ($line = <FH>) { $lineno++; check_include(); + check_prototypes(); } close FH; }
@@ -54,3 +57,10 @@ sub check_include } } } + +sub check_prototypes +{ + if ($line =~ m/^\s*extern\b/) { + printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; + } +}
Signature · 1 line
1.6.0.2.GIT
PATCH 9/13 kbuild: check for leaked CONFIG_ symbols to userspace
In reply to Sam Ravnborg--- scripts/headers_check.pl | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
scripts/headers_check.pl +10 -1
@@ -16,7 +16,7 @@ # # 2) It is checked that prototypes does not use "extern" # -# 3) TODO: check for leaked CONFIG_ symbols +# 3) Check for leaked CONFIG_ symbols use strict;
@@ -36,6 +36,7 @@ foreach my $file (@files) { $lineno++; check_include(); check_prototypes(); + check_config(); } close FH; }
@@ -64,3 +65,11 @@ sub check_prototypes printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; } } + +sub check_config +{ + if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) { + printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n"; + } +} +
Signature · 1 line
1.6.0.2.GIT
PATCH 10/13 kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__
In reply to Sam RavnborgFrom: Mike Frysinger <[email protected]>
Headers in userspace should be using the __xxx__ form of the asm, inline, and volatile keywords. Since people like to revert these things without realizing what's going on, have the headers install step autoconvert these keywords.
--- scripts/headers_install.pl | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/headers_install.pl +3 -0
@@ -36,6 +36,9 @@ foreach my $file (@files) { $line =~ s/\s__attribute_const__\s/ /g; $line =~ s/\s__attribute_const__$//g; $line =~ s/^#include <linux\/compiler.h>//; + $line =~ s/(^|\s)(inline)\b/$1__$2__/g; + $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; + $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; printf OUTFILE "%s", $line; } close OUTFILE;
Signature · 1 line
1.6.0.2.GIT
PATCH 11/13 kbuild: disable sparse warning "returning void-valued expression"
In reply to Sam RavnborgFrom: Hannes Eder <[email protected]>
The sparse warning -Wreturn-void ("returning void-valued expression") is off by default, but it is enabled with -Wall, so add -Wno-return-void to CHECKFLAGS to disable it.
--- Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Makefile +2 -1
@@ -320,7 +320,8 @@ KALLSYMS = scripts/kallsyms PERL = perl CHECK = sparse -CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF) +CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ + -Wbitwise -Wno-return-void $(CF) MODFLAGS = -DMODULE CFLAGS_MODULE = $(MODFLAGS) AFLAGS_MODULE = $(MODFLAGS)
Signature · 1 line
1.6.0.2.GIT
PATCH 12/13 kbuild: make *config usage docs
In reply to Sam RavnborgFrom: Randy Dunlap <[email protected]>
Create a kconfig user assistance guide, with a few tips and hints about using menuconfig, xconfig, and gconfig.
Mostly contains user interface, environment variables, and search topics, along with mini.config/custom.config usage.
--- Documentation/kbuild/00-INDEX | 2 + Documentation/kbuild/kconfig.txt | 188 ++++++++++++++++++++++++++++++++++++++ README | 32 ++++--- 3 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 Documentation/kbuild/kconfig.txt
Documentation/kbuild/00-INDEX +2 -0
@@ -4,5 +4,7 @@ kconfig-language.txt - specification of Config Language, the language in Kconfig files makefiles.txt - developer information for linux kernel makefiles +kconfig.txt + - usage help for make *config modules.txt - how to build modules and to install them
Documentation/kbuild/kconfig.txt new file +188 -0
188 lines not on this page · raw message
README +20 -12
@@ -52,11 +52,11 @@ DOCUMENTATION: - The Documentation/DocBook/ subdirectory contains several guides for kernel developers and users. These guides can be rendered in a - number of formats: PostScript (.ps), PDF, and HTML, among others. - After installation, "make psdocs", "make pdfdocs", or "make htmldocs" - will render the documentation in the requested format. + number of formats: PostScript (.ps), PDF, HTML, & man-pages, among others. + After installation, "make psdocs", "make pdfdocs", "make htmldocs", + or "make mandocs" will render the documentation in the requested format. -INSTALLING the kernel: +INSTALLING the kernel source: - If you install the full sources, put the kernel tarball in a directory where you have permissions (eg. your home directory) and
@@ -187,14 +187,9 @@ CONFIGURING the kernel: "make randconfig" Create a ./.config file by setting symbol values to random values. - The allyesconfig/allmodconfig/allnoconfig/randconfig variants can - also use the environment variable KCONFIG_ALLCONFIG to specify a - filename that contains config options that the user requires to be - set to a specific value. If KCONFIG_ALLCONFIG=filename is not used, - "make *config" checks for a file named "all{yes/mod/no/random}.config" - for symbol values that are to be forced. If this file is not found, - it checks for a file named "all.config" to contain forced values. - + You can find more information on using the Linux kernel config tools + in Documentation/kbuild/make-configs.txt. + NOTES on "make config": - having unnecessary drivers will make the kernel bigger, and can under some circumstances lead to problems: probing for a
@@ -231,6 +226,19 @@ COMPILING the kernel: - If you configured any of the parts of the kernel as `modules', you will also have to do "make modules_install". + - Verbose kernel compile/build output: + + Normally the kernel build system runs in a fairly quiet mode (but not + totally silent). However, sometimes you or other kernel developers need + to see compile, link, or other commands exactly as they are executed. + For this, use "verbose" build mode. This is done by inserting + "V=1" in the "make" command. E.g.: + + make V=1 all + + To have the build system also tell the reason for the rebuild of each + target, use "V=2". The default is "V=0". + - Keep a backup kernel handy in case something goes wrong. This is especially true for the development releases, since each new release contains new code which has not been debugged. Make sure you keep a
Signature · 1 line
1.6.0.2.GIT
PATCH 13/13 kbuild: document environment variables
In reply to Sam RavnborgAdd kbuild.txt to Documentation/kbuild
More stuff can be added later - at least we have som of the varous environment variables documented now.
--- Documentation/kbuild/00-INDEX | 8 ++- Documentation/kbuild/kbuild.txt | 126 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 Documentation/kbuild/kbuild.txt
Documentation/kbuild/00-INDEX +5 -3
@@ -1,10 +1,12 @@ 00-INDEX - - this file: info on the kernel build process + - this file: info on the kernel build process +kbuild.txt + - developer information on kbuild +kconfig.txt + - usage help for make *config kconfig-language.txt - specification of Config Language, the language in Kconfig files makefiles.txt - developer information for linux kernel makefiles -kconfig.txt - - usage help for make *config modules.txt - how to build modules and to install them
Documentation/kbuild/kbuild.txt new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.6.0.2.GIT