* Re: kbuild: Preparing for merge window
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
@ 2008-01-24 22:00 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 01/77] kernel-doc: fix xml output mode Sam Ravnborg
` (77 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:00 UTC (permalink / raw)
To: linux-kbuild, LKML
On Thu, Jan 24, 2008 at 10:58:13PM +0100, Sam Ravnborg wrote:
> The following is the list of patches queued up for the merge window at the moment.
> I have during the last week done several modpost changes to make section ismatch
> warnings more reliable and I am happy with the modified modpost code now.
>
> The warnings generated will if CONFIG_DEBUG_SECTION_MISMATCH=y be verbose
> so it better guides the developer how to fix the warning.
>
> Other patches of interest:
>
> - We now have separate sections for all init/exit annotations
> - We have restarted getting kconfig globalized, pending is widechar support
> - Support for modules.order to tell in what order to load modules
> - lots of small fixes/enhancements
>
> The diffstat say that we touch a lot of files.
> This is due to the following changes (mainly):
> - consolidation touching all .lds.S files
> - removal ofstale comment about make dep
> - removal of obsolete __attribute_used__
> - removal of TOPDIR
>
> Patches will follow for review.
Patches will be sent to linux-kbuild only.
Sam
^ permalink raw reply [flat|nested] 100+ messages in thread* [PATCH 01/77] kernel-doc: fix xml output mode
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
2008-01-24 22:00 ` Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 02/77] kernel-doc: init kernel version Sam Ravnborg
` (76 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
After Randy's patch fixing the HTML output in DOC: sections
(6b5b55f6c404fa730a09a8254eb19f5a038afcc2) the same bug remained in XML
mode, this fixes it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kernel-doc | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 1d14018..e4fa8d9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -182,10 +182,10 @@ my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>",
$type_constant, "<constant>\$1</constant>",
$type_func, "<function>\$1</function>",
- $type_struct, "<structname>\$1</structname>",
+ $type_struct_xml, "<structname>\$1</structname>",
$type_env, "<envar>\$1</envar>",
$type_param, "<parameter>\$1</parameter>" );
-my $blankline_xml = "</para><para>\n";
+my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
# gnome, docbook format
my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>",
@@ -394,7 +394,7 @@ sub output_highlight {
# confess "output_highlight got called with no args?\n";
# }
- if ($output_mode eq "html") {
+ if ($output_mode eq "html" || $output_mode eq "xml") {
$contents = local_unescape($contents);
# convert data read & converted thru xml_escape() into &xyz; format:
$contents =~ s/\\\\\\/&/g;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 02/77] kernel-doc: init kernel version
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
2008-01-24 22:00 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 01/77] kernel-doc: fix xml output mode Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 03/77] kernel-doc: single DOC: selection Sam Ravnborg
` (75 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
The kernel-doc script triggers a perl warning when invoked
without KERNELVERSION in the environment, rather make it use
the string "unknown kernel version" instead.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kernel-doc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index e4fa8d9..8cf528b 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -334,7 +334,7 @@ while ($ARGV[0] =~ m/^-(.*)/) {
# get kernel version from env
sub get_kernel_version() {
- my $version;
+ my $version = 'unknown kernel version';
if (defined($ENV{'KERNELVERSION'})) {
$version = $ENV{'KERNELVERSION'};
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 03/77] kernel-doc: single DOC: selection
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (2 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 02/77] kernel-doc: init kernel version Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 04/77] kernel-doc: process functions, not DOC: Sam Ravnborg
` (74 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
Currently, DOC: sections are always output even if only a single
function is requested, fix this and also make it possible to just
output a single DOC: section by giving its title as the function
name to output.
Also fixes docbook XML well-formedness for sections with examples.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kernel-doc | 63 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8cf528b..8255f72 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -54,13 +54,13 @@ use strict;
# Set output format using one of -docbook -html -text or -man. Default is man.
#
# -function funcname
-# If set, then only generate documentation for the given function(s). All
-# other functions are ignored.
+# If set, then only generate documentation for the given function(s) or
+# DOC: section titles. All other functions and DOC: sections are ignored.
#
# -nofunction funcname
-# If set, then only generate documentation for the other function(s).
-# Cannot be used together with -function
-# (yes, that's a bug -- perl hackers can fix it 8))
+# If set, then only generate documentation for the other function(s)/DOC:
+# sections. Cannot be used together with -function (yes, that's a bug --
+# perl hackers can fix it 8))
#
# c files - list of 'c' files to process
#
@@ -374,6 +374,25 @@ sub dump_section {
}
##
+# dump DOC: section after checking that it should go out
+#
+sub dump_doc_section {
+ my $name = shift;
+ my $contents = join "\n", @_;
+
+ if (($function_only == 0) ||
+ ( $function_only == 1 && defined($function_table{$name})) ||
+ ( $function_only == 2 && !defined($function_table{$name})))
+ {
+ dump_section $name, $contents;
+ output_blockhead({'sectionlist' => \@sectionlist,
+ 'sections' => \%sections,
+ 'module' => $modulename,
+ 'content-only' => ($function_only != 0), });
+ }
+}
+
+##
# output function
#
# parameterdescs, a hash.
@@ -564,8 +583,8 @@ sub output_function_html(%) {
print "<hr>\n";
}
-# output intro in html
-sub output_intro_html(%) {
+# output DOC: block header in html
+sub output_blockhead_html(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
@@ -871,7 +890,7 @@ sub output_typedef_xml(%) {
}
# output in XML DocBook
-sub output_intro_xml(%) {
+sub output_blockhead_xml(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
@@ -882,15 +901,23 @@ sub output_intro_xml(%) {
# print out each section
$lineprefix=" ";
foreach $section (@{$args{'sectionlist'}}) {
- print "<refsect1>\n <title>$section</title>\n <para>\n";
+ if (!$args{'content-only'}) {
+ print "<refsect1>\n <title>$section</title>\n";
+ }
if ($section =~ m/EXAMPLE/i) {
print "<example><para>\n";
+ } else {
+ print "<para>\n";
}
output_highlight($args{'sections'}{$section});
if ($section =~ m/EXAMPLE/i) {
print "</para></example>\n";
+ } else {
+ print "</para>";
+ }
+ if (!$args{'content-only'}) {
+ print "\n</refsect1>\n";
}
- print " </para>\n</refsect1>\n";
}
print "\n\n";
@@ -1137,7 +1164,7 @@ sub output_typedef_man(%) {
}
}
-sub output_intro_man(%) {
+sub output_blockhead_man(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
@@ -1294,7 +1321,7 @@ sub output_struct_text(%) {
output_section_text(@_);
}
-sub output_intro_text(%) {
+sub output_blockhead_text(%) {
my %args = %{$_[0]};
my ($parameter, $section);
@@ -1325,9 +1352,9 @@ sub output_declaration {
##
# generic output function - calls the right one based on current output mode.
-sub output_intro {
+sub output_blockhead {
no strict 'refs';
- my $func = "output_intro_".$output_mode;
+ my $func = "output_blockhead_".$output_mode;
&$func(@_);
$section_counter++;
}
@@ -1926,9 +1953,7 @@ sub process_file($) {
} elsif ($state == 4) {
# Documentation block
if (/$doc_block/) {
- dump_section($section, xml_escape($contents));
- output_intro({'sectionlist' => \@sectionlist,
- 'sections' => \%sections });
+ dump_doc_section($section, xml_escape($contents));
$contents = "";
$function = "";
%constants = ();
@@ -1946,9 +1971,7 @@ sub process_file($) {
}
elsif (/$doc_end/)
{
- dump_section($section, xml_escape($contents));
- output_intro({'sectionlist' => \@sectionlist,
- 'sections' => \%sections });
+ dump_doc_section($section, xml_escape($contents));
$contents = "";
$function = "";
%constants = ();
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 04/77] kernel-doc: process functions, not DOC:
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (3 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 03/77] kernel-doc: single DOC: selection Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 05/77] kernel-doc: use no-doc option Sam Ravnborg
` (73 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
This flag is necessary for the next patch for docproc to output
only the functions and not DOC: sections when a function list
is requested.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kernel-doc | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8255f72..ec54f12 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -46,13 +46,16 @@ use strict;
# Note: This only supports 'c'.
# usage:
-# kernel-doc [ -docbook | -html | -text | -man ]
+# kernel-doc [ -docbook | -html | -text | -man ] [ -no-doc-sections ]
# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile
# or
# [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile
#
# Set output format using one of -docbook -html -text or -man. Default is man.
#
+# -no-doc-sections
+# Do not output DOC: sections
+#
# -function funcname
# If set, then only generate documentation for the given function(s) or
# DOC: section titles. All other functions and DOC: sections are ignored.
@@ -211,7 +214,7 @@ my $blankline_text = "";
sub usage {
- print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man ]\n";
+ print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man ] [ -no-doc-sections ]\n";
print " [ -function funcname [ -function funcname ...] ]\n";
print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
print " c source file(s) > outputfile\n";
@@ -225,6 +228,7 @@ if ($#ARGV==-1) {
my $verbose = 0;
my $output_mode = "man";
+my $no_doc_sections = 0;
my %highlights = %highlights_man;
my $blankline = $blankline_man;
my $modulename = "Kernel API";
@@ -329,6 +333,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {
usage();
} elsif ($cmd eq '-filelist') {
$filelist = shift @ARGV;
+ } elsif ($cmd eq '-no-doc-sections') {
+ $no_doc_sections = 1;
}
}
@@ -380,6 +386,10 @@ sub dump_doc_section {
my $name = shift;
my $contents = join "\n", @_;
+ if ($no_doc_sections) {
+ return;
+ }
+
if (($function_only == 0) ||
( $function_only == 1 && defined($function_table{$name})) ||
( $function_only == 2 && !defined($function_table{$name})))
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 05/77] kernel-doc: use no-doc option
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (4 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 04/77] kernel-doc: process functions, not DOC: Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 06/77] kernel-doc: new P directive for DOC: sections Sam Ravnborg
` (72 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
When asked by a template to include all functions from a file,
it will also include DOC: sections wreaking havoc in the generated
docbook file. This patch makes it use the new -no-doc-sections
flag for kernel-doc to avoid this.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/basic/docproc.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 0e4bd54..7eae534 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -65,6 +65,7 @@ FILELINE * entity_system;
#define DOCBOOK "-docbook"
#define FUNCTION "-function"
#define NOFUNCTION "-nofunction"
+#define NODOCSECTIONS "-no-doc-sections"
char *srctree;
@@ -231,13 +232,14 @@ void docfunctions(char * filename, char * type)
for (i=0; i <= symfilecnt; i++)
symcnt += symfilelist[i].symbolcnt;
- vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*));
+ vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *));
if (vec == NULL) {
perror("docproc: ");
exit(1);
}
vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK;
+ vec[idx++] = NODOCSECTIONS;
for (i=0; i < symfilecnt; i++) {
struct symfile * sym = &symfilelist[i];
for (j=0; j < sym->symbolcnt; j++) {
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 06/77] kernel-doc: new P directive for DOC: sections
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (5 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 05/77] kernel-doc: use no-doc option Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 07/77] kbuild: add 'includecheck' help text Sam Ravnborg
` (71 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Randy Dunlap, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
The !P directive includes the contents of a DOC: section
given by title, e.g.
!Pfilename Title of the section
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/basic/docproc.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 7eae534..35bdc68 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -30,6 +30,7 @@
* !Ifilename
* !Dfilename
* !Ffilename
+ * !Pfilename
*
*/
@@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
typedef void FILELINE(char * file, char * line);
FILELINE * singlefunctions;
FILELINE * entity_system;
+FILELINE * docsection;
#define MAXLINESZ 2048
#define MAXFILES 250
@@ -289,12 +291,36 @@ void singfunc(char * filename, char * line)
}
/*
+ * Insert specific documentation section from a file.
+ * Call kernel-doc with the following parameters:
+ * kernel-doc -docbook -function "doc section" filename
+ */
+void docsect(char *filename, char *line)
+{
+ char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
+ char *s;
+
+ for (s = line; *s; s++)
+ if (*s == '\n')
+ *s = '\0';
+
+ vec[0] = KERNELDOC;
+ vec[1] = DOCBOOK;
+ vec[2] = FUNCTION;
+ vec[3] = line;
+ vec[4] = filename;
+ vec[5] = NULL;
+ exec_kernel_doc(vec);
+}
+
+/*
* Parse file, calling action specific functions for:
* 1) Lines containing !E
* 2) Lines containing !I
* 3) Lines containing !D
* 4) Lines containing !F
- * 5) Default lines - lines not matching the above
+ * 5) Lines containing !P
+ * 6) Default lines - lines not matching the above
*/
void parse_file(FILE *infile)
{
@@ -328,6 +354,15 @@ void parse_file(FILE *infile)
s++;
singlefunctions(line +2, s);
break;
+ case 'P':
+ /* filename */
+ while (*s && !isspace(*s)) s++;
+ *s++ = '\0';
+ /* DOC: section name */
+ while (isspace(*s))
+ s++;
+ docsection(line + 2, s);
+ break;
default:
defaultline(line);
}
@@ -374,6 +409,7 @@ int main(int argc, char *argv[])
externalfunctions = find_export_symbols;
symbolsonly = find_export_symbols;
singlefunctions = noaction2;
+ docsection = noaction2;
parse_file(infile);
/* Rewind to start from beginning of file again */
@@ -383,6 +419,7 @@ int main(int argc, char *argv[])
externalfunctions = extfunc;
symbolsonly = printline;
singlefunctions = singfunc;
+ docsection = docsect;
parse_file(infile);
}
@@ -396,6 +433,7 @@ int main(int argc, char *argv[])
externalfunctions = adddep;
symbolsonly = adddep;
singlefunctions = adddep2;
+ docsection = adddep2;
parse_file(infile);
printf("\n");
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 07/77] kbuild: add 'includecheck' help text
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (6 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 06/77] kernel-doc: new P directive for DOC: sections Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 08/77] kbuild: document versioncheck in make help Sam Ravnborg
` (70 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Randy Dunlap, Sam Ravnborg
From: Randy Dunlap <randy.dunlap@oracle.com>
Add 'includecheck' to the Static analyzers help list.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index ce641eb..79c48b2 100644
--- a/Makefile
+++ b/Makefile
@@ -1188,6 +1188,7 @@ help:
@echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel'
+ @echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
@if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
echo ' headers_check - Sanity check on exported headers'; \
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 08/77] kbuild: document versioncheck in make help
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (7 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 07/77] kbuild: add 'includecheck' help text Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 09/77] kbuild: Add missing srctree prefix for includecheck and versioncheck Sam Ravnborg
` (69 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 79c48b2..39b9bfe 100644
--- a/Makefile
+++ b/Makefile
@@ -1188,6 +1188,7 @@ help:
@echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel'
+ @echo ' versioncheck - Sanity check on version.h usage'
@echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
@if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 09/77] kbuild: Add missing srctree prefix for includecheck and versioncheck
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (8 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 08/77] kbuild: document versioncheck in make help Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 10/77] convert drivers/base/power/Makefile to ccflags Sam Ravnborg
` (68 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Geert Uytterhoeven, Sam Ravnborg
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Add missing $(srctree)/ prefix for scripts used by the includecheck and
versioncheck make targets
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 39b9bfe..c546e05 100644
--- a/Makefile
+++ b/Makefile
@@ -1430,12 +1430,12 @@ tags: FORCE
includecheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
- | xargs $(PERL) -w scripts/checkincludes.pl
+ | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
versioncheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
- | xargs $(PERL) -w scripts/checkversion.pl
+ | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
namespacecheck:
$(PERL) $(srctree)/scripts/namespace.pl
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 10/77] convert drivers/base/power/Makefile to ccflags
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (9 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 09/77] kbuild: Add missing srctree prefix for includecheck and versioncheck Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 11/77] aic7(3*x): fix firmware build Sam Ravnborg
` (67 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Johannes Berg, Sam Ravnborg
From: Johannes Berg <johannes@sipsolutions.net>
This patch converts drivers/base/power/Makefile to use ccflags instead
of EXTRA_CFLAGS.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
drivers/base/power/Makefile | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index 44504e6..15e2f1d 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -3,9 +3,5 @@ obj-$(CONFIG_PM) += sysfs.o
obj-$(CONFIG_PM_SLEEP) += main.o
obj-$(CONFIG_PM_TRACE) += trace.o
-ifeq ($(CONFIG_DEBUG_DRIVER),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
-ifeq ($(CONFIG_PM_VERBOSE),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
+ccflags-$(CONFIG_PM_VERBOSE) += -DDEBUG
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 11/77] aic7(3*x): fix firmware build
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (10 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 10/77] convert drivers/base/power/Makefile to ccflags Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 12/77] kbuild: implement modules.order Sam Ravnborg
` (66 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Vegard Nossum, Sam Ravnborg, linux-scsi
From: Vegard Nossum <vegard.nossum@gmail.com>
This patch adds the proper $(obj) and $(src) prefixes to dependency
rules in aic7xxx makefile. Without this patch, there is a remote
possibility that parallel make with a different output directory can
fail.
Also changed the deprecated EXTRA_CFLAGS construct to ccflags-y syntax.
Fixed up patch to survive "make drivers/scsi/ -j"
with BUILD_FIRMWARE enable. /Sam
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/aic7xxx/Makefile | 45 ++++++++++++++++------------------------
1 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile
index 9a6ce19..e4f70c5 100644
--- a/drivers/scsi/aic7xxx/Makefile
+++ b/drivers/scsi/aic7xxx/Makefile
@@ -33,11 +33,10 @@ aic79xx-y += aic79xx_osm.o \
aic79xx_proc.o \
aic79xx_osm_pci.o
-EXTRA_CFLAGS += -Idrivers/scsi
+ccflags-y += -Idrivers/scsi
ifdef WARNINGS_BECOME_ERRORS
-EXTRA_CFLAGS += -Werror
+ccflags-y += -Werror
endif
-#EXTRA_CFLAGS += -g
# Files generated that shall be removed upon make clean
clean-files := aic7xxx_seq.h aic7xxx_reg.h aic7xxx_reg_print.c
@@ -46,53 +45,45 @@ clean-files += aic79xx_seq.h aic79xx_reg.h aic79xx_reg_print.c
# Dependencies for generated files need to be listed explicitly
$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h
+$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_reg.h
$(obj)/aic79xx_core.o: $(obj)/aic79xx_seq.h
-$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped
-$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
+$(obj)/aic79xx_core.o: $(obj)/aic79xx_reg.h
-$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_reg.h
-$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_reg.h
+$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_seq.h
+$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_seq.h
-aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_seq.h \
- $(obj)/aic7xxx_reg.h
+aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h
aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c
aicasm-7xxx-opts-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) := \
-p $(obj)/aic7xxx_reg_print.c -i aic7xxx_osm.h
ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
-# Create a dependency chain in generated files
-# to avoid concurrent invocations of the single
-# rule that builds them all.
-aic7xxx_seq.h: aic7xxx_reg.h
-ifeq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT),y)
-aic7xxx_reg.h: aic7xxx_reg_print.c
-endif
-$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
+$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \
$(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \
$(src)/aic7xxx.seq
+
+$(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h
+else
+$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
endif
-aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_seq.h \
- $(obj)/aic79xx_reg.h
+aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_reg.h
aic79xx-gen-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) += $(obj)/aic79xx_reg_print.c
aicasm-79xx-opts-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) := \
-p $(obj)/aic79xx_reg_print.c -i aic79xx_osm.h
ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
-# Create a dependency chain in generated files
-# to avoid concurrent invocations of the single
-# rule that builds them all.
-aic79xx_seq.h: aic79xx_reg.h
-ifeq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT),y)
-aic79xx_reg.h: aic79xx_reg_print.c
-endif
-$(aic79xx-gen-y): $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
+$(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \
$(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \
$(src)/aic79xx.seq
+
+$(aic79xx-gen-y): $(obj)/aic79xx_seq.h
+else
+$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped
endif
$(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl]
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 12/77] kbuild: implement modules.order
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (11 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 11/77] aic7(3*x): fix firmware build Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:46 ` Greg KH
2008-01-25 3:19 ` Rusty Russell
2008-01-24 22:02 ` [PATCH 13/77] kconfig: if ncurses-devel is missing then say so Sam Ravnborg
` (65 subsequent siblings)
78 siblings, 2 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild
Cc: Tejun Heo, Bill Nottingham, Rusty Russell, Greg Kroah-Hartman,
Kay Sievers, Sam Ravnborg
From: Tejun Heo <htejun@gmail.com>
When multiple built-in modules (especially drivers) provide the same
capability, they're prioritized by link order specified by the order
listed in Makefile. This implicit ordering is lost for loadable
modules.
When driver modules are loaded by udev, what comes first in
modules.alias file is selected. However, the order in this file is
indeterministic (depends on filesystem listing order of installed
modules). This causes confusion.
The solution is two-parted. This patch updates kbuild such that it
generates and installs modules.order which contains the name of
modules ordered according to Makefile. The second part is update to
depmod such that it generates output files according to this file.
Note that both obj-y and obj-m subdirs can contain modules and
ordering information between those two are lost from beginning.
Currently obj-y subdirs are put before obj-m subdirs.
Sam Ravnborg cleaned up Makefile modifications and suggested using awk
to remove duplicate lines from modules.order instead of using separate
C program.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Bill Nottingham <notting@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 8 +++++++-
scripts/Makefile.build | 17 ++++++++++++++++-
scripts/Makefile.lib | 6 ++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index c546e05..532981a 100644
--- a/Makefile
+++ b/Makefile
@@ -1021,9 +1021,14 @@ ifdef CONFIG_MODULES
all: modules
# Build modules
+#
+# A module can be listed more than once in obj-m resulting in
+# duplicate lines in modules.order files. Those are removed
+# using awk while concatenating to the final file.
PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
+ $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -1051,6 +1056,7 @@ _modinst_:
rm -f $(MODLIB)/build ; \
ln -s $(objtree) $(MODLIB)/build ; \
fi
+ @cp -f $(objtree)/modules.order $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial
@@ -1110,7 +1116,7 @@ clean: archclean $(clean-dirs)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
- -o -name '*.symtypes' \) \
+ -o -name '*.symtypes' -o -name 'modules.order' \) \
-type f -print | xargs rm -f
# mrproper - Delete all generated files, including .config
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de9836e..db38ef4 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
builtin-target := $(obj)/built-in.o
endif
+modorder-target := $(obj)/modules.order
+
# We keep a list of all modules in $(MODVERDIR)
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
- $(if $(KBUILD_MODULES),$(obj-m)) \
+ $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
$(subdir-ym) $(always)
@:
@@ -276,6 +278,19 @@ targets += $(builtin-target)
endif # builtin-target
#
+# Rule to create modules.order file
+#
+# Create commands to either record .ko file or cat modules.order from
+# a subdirectory
+modorder-cmds = \
+ $(foreach m, $(modorder), \
+ $(if $(filter %/modules.order, $m), \
+ cat $m;, echo kernel/$m;))
+
+$(modorder-target): $(subdir-ym) FORCE
+ $(Q)(cat /dev/null; $(modorder-cmds)) > $@
+
+#
# Rule to compile a set of .o files into one .a file
#
ifdef lib-target
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3c5e88b..8e44023 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
# and add the directory to the list of dirs to descend into: $(subdir-m)
+# Determine modorder.
+# Unfortunately, we don't have information about ordering between -y
+# and -m subdirs. Just put -y's first.
+modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
+
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
@@ -64,6 +69,7 @@ real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)
extra-y := $(addprefix $(obj)/,$(extra-y))
always := $(addprefix $(obj)/,$(always))
targets := $(addprefix $(obj)/,$(targets))
+modorder := $(addprefix $(obj)/,$(modorder))
obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
lib-y := $(addprefix $(obj)/,$(lib-y))
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-24 22:02 ` [PATCH 12/77] kbuild: implement modules.order Sam Ravnborg
@ 2008-01-24 22:46 ` Greg KH
2008-01-25 3:19 ` Rusty Russell
1 sibling, 0 replies; 100+ messages in thread
From: Greg KH @ 2008-01-24 22:46 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-kbuild, Tejun Heo, Bill Nottingham, Rusty Russell,
Kay Sievers
On Thu, Jan 24, 2008 at 11:02:53PM +0100, Sam Ravnborg wrote:
> From: Tejun Heo <htejun@gmail.com>
>
> When multiple built-in modules (especially drivers) provide the same
> capability, they're prioritized by link order specified by the order
> listed in Makefile. This implicit ordering is lost for loadable
> modules.
>
> When driver modules are loaded by udev, what comes first in
> modules.alias file is selected. However, the order in this file is
> indeterministic (depends on filesystem listing order of installed
> modules). This causes confusion.
>
> The solution is two-parted. This patch updates kbuild such that it
> generates and installs modules.order which contains the name of
> modules ordered according to Makefile. The second part is update to
> depmod such that it generates output files according to this file.
>
> Note that both obj-y and obj-m subdirs can contain modules and
> ordering information between those two are lost from beginning.
> Currently obj-y subdirs are put before obj-m subdirs.
>
> Sam Ravnborg cleaned up Makefile modifications and suggested using awk
> to remove duplicate lines from modules.order instead of using separate
> C program.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> Cc: Bill Nottingham <notting@redhat.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
thanks,
greg k-h
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-24 22:02 ` [PATCH 12/77] kbuild: implement modules.order Sam Ravnborg
2008-01-24 22:46 ` Greg KH
@ 2008-01-25 3:19 ` Rusty Russell
2008-01-25 3:29 ` Tejun Heo
1 sibling, 1 reply; 100+ messages in thread
From: Rusty Russell @ 2008-01-25 3:19 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-kbuild, Tejun Heo, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
On Friday 25 January 2008 09:02:53 Sam Ravnborg wrote:
> From: Tejun Heo <htejun@gmail.com>
>
> When driver modules are loaded by udev, what comes first in
> modules.alias file is selected.
Actually, I had occasion to look at this the other day, and in the modprobe
version here every match is selected. And they'll be loaded in reverse order
of the module.alias file.
Looks like Jon's latest git tree does the same.
So, what does this patch actually fix?
Confused,
Rusty.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-25 3:19 ` Rusty Russell
@ 2008-01-25 3:29 ` Tejun Heo
2008-01-25 5:00 ` Jon Masters
2008-01-26 4:01 ` Rusty Russell
0 siblings, 2 replies; 100+ messages in thread
From: Tejun Heo @ 2008-01-25 3:29 UTC (permalink / raw)
To: Rusty Russell
Cc: Sam Ravnborg, linux-kbuild, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
Rusty Russell wrote:
> On Friday 25 January 2008 09:02:53 Sam Ravnborg wrote:
>> From: Tejun Heo <htejun@gmail.com>
>>
>> When driver modules are loaded by udev, what comes first in
>> modules.alias file is selected.
>
> Actually, I had occasion to look at this the other day, and in the modprobe
> version here every match is selected.
What do you mean by "every match is selected"?
> And they'll be loaded in reverse order of the module.alias file.
What do you mean by 'loaded'?
> Looks like Jon's latest git tree does the same.
>
> So, what does this patch actually fix?
This patch makes kbuild generate modules.order and another patch makes
depmod generate modules.alias or whatever else according to the order
specified in modules.order, so that modprobe prefer modules which is
earlier in the linking order.
So, are you saying that modprobe chooses modules in the reverse order of
modules.alias file?
--
tejun
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-25 3:29 ` Tejun Heo
@ 2008-01-25 5:00 ` Jon Masters
2008-01-26 4:01 ` Rusty Russell
1 sibling, 0 replies; 100+ messages in thread
From: Jon Masters @ 2008-01-25 5:00 UTC (permalink / raw)
To: Tejun Heo
Cc: Rusty Russell, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
On Fri, 2008-01-25 at 12:29 +0900, Tejun Heo wrote:
> This patch makes kbuild generate modules.order and another patch makes
> depmod generate modules.alias or whatever else according to the order
> specified in modules.order, so that modprobe prefer modules which is
> earlier in the linking order.
I flaked on the Modules.order stuff and it's been on my TODO for over a
week - company deadlines got in the way. I will push a new tree asap,
hopefully before next week, which excites me in particular because...
...in RHEL, I had to fix this too just now, so I've been looking forward
to a better upstream fix. What I had to do for RHEL5 in the end was just
alphabetically sort the modules list prior to writing to disk. It's not
elegant, but it does guarantee consistent behavior on multiple matches.
Jon.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-25 3:29 ` Tejun Heo
2008-01-25 5:00 ` Jon Masters
@ 2008-01-26 4:01 ` Rusty Russell
2008-01-26 4:22 ` Tejun Heo
1 sibling, 1 reply; 100+ messages in thread
From: Rusty Russell @ 2008-01-26 4:01 UTC (permalink / raw)
To: Tejun Heo
Cc: Sam Ravnborg, linux-kbuild, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
On Friday 25 January 2008 14:29:12 Tejun Heo wrote:
> Rusty Russell wrote:
> > On Friday 25 January 2008 09:02:53 Sam Ravnborg wrote:
> >> From: Tejun Heo <htejun@gmail.com>
> >>
> >> When driver modules are loaded by udev, what comes first in
> >> modules.alias file is selected.
> >
> > Actually, I had occasion to look at this the other day, and in the
> > modprobe version here every match is selected.
>
> What do you mean by "every match is selected"?
(I really can't tell if you're being facecious here, or you really don't know
this, so I'll assume the latter...)
modules.alias contains wildcards for what devices this module might match, eg.
alias pci:v00008086d00002829sv*sd*bc*sc*i* ahci
modprobe gets called to insert
eg 'pci:v00008086d00002829sv000017AAsd000020A7bc01sc06i01'.
After finding nothing in the normal config files, it looks for all matches in
modules.alias, and inserts all those modules in the kernel.
> > And they'll be loaded in reverse order of the module.alias file.
>
> What do you mean by 'loaded'?
I mean modprobe loads the moduled into the kernel. Each module is loaded into
memory, then sys_init_module() called to load the module, with args chosen
from the modprobe.conf/modprobe.d files.
> > Looks like Jon's latest git tree does the same.
> >
> > So, what does this patch actually fix?
>
> This patch makes kbuild generate modules.order and another patch makes
> depmod generate modules.alias or whatever else according to the order
> specified in modules.order, so that modprobe prefer modules which is
> earlier in the linking order.
That's what the patch does, and you've explained that clearly multiple times.
But I can only ask again, "what does this patch actually fix?". ie. what
system got messed up because of the current behaviour? Where's the problem
we're fixing? This might fix it as a side effect, but let's try harder than
that, OK?
> So, are you saying that modprobe chooses modules in the reverse order of
> modules.alias file?
That is precisely what I'm saying, and more.
Rusty.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 4:01 ` Rusty Russell
@ 2008-01-26 4:22 ` Tejun Heo
2008-01-26 4:28 ` Jon Masters
2008-01-26 9:25 ` Rusty Russell
0 siblings, 2 replies; 100+ messages in thread
From: Tejun Heo @ 2008-01-26 4:22 UTC (permalink / raw)
To: Rusty Russell
Cc: Sam Ravnborg, linux-kbuild, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
Hello, Rusty.
Rusty Russell wrote:
> On Friday 25 January 2008 14:29:12 Tejun Heo wrote:
>> Rusty Russell wrote:
>>> On Friday 25 January 2008 09:02:53 Sam Ravnborg wrote:
>>>> From: Tejun Heo <htejun@gmail.com>
>>>>
>>>> When driver modules are loaded by udev, what comes first in
>>>> modules.alias file is selected.
>>> Actually, I had occasion to look at this the other day, and in the
>>> modprobe version here every match is selected.
>> What do you mean by "every match is selected"?
>
> (I really can't tell if you're being facecious here, or you really don't know
> this, so I'll assume the latter...)
The third, actually. Somehow it wasn't clear to me what you meant by
'match', 'selected' and 'loaded'.
> modules.alias contains wildcards for what devices this module might match, eg.
>
> alias pci:v00008086d00002829sv*sd*bc*sc*i* ahci
>
> modprobe gets called to insert
> eg 'pci:v00008086d00002829sv000017AAsd000020A7bc01sc06i01'.
>
> After finding nothing in the normal config files, it looks for all matches in
> modules.alias, and inserts all those modules in the kernel.
Thanks for the clarification.
>>> And they'll be loaded in reverse order of the module.alias file.
>> What do you mean by 'loaded'?
>
> I mean modprobe loads the moduled into the kernel. Each module is loaded into
> memory, then sys_init_module() called to load the module, with args chosen
> from the modprobe.conf/modprobe.d files.
>
>>> Looks like Jon's latest git tree does the same.
>>>
>>> So, what does this patch actually fix?
>> This patch makes kbuild generate modules.order and another patch makes
>> depmod generate modules.alias or whatever else according to the order
>> specified in modules.order, so that modprobe prefer modules which is
>> earlier in the linking order.
>
> That's what the patch does, and you've explained that clearly multiple times.
>
> But I can only ask again, "what does this patch actually fix?". ie. what
> system got messed up because of the current behaviour? Where's the problem
> we're fixing? This might fix it as a side effect, but let's try harder than
> that, OK?
There was a non-deterministic behavior involving ata_piix and ahci
drivers on ich6. Both drivers support the chipset but ata_piix is less
capable while ahci might misbehave (chip bug). Generally, ahci should
be preferred as it seems the problem cases seem to be rare. When
drivers are linked in, this is forced by link order. When module is
loaded via udev, depending on how modules.alias is generated, sometimes
ata_piix is loaded and at other times ahci, causing 'oops,
hotplugging/NCQ doesn't work after kernel update' - 'what? it was
security update one liner'.
More generally, occasionally some feature or hardware is supported in
more than one ways. Maybe new driver is under development or the
feature has inherent dualism. Link order isn't a complete solution but
can cover most usual cases and at least gives configurable (by
developers) deterministic priority. So, these changes try to extend
link order to module loading too.
>> So, are you saying that modprobe chooses modules in the reverse order of
>> modules.alias file?
>
> That is precisely what I'm saying, and more.
Oops, then modprobe needs to be updated too. Jon, can you please put
this onto your to-do list too?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 4:22 ` Tejun Heo
@ 2008-01-26 4:28 ` Jon Masters
2008-01-26 4:52 ` Tejun Heo
2008-01-26 9:25 ` Rusty Russell
1 sibling, 1 reply; 100+ messages in thread
From: Jon Masters @ 2008-01-26 4:28 UTC (permalink / raw)
To: Tejun Heo
Cc: Rusty Russell, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
On Sat, 2008-01-26 at 13:22 +0900, Tejun Heo wrote:
> Rusty Russell wrote:
> > On Friday 25 January 2008 14:29:12 Tejun Heo wrote:
> >> Rusty Russell wrote:
> >>> On Friday 25 January 2008 09:02:53 Sam Ravnborg wrote:
> >> So, are you saying that modprobe chooses modules in the reverse order of
> >> modules.alias file?
> >
> > That is precisely what I'm saying, and more.
>
> Oops, then modprobe needs to be updated too. Jon, can you please put
> this onto your to-do list too?
But the thing Rusty is also getting at (so I think) is that this might
not be the way to fix the "problem". Perhaps using the rebinding bits in
the kernel might be the best way to solve this in the longer term. I can
fix both depmod and modprobe, but I would appreciate some more input :)
Alternatives are a config option to only load the first match for now,
and to load based on the Modules.order. Thoughts?
Jon.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 4:28 ` Jon Masters
@ 2008-01-26 4:52 ` Tejun Heo
0 siblings, 0 replies; 100+ messages in thread
From: Tejun Heo @ 2008-01-26 4:52 UTC (permalink / raw)
To: Jon Masters
Cc: Rusty Russell, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
Jon Masters wrote:
>>> That is precisely what I'm saying, and more.
>> Oops, then modprobe needs to be updated too. Jon, can you please put
>> this onto your to-do list too?
>
> But the thing Rusty is also getting at (so I think) is that this might
> not be the way to fix the "problem". Perhaps using the rebinding bits in
> the kernel might be the best way to solve this in the longer term. I can
> fix both depmod and modprobe, but I would appreciate some more input :)
Proper solution : module loader with sane default order (which again
should be specified by developers) and allows the user to choose which
module to use.
Complete but probably overkill solution : Don't let drivers probe
devices on load. Control device binding per-device such that different
devices of the same type can attach to different drivers. This is
somewhat necessary between ahci and ata_piix because one is not subset
of the other but controlling loading order seems to do the trick till now.
> Alternatives are a config option to only load the first match for now,
> and to load based on the Modules.order. Thoughts?
That doesn't really change anything other than saving memory for the
second module. Also, it's incomplete solution because the first module
might or might not attach to the device. Sometimes device ID isn't
enough to determine whether a specific driver can be used or not.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 4:22 ` Tejun Heo
2008-01-26 4:28 ` Jon Masters
@ 2008-01-26 9:25 ` Rusty Russell
2008-01-27 4:33 ` Jon Masters
2008-01-28 1:45 ` Tejun Heo
1 sibling, 2 replies; 100+ messages in thread
From: Rusty Russell @ 2008-01-26 9:25 UTC (permalink / raw)
To: Tejun Heo
Cc: Sam Ravnborg, linux-kbuild, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
On Saturday 26 January 2008 15:22:21 Tejun Heo wrote:
> Hello, Rusty.
Hi Tejun,
> There was a non-deterministic behavior involving ata_piix and ahci
> drivers on ich6. Both drivers support the chipset but ata_piix is less
> capable while ahci might misbehave (chip bug). Generally, ahci should
> be preferred as it seems the problem cases seem to be rare. When
> drivers are linked in, this is forced by link order.
Right. Nasty. This is currently dealt with by blacklisting the lesser
driver; if that's wrong, blacklist the other one (blacklisting means that
aliases can't pull it in, it needs to be modprobed by name). That kind of
sucks because it's not under kernel control and the distros have to do it,
but that's how it's always been.
After all, they chose to build two drivers for one device, perhaps they are
the best people to decide?
> >> So, are you saying that modprobe chooses modules in the reverse order of
> >> modules.alias file?
> >
> > That is precisely what I'm saying, and more.
>
> Oops, then modprobe needs to be updated too. Jon, can you please put
> this onto your to-do list too?
The modprobe beheavour of loading them all is IMHO correct. The order was
never defined however, and reverse was how it was implemented.
There is, of course, no reason to change modprobe; just define the current
behaviour that the *last* alias is preferred, and generate modules.alias
accordingly.
Jon's idea of having the later one pull the device away would also work, but
seems like it's a complex solution to a corner case.
Thanks for the explanation!
Rusty.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 9:25 ` Rusty Russell
@ 2008-01-27 4:33 ` Jon Masters
2008-01-28 1:47 ` Tejun Heo
2008-01-28 1:45 ` Tejun Heo
1 sibling, 1 reply; 100+ messages in thread
From: Jon Masters @ 2008-01-27 4:33 UTC (permalink / raw)
To: Rusty Russell
Cc: Tejun Heo, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
On Sat, 2008-01-26 at 20:25 +1100, Rusty Russell wrote:
> There is, of course, no reason to change modprobe; just define the current
> behaviour that the *last* alias is preferred, and generate modules.alias
> accordingly.
For now, let's base it on Modules.order but ensure the alias file is
written in the appropriate order (I need to check, that's probably in
reverse of Modules.order...I'll think about this tomorrow, this has been
on my mind recently, and like I said, I had to kludge a fix for an
Enterprise distribution for deterministic behavior recently too).
> Jon's idea of having the later one pull the device away would also work, but
> seems like it's a complex solution to a corner case.
Well, ultimately, we (myself, Kay, and others) would seem to prefer that
rebinding be done properly - so through a combination of udev rules and
kernel behavior, the user/third parties define the priorities. We should
load all the drivers - that's totally correct - but we shouldn't depend
upon whichever probe function will run first, that's too lame.
I'll start with the simple fix, then we should debate this...
Jon.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-27 4:33 ` Jon Masters
@ 2008-01-28 1:47 ` Tejun Heo
0 siblings, 0 replies; 100+ messages in thread
From: Tejun Heo @ 2008-01-28 1:47 UTC (permalink / raw)
To: Jon Masters
Cc: Rusty Russell, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
Hello,
Jon Masters wrote:
>> There is, of course, no reason to change modprobe; just define the current
>> behaviour that the *last* alias is preferred, and generate modules.alias
>> accordingly.
>
> For now, let's base it on Modules.order but ensure the alias file is
> written in the appropriate order (I need to check, that's probably in
> reverse of Modules.order...I'll think about this tomorrow, this has been
> on my mind recently, and like I said, I had to kludge a fix for an
> Enterprise distribution for deterministic behavior recently too).
>
>> Jon's idea of having the later one pull the device away would also work, but
>> seems like it's a complex solution to a corner case.
>
> Well, ultimately, we (myself, Kay, and others) would seem to prefer that
> rebinding be done properly - so through a combination of udev rules and
> kernel behavior, the user/third parties define the priorities. We should
> load all the drivers - that's totally correct - but we shouldn't depend
> upon whichever probe function will run first, that's too lame.
It is lame but works for most of the cases. I'm not sure whether
full-fledged fine-grained driver selection would be an unnecessary
overkill or not.
> I'll start with the simple fix, then we should debate this...
Yeap.
--
tejun
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-26 9:25 ` Rusty Russell
2008-01-27 4:33 ` Jon Masters
@ 2008-01-28 1:45 ` Tejun Heo
2008-01-28 3:20 ` Jon Masters
1 sibling, 1 reply; 100+ messages in thread
From: Tejun Heo @ 2008-01-28 1:45 UTC (permalink / raw)
To: Rusty Russell
Cc: Sam Ravnborg, linux-kbuild, Bill Nottingham, Greg Kroah-Hartman,
Kay Sievers, Jon Masters
Hello,
Rusty Russell wrote:
>> There was a non-deterministic behavior involving ata_piix and ahci
>> drivers on ich6. Both drivers support the chipset but ata_piix is less
>> capable while ahci might misbehave (chip bug). Generally, ahci should
>> be preferred as it seems the problem cases seem to be rare. When
>> drivers are linked in, this is forced by link order.
>
> Right. Nasty. This is currently dealt with by blacklisting the lesser
> driver; if that's wrong, blacklist the other one (blacklisting means that
> aliases can't pull it in, it needs to be modprobed by name). That kind of
> sucks because it's not under kernel control and the distros have to do it,
> but that's how it's always been.
In SUSE, it's dealt with by having a rudimentary module priority in
initrd. User can select which driver to use for which controller with
the configuration tool, which mostly works but the configuration can't
be enforced if there are multiple controllers which can be driven by
more than one drivers (the first one grabs them all).
I think the base system (kernel + udev) needs to provide deterministic,
sensible default behavior.
> After all, they chose to build two drivers for one device, perhaps they are
> the best people to decide?
The thing is that kernel drivers forced them to do that. They can't
choose between ata_piix and ahci. One is not proper subset of the other.
>>>> So, are you saying that modprobe chooses modules in the reverse order of
>>>> modules.alias file?
>>> That is precisely what I'm saying, and more.
>> Oops, then modprobe needs to be updated too. Jon, can you please put
>> this onto your to-do list too?
>
> The modprobe beheavour of loading them all is IMHO correct. The order was
> never defined however, and reverse was how it was implemented.
Yeah, modprobe should load all modules matching the alias as it can't
tell whether the previously loaded module actually attached to everything.
> There is, of course, no reason to change modprobe; just define the current
> behaviour that the *last* alias is preferred, and generate modules.alias
> accordingly.
Yeah, the alias file can be generated in reverse but I think it's better
to do things straight. It may cause some surprises (after upgrading
modprobe, the other driver is being loaded!) but IMHO we'll be better
off with forward-ordered aliases in the long run. After all, module
loading order was undefined anyway.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-28 1:45 ` Tejun Heo
@ 2008-01-28 3:20 ` Jon Masters
2008-01-29 3:29 ` Rusty Russell
0 siblings, 1 reply; 100+ messages in thread
From: Jon Masters @ 2008-01-28 3:20 UTC (permalink / raw)
To: Tejun Heo
Cc: Rusty Russell, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
On Mon, 2008-01-28 at 10:45 +0900, Tejun Heo wrote:
> Yeah, the alias file can be generated in reverse but I think it's better
> to do things straight. It may cause some surprises (after upgrading
> modprobe, the other driver is being loaded!) but IMHO we'll be better
> off with forward-ordered aliases in the long run. After all, module
> loading order was undefined anyway.
I actually agree, in that the first entry is probably what people expect
to get loaded, and that works well with things like Modules.order. I
guess I'll just throw that together, since this wasn't defined anyway,
and perhaps add a config option so you can reverse order if you want.
Really we should all fix this through rebinding of loaded drivers. We're
beyond the days of one driver per device, into the realm of SATA
chipsets that also do "legacy", and much more funky stuff. A few of us
are already looking at dynamic driver updates for "Enterprise" distros,
and we have debated the rebinding issue. David Z. and I discussed using
a GUI tool like the hal device manager to facilitate udev rule writing.
It'll probably all happen at some point, hopefully before OLs :)
Jon.
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 12/77] kbuild: implement modules.order
2008-01-28 3:20 ` Jon Masters
@ 2008-01-29 3:29 ` Rusty Russell
0 siblings, 0 replies; 100+ messages in thread
From: Rusty Russell @ 2008-01-29 3:29 UTC (permalink / raw)
To: Jon Masters
Cc: Tejun Heo, Sam Ravnborg, linux-kbuild, Bill Nottingham,
Greg Kroah-Hartman, Kay Sievers
On Monday 28 January 2008 14:20:10 Jon Masters wrote:
> On Mon, 2008-01-28 at 10:45 +0900, Tejun Heo wrote:
> > Yeah, the alias file can be generated in reverse but I think it's better
> > to do things straight. It may cause some surprises (after upgrading
> > modprobe, the other driver is being loaded!) but IMHO we'll be better
> > off with forward-ordered aliases in the long run. After all, module
> > loading order was undefined anyway.
>
> I actually agree, in that the first entry is probably what people expect
> to get loaded, and that works well with things like Modules.order. I
> guess I'll just throw that together, since this wasn't defined anyway,
> and perhaps add a config option so you can reverse order if you want.
Please bear in mind that modules.alias is a (cimpletely undocumented) internal
module utilities detail: in theory modprobe is reading all the aliases out of
modules themselves (that's too slow, since nowdays probe-by-alias is the
common case).
So since this is a temporary hack anyway, I think backwards is fine.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 100+ messages in thread
* [PATCH 13/77] kconfig: if ncurses-devel is missing then say so
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (12 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 12/77] kbuild: implement modules.order Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 14/77] kbuild: declare the modpost error functions as printf like Sam Ravnborg
` (64 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Frans Pop
With this patch when ncurses-devel (or whatever it is named)
is missing trying to run menuconfig will result in this:
$ make menuconfig
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/kxgettext.o
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
Much better than before where we just listed some build errors.
The other *config targets will work indepenednt on ncurses
being present or not.
Includes improvements suggested by: Frans Pop <elendil@planet.nl>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Frans Pop <elendil@planet.nl>
---
scripts/kconfig/Makefile | 14 ++++++++------
scripts/kconfig/lxdialog/check-lxdialog.sh | 16 +++++++++-------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 1ad6f7f..8091435 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -93,12 +93,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE
-PHONY += $(obj)/dochecklxdialog
-$(obj)/dochecklxdialog:
- $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
-
-always := dochecklxdialog
-
# ===========================================================================
# Shared Makefile for the various kconfig executables:
@@ -145,6 +139,14 @@ clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
clean-files += mconf qconf gconf
+# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
+PHONY += $(obj)/dochecklxdialog
+$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
+$(obj)/dochecklxdialog:
+ $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
+
+always := dochecklxdialog
+
# Add environment specific flags
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 9681476..62e1e02 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses
check() {
- echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
+ echo -e " #include CURSES_LOC \n main() {}" |
+ $cc -xc - -o $tmp 2> /dev/null
if [ $? != 0 ]; then
- echo " *** Unable to find the ncurses libraries." 1>&2
- echo " *** make menuconfig require the ncurses libraries" 1>&2
- echo " *** " 1>&2
- echo " *** Install ncurses (ncurses-devel) and try again" 1>&2
- echo " *** " 1>&2
- exit 1
+ echo " *** Unable to find the ncurses libraries or the" 1>&2
+ echo " *** required header files." 1>&2
+ echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
+ echo " *** " 1>&2
+ echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
+ echo " *** " 1>&2
+ exit 1
fi
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 14/77] kbuild: declare the modpost error functions as printf like
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (13 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 13/77] kconfig: if ncurses-devel is missing then say so Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 15/77] kbuild: fix format string warnings in modpost Sam Ravnborg
` (63 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Andi Kleen, Sam Ravnborg
From: Andi Kleen <ak@suse.de>
This way gcc can warn for wrong format strings
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 93ac52a..3a12c22 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -33,7 +33,9 @@ enum export {
export_unused_gpl, export_gpl_future, export_unknown
};
-void fatal(const char *fmt, ...)
+#define PRINTF __attribute__ ((format (printf, 1, 2)))
+
+PRINTF void fatal(const char *fmt, ...)
{
va_list arglist;
@@ -46,7 +48,7 @@ void fatal(const char *fmt, ...)
exit(1);
}
-void warn(const char *fmt, ...)
+PRINTF void warn(const char *fmt, ...)
{
va_list arglist;
@@ -57,7 +59,7 @@ void warn(const char *fmt, ...)
va_end(arglist);
}
-void merror(const char *fmt, ...)
+PRINTF void merror(const char *fmt, ...)
{
va_list arglist;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 15/77] kbuild: fix format string warnings in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (14 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 14/77] kbuild: declare the modpost error functions as printf like Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 16/77] kbuild: fix a buffer overflow " Sam Ravnborg
` (62 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Andi Kleen, Sam Ravnborg
From: Andi Kleen <ak@suse.de>
Fix wrong format strings in modpost exposed by the previous patch.
Including one missing argument -- some random data was printed instead.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3a12c22..404ee0d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -388,7 +388,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
/* Check if file offset is correct */
if (hdr->e_shoff > info->size) {
- fatal("section header offset=%u in file '%s' is bigger then filesize=%lu\n", hdr->e_shoff, filename, info->size);
+ fatal("section header offset=%lu in file '%s' is bigger then filesize=%lu\n", (unsigned long)hdr->e_shoff, filename, info->size);
return 0;
}
@@ -409,7 +409,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
const char *secname;
if (sechdrs[i].sh_offset > info->size) {
- fatal("%s is truncated. sechdrs[i].sh_offset=%u > sizeof(*hrd)=%ul\n", filename, (unsigned int)sechdrs[i].sh_offset, sizeof(*hdr));
+ fatal("%s is truncated. sechdrs[i].sh_offset=%lu > sizeof(*hrd)=%lu\n", filename, (unsigned long)sechdrs[i].sh_offset, sizeof(*hdr));
return 0;
}
secname = secstrings + sechdrs[i].sh_name;
@@ -907,7 +907,8 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
"before '%s' (at offset -0x%llx)\n",
modname, fromsec, (unsigned long long)r.r_offset,
secname, refsymname,
- elf->strtab + after->st_name);
+ elf->strtab + after->st_name,
+ (unsigned long long)r.r_offset);
} else {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
modname, fromsec, (unsigned long long)r.r_offset,
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 16/77] kbuild: fix a buffer overflow in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (15 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 15/77] kbuild: fix format string warnings in modpost Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 17/77] kconfig: use getopt() in conf.c for handling command line arguments Sam Ravnborg
` (61 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Andi Kleen, Sam Ravnborg
From: Andi Kleen <ak@suse.de>
When passing an file name > 1k the stack could be overflowed.
Not really a security issue, but still better plugged.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 404ee0d..4d1c590 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1656,7 +1656,6 @@ int main(int argc, char **argv)
{
struct module *mod;
struct buffer buf = { };
- char fname[SZ];
char *kernel_read = NULL, *module_read = NULL;
char *dump_write = NULL;
int opt;
@@ -1709,6 +1708,8 @@ int main(int argc, char **argv)
err = 0;
for (mod = modules; mod; mod = mod->next) {
+ char fname[strlen(mod->name) + 10];
+
if (mod->skip)
continue;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 17/77] kconfig: use getopt() in conf.c for handling command line arguments
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (16 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 16/77] kbuild: fix a buffer overflow " Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:02 ` [PATCH 18/77] kbuild: support mercurial in setlocalversion Sam Ravnborg
` (60 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Andres Salomon, Sam Ravnborg, Roman Zippel
From: Andres Salomon <dilinger@debian.org>
Switch from doing our own parsing of command line arguments to
using getopt(3) to do it. Aside from simplifying things, this allows us to
specify multiple arguments; the old code could only accept two arguments
(input_mode and kconfig name).
Note some subtle changes:
- The argument '-?' is no longer supported.
- '-h' is not treated as an error, so output goes to stdout, and we
exit with '0'.
- There is no compatibility checking amongst arguments; the last option
will simply override earlier options. For example, 'conf -n -y foo'
is perfectly valid now (input_mode will be set_yes). Previously, that
would have been an error ("can't find file -y").
Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/conf.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 8d6f174..d4737d3 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -495,12 +495,12 @@ static void check_conf(struct menu *menu)
int main(int ac, char **av)
{
- int i = 1;
+ int opt;
const char *name;
struct stat tmpstat;
- if (ac > i && av[i][0] == '-') {
- switch (av[i++][1]) {
+ while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
+ switch (opt) {
case 'o':
input_mode = ask_new;
break;
@@ -513,12 +513,7 @@ int main(int ac, char **av)
break;
case 'D':
input_mode = set_default;
- defconfig_file = av[i++];
- if (!defconfig_file) {
- printf(_("%s: No default config file specified\n"),
- av[0]);
- exit(1);
- }
+ defconfig_file = optarg;
break;
case 'n':
input_mode = set_no;
@@ -534,16 +529,19 @@ int main(int ac, char **av)
srandom(time(NULL));
break;
case 'h':
- case '?':
- fprintf(stderr, "See README for usage info\n");
+ printf("See README for usage info\n");
exit(0);
+ break;
+ default:
+ fprintf(stderr, "See README for usage info\n");
+ exit(1);
}
}
- name = av[i];
- if (!name) {
+ if (ac == optind) {
printf(_("%s: Kconfig file missing\n"), av[0]);
exit(1);
}
+ name = av[optind];
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 18/77] kbuild: support mercurial in setlocalversion
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (17 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 17/77] kconfig: use getopt() in conf.c for handling command line arguments Sam Ravnborg
@ 2008-01-24 22:02 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 19/77] Kbuild: Clarify the rpm-related make packaging targets Sam Ravnborg
` (59 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:02 UTC (permalink / raw)
To: linux-kbuild; +Cc: Aron Griffis, Sam Ravnborg
From: Aron Griffis <aron@hp.com>
This represents mercurial changesets similarly to git. For untagged
revisions, append the changeset id. If there are uncommitted changes,
append -dirty. For example, -hgc60016ba6237-dirty
Signed-off-by: Aron Griffis <aron@hp.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/setlocalversion | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 82e4993..a80d6ea 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -19,4 +19,27 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
if git diff-index HEAD | read dummy; then
printf '%s' -dirty
fi
+
+ # All done with git
+ exit
+fi
+
+# Check for mercurial and a mercurial repo.
+if hgid=`hg id 2>/dev/null`; then
+ tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+
+ # Do we have an untagged version?
+ if [ -z "$tag" -o "$tag" = tip ]; then
+ id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+ printf '%s%s' -hg "$id"
+ fi
+
+ # Are there uncommitted changes?
+ # These are represented by + after the changeset id.
+ case "$hgid" in
+ *+|*+\ *) printf '%s' -dirty ;;
+ esac
+
+ # All done with mercurial
+ exit
fi
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 19/77] Kbuild: Clarify the rpm-related make packaging targets
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (18 preceding siblings ...)
2008-01-24 22:02 ` [PATCH 18/77] kbuild: support mercurial in setlocalversion Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 20/77] kbuild: fix buglet in gcc-version.sh Sam Ravnborg
` (58 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Robert P. J. Day, Sam Ravnborg
From: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 1 -
scripts/package/Makefile | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 532981a..4aa59b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1181,7 +1181,6 @@ help:
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
- @echo ' rpm - Build a kernel as an RPM package'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 7c434e0..5e32607 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -89,9 +89,8 @@ clean-dirs += $(objtree)/tar-install/
# Help text displayed when executing 'make help'
# ---------------------------------------------------------------------------
help: FORCE
- @echo ' rpm-pkg - Build the kernel as an RPM package'
- @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel'
- @echo ' and modules'
+ @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
+ @echo ' binrpm-pkg - Build only the binary kernel package'
@echo ' deb-pkg - Build the kernel as an deb package'
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 20/77] kbuild: fix buglet in gcc-version.sh
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (19 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 19/77] Kbuild: Clarify the rpm-related make packaging targets Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 21/77] kbuild: ignore *.order files Sam Ravnborg
` (57 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Greg Schafer, Jesper Juhl
Greg Schafer <gschafer@zip.com.au> reported:
====
$make mrproper
scripts/gcc-version.sh: [[: command not found
This is on a very old host with an ancient bash as /bin/sh. But I have
CONFIG_SHELL set and pointing to a modern bash. Something is wrong.
This doesn't happen with 2.6.23
====
Fixed using a more common string equality test.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Schafer <gschafer@zip.com.au>
Cc: Jesper Juhl <jesper.juhl@gmail.com>
---
scripts/gcc-version.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
index a5121a6..cc767b3 100644
--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -9,7 +9,10 @@
# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
#
-if [[ $1 = "-p" ]] ; then with_patchlevel=1; shift; fi
+if [ "$1" = "-p" ] ; then
+ with_patchlevel=1;
+ shift;
+fi
compiler="$*"
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 21/77] kbuild: ignore *.order files
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (20 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 20/77] kbuild: fix buglet in gcc-version.sh Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 23:05 ` Tejun Heo
2008-01-24 22:03 ` [PATCH 22/77] kbuild: fixup genksyms usage/getopt Sam Ravnborg
` (56 subsequent siblings)
78 siblings, 1 reply; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Tejun Heo
Introducing the new modules.order patch created a number
of additional files. Teach git to ignore them.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Tejun Heo <htejun@gmail.com>
---
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8d14531..8363e48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
*.i
*.lst
*.symtypes
+*.order
#
# Top-level generic files
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 22/77] kbuild: fixup genksyms usage/getopt
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (21 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 21/77] kbuild: ignore *.order files Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 23/77] Remove references to "make dep" Sam Ravnborg
` (55 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Mike Frysinger, Mike Frysinger, Sam Ravnborg
From: Mike Frysinger <vapier.adi@gmail.com>
The usage does not mention the "-a,--arch" or "-T,--dump-types" options, so
add them. The calls to getopt() seem to mention options that no longer exist
(some "k" and "p" thingy) but omits the "h" option which means using '-h'
actually triggers the error code path, so update those as well.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/genksyms/genksyms.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 511023b..dca5e0d 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -440,17 +440,21 @@ void error_with_pos(const char *fmt, ...)
static void genksyms_usage(void)
{
- fputs("Usage:\n" "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n" "\n"
+ fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
#ifdef __GNU_LIBRARY__
+ " -a, --arch Select architecture\n"
" -d, --debug Increment the debug level (repeatable)\n"
" -D, --dump Dump expanded symbol defs (for debugging only)\n"
+ " -T, --dump-types file Dump expanded types into file (for debugging only)\n"
" -w, --warnings Enable warnings\n"
" -q, --quiet Disable warnings (default)\n"
" -h, --help Print this message\n"
" -V, --version Print the release version\n"
#else /* __GNU_LIBRARY__ */
+ " -a Select architecture\n"
" -d Increment the debug level (repeatable)\n"
" -D Dump expanded symbol defs (for debugging only)\n"
+ " -T file Dump expanded types into file (for debugging only)\n"
" -w Enable warnings\n"
" -q Disable warnings (default)\n"
" -h Print this message\n"
@@ -477,10 +481,10 @@ int main(int argc, char **argv)
{0, 0, 0, 0}
};
- while ((o = getopt_long(argc, argv, "a:dwqVDT:k:p:",
+ while ((o = getopt_long(argc, argv, "a:dwqVDT:h",
&long_opts[0], NULL)) != EOF)
#else /* __GNU_LIBRARY__ */
- while ((o = getopt(argc, argv, "a:dwqVDT:k:p:")) != EOF)
+ while ((o = getopt(argc, argv, "a:dwqVDT:h")) != EOF)
#endif /* __GNU_LIBRARY__ */
switch (o) {
case 'a':
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 23/77] Remove references to "make dep"
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (22 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 22/77] kbuild: fixup genksyms usage/getopt Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 24/77] A few corrections to include/linux/Kbuild Sam Ravnborg
` (54 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Adrian Bunk, Sam Ravnborg
From: Adrian Bunk <bunk@kernel.org>
"make dep" is no longer required in kernel 2.6, but was still mentioned
in some places.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/arm/mach-imx/Makefile | 3 ---
arch/arm/mach-netx/Makefile | 3 ---
arch/frv/kernel/gdb-stub.c | 2 +-
arch/mips/tx4927/common/Makefile | 4 ----
arch/mips/tx4938/common/Makefile | 4 ----
arch/mips/tx4938/toshiba_rbtx4938/Makefile | 4 ----
arch/sh64/kernel/Makefile | 4 ----
arch/sh64/lib/Makefile | 4 ----
arch/sh64/mach-cayman/Makefile | 4 ----
arch/sh64/mm/Makefile | 4 ----
arch/xtensa/mm/Makefile | 4 ----
arch/xtensa/platform-iss/Makefile | 5 -----
12 files changed, 1 insertions(+), 44 deletions(-)
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 02272aa..88d5e61 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,9 +1,6 @@
#
# Makefile for the linux kernel.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
# Object file lists.
diff --git a/arch/arm/mach-netx/Makefile b/arch/arm/mach-netx/Makefile
index 18785ff..7ce4ba9 100644
--- a/arch/arm/mach-netx/Makefile
+++ b/arch/arm/mach-netx/Makefile
@@ -1,9 +1,6 @@
#
# Makefile for the linux kernel.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
# Object file lists.
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index e89cad1..48a0393 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -87,7 +87,7 @@
* Example:
* $ cd ~/linux
* $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
- * $ make dep; make vmlinux
+ * $ make vmlinux
*
* Step 3:
* Download the kernel to the remote target and start
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile
index 1837578..e862961 100644
--- a/arch/mips/tx4927/common/Makefile
+++ b/arch/mips/tx4927/common/Makefile
@@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o
diff --git a/arch/mips/tx4938/common/Makefile b/arch/mips/tx4938/common/Makefile
index 8352eca..eff3d1d 100644
--- a/arch/mips/tx4938/common/Makefile
+++ b/arch/mips/tx4938/common/Makefile
@@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y += prom.o setup.o irq.o
obj-$(CONFIG_KGDB) += dbgio.o
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/Makefile b/arch/mips/tx4938/toshiba_rbtx4938/Makefile
index 675bb1c..2316dd7 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/Makefile
+++ b/arch/mips/tx4938/toshiba_rbtx4938/Makefile
@@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y += prom.o setup.o irq.o spi_eeprom.o
diff --git a/arch/sh64/kernel/Makefile b/arch/sh64/kernel/Makefile
index e3467bd..8443d3b 100644
--- a/arch/sh64/kernel/Makefile
+++ b/arch/sh64/kernel/Makefile
@@ -8,10 +8,6 @@
#
# Makefile for the Linux sh64 kernel.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
extra-y := head.o init_task.o vmlinux.lds
diff --git a/arch/sh64/lib/Makefile b/arch/sh64/lib/Makefile
index 6a4cc3f..754d725 100644
--- a/arch/sh64/lib/Makefile
+++ b/arch/sh64/lib/Makefile
@@ -8,10 +8,6 @@
#
# Makefile for the SH-5 specific library files..
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
# Panic should really be compiled as PIC
lib-y := udelay.o c-checksum.o dbg.o io.o panic.o memcpy.o copy_user_memcpy.o \
diff --git a/arch/sh64/mach-cayman/Makefile b/arch/sh64/mach-cayman/Makefile
index 67a2258..847c828 100644
--- a/arch/sh64/mach-cayman/Makefile
+++ b/arch/sh64/mach-cayman/Makefile
@@ -1,10 +1,6 @@
#
# Makefile for the Hitachi Cayman specific parts of the kernel
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y := setup.o irq.o iomap.o
obj-$(CONFIG_HEARTBEAT) += led.o
diff --git a/arch/sh64/mm/Makefile b/arch/sh64/mm/Makefile
index d0e8136..486c656 100644
--- a/arch/sh64/mm/Makefile
+++ b/arch/sh64/mm/Makefile
@@ -8,10 +8,6 @@
#
# Makefile for the sh64-specific parts of the Linux memory manager.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y := cache.o consistent.o extable.o fault.o init.o ioremap.o \
tlbmiss.o tlb.o
diff --git a/arch/xtensa/mm/Makefile b/arch/xtensa/mm/Makefile
index 10aec22..64e304a 100644
--- a/arch/xtensa/mm/Makefile
+++ b/arch/xtensa/mm/Makefile
@@ -1,9 +1,5 @@
#
# Makefile for the Linux/Xtensa-specific parts of the memory manager.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
obj-y := init.o fault.o tlb.o misc.o cache.o
diff --git a/arch/xtensa/platform-iss/Makefile b/arch/xtensa/platform-iss/Makefile
index 5b394e9..af96e31 100644
--- a/arch/xtensa/platform-iss/Makefile
+++ b/arch/xtensa/platform-iss/Makefile
@@ -3,11 +3,6 @@
# Makefile for the Xtensa Instruction Set Simulator (ISS)
# "prom monitor" library routines under Linux.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are in the main makefile...
obj-y = io.o console.o setup.o network.o
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 24/77] A few corrections to include/linux/Kbuild
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (23 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 23/77] Remove references to "make dep" Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 25/77] kbuild: fix installing external modules Sam Ravnborg
` (53 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild
Cc: Robert P. J. Day, David Woodhouse, Andrew Morton, Sam Ravnborg
From: Robert P. J. Day <rpjday@crashcourse.ca>
auxvec.h, i2c-dev.h and vt.h *should* be unifdef'ed i2o-dev.h does not need
unifdef'ing
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
include/linux/Kbuild | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index f30fa92..e6e541d 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -34,7 +34,6 @@ header-y += atmsap.h
header-y += atmsvc.h
header-y += atm_zatm.h
header-y += auto_fs4.h
-header-y += auxvec.h
header-y += ax25.h
header-y += b1lli.h
header-y += baycom.h
@@ -72,7 +71,7 @@ header-y += gen_stats.h
header-y += gigaset_dev.h
header-y += hdsmart.h
header-y += hysdn_if.h
-header-y += i2c-dev.h
+header-y += i2o-dev.h
header-y += i8k.h
header-y += if_arcnet.h
header-y += if_bonding.h
@@ -157,7 +156,6 @@ header-y += veth.h
header-y += video_decoder.h
header-y += video_encoder.h
header-y += videotext.h
-header-y += vt.h
header-y += x25.h
unifdef-y += acct.h
@@ -172,6 +170,7 @@ unifdef-y += atm.h
unifdef-y += atm_tcp.h
unifdef-y += audit.h
unifdef-y += auto_fs.h
+unifdef-y += auxvec.h
unifdef-y += binfmts.h
unifdef-y += capability.h
unifdef-y += capi.h
@@ -213,7 +212,7 @@ unifdef-y += hdreg.h
unifdef-y += hiddev.h
unifdef-y += hpet.h
unifdef-y += i2c.h
-unifdef-y += i2o-dev.h
+unifdef-y += i2c-dev.h
unifdef-y += icmp.h
unifdef-y += icmpv6.h
unifdef-y += if_addr.h
@@ -348,6 +347,7 @@ unifdef-y += videodev.h
unifdef-y += virtio_config.h
unifdef-y += virtio_blk.h
unifdef-y += virtio_net.h
+unifdef-y += vt.h
unifdef-y += wait.h
unifdef-y += wanrouter.h
unifdef-y += watchdog.h
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 25/77] kbuild: fix installing external modules
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (24 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 24/77] A few corrections to include/linux/Kbuild Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 26/77] CRIS: Remove 'TOPDIR' from Makefiles Sam Ravnborg
` (52 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Eric Sandeen
Eric Sandeen <sandeen@redhat.com> reported:
Installing external modules is supposed to put them in some path
under /lib/modules/<version>/extra/subdir/, but this change:
http://linux.bkbits.net:8080/linux-2.6/?PAGE=cset&REV=1.1982.9.23
makes them go under /lib/modules/<version>/extrasubdir
(for example, make M=fs/ext3 modules_install puts ext3.ko in
/lib/modules/<version>/extrafs/ext3.ko)
This was the case only when specifying a trailing slash to M=..
Fixed by removing trailing slash if present so
we correctly match dir part of target.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Eric Sandeen <sandeen@redhat.com>
---
scripts/Makefile.modinst | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index f0ff248..efa5d94 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -21,7 +21,7 @@ quiet_cmd_modules_install = INSTALL $@
# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
-ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D))
+ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 26/77] CRIS: Remove 'TOPDIR' from Makefiles
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (25 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 25/77] kbuild: fix installing external modules Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-25 9:38 ` Jesper Nilsson
2008-01-24 22:03 ` [PATCH 27/77] INFINIBAND: " Sam Ravnborg
` (51 subsequent siblings)
78 siblings, 1 reply; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild
Cc: WANG Cong, Mikael Starvik, Jesper Nilsson, Andreas Schwab,
Sam Ravnborg
From: WANG Cong <xiyou.wangcong@gmail.com>
This patch removes TOPDIR from Cris Makefiles.
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Andreas Schwab <schwab@suse.de>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Jesper Nilsson <jesper.nilsson@axis.com>
---
arch/cris/arch-v32/boot/compressed/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 9f77eda..609692f 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -7,7 +7,7 @@
target = $(target_compressed_dir)
src = $(src_compressed_dir)
-CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
+CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* Re: [PATCH 26/77] CRIS: Remove 'TOPDIR' from Makefiles
2008-01-24 22:03 ` [PATCH 26/77] CRIS: Remove 'TOPDIR' from Makefiles Sam Ravnborg
@ 2008-01-25 9:38 ` Jesper Nilsson
0 siblings, 0 replies; 100+ messages in thread
From: Jesper Nilsson @ 2008-01-25 9:38 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kbuild, WANG Cong, Mikael Starvik, Andreas Schwab
On Thu, Jan 24, 2008 at 11:03:07PM +0100, Sam Ravnborg wrote:
> From: WANG Cong <xiyou.wangcong@gmail.com>
>
> This patch removes TOPDIR from Cris Makefiles.
>
> Cc: Mikael Starvik <starvik@axis.com>
> Cc: Jesper Nilsson <jesper.nilsson@axis.com>
> Cc: Andreas Schwab <schwab@suse.de>
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Tested-by: Jesper Nilsson <jesper.nilsson@axis.com>
> ---
> arch/cris/arch-v32/boot/compressed/Makefile | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
> index 9f77eda..609692f 100644
> --- a/arch/cris/arch-v32/boot/compressed/Makefile
> +++ b/arch/cris/arch-v32/boot/compressed/Makefile
> @@ -7,7 +7,7 @@
> target = $(target_compressed_dir)
> src = $(src_compressed_dir)
>
> -CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
> +CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
> CFLAGS = -O2
> LD = gcc-cris -mlinux -march=v32 -nostdlib
> OBJCOPY = objcopy-cris
> --
> 1.5.4.rc3.14.g44397
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 100+ messages in thread
* [PATCH 27/77] INFINIBAND: Remove 'TOPDIR' from Makefiles
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (26 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 26/77] CRIS: Remove 'TOPDIR' from Makefiles Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 28/77] FRV: Drop " Sam Ravnborg
` (50 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild
Cc: WANG Cong, Roland Dreier, Sean Hefty, Hal Rosenstock,
Sam Ravnborg
From: WANG Cong <xiyou.wangcong@gmail.com>
This patch removes TOPDIR from infiniband Makefile and delete
one include statement pointing to a non-existing directory
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <mshefty@ichips.intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
drivers/infiniband/hw/cxgb3/Makefile | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb3/Makefile b/drivers/infiniband/hw/cxgb3/Makefile
index 36b9898..7e7b5a6 100644
--- a/drivers/infiniband/hw/cxgb3/Makefile
+++ b/drivers/infiniband/hw/cxgb3/Makefile
@@ -1,5 +1,4 @@
-EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
- -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
+EXTRA_CFLAGS += -Idrivers/net/cxgb3
obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 28/77] FRV: Drop 'TOPDIR' from Makefiles
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (27 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 27/77] INFINIBAND: " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-29 0:22 ` David Howells
2008-01-24 22:03 ` [PATCH 29/77] FS: Remove dead code Sam Ravnborg
` (49 subsequent siblings)
78 siblings, 1 reply; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: WANG Cong, David Howells, Sam Ravnborg
From: WANG Cong <xiyou.wangcong@gmail.com>
This patch drops TOPDIR from frv Makefiles.
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/frv/boot/Makefile | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
index dc6f038..6ae3254 100644
--- a/arch/frv/boot/Makefile
+++ b/arch/frv/boot/Makefile
@@ -10,7 +10,7 @@
targets := Image zImage bootpImage
-SYSTEM =$(TOPDIR)/$(LINUX)
+SYSTEM =$(LINUX)
ZTEXTADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
-compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
+compressed/$(LINUX): $(LINUX) dep
@$(MAKE) -C compressed $(LINUX)
bootp/bootp: zImage initrd
@@ -59,10 +59,10 @@ initrd:
# installation
#
install: $(CONFIGURE) Image
- sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) Image System.map "$(INSTALL_PATH)"
zinstall: $(CONFIGURE) zImage
- sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)"
#
# miscellany
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* Re: [PATCH 28/77] FRV: Drop 'TOPDIR' from Makefiles
2008-01-24 22:03 ` [PATCH 28/77] FRV: Drop " Sam Ravnborg
@ 2008-01-29 0:22 ` David Howells
2008-01-29 5:14 ` Sam Ravnborg
0 siblings, 1 reply; 100+ messages in thread
From: David Howells @ 2008-01-29 0:22 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: dhowells, linux-kbuild, WANG Cong
Sam Ravnborg <sam@ravnborg.org> wrote:
> This patch drops TOPDIR from frv Makefiles.
I thought you already had a patch to do this. Anyway, it looks reasonable,
but I can't test it until I get back from LCA.
David
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: [PATCH 28/77] FRV: Drop 'TOPDIR' from Makefiles
2008-01-29 0:22 ` David Howells
@ 2008-01-29 5:14 ` Sam Ravnborg
0 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-29 5:14 UTC (permalink / raw)
To: David Howells; +Cc: linux-kbuild, WANG Cong
On Tue, Jan 29, 2008 at 12:22:57AM +0000, David Howells wrote:
> Sam Ravnborg <sam@ravnborg.org> wrote:
>
> > This patch drops TOPDIR from frv Makefiles.
>
> I thought you already had a patch to do this. Anyway, it looks reasonable,
> but I can't test it until I get back from LCA.
It is the same patch you have seen before - I just
sent my full queue for review before the merge.
Sam
^ permalink raw reply [flat|nested] 100+ messages in thread
* [PATCH 29/77] FS: Remove dead code
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (28 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 28/77] FRV: Drop " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 30/77] kbuild: eradicate bashisms in scripts/patch-kernel Sam Ravnborg
` (48 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: WANG Cong, Al Viro, Tim Shimmin, Sam Ravnborg
From: WANG Cong <xiyou.wangcong@gmail.com>
Remove dead code in smbfs makefile.
Cc: Al Viro <viro@www.linux.org.uk>
Cc: Tim Shimmin <xfs-masters@oss.sgi.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
fs/smbfs/Makefile | 20 --------------------
1 files changed, 0 insertions(+), 20 deletions(-)
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 6673ee8..4faf8c4 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
#EXTRA_CFLAGS += -Werror
-#
-# Maintainer rules
-#
-
-# getopt.c not included. It is intentionally separate
-SRC = proc.c dir.c cache.c sock.c inode.c file.c ioctl.c smbiod.c request.c \
- symlink.c
-
-proto:
- -rm -f proto.h
- @echo > proto2.h "/*"
- @echo >> proto2.h " * Autogenerated with cproto on: " `date`
- @echo >> proto2.h " */"
- @echo >> proto2.h ""
- @echo >> proto2.h "struct smb_request;"
- @echo >> proto2.h "struct sock;"
- @echo >> proto2.h "struct statfs;"
- @echo >> proto2.h ""
- cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
- mv proto2.h proto.h
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 30/77] kbuild: eradicate bashisms in scripts/patch-kernel
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (29 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 29/77] FS: Remove dead code Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 31/77] kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish format Sam Ravnborg
` (47 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Andreas Mohr, Sam Ravnborg
From: Andreas Mohr <andi@lisas.de>
Make the patch-kernel shell script sufficiently compatible with POSIX
shells, i.e., remove bashisms from scripts/patch-kernel.
This means that it now also works on dash 0.5.3-5
and still works on bash 3.1dfsg-8.
Full changelog:
- replaced non-standard "==" by standard "="
- replaced non-standard "source" statement by POSIX "dot" command
- use leading ./ on mktemp filename to force the tempfile to a local
directory, so that the search path is not used
- replace bash syntax to remove leading dot by similar POSIX syntax
- added missing (optional/not required) $ signs to shell variable names
Signed-off-by: Andreas Mohr <andi@lisas.de>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/patch-kernel | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 67e4b18..ece46ef 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -65,7 +65,7 @@ sourcedir=${1-/usr/src/linux}
patchdir=${2-.}
stopvers=${3-default}
-if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then
+if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
cat << USAGE
usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
source directory defaults to /usr/src/linux,
@@ -182,10 +182,12 @@ reversePatch () {
}
# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
-TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
+# force $TMPFILEs below to be in local directory: a slash character prevents
+# the dot command from using the search path.
+TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
tr -d [:blank:] < $TMPFILE > $TMPFILE.1
-source $TMPFILE.1
+. $TMPFILE.1
rm -f $TMPFILE*
if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
then
@@ -202,11 +204,7 @@ echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($
EXTRAVER=
if [ x$EXTRAVERSION != "x" ]
then
- if [ ${EXTRAVERSION:0:1} == "." ]; then
- EXTRAVER=${EXTRAVERSION:1}
- else
- EXTRAVER=$EXTRAVERSION
- fi
+ EXTRAVER=${EXTRAVERSION#.}
EXTRAVER=${EXTRAVER%%[[:punct:]]*}
#echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
fi
@@ -251,16 +249,16 @@ while : # incrementing SUBLEVEL (s in v.p.s)
do
CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
EXTRAVER=
- if [ $stopvers == $CURRENTFULLVERSION ]; then
+ if [ $stopvers = $CURRENTFULLVERSION ]; then
echo "Stopping at $CURRENTFULLVERSION base as requested."
break
fi
- SUBLEVEL=$((SUBLEVEL + 1))
+ SUBLEVEL=$(($SUBLEVEL + 1))
FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
#echo "#___ trying $FULLVERSION ___"
- if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then
+ if [ $(($SUBLEVEL)) -gt $(($STOPSUBLEVEL)) ]; then
echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
exit 1
fi
@@ -297,7 +295,7 @@ fi
if [ x$gotac != x ]; then
# Out great user wants the -ac patches
# They could have done -ac (get latest) or -acxx where xx=version they want
- if [ $gotac == "-ac" ]; then
+ if [ $gotac = "-ac" ]; then
# They want the latest version
HIGHESTPATCH=0
for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 31/77] kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish format
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (30 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 30/77] kbuild: eradicate bashisms in scripts/patch-kernel Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 32/77] kbuild: fix scripts/setlocalversion to avoid erroneous -dirty tag Sam Ravnborg
` (46 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Theodore Ts'o, Sam Ravnborg
From: Theodore Ts'o <tytso@mit.edu>
Change the automatic local version to have the form -nnnnn-gSHA1SUMID,
where 'nnnnn' is the number of commits since the last tag (i.e.,
2.6.21-rc7). This makes it much more likely that the package names created
for the kernel will look "newer" to a package manager.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/setlocalversion | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index a80d6ea..1b31da8 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -12,7 +12,7 @@ cd "${1:-.}" || usage
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Do we have an untagged version?
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
- printf '%s%s' -g `echo "$head" | cut -c1-8`
+ git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
fi
# Are there uncommitted changes?
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 32/77] kbuild: fix scripts/setlocalversion to avoid erroneous -dirty tag
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (31 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 31/77] kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish format Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 33/77] kbuild: fix false positive -dirty tag caused by make-kpkg Sam Ravnborg
` (45 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Theodore Ts'o, Sam Ravnborg
From: Theodore Ts'o <tytso@mit.edu>
If git's index file is out of date, and some files have been touched
such that their timestamp doesn't what is in the index, "git
diff-index HEAD" may show that a particular file is dirty, when in
fact it really isn't. Running "git update-index" will update the
index to avoid these false positives.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/setlocalversion | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 1b31da8..acce8eb 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -16,6 +16,7 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
fi
# Are there uncommitted changes?
+ git update-index --refresh --unmerged > /dev/null
if git diff-index HEAD | read dummy; then
printf '%s' -dirty
fi
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 33/77] kbuild: fix false positive -dirty tag caused by make-kpkg
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (32 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 32/77] kbuild: fix scripts/setlocalversion to avoid erroneous -dirty tag Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 34/77] kconfig: add hints/tips/tricks to Documentation/kbuild/kconfig-language.txt Sam Ravnborg
` (44 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Theodore Ts'o, Sam Ravnborg
From: Theodore Ts'o <tytso@mit.edu>
make-kpkg modifies scripts/package/Makefile and deletes
scripts/package/builddeb as part of its build process. Ignore these
changes so the tree isn't marked as -dirty, when it is just an
artifact of make-kpkg. (make-kpkg clean restores the files to their
original state, and these helper scripts won't affect the final
compiled kernel in any way.)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/setlocalversion | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index acce8eb..52f032e 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -17,7 +17,8 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Are there uncommitted changes?
git update-index --refresh --unmerged > /dev/null
- if git diff-index HEAD | read dummy; then
+ if git diff-index --name-only HEAD | grep -v "^scripts/package" \
+ | read dummy; then
printf '%s' -dirty
fi
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 34/77] kconfig: add hints/tips/tricks to Documentation/kbuild/kconfig-language.txt
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (33 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 33/77] kbuild: fix false positive -dirty tag caused by make-kpkg Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 35/77] kconfig: make kconfig MinGW friendly Sam Ravnborg
` (43 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Randy Dunlap, Sam Ravnborg
From: Randy Dunlap <randy.dunlap@oracle.com>
Add a section on kconfig hints: how to do <something> in Kconfig files.
Fix a few typos/spellos.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Documentation/kbuild/kconfig-language.txt | 54 +++++++++++++++++++++++++---
1 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 616043a..53ca12f 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -24,7 +24,7 @@ visible if its parent entry is also visible.
Menu entries
------------
-Most entries define a config option, all other entries help to organize
+Most entries define a config option; all other entries help to organize
them. A single configuration option is defined like this:
config MODVERSIONS
@@ -50,7 +50,7 @@ applicable everywhere (see syntax).
- type definition: "bool"/"tristate"/"string"/"hex"/"int"
Every config option must have a type. There are only two basic types:
- tristate and string, the other types are based on these two. The type
+ tristate and string; the other types are based on these two. The type
definition optionally accepts an input prompt, so these two examples
are equivalent:
@@ -108,7 +108,7 @@ applicable everywhere (see syntax).
equal to 'y' without visiting the dependencies. So abusing
select you are able to select a symbol FOO even if FOO depends
on BAR that is not set. In general use select only for
- non-visible symbols (no promts anywhere) and for symbols with
+ non-visible symbols (no prompts anywhere) and for symbols with
no dependencies. That will limit the usefulness but on the
other hand avoid the illegal configurations all over. kconfig
should one day warn about such things.
@@ -162,9 +162,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'.
-There are two types of symbols: constant and nonconstant symbols.
-Nonconstant symbols are the most common ones and are defined with the
-'config' statement. Nonconstant symbols consist entirely of alphanumeric
+There are two types of symbols: constant and non-constant symbols.
+Non-constant symbols are the most common ones and are defined with the
+'config' statement. Non-constant symbols consist entirely of alphanumeric
characters or underscores.
Constant symbols are only part of expressions. Constant symbols are
always surrounded by single or double quotes. Within the quote, any
@@ -301,3 +301,45 @@ mainmenu:
This sets the config program's title bar if the config program chooses
to use it.
+
+
+Kconfig hints
+-------------
+This is a collection of Kconfig tips, most of which aren't obvious at
+first glance and most of which have become idioms in several Kconfig
+files.
+
+Build as module only
+~~~~~~~~~~~~~~~~~~~~
+To restrict a component build to module-only, qualify its config symbol
+with "depends on m". E.g.:
+
+config FOO
+ depends on BAR && m
+
+limits FOO to module (=m) or disabled (=n).
+
+
+Build limited by a third config symbol which may be =y or =m
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+A common idiom that we see (and sometimes have problems with) is this:
+
+When option C in B (module or subsystem) uses interfaces from A (module
+or subsystem), and both A and B are tristate (could be =y or =m if they
+were independent of each other, but they aren't), then we need to limit
+C such that it cannot be built statically if A is built as a loadable
+module. (C already depends on B, so there is no dependency issue to
+take care of here.)
+
+If A is linked statically into the kernel image, C can be built
+statically or as loadable module(s). However, if A is built as loadable
+module(s), then C must be restricted to loadable module(s) also. This
+can be expressed in kconfig language as:
+
+config C
+ depends on A = y || A = B
+
+or for real examples, use this command in a kernel tree:
+
+$ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig
+
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 35/77] kconfig: make kconfig MinGW friendly
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (34 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 34/77] kconfig: add hints/tips/tricks to Documentation/kbuild/kconfig-language.txt Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 36/77] kconfig: allow overriding symbols Sam Ravnborg
` (42 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Ladislav Michl, Sam Ravnborg, Roman Zippel
From: Ladislav Michl <ladis@linux-mips.org>
Kconfig is powerfull tool. So powerfull that more and more software
projects are using it for configuration. So instead of fixing some of
them one by one, lets fix it in kernel and wait for sync.
This work was originaly done for PTXdist - GPL licensed build system for
userlands and cross-compilers, but it will not hurt kernel kconfig
either. PTXdist menuconfig now works on Windows linked with PDCurses and
compiled using MinGW - there is no termios and signals.
* Do not include <sys/wait.h> and <signal.h> (comes from times when
lxdialog was separate process)
* Do not mess with termios directly and let curses tell screen size.
Comment to commit c8dc68ad0fbd934e78e913b8a8d7b45945db4930 says
check for screen size could be removed later, but because it didn't
happen for more than year I left it here as well.
* Save cursor position added by Sam
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/lxdialog/dialog.h | 5 +--
scripts/kconfig/lxdialog/util.c | 32 +++++++++++++-------
scripts/kconfig/mconf.c | 61 +++++-------------------------------
3 files changed, 32 insertions(+), 66 deletions(-)
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index 7e17eba..c4ad37f 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -187,10 +187,9 @@ int item_is_tag(char tag);
int on_key_esc(WINDOW *win);
int on_key_resize(void);
-void init_dialog(const char *backtitle);
+int init_dialog(const char *backtitle);
void set_dialog_backtitle(const char *backtitle);
-void reset_dialog(void);
-void end_dialog(void);
+void end_dialog(int x, int y);
void attr_clear(WINDOW * win, int height, int width, chtype attr);
void dialog_clear(void);
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index a1bddef..86d95cc 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -266,31 +266,41 @@ void dialog_clear(void)
/*
* Do some initialization for dialog
*/
-void init_dialog(const char *backtitle)
+int init_dialog(const char *backtitle)
{
- dlg.backtitle = backtitle;
- color_setup(getenv("MENUCONFIG_COLOR"));
-}
+ int height, width;
+
+ initscr(); /* Init curses */
+ getmaxyx(stdscr, height, width);
+ if (height < 19 || width < 80) {
+ endwin();
+ return -ERRDISPLAYTOOSMALL;
+ }
-void set_dialog_backtitle(const char *backtitle)
-{
dlg.backtitle = backtitle;
-}
+ color_setup(getenv("MENUCONFIG_COLOR"));
-void reset_dialog(void)
-{
- initscr(); /* Init curses */
keypad(stdscr, TRUE);
cbreak();
noecho();
dialog_clear();
+
+ return 0;
+}
+
+void set_dialog_backtitle(const char *backtitle)
+{
+ dlg.backtitle = backtitle;
}
/*
* End using dialog functions.
*/
-void end_dialog(void)
+void end_dialog(int x, int y)
{
+ /* move cursor back to original position */
+ move(y, x);
+ refresh();
endwin();
}
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 47e226f..ee9ed30 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -8,17 +8,13 @@
* i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/
-#include <sys/ioctl.h>
-#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <termios.h>
#include <unistd.h>
#include <locale.h>
@@ -275,8 +271,6 @@ search_help[] = N_(
"\n");
static int indent;
-static struct termios ios_org;
-static int rows = 0, cols = 0;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
@@ -290,41 +284,6 @@ static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
-static void init_wsize(void)
-{
- struct winsize ws;
- char *env;
-
- if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) {
- rows = ws.ws_row;
- cols = ws.ws_col;
- }
-
- if (!rows) {
- env = getenv("LINES");
- if (env)
- rows = atoi(env);
- if (!rows)
- rows = 24;
- }
- if (!cols) {
- env = getenv("COLUMNS");
- if (env)
- cols = atoi(env);
- if (!cols)
- cols = 80;
- }
-
- if (rows < 19 || cols < 80) {
- fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
- fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
- exit(1);
- }
-
- rows -= 4;
- cols -= 5;
-}
-
static void get_prompt_str(struct gstr *r, struct property *prop)
{
int i, j;
@@ -900,13 +859,9 @@ static void conf_save(void)
}
}
-static void conf_cleanup(void)
-{
- tcsetattr(1, TCSAFLUSH, &ios_org);
-}
-
int main(int ac, char **av)
{
+ int saved_x, saved_y;
char *mode;
int res;
@@ -923,11 +878,13 @@ int main(int ac, char **av)
single_menu_mode = 1;
}
- tcgetattr(1, &ios_org);
- atexit(conf_cleanup);
- init_wsize();
- reset_dialog();
- init_dialog(NULL);
+ getyx(stdscr, saved_y, saved_x);
+ if (init_dialog(NULL)) {
+ fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
+ fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
+ return 1;
+ }
+
set_config_filename(conf_get_configname());
do {
conf(&rootmenu);
@@ -941,7 +898,7 @@ int main(int ac, char **av)
else
res = -1;
} while (res == KEY_ESC);
- end_dialog();
+ end_dialog(saved_x, saved_y);
switch (res) {
case 0:
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 36/77] kconfig: allow overriding symbols
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (35 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 35/77] kconfig: make kconfig MinGW friendly Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 37/77] kconfig: rename E_OR & friends to avoid name clash Sam Ravnborg
` (41 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Jan Engelhardt, Sam Ravnborg, Roman Zippel, Randy Dunlap
From: Jan Engelhardt <jengelh@computergmbh.de>
Allow config variables in .config to override earlier ones in the same
file. In other words,
# CONFIG_SECURITY is not defined
CONFIG_SECURITY=y
will activate it. This makes it a bit easier to do
cat original-config myconfig myconfig2 ... >.config;
and run *config as expected.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
---
scripts/kconfig/confdata.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e0f402f..2eccefb 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -232,8 +232,7 @@ load:
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
- conf_warning("trying to reassign symbol %s", sym->name);
- break;
+ conf_warning("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
@@ -272,8 +271,7 @@ load:
sym->type = S_OTHER;
}
if (sym->flags & def_flags) {
- conf_warning("trying to reassign symbol %s", sym->name);
- break;
+ conf_warning("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
@@ -297,11 +295,9 @@ load:
}
break;
case yes:
- if (cs->def[def].tri != no) {
- conf_warning("%s creates inconsistent choice state", sym->name);
- cs->flags &= ~def_flags;
- } else
- cs->def[def].val = sym;
+ if (cs->def[def].tri != no)
+ conf_warning("override: %s changes choice state", sym->name);
+ cs->def[def].val = sym;
break;
}
cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 37/77] kconfig: rename E_OR & friends to avoid name clash
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (36 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 36/77] kconfig: allow overriding symbols Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 38/77] kconfig: delete unused FILE_ and SYMBOL_ flags Sam Ravnborg
` (40 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Roman Zippel
We had macros named the same as a set of enumeration values.
It is legal code but very confusing to read - so rename
the macros from E_* to EXPR_*
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/confdata.c | 2 +-
scripts/kconfig/expr.c | 6 +++---
scripts/kconfig/expr.h | 6 +++---
scripts/kconfig/symbol.c | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2eccefb..497a19e 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -300,7 +300,7 @@ load:
cs->def[def].val = sym;
break;
}
- cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
+ cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
}
}
fclose(in);
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 6f98dbf..c8793d1 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e)
case E_AND:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
- return E_AND(val1, val2);
+ return EXPR_AND(val1, val2);
case E_OR:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
- return E_OR(val1, val2);
+ return EXPR_OR(val1, val2);
case E_NOT:
val1 = expr_calc_value(e->left.expr);
- return E_NOT(val1);
+ return EXPR_NOT(val1);
case E_EQUAL:
sym_calc_value(e->left.sym);
sym_calc_value(e->right.sym);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index a195986..b788997 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -45,9 +45,9 @@ struct expr {
union expr_data left, right;
};
-#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
-#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
-#define E_NOT(dep) (2-(dep))
+#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
+#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
+#define EXPR_NOT(dep) (2-(dep))
struct expr_value {
struct expr *expr;
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index c35dcc5..add068c 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -199,7 +199,7 @@ static void sym_calc_visibility(struct symbol *sym)
tri = no;
for_all_prompts(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
- tri = E_OR(tri, prop->visible.tri);
+ tri = EXPR_OR(tri, prop->visible.tri);
}
if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
tri = yes;
@@ -303,7 +303,7 @@ void sym_calc_value(struct symbol *sym)
if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym);
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
- } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
+ } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym))
newval.tri = sym->def[S_DEF_USER].tri;
@@ -312,7 +312,7 @@ void sym_calc_value(struct symbol *sym)
if (prop)
newval.tri = expr_calc_value(prop->expr);
}
- newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
+ newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri);
} else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop) {
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 38/77] kconfig: delete unused FILE_ and SYMBOL_ flags
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (37 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 37/77] kconfig: rename E_OR & friends to avoid name clash Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 39/77] kbuild: ignore cache modifiers for generating the tags files Sam Ravnborg
` (39 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Roman Zippel
The *_PRINTED flags were never used - so delete them.
Do we need them later then we can re-add them.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/expr.h | 2 --
scripts/kconfig/gconf.c | 2 --
2 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index b788997..1ee8b16 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -25,7 +25,6 @@ struct file {
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
-#define FILE_PRINTED 0x0004
typedef enum tristate {
no, mod, yes
@@ -86,7 +85,6 @@ struct symbol {
#define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020
-#define SYMBOL_PRINTED 0x0040
#define SYMBOL_VALID 0x0080
#define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 262908c..df910cb 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -119,8 +119,6 @@ const char *dbg_print_flags(int val)
strcat(buf, "choice/");
if (val & SYMBOL_CHOICEVAL)
strcat(buf, "choiceval/");
- if (val & SYMBOL_PRINTED)
- strcat(buf, "printed/");
if (val & SYMBOL_VALID)
strcat(buf, "valid/");
if (val & SYMBOL_OPTIONAL)
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 39/77] kbuild: ignore cache modifiers for generating the tags files
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (38 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 38/77] kconfig: delete unused FILE_ and SYMBOL_ flags Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 40/77] kconfig: fix whitespace and sort includes in conf.c Sam Ravnborg
` (38 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Uwe Kleine-König, Sam Ravnborg
From: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
With this patch I'm able to find the definition of _xmit_lock defined in
include/linux/netdevice.h as follows:
struct net_device {
...
spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
}
Otherwise this counts as definition of ____cacheline_aligned_in_smp.
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 4aa59b8..d599acd 100644
--- a/Makefile
+++ b/Makefile
@@ -1378,6 +1378,7 @@ define xtags
if $1 --version 2>&1 | grep -iq exuberant; then \
$(all-sources) | xargs $1 -a \
-I __initdata,__exitdata,__acquires,__releases \
+ -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \
--regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 40/77] kconfig: fix whitespace and sort includes in conf.c
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (39 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 39/77] kbuild: ignore cache modifiers for generating the tags files Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 41/77] kconfig: use C89 random functions " Sam Ravnborg
` (37 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild
Cc: Ladislav Michl, Sam Ravnborg, Roman, "Zippel <zippel"
From: Ladislav Michl <ladis@linux-mips.org>
Sort includes and remove leading whitespace.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org
---
scripts/kconfig/conf.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index d4737d3..a3d2d0b 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -4,11 +4,11 @@
*/
#include <ctype.h>
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <time.h>
+#include <unistd.h>
#include <sys/stat.h>
#define LKC_DIRECT_LINK
@@ -160,7 +160,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
}
case set_random:
do {
- val = (tristate)(random() % 3);
+ val = (tristate)(rand() % 3);
} while (!sym_tristate_within_range(sym, val));
switch (val) {
case no: line[0] = 'n'; break;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 41/77] kconfig: use C89 random functions in conf.c
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (40 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 40/77] kconfig: fix whitespace and sort includes in conf.c Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 42/77] kbuild: clean up modpost.c Sam Ravnborg
` (36 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Ladislav Michl, Sam Ravnborg, Roman Zippel
From: Ladislav Michl <ladis@linux-mips.org>
rand and srand functions conform also to C89 in addition to POSIX.1-2001,
which makes them a bit more portable (work also on MinGW host). Linux man
page also says:
"The versions of rand() and srand() in the Linux C Library use the same
random number generator as random() and srandom()".
* Use C89 conformant functions rand() and srand()
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/conf.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index a3d2d0b..01c2f35 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -375,7 +375,7 @@ static int conf_choice(struct menu *menu)
break;
case set_random:
if (is_new)
- def = (random() % cnt) + 1;
+ def = (rand() % cnt) + 1;
case set_default:
case set_yes:
case set_mod:
@@ -526,7 +526,7 @@ int main(int ac, char **av)
break;
case 'r':
input_mode = set_random;
- srandom(time(NULL));
+ srand(time(NULL));
break;
case 'h':
printf("See README for usage info\n");
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 42/77] kbuild: clean up modpost.c
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (41 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 41/77] kconfig: use C89 random functions " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 43/77] kbuild: scripts/mkmakefile: dynamic determination of output directory Sam Ravnborg
` (35 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
akpm complained about overly long lines in modpost.c and
when started additional style issues were fixed:
o Updated my copyright
o Removed unneeded {}
o Drop assignments in if ()
o Spaces around operators
o Break long lines
o locate * near variable not type
o Fix a format specifier for sizeof()
o Corrected placement of '{' and '}'
o spaces to tabs (but use tabs only for indention)
modpost.c is not checkpatch clean. Readability were favoured
on top of checkpatch compliance.
But checkpatch were used to find additional stuff to clean up.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 197 +++++++++++++++++++++++++------------------------
1 files changed, 101 insertions(+), 96 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 4d1c590..696d2a5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2,7 +2,7 @@
*
* Copyright 2003 Kai Germaschewski
* Copyright 2002-2004 Rusty Russell, IBM Corporation
- * Copyright 2006 Sam Ravnborg
+ * Copyright 2006-2008 Sam Ravnborg
* Based in part on module-init-tools/depmod.c,file2alias
*
* This software may be used and distributed according to the terms
@@ -74,7 +74,8 @@ static int is_vmlinux(const char *modname)
{
const char *myname;
- if ((myname = strrchr(modname, '/')))
+ myname = strrchr(modname, '/');
+ if (myname)
myname++;
else
myname = modname;
@@ -85,14 +86,13 @@ static int is_vmlinux(const char *modname)
void *do_nofail(void *ptr, const char *expr)
{
- if (!ptr) {
+ if (!ptr)
fatal("modpost: Memory allocation failure: %s.\n", expr);
- }
+
return ptr;
}
/* A list of all modules we processed */
-
static struct module *modules;
static struct module *find_module(char *modname)
@@ -115,7 +115,8 @@ static struct module *new_module(char *modname)
p = NOFAIL(strdup(modname));
/* strip trailing .o */
- if ((s = strrchr(p, '.')) != NULL)
+ s = strrchr(p, '.');
+ if (s != NULL)
if (strcmp(s, ".o") == 0)
*s = '\0';
@@ -156,7 +157,7 @@ static inline unsigned int tdb_hash(const char *name)
unsigned i; /* Used to cycle through random values. */
/* Set the initial value from the key size. */
- for (value = 0x238F13AF * strlen(name), i=0; name[i]; i++)
+ for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
value = (value + (((unsigned char *)name)[i] << (i*5 % 24)));
return (1103515243 * value + 12345);
@@ -200,7 +201,7 @@ static struct symbol *find_symbol(const char *name)
if (name[0] == '.')
name++;
- for (s = symbolhash[tdb_hash(name) % SYMBOL_HASH_SIZE]; s; s=s->next) {
+ for (s = symbolhash[tdb_hash(name) % SYMBOL_HASH_SIZE]; s; s = s->next) {
if (strcmp(s->name, name) == 0)
return s;
}
@@ -225,9 +226,10 @@ static const char *export_str(enum export ex)
return export_list[ex].str;
}
-static enum export export_no(const char * s)
+static enum export export_no(const char *s)
{
int i;
+
if (!s)
return export_unknown;
for (i = 0; export_list[i].export != export_unknown; i++) {
@@ -317,7 +319,7 @@ void *grab_file(const char *filename, unsigned long *size)
* spaces in the beginning of the line is trimmed away.
* Return a pointer to a static buffer.
**/
-char* get_next_line(unsigned long *pos, void *file, unsigned long size)
+char *get_next_line(unsigned long *pos, void *file, unsigned long size)
{
static char line[4096];
int skip = 1;
@@ -325,8 +327,7 @@ char* get_next_line(unsigned long *pos, void *file, unsigned long size)
signed char *p = (signed char *)file + *pos;
char *s = line;
- for (; *pos < size ; (*pos)++)
- {
+ for (; *pos < size ; (*pos)++) {
if (skip && isspace(*p)) {
p++;
continue;
@@ -388,7 +389,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
/* Check if file offset is correct */
if (hdr->e_shoff > info->size) {
- fatal("section header offset=%lu in file '%s' is bigger then filesize=%lu\n", (unsigned long)hdr->e_shoff, filename, info->size);
+ fatal("section header offset=%lu in file '%s' is bigger than "
+ "filesize=%lu\n", (unsigned long)hdr->e_shoff,
+ filename, info->size);
return 0;
}
@@ -409,7 +412,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
const char *secname;
if (sechdrs[i].sh_offset > info->size) {
- fatal("%s is truncated. sechdrs[i].sh_offset=%lu > sizeof(*hrd)=%lu\n", filename, (unsigned long)sechdrs[i].sh_offset, sizeof(*hdr));
+ fatal("%s is truncated. sechdrs[i].sh_offset=%lu > "
+ "sizeof(*hrd)=%zu\n", filename,
+ (unsigned long)sechdrs[i].sh_offset,
+ sizeof(*hdr));
return 0;
}
secname = secstrings + sechdrs[i].sh_name;
@@ -436,9 +442,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
info->strtab = (void *)hdr +
sechdrs[sechdrs[i].sh_link].sh_offset;
}
- if (!info->symtab_start) {
+ if (!info->symtab_start)
fatal("%s has no symtab?\n", filename);
- }
+
/* Fix endianness in symbols */
for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
sym->st_shndx = TO_NATIVE(sym->st_shndx);
@@ -507,11 +513,13 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
#endif
if (memcmp(symname, MODULE_SYMBOL_PREFIX,
- strlen(MODULE_SYMBOL_PREFIX)) == 0)
- mod->unres = alloc_symbol(symname +
- strlen(MODULE_SYMBOL_PREFIX),
- ELF_ST_BIND(sym->st_info) == STB_WEAK,
- mod->unres);
+ strlen(MODULE_SYMBOL_PREFIX)) == 0) {
+ mod->unres =
+ alloc_symbol(symname +
+ strlen(MODULE_SYMBOL_PREFIX),
+ ELF_ST_BIND(sym->st_info) == STB_WEAK,
+ mod->unres);
+ }
break;
default:
/* All exported symbols */
@@ -580,21 +588,21 @@ static char *get_modinfo(void *modinfo, unsigned long modinfo_len,
**/
static int strrcmp(const char *s, const char *sub)
{
- int slen, sublen;
+ int slen, sublen;
if (!s || !sub)
return 1;
slen = strlen(s);
- sublen = strlen(sub);
+ sublen = strlen(sub);
if ((slen == 0) || (sublen == 0))
return 1;
- if (sublen > slen)
- return 1;
+ if (sublen > slen)
+ return 1;
- return memcmp(s + slen - sublen, sub, sublen);
+ return memcmp(s + slen - sublen, sub, sublen);
}
/*
@@ -671,7 +679,8 @@ static int data_section(const char *name)
* the pattern is identified by:
* tosec = init or exit section
* fromsec = data section
- * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
+ * atsym = *driver, *_template, *_sht, *_ops, *_probe,
+ * *probe_one, *_console, *_timer
*
* Pattern 3:
* Whitelist all refereces from .text.head to .init.data
@@ -731,15 +740,16 @@ static int secref_whitelist(const char *modname, const char *tosec,
return 1;
/* Check for pattern 2 */
- if ((init_section(tosec) || exit_section(tosec)) && data_section(fromsec))
+ if ((init_section(tosec) || exit_section(tosec))
+ && data_section(fromsec))
for (s = pat2sym; *s; s++)
if (strrcmp(atsym, *s) == 0)
return 1;
/* Check for pattern 3 */
if ((strcmp(fromsec, ".text.head") == 0) &&
- ((strcmp(tosec, ".init.data") == 0) ||
- (strcmp(tosec, ".init.text") == 0)))
+ ((strcmp(tosec, ".init.data") == 0) ||
+ (strcmp(tosec, ".init.text") == 0)))
return 1;
/* Check for pattern 4 */
@@ -816,7 +826,7 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
**/
static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
const char *sec,
- Elf_Sym **before, Elf_Sym **after)
+ Elf_Sym **before, Elf_Sym **after)
{
Elf_Sym *sym;
Elf_Ehdr *hdr = elf->hdr;
@@ -842,20 +852,15 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
if ((addr - sym->st_value) < beforediff) {
beforediff = addr - sym->st_value;
*before = sym;
- }
- else if ((addr - sym->st_value) == beforediff) {
+ } else if ((addr - sym->st_value) == beforediff) {
*before = sym;
}
- }
- else
- {
+ } else {
if ((sym->st_value - addr) < afterdiff) {
afterdiff = sym->st_value - addr;
*after = sym;
- }
- else if ((sym->st_value - addr) == afterdiff) {
+ } else if ((sym->st_value - addr) == afterdiff)
*after = sym;
- }
}
}
}
@@ -952,12 +957,14 @@ static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
switch (r_typ) {
case R_ARM_ABS32:
/* From ARM ABI: (S + A) | T */
- r->r_addend = (int)(long)(elf->symtab_start + ELF_R_SYM(r->r_info));
+ r->r_addend = (int)(long)
+ (elf->symtab_start + ELF_R_SYM(r->r_info));
break;
case R_ARM_PC24:
/* From ARM ABI: ((S + A) | T) - P */
- r->r_addend = (int)(long)(elf->hdr + elf->sechdrs[rsection].sh_offset +
- (r->r_offset - elf->sechdrs[rsection].sh_addr));
+ r->r_addend = (int)(long)(elf->hdr +
+ elf->sechdrs[rsection].sh_offset +
+ (r->r_offset - elf->sechdrs[rsection].sh_addr));
break;
default:
return 1;
@@ -1002,7 +1009,7 @@ static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
**/
static void check_sec_ref(struct module *mod, const char *modname,
struct elf_info *elf,
- int section(const char*),
+ int section(const char *),
int section_ref_ok(const char *))
{
int i;
@@ -1022,7 +1029,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
if (sechdrs[i].sh_type == SHT_RELA) {
Elf_Rela *rela;
Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset;
- Elf_Rela *stop = (void*)start + sechdrs[i].sh_size;
+ Elf_Rela *stop = (void *)start + sechdrs[i].sh_size;
name += strlen(".rela");
if (section_ref_ok(name))
continue;
@@ -1059,7 +1066,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
} else if (sechdrs[i].sh_type == SHT_REL) {
Elf_Rel *rel;
Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset;
- Elf_Rel *stop = (void*)start + sechdrs[i].sh_size;
+ Elf_Rel *stop = (void *)start + sechdrs[i].sh_size;
name += strlen(".rel");
if (section_ref_ok(name))
continue;
@@ -1088,7 +1095,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
continue;
break;
case EM_ARM:
- if(addend_arm_rel(elf, i, &r))
+ if (addend_arm_rel(elf, i, &r))
continue;
break;
case EM_MIPS:
@@ -1126,32 +1133,32 @@ static int initexit_section_ref_ok(const char *name)
const char **s;
/* Absolute section names */
const char *namelist1[] = {
- "__bug_table", /* used by powerpc for BUG() */
+ "__bug_table", /* used by powerpc for BUG() */
"__ex_table",
".altinstructions",
- ".cranges", /* used by sh64 */
+ ".cranges", /* used by sh64 */
".fixup",
- ".machvec", /* ia64 + powerpc uses these */
+ ".machvec", /* ia64 + powerpc uses these */
".machine.desc",
- ".opd", /* See comment [OPD] */
+ ".opd", /* See comment [OPD] */
"__dbe_table",
".parainstructions",
".pdr",
- ".plt", /* seen on ARCH=um build on x86_64. Harmless */
+ ".plt", /* seen on ARCH=um build on x86_64. Harmless */
".smp_locks",
".stab",
".m68k_fixup",
- ".xt.prop", /* xtensa informational section */
- ".xt.lit", /* xtensa informational section */
+ ".xt.prop", /* xtensa informational section */
+ ".xt.lit", /* xtensa informational section */
NULL
};
/* Start of section names */
const char *namelist2[] = {
".debug",
".eh_frame",
- ".note", /* ignore ELF notes - may contain anything */
- ".got", /* powerpc - global offset table */
- ".toc", /* powerpc - table of contents */
+ ".note", /* ignore ELF notes - may contain anything */
+ ".got", /* powerpc - global offset table */
+ ".toc", /* powerpc - table of contents */
NULL
};
/* part of section name */
@@ -1221,7 +1228,8 @@ static int init_section_ref_ok(const char *name)
return 1;
/* If section name ends with ".init" we allow references
- * as is the case with .initcallN.init, .early_param.init, .taglist.init etc
+ * as is the case with .initcallN.init, .early_param.init,
+ * .taglist.init etc
*/
if (strrcmp(name, ".init") == 0)
return 1;
@@ -1368,7 +1376,7 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s)
}
}
-static void check_for_unused(enum export exp, const char* m, const char* s)
+static void check_for_unused(enum export exp, const char *m, const char *s)
{
const char *e = is_vmlinux(m) ?"":".ko";
@@ -1401,7 +1409,7 @@ static void check_exports(struct module *mod)
if (!mod->gpl_compatible)
check_for_gpl_usage(exp->export, basename, exp->name);
check_for_unused(exp->export, basename, exp->name);
- }
+ }
}
/**
@@ -1465,9 +1473,8 @@ static int add_versions(struct buffer *b, struct module *mod)
buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
for (s = mod->unres; s; s = s->next) {
- if (!s->module) {
+ if (!s->module)
continue;
- }
if (!s->crc_valid) {
warn("\"%s\" [%s.ko] has no CRC!\n",
s->name, mod->name);
@@ -1488,9 +1495,8 @@ static void add_depends(struct buffer *b, struct module *mod,
struct module *m;
int first = 1;
- for (m = modules; m; m = m->next) {
+ for (m = modules; m; m = m->next)
m->seen = is_vmlinux(m->name);
- }
buf_printf(b, "\n");
buf_printf(b, "static const char __module_depends[]\n");
@@ -1506,7 +1512,8 @@ static void add_depends(struct buffer *b, struct module *mod,
continue;
s->module->seen = 1;
- if ((p = strrchr(s->module->name, '/')) != NULL)
+ p = strrchr(s->module->name, '/');
+ if (p)
p++;
else
p = s->module->name;
@@ -1578,7 +1585,7 @@ static void read_dump(const char *fname, unsigned int kernel)
void *file = grab_file(fname, &size);
char *line;
- if (!file)
+ if (!file)
/* No symbol versions, silently ignore */
return;
@@ -1601,11 +1608,10 @@ static void read_dump(const char *fname, unsigned int kernel)
crc = strtoul(line, &d, 16);
if (*symname == '\0' || *modname == '\0' || *d != '\0')
goto fail;
-
- if (!(mod = find_module(modname))) {
- if (is_vmlinux(modname)) {
+ mod = find_module(modname);
+ if (!mod) {
+ if (is_vmlinux(modname))
have_vmlinux = 1;
- }
mod = new_module(NOFAIL(strdup(modname)));
mod->skip = 1;
}
@@ -1662,31 +1668,31 @@ int main(int argc, char **argv)
int err;
while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
- switch(opt) {
- case 'i':
- kernel_read = optarg;
- break;
- case 'I':
- module_read = optarg;
- external_module = 1;
- break;
- case 'm':
- modversions = 1;
- break;
- case 'o':
- dump_write = optarg;
- break;
- case 'a':
- all_versions = 1;
- break;
- case 's':
- vmlinux_section_warnings = 0;
- break;
- case 'w':
- warn_unresolved = 1;
- break;
- default:
- exit(1);
+ switch (opt) {
+ case 'i':
+ kernel_read = optarg;
+ break;
+ case 'I':
+ module_read = optarg;
+ external_module = 1;
+ break;
+ case 'm':
+ modversions = 1;
+ break;
+ case 'o':
+ dump_write = optarg;
+ break;
+ case 'a':
+ all_versions = 1;
+ break;
+ case 's':
+ vmlinux_section_warnings = 0;
+ break;
+ case 'w':
+ warn_unresolved = 1;
+ break;
+ default:
+ exit(1);
}
}
@@ -1695,9 +1701,8 @@ int main(int argc, char **argv)
if (module_read)
read_dump(module_read, 0);
- while (optind < argc) {
+ while (optind < argc)
read_symbols(argv[optind++]);
- }
for (mod = modules; mod; mod = mod->next) {
if (mod->skip)
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 43/77] kbuild: scripts/mkmakefile: dynamic determination of output directory
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (42 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 42/77] kbuild: clean up modpost.c Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 44/77] kbuild: document 'make prepare' in 'make help' Sam Ravnborg
` (34 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Jan Beulich, Sam Ravnborg
From: Jan Beulich <jbeulich@novell.com>
Rather than fixing the output directory in the generated Makefile,
determine it from the placement of Makefile. This allows moving
the build tree around or accessing it through different mount paths.
(The lastword definition is a compatibility one for make prior to 3.81;
newer make will simply ignore it and use the [faster] built-in.)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mkmakefile | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e0f54b9..e65d8b3 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile
VERSION = $3
PATCHLEVEL = $4
-KERNELSRC := $1
-KERNELOUTPUT := $2
+lastword = \$(word \$(words \$(1)),\$(1))
+makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
+
+MAKEARGS := -C $1
+MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
MAKEFLAGS += --no-print-directory
@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory
all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
all:
- \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all)
+ \$(MAKE) \$(MAKEARGS) \$(all)
Makefile:;
\$(all) %/: all
@:
+
EOF
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 44/77] kbuild: document 'make prepare' in 'make help'
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (43 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 43/77] kbuild: scripts/mkmakefile: dynamic determination of output directory Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 45/77] kconfig: update-po-config info Sam Ravnborg
` (33 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Valdis.Kletnieks@vt.edu, Valdis Kletnieks, Sam Ravnborg
From: Valdis.Kletnieks@vt.edu <Valdis.Kletnieks@vt.edu>
The output of 'make help' covers a lot of options, but doesn't include
a listing for 'make prepare'. Here's a one-liner to fix that...
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index d599acd..e518ed6 100644
--- a/Makefile
+++ b/Makefile
@@ -1181,6 +1181,7 @@ help:
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
+ @echo ' prepare - Set up for building external modules'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 45/77] kconfig: update-po-config info
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (44 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 44/77] kbuild: document 'make prepare' in 'make help' Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 46/77] kconfig: whitespace removing Sam Ravnborg
` (32 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
This patch adds tracking messages.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/Makefile | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 8091435..d28bf85 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -24,22 +24,25 @@ oldconfig: $(obj)/conf
silentoldconfig: $(obj)/conf
$< -s $(Kconfig)
-# Create new linux.po file
+# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
# The symlink is used to repair a deficiency in arch/um
update-po-config: $(obj)/kxgettext
- xgettext --default-domain=linux \
+ $(Q)echo " GEN config"
+ $(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
--files-from=scripts/kconfig/POTFILES.in \
--output $(obj)/config.pot
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
- (for i in `ls arch/`; \
- do \
- $(obj)/kxgettext arch/$$i/Kconfig; \
- done ) >> $(obj)/config.pot
- msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
+ $(Q)(for i in `ls arch/`; \
+ do \
+ echo " GEN $$i"; \
+ $(obj)/kxgettext arch/$$i/Kconfig \
+ >> $(obj)/config.pot; \
+ done )
+ $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot
$(Q)rm -f arch/um/Kconfig.arch
$(Q)rm -f $(obj)/config.pot
@@ -138,6 +141,7 @@ endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
clean-files += mconf qconf gconf
+clean-files += config.pot linux.pot
# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
PHONY += $(obj)/dochecklxdialog
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 46/77] kconfig: whitespace removing
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (45 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 45/77] kconfig: update-po-config info Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 47/77] kconfig: missing macros in gconfig Sam Ravnborg
` (31 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
This patch removes the unnecessary whitespaces from
end of help lines of Kconfig files.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/lex.zconf.c_shipped | 5 +++++
scripts/kconfig/zconf.l | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index a065d5a..bed0f4e 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -1275,6 +1275,11 @@ YY_RULE_SETUP
case 32:
YY_RULE_SETUP
{
+ while (zconfleng) {
+ if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
+ break;
+ zconfleng--;
+ }
append_string(zconftext, zconfleng);
if (!first_ts)
first_ts = last_ts;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 187d38c..4cea5c8 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -217,6 +217,11 @@ n [A-Za-z0-9_]
append_string("\n", 1);
}
[^ \t\n].* {
+ while (yyleng) {
+ if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
+ break;
+ yyleng--;
+ }
append_string(yytext, yyleng);
if (!first_ts)
first_ts = last_ts;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 47/77] kconfig: missing macros in gconfig
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (46 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 46/77] kconfig: whitespace removing Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 48/77] kconfig: gettext support for gconfig Sam Ravnborg
` (30 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
This patch adds missing gettext macros.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/gconf.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index df910cb..dfe748c 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -455,11 +455,15 @@ static void text_insert_help(struct menu *menu)
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
- const char *prompt = menu_get_prompt(menu);
+ const char *prompt = _(menu_get_prompt(menu));
gchar *name;
const char *help;
- help = _(menu_get_help(menu));
+ help = menu_get_help(menu);
+
+ /* Gettextize if the help text not empty */
+ if ((help != 0) && (help[0] != 0))
+ help = _(help);
if (menu->sym && menu->sym->name)
name = g_strdup_printf(_(menu->sym->name));
@@ -1169,7 +1173,7 @@ static gchar **fill_row(struct menu *menu)
bzero(row, sizeof(row));
row[COL_OPTION] =
- g_strdup_printf("%s %s", menu_get_prompt(menu),
+ g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
sym && sym_has_value(sym) ? "(NEW)" : "");
if (show_all && !menu_is_visible(menu))
@@ -1219,7 +1223,7 @@ static gchar **fill_row(struct menu *menu)
if (def_menu)
row[COL_VALUE] =
- g_strdup(menu_get_prompt(def_menu));
+ g_strdup(_(menu_get_prompt(def_menu)));
}
if (sym->flags & SYMBOL_CHOICEVAL)
row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 48/77] kconfig: gettext support for gconfig
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (47 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 47/77] kconfig: missing macros in gconfig Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 49/77] kconfig: macro fix in menu.c Sam Ravnborg
` (29 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
Gettext support for menu and toolbar.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/Makefile | 7 +++++--
scripts/kconfig/POTFILES.in | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d28bf85..32e8c5a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -27,7 +27,7 @@ silentoldconfig: $(obj)/conf
# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
# The symlink is used to repair a deficiency in arch/um
-update-po-config: $(obj)/kxgettext
+update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)echo " GEN config"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
@@ -139,7 +139,7 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o
endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
- .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
+ .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf
clean-files += config.pot linux.pot
@@ -254,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h
$(obj)/lkc_defs.h: $(src)/lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
+# Extract gconf menu items for I18N support
+$(obj)/gconf.glade.h: $(obj)/gconf.glade
+ intltool-extract --type=gettext/glade $(obj)/gconf.glade
###
# The following requires flex/bison/gperf
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in
index cc94e46..19d0e63 100644
--- a/scripts/kconfig/POTFILES.in
+++ b/scripts/kconfig/POTFILES.in
@@ -2,4 +2,5 @@ scripts/kconfig/mconf.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/gconf.c
+scripts/kconfig/gconf.glade.h
scripts/kconfig/qconf.cc
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 49/77] kconfig: macro fix in menu.c
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (48 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 48/77] kconfig: gettext support for gconfig Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 50/77] kconfig: gettext support for xconfig Sam Ravnborg
` (28 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
This patch removes the indirect I18N support for config file.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
| 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f9d0d91..e9deebe 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -394,9 +394,9 @@ bool menu_is_visible(struct menu *menu)
const char *menu_get_prompt(struct menu *menu)
{
if (menu->prompt)
- return _(menu->prompt->text);
+ return menu->prompt->text;
else if (menu->sym)
- return _(menu->sym->name);
+ return menu->sym->name;
return NULL;
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 50/77] kconfig: gettext support for xconfig
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (49 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 49/77] kconfig: macro fix in menu.c Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 51/77] kconfig: gettext support for menuconfig Sam Ravnborg
` (27 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
Full gettext support for xconfig.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/qconf.cc | 93 ++++++++++++++++++++++++----------------------
1 files changed, 49 insertions(+), 44 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index b9bb32d..9fe27ca 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -114,7 +114,7 @@ void ConfigItem::updateMenu(void)
sym = menu->sym;
prop = menu->prompt;
- prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
+ prompt = _(menu_get_prompt(menu));
if (prop) switch (prop->type) {
case P_MENU:
@@ -208,7 +208,7 @@ void ConfigItem::updateMenu(void)
break;
}
if (!sym_has_value(sym) && visible)
- prompt += " (NEW)";
+ prompt += _(" (NEW)");
set_prompt:
setText(promptColIdx, prompt);
}
@@ -346,7 +346,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
for (i = 0; i < colNr; i++)
colMap[i] = colRevMap[i] = -1;
- addColumn(promptColIdx, "Option");
+ addColumn(promptColIdx, _("Option"));
reinit();
}
@@ -360,14 +360,14 @@ void ConfigList::reinit(void)
removeColumn(nameColIdx);
if (showName)
- addColumn(nameColIdx, "Name");
+ addColumn(nameColIdx, _("Name"));
if (showRange) {
addColumn(noColIdx, "N");
addColumn(modColIdx, "M");
addColumn(yesColIdx, "Y");
}
if (showData)
- addColumn(dataColIdx, "Value");
+ addColumn(dataColIdx, _("Value"));
updateListAll();
}
@@ -803,7 +803,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
QAction *action;
headerPopup = new QPopupMenu(this);
- action = new QAction(NULL, "Show Name", 0, this);
+ action = new QAction(NULL, _("Show Name"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
@@ -811,7 +811,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showName);
action->addTo(headerPopup);
- action = new QAction(NULL, "Show Range", 0, this);
+ action = new QAction(NULL, _("Show Range"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
@@ -819,7 +819,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showRange);
action->addTo(headerPopup);
- action = new QAction(NULL, "Show Data", 0, this);
+ action = new QAction(NULL, _("Show Data"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
@@ -1041,7 +1041,12 @@ void ConfigInfoView::menuInfo(void)
if (showDebug())
debug = debug_info(sym);
- help = print_filter(_(menu_get_help(menu)));
+ help = menu_get_help(menu);
+ /* Gettextize if the help text not empty */
+ if (help.isEmpty())
+ help = print_filter(menu_get_help(menu));
+ else
+ help = print_filter(_(menu_get_help(menu)));
} else if (menu->prompt) {
head += "<big><b>";
head += print_filter(_(menu->prompt->text));
@@ -1167,7 +1172,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
{
QPopupMenu* popup = Parent::createPopupMenu(pos);
- QAction* action = new QAction(NULL,"Show Debug Info", 0, popup);
+ QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1189,11 +1194,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6);
QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6);
- layout2->addWidget(new QLabel("Find:", this));
+ layout2->addWidget(new QLabel(_("Find:"), this));
editField = new QLineEdit(this);
connect(editField, SIGNAL(returnPressed()), SLOT(search()));
layout2->addWidget(editField);
- searchButton = new QPushButton("Search", this);
+ searchButton = new QPushButton(_("Search"), this);
searchButton->setAutoDefault(FALSE);
connect(searchButton, SIGNAL(clicked()), SLOT(search()));
layout2->addWidget(searchButton);
@@ -1313,58 +1318,58 @@ ConfigMainWindow::ConfigMainWindow(void)
menu = menuBar();
toolBar = new QToolBar("Tools", this);
- backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this);
+ backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
connect(backAction, SIGNAL(activated()), SLOT(goBack()));
backAction->setEnabled(FALSE);
- QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this);
+ QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this);
connect(quitAction, SIGNAL(activated()), SLOT(close()));
- QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this);
+ QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this);
connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
- saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
+ saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this);
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
conf_set_changed_callback(conf_changed);
// Set saveAction's initial state
conf_changed();
- QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
+ QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
- QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this);
+ QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this);
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
- QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
+ QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
- QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this);
+ QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
- QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
+ QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
- QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
+ QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
showNameAction->setToggleAction(TRUE);
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
showNameAction->setOn(configView->showName());
- QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this);
+ QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this);
showRangeAction->setToggleAction(TRUE);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
showRangeAction->setOn(configList->showRange);
- QAction *showDataAction = new QAction(NULL, "Show Data", 0, this);
+ QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this);
showDataAction->setToggleAction(TRUE);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
showDataAction->setOn(configList->showData);
- QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this);
+ QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
showAllAction->setToggleAction(TRUE);
connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
showAllAction->setOn(configList->showAll);
- QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
+ QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
showDebugAction->setToggleAction(TRUE);
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
showDebugAction->setOn(helpText->showDebug());
- QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
+ QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this);
connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
- QAction *showAboutAction = new QAction(NULL, "About", 0, this);
+ QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
// init tool bar
@@ -1379,7 +1384,7 @@ ConfigMainWindow::ConfigMainWindow(void)
// create config menu
QPopupMenu* config = new QPopupMenu(this);
- menu->insertItem("&File", config);
+ menu->insertItem(_("&File"), config);
loadAction->addTo(config);
saveAction->addTo(config);
saveAsAction->addTo(config);
@@ -1388,12 +1393,12 @@ ConfigMainWindow::ConfigMainWindow(void)
// create edit menu
QPopupMenu* editMenu = new QPopupMenu(this);
- menu->insertItem("&Edit", editMenu);
+ menu->insertItem(_("&Edit"), editMenu);
searchAction->addTo(editMenu);
// create options menu
QPopupMenu* optionMenu = new QPopupMenu(this);
- menu->insertItem("&Option", optionMenu);
+ menu->insertItem(_("&Option"), optionMenu);
showNameAction->addTo(optionMenu);
showRangeAction->addTo(optionMenu);
showDataAction->addTo(optionMenu);
@@ -1404,7 +1409,7 @@ ConfigMainWindow::ConfigMainWindow(void)
// create help menu
QPopupMenu* helpMenu = new QPopupMenu(this);
menu->insertSeparator();
- menu->insertItem("&Help", helpMenu);
+ menu->insertItem(_("&Help"), helpMenu);
showIntroAction->addTo(helpMenu);
showAboutAction->addTo(helpMenu);
@@ -1452,14 +1457,14 @@ void ConfigMainWindow::loadConfig(void)
if (s.isNull())
return;
if (conf_read(QFile::encodeName(s)))
- QMessageBox::information(this, "qconf", "Unable to load configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to load configuration!"));
ConfigView::updateListAll();
}
void ConfigMainWindow::saveConfig(void)
{
if (conf_write(NULL))
- QMessageBox::information(this, "qconf", "Unable to save configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::saveConfigAs(void)
@@ -1468,7 +1473,7 @@ void ConfigMainWindow::saveConfigAs(void)
if (s.isNull())
return;
if (conf_write(QFile::encodeName(s)))
- QMessageBox::information(this, "qconf", "Unable to save configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::searchConfig(void)
@@ -1612,11 +1617,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
e->accept();
return;
}
- QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning,
+ QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
- mb.setButtonText(QMessageBox::Yes, "&Save Changes");
- mb.setButtonText(QMessageBox::No, "&Discard Changes");
- mb.setButtonText(QMessageBox::Cancel, "Cancel Exit");
+ mb.setButtonText(QMessageBox::Yes, _("&Save Changes"));
+ mb.setButtonText(QMessageBox::No, _("&Discard Changes"));
+ mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
switch (mb.exec()) {
case QMessageBox::Yes:
conf_write(NULL);
@@ -1631,7 +1636,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
void ConfigMainWindow::showIntro(void)
{
- static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
+ static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
"For each option, a blank box indicates the feature is disabled, a check\n"
"indicates it is enabled, and a dot indicates that it is to be compiled\n"
"as a module. Clicking on the box will cycle through the three states.\n\n"
@@ -1641,15 +1646,15 @@ void ConfigMainWindow::showIntro(void)
"options must be enabled to support the option you are interested in, you can\n"
"still view the help of a grayed-out option.\n\n"
"Toggling Show Debug Info under the Options menu will show the dependencies,\n"
- "which you can then match by examining other options.\n\n";
+ "which you can then match by examining other options.\n\n");
QMessageBox::information(this, "qconf", str);
}
void ConfigMainWindow::showAbout(void)
{
- static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
- "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
+ static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
+ "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n");
QMessageBox::information(this, "qconf", str);
}
@@ -1707,7 +1712,7 @@ static const char *progname;
static void usage(void)
{
- printf("%s <config>\n", progname);
+ printf(_("%s <config>\n"), progname);
exit(0);
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 51/77] kconfig: gettext support for menuconfig
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (50 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 50/77] kconfig: gettext support for xconfig Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 52/77] kconfig: gettext support for lxdialog Sam Ravnborg
` (26 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
Full gettext support for menuconfig.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/mconf.c | 51 ++++++++++++++++++++++++-----------------------
1 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index ee9ed30..50e61c4 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -289,11 +289,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
int i, j;
struct menu *submenu[8], *menu;
- str_printf(r, "Prompt: %s\n", prop->text);
- str_printf(r, " Defined at %s:%d\n", prop->menu->file->name,
+ str_printf(r, _("Prompt: %s\n"), _(prop->text));
+ str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
- str_append(r, " Depends on: ");
+ str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
@@ -301,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu;
if (i > 0) {
- str_printf(r, " Location:\n");
+ str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
- str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu));
+ str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
- menu->sym->name : "<choice>",
+ menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
@@ -337,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
if (hit)
str_append(r, "\n");
if (sym->rev_dep.expr) {
- str_append(r, " Selected by: ");
+ str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
@@ -353,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
- str_append(&res, "No matches found.\n");
+ str_append(&res, _("No matches found.\n"));
return res;
}
@@ -433,6 +433,7 @@ static void build_conf(struct menu *menu)
switch (prop->type) {
case P_MENU:
child_count++;
+ prompt = _(prompt);
if (single_menu_mode) {
item_make("%s%*c%s",
menu->data ? "-->" : "++>",
@@ -448,7 +449,7 @@ static void build_conf(struct menu *menu)
case P_COMMENT:
if (prompt) {
child_count++;
- item_make(" %*c*** %s ***", indent + 1, ' ', prompt);
+ item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
item_set_tag(':');
item_set_data(menu);
}
@@ -456,7 +457,7 @@ static void build_conf(struct menu *menu)
default:
if (prompt) {
child_count++;
- item_make("---%*c%s", indent + 1, ' ', prompt);
+ item_make("---%*c%s", indent + 1, ' ', _(prompt));
item_set_tag(':');
item_set_data(menu);
}
@@ -500,10 +501,10 @@ static void build_conf(struct menu *menu)
item_set_data(menu);
}
- item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
+ item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
if (val == yes) {
if (def_menu) {
- item_add_str(" (%s)", menu_get_prompt(def_menu));
+ item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
@@ -515,7 +516,7 @@ static void build_conf(struct menu *menu)
}
} else {
if (menu == current_menu) {
- item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
+ item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
item_set_tag(':');
item_set_data(menu);
goto conf_childs;
@@ -558,17 +559,17 @@ static void build_conf(struct menu *menu)
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
- item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
+ item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
- "" : " (NEW)");
+ "" : _(" (NEW)"));
item_set_tag('s');
item_set_data(menu);
goto conf_childs;
}
}
- item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
+ item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
- "" : " (NEW)");
+ "" : _(" (NEW)"));
if (menu->prompt->type == P_MENU) {
item_add_str(" --->");
return;
@@ -606,7 +607,7 @@ static void conf(struct menu *menu)
item_set_tag('S');
}
dialog_clear();
- res = dialog_menu(prompt ? prompt : _("Main Menu"),
+ res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
_(menu_instructions),
active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
@@ -653,7 +654,7 @@ static void conf(struct menu *menu)
if (sym)
show_help(submenu);
else
- show_helptext("README", _(mconf_readme));
+ show_helptext(_("README"), _(mconf_readme));
break;
case 3:
if (item_is_tag('t')) {
@@ -711,13 +712,13 @@ static void show_help(struct menu *menu)
str_append(&help, nohelp_text);
}
get_symbol_str(&help, sym);
- show_helptext(menu_get_prompt(menu), str_get(&help));
+ show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help);
}
static void conf_choice(struct menu *menu)
{
- const char *prompt = menu_get_prompt(menu);
+ const char *prompt = _(menu_get_prompt(menu));
struct menu *child;
struct symbol *active;
@@ -731,7 +732,7 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
- item_make("%s", menu_get_prompt(child));
+ item_make("%s", _(menu_get_prompt(child)));
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
@@ -739,7 +740,7 @@ static void conf_choice(struct menu *menu)
item_set_tag('X');
}
dialog_clear();
- res = dialog_checklist(prompt ? prompt : _("Main Menu"),
+ res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
_(radiolist_instructions),
15, 70, 6);
selected = item_activate_selected();
@@ -785,10 +786,10 @@ static void conf_string(struct menu *menu)
heading = _(inputbox_instructions_string);
break;
default:
- heading = "Internal mconf error!";
+ heading = _("Internal mconf error!");
}
dialog_clear();
- res = dialog_inputbox(prompt ? prompt : _("Main Menu"),
+ res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
heading, 10, 75,
sym_get_string_value(menu->sym));
switch (res) {
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 52/77] kconfig: gettext support for lxdialog
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (51 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 51/77] kconfig: gettext support for menuconfig Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 53/77] kconfig: gettext support for config Sam Ravnborg
` (25 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
Gettext support for lxdialog.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/POTFILES.in | 6 ++++++
scripts/kconfig/lxdialog/checklist.c | 4 ++--
scripts/kconfig/lxdialog/dialog.h | 6 ++++++
scripts/kconfig/lxdialog/inputbox.c | 4 ++--
| 6 +++---
scripts/kconfig/lxdialog/textbox.c | 2 +-
scripts/kconfig/lxdialog/yesno.c | 4 ++--
7 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in
index 19d0e63..9674573 100644
--- a/scripts/kconfig/POTFILES.in
+++ b/scripts/kconfig/POTFILES.in
@@ -1,3 +1,9 @@
+scripts/kconfig/lxdialog/checklist.c
+scripts/kconfig/lxdialog/inputbox.c
+scripts/kconfig/lxdialog/menubox.c
+scripts/kconfig/lxdialog/textbox.c
+scripts/kconfig/lxdialog/util.c
+scripts/kconfig/lxdialog/yesno.c
scripts/kconfig/mconf.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index cf69708..b2a878c 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11;
int y = height - 2;
- print_button(dialog, "Select", y, x, selected == 0);
- print_button(dialog, " Help ", y, x + 14, selected == 1);
+ print_button(dialog, gettext("Select"), y, x, selected == 0);
+ print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index c4ad37f..b5211fc 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -26,6 +26,12 @@
#include <string.h>
#include <stdbool.h>
+#ifndef KBUILD_NO_NLS
+# include <libintl.h>
+#else
+# define gettext(Msgid) ((const char *) (Msgid))
+#endif
+
#ifdef __sun__
#define CURS_MACROS
#endif
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 05e7206..4946bd0 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11;
int y = height - 2;
- print_button(dialog, " Ok ", y, x, selected == 0);
- print_button(dialog, " Help ", y, x + 14, selected == 1);
+ print_button(dialog, gettext(" Ok "), y, x, selected == 0);
+ print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);
--git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 0d83159..fa9d633 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected)
int x = width / 2 - 16;
int y = height - 2;
- print_button(win, "Select", y, x, selected == 0);
- print_button(win, " Exit ", y, x + 12, selected == 1);
- print_button(win, " Help ", y, x + 24, selected == 2);
+ print_button(win, gettext("Select"), y, x, selected == 0);
+ print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
+ print_button(win, gettext(" Help "), y, x + 24, selected == 2);
wmove(win, y, x + 1 + 12 * selected);
wrefresh(win);
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index fabfc1a..c704712 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -114,7 +114,7 @@ do_resize:
print_title(dialog, title, width);
- print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE);
+ print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE);
wnoutrefresh(dialog);
getyx(dialog, cur_y, cur_x); /* Save cursor position */
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c
index ee0a04e..4e6e809 100644
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 10;
int y = height - 2;
- print_button(dialog, " Yes ", y, x, selected == 0);
- print_button(dialog, " No ", y, x + 13, selected == 1);
+ print_button(dialog, gettext(" Yes "), y, x, selected == 0);
+ print_button(dialog, gettext(" No "), y, x + 13, selected == 1);
wmove(dialog, y, x + 1 + 13 * selected);
wrefresh(dialog);
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 53/77] kconfig: gettext support for config
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (52 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 52/77] kconfig: gettext support for lxdialog Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 54/77] kconfig: gconfig: symbol fix Sam Ravnborg
` (24 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel, Kyle McMartin
From: EGRY Gabor <gaboregry1@t-online.hu>
Gettext support for conf.c
[Include locale.h by Kyle].
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
---
scripts/kconfig/conf.c | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 01c2f35..d1a0368 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -3,6 +3,7 @@
* Released under the terms of the GNU GPL v2.0.
*/
+#include <locale.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"
static const char *get_help(struct menu *menu)
{
if (menu_has_help(menu))
- return menu_get_help(menu);
+ return _(menu_get_help(menu));
else
return nohelp_text;
}
@@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
tristate val;
if (!sym_has_value(sym))
- printf("(NEW) ");
+ printf(_("(NEW) "));
line[0] = '\n';
line[1] = 0;
@@ -183,7 +184,7 @@ int conf_string(struct menu *menu)
const char *def;
while (1) {
- printf("%*s%s ", indent - 1, "", menu->prompt->text);
+ printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
printf("(%s) ", sym->name);
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
@@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu)
tristate oldval, newval;
while (1) {
- printf("%*s%s ", indent - 1, "", menu->prompt->text);
+ printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
@@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu)
case no:
return 1;
case mod:
- printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
+ printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
return 0;
case yes:
break;
@@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu)
while (1) {
int cnt, def;
- printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
+ printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
def_sym = sym_get_choice_value(sym);
cnt = def = 0;
line[0] = 0;
@@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu)
if (!menu_is_visible(child))
continue;
if (!child->sym) {
- printf("%*c %s\n", indent, '*', menu_get_prompt(child));
+ printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
continue;
}
cnt++;
@@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu)
printf("%*c", indent, '>');
} else
printf("%*c", indent, ' ');
- printf(" %d. %s", cnt, menu_get_prompt(child));
+ printf(" %d. %s", cnt, _(menu_get_prompt(child)));
if (child->sym->name)
printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym))
- printf(" (NEW)");
+ printf(_(" (NEW)"));
printf("\n");
}
- printf("%*schoice", indent - 1, "");
+ printf(_("%*schoice"), indent - 1, "");
if (cnt == 1) {
printf("[1]: 1\n");
goto conf_childs;
@@ -433,7 +434,7 @@ static void conf(struct menu *menu)
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
- indent, '*', prompt,
+ indent, '*', _(prompt),
indent, '*');
default:
;
@@ -499,6 +500,10 @@ int main(int ac, char **av)
const char *name;
struct stat tmpstat;
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
switch (opt) {
case 'o':
@@ -529,11 +534,11 @@ int main(int ac, char **av)
srand(time(NULL));
break;
case 'h':
- printf("See README for usage info\n");
+ printf(_("See README for usage info\n"));
exit(0);
break;
default:
- fprintf(stderr, "See README for usage info\n");
+ fprintf(stderr, _("See README for usage info\n"));
exit(1);
}
}
@@ -549,9 +554,9 @@ int main(int ac, char **av)
if (!defconfig_file)
defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) {
- printf("***\n"
+ printf(_("***\n"
"*** Can't find default configuration \"%s\"!\n"
- "***\n", defconfig_file);
+ "***\n"), defconfig_file);
exit(1);
}
break;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 54/77] kconfig: gconfig: symbol fix
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (53 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 53/77] kconfig: gettext support for config Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 55/77] kconfig: explicitly introduce expression list Sam Ravnborg
` (23 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: EGRY Gabor, Sam Ravnborg, Roman Zippel
From: EGRY Gabor <gaboregry1@t-online.hu>
Gettext support for symbol names are unnecessary.
Signed-off-by: Egry Gabor <gaboregry1@t-online.hu>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/gconf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index dfe748c..199b22b 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -466,7 +466,7 @@ static void text_insert_help(struct menu *menu)
help = _(help);
if (menu->sym && menu->sym->name)
- name = g_strdup_printf(_(menu->sym->name));
+ name = g_strdup_printf(menu->sym->name);
else
name = g_strdup("");
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 55/77] kconfig: explicitly introduce expression list
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (54 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 54/77] kconfig: gconfig: symbol fix Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 56/77] kconfig: environment symbol support Sam Ravnborg
` (22 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Roman Zippel, Sam Ravnborg
From: Roman Zippel <zippel@linux-m68k.org>
Rename E_CHOICE to E_LIST to explicitly add support for expression
lists. Add a helper macro expr_list_for_each_sym to more easily iterate
over the list.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kconfig/confdata.c | 8 ++++----
scripts/kconfig/expr.c | 16 ++++++++--------
scripts/kconfig/expr.h | 5 ++++-
| 2 +-
scripts/kconfig/symbol.c | 13 +++++++------
5 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 497a19e..ee5fe94 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -312,7 +312,7 @@ load:
int conf_read(const char *name)
{
- struct symbol *sym;
+ struct symbol *sym, *choice_sym;
struct property *prop;
struct expr *e;
int i, flags;
@@ -353,9 +353,9 @@ int conf_read(const char *name)
*/
prop = sym_get_choice_prop(sym);
flags = sym->flags;
- for (e = prop->expr; e; e = e->left.expr)
- if (e->right.sym->visible != no)
- flags &= e->right.sym->flags;
+ expr_list_for_each_sym(prop->expr, e, choice_sym)
+ if (choice_sym->visible != no)
+ flags &= choice_sym->flags;
sym->flags &= flags | ~SYMBOL_DEF_USER;
}
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index c8793d1..13788ad 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org)
break;
case E_AND:
case E_OR:
- case E_CHOICE:
+ case E_LIST:
e->left.expr = expr_copy(org->left.expr);
e->right.expr = expr_copy(org->right.expr);
break;
@@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
expr_free(e2);
trans_count = old_count;
return res;
- case E_CHOICE:
+ case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
@@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e)
case E_EQUAL:
case E_UNEQUAL:
case E_SYMBOL:
- case E_CHOICE:
+ case E_LIST:
break;
default:
e->left.expr = expr_transform(e->left.expr);
@@ -932,7 +932,7 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
break;
case E_SYMBOL:
return expr_alloc_comp(type, e->left.sym, sym);
- case E_CHOICE:
+ case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
@@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
if (t2 == E_OR)
return 1;
case E_OR:
- if (t2 == E_CHOICE)
+ if (t2 == E_LIST)
return 1;
- case E_CHOICE:
+ case E_LIST:
if (t2 == 0)
return 1;
default:
@@ -1053,11 +1053,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
fn(data, NULL, " && ");
expr_print(e->right.expr, fn, data, E_AND);
break;
- case E_CHOICE:
+ case E_LIST:
fn(data, e->right.sym, e->right.sym->name);
if (e->left.expr) {
fn(data, NULL, " ^ ");
- expr_print(e->left.expr, fn, data, E_CHOICE);
+ expr_print(e->left.expr, fn, data, E_LIST);
}
break;
case E_RANGE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 1ee8b16..b6f922c 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -31,7 +31,7 @@ typedef enum tristate {
} tristate;
enum expr_type {
- E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
+ E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
};
union expr_data {
@@ -48,6 +48,9 @@ struct expr {
#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define EXPR_NOT(dep) (2-(dep))
+#define expr_list_for_each_sym(l, e, s) \
+ for (e = (l); e && (s = e->right.sym); e = e->left.expr)
+
struct expr_value {
struct expr *expr;
tristate tri;
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e9deebe..3637d10 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -331,7 +331,7 @@ void menu_finalize(struct menu *parent)
prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
;
- *ep = expr_alloc_one(E_CHOICE, NULL);
+ *ep = expr_alloc_one(E_LIST, NULL);
(*ep)->right.sym = menu->sym;
}
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index add068c..a7dfc82 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -247,8 +247,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
/* just get the first visible value */
prop = sym_get_choice_prop(sym);
- for (e = prop->expr; e; e = e->left.expr) {
- def_sym = e->right.sym;
+ expr_list_for_each_sym(prop->expr, e, def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
@@ -361,12 +360,14 @@ void sym_calc_value(struct symbol *sym)
}
if (sym_is_choice(sym)) {
+ struct symbol *choice_sym;
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
+
prop = sym_get_choice_prop(sym);
- for (e = prop->expr; e; e = e->left.expr) {
- e->right.sym->flags |= flags;
+ expr_list_for_each_sym(prop->expr, e, choice_sym) {
+ choice_sym->flags |= flags;
if (flags & SYMBOL_CHANGED)
- sym_set_changed(e->right.sym);
+ sym_set_changed(choice_sym);
}
}
}
@@ -849,7 +850,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
struct symbol *prop_get_symbol(struct property *prop)
{
if (prop->expr && (prop->expr->type == E_SYMBOL ||
- prop->expr->type == E_CHOICE))
+ prop->expr->type == E_LIST))
return prop->expr->left.sym;
return NULL;
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 56/77] kconfig: environment symbol support
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (55 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 55/77] kconfig: explicitly introduce expression list Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 57/77] kconfig: use environment option Sam Ravnborg
` (21 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Roman Zippel, Sam Ravnborg
From: Roman Zippel <zippel@linux-m68k.org>
Add the possibility to import a value from the environment into kconfig
via the option syntax. Beside flexibility this has the advantage
providing proper dependencies.
Documented the options syntax.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Documentation/kbuild/kconfig-language.txt | 21 +++++++++++++
scripts/kconfig/expr.h | 3 +-
scripts/kconfig/lkc.h | 5 +++
| 5 ++-
scripts/kconfig/qconf.cc | 16 +++-------
scripts/kconfig/symbol.c | 45 +++++++++++++++++++++++++++++
scripts/kconfig/util.c | 23 +++++++++++++-
scripts/kconfig/zconf.gperf | 1 +
scripts/kconfig/zconf.hash.c_shipped | 45 ++++++++++++++++-------------
9 files changed, 129 insertions(+), 35 deletions(-)
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 53ca12f..a43fcc6 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -127,6 +127,27 @@ applicable everywhere (see syntax).
used to help visually separate configuration logic from help within
the file as an aid to developers.
+- misc options: "option" <symbol>[=<value>]
+ Various less common options can be defined via this option syntax,
+ which can modify the behaviour of the menu entry and its config
+ symbol. These options are currently possible:
+
+ - "defconfig_list"
+ This declares a list of default entries which can be used when
+ looking for the default configuration (which is used when the main
+ .config doesn't exists yet.)
+
+ - "modules"
+ This declares the symbol to be used as the MODULES symbol, which
+ enables the third modular state for all config symbols.
+
+ - "env"=<value>
+ This imports the environment variable into Kconfig. It behaves like
+ a default, except that the value comes from the environment, this
+ also means that the behaviour when mixing it with normal defaults is
+ undefined at this point. The symbol is currently not exported back
+ to the build environment (if this is desired, it can be done via
+ another symbol).
Menu dependencies
-----------------
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index b6f922c..9d4cba1 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -106,7 +106,8 @@ struct symbol {
#define SYMBOL_HASHMASK 0xff
enum prop_type {
- P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
+ P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE,
+ P_SELECT, P_RANGE, P_ENV
};
struct property {
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 8a07ee4..4bc68f2 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -44,6 +44,7 @@ extern "C" {
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
+#define T_OPT_ENV 3
struct kconf_id {
int name;
@@ -74,6 +75,7 @@ void kconfig_load(void);
/* menu.c */
void menu_init(void);
+void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
@@ -103,6 +105,8 @@ void str_printf(struct gstr *gs, const char *fmt, ...);
const char *str_get(struct gstr *gs);
/* symbol.c */
+extern struct expr *sym_env_list;
+
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
@@ -110,6 +114,7 @@ void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);
+struct property *sym_get_env_prop(struct symbol *sym);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 3637d10..e6ef171 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -15,7 +15,7 @@ static struct menu **last_entry_ptr;
struct file *file_list;
struct file *current_file;
-static void menu_warn(struct menu *menu, const char *fmt, ...)
+void menu_warn(struct menu *menu, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -172,6 +172,9 @@ void menu_add_option(int token, char *arg)
else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol");
break;
+ case T_OPT_ENV:
+ prop_add_env(arg);
+ break;
}
}
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9fe27ca..5d0fd38 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1088,7 +1088,11 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "</a><br>";
break;
case P_DEFAULT:
- debug += "default: ";
+ case P_SELECT:
+ case P_RANGE:
+ case P_ENV:
+ debug += prop_get_type_name(prop->type);
+ debug += ": ";
expr_print(prop->expr, expr_print_help, &debug, E_NONE);
debug += "<br>";
break;
@@ -1099,16 +1103,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "<br>";
}
break;
- case P_SELECT:
- debug += "select: ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
- break;
- case P_RANGE:
- debug += "range: ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
- break;
default:
debug += "unknown property: ";
debug += prop_get_type_name(prop->type);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index a7dfc82..99e3d02 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -34,6 +34,8 @@ struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
+struct expr *sym_env_list;
+
void sym_add_default(struct symbol *sym, const char *def)
{
struct property *prop = prop_alloc(P_DEFAULT, sym);
@@ -117,6 +119,15 @@ struct property *sym_get_choice_prop(struct symbol *sym)
return NULL;
}
+struct property *sym_get_env_prop(struct symbol *sym)
+{
+ struct property *prop;
+
+ for_all_properties(sym, prop, P_ENV)
+ return prop;
+ return NULL;
+}
+
struct property *sym_get_default_prop(struct symbol *sym)
{
struct property *prop;
@@ -346,6 +357,9 @@ void sym_calc_value(struct symbol *sym)
;
}
+ if (sym->flags & SYMBOL_AUTO)
+ sym->flags &= ~SYMBOL_WRITE;
+
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);
@@ -860,6 +874,8 @@ const char *prop_get_type_name(enum prop_type type)
switch (type) {
case P_PROMPT:
return "prompt";
+ case P_ENV:
+ return "env";
case P_COMMENT:
return "comment";
case P_MENU:
@@ -877,3 +893,32 @@ const char *prop_get_type_name(enum prop_type type)
}
return "unknown";
}
+
+void prop_add_env(const char *env)
+{
+ struct symbol *sym, *sym2;
+ struct property *prop;
+ char *p;
+
+ sym = current_entry->sym;
+ sym->flags |= SYMBOL_AUTO;
+ for_all_properties(sym, prop, P_ENV) {
+ sym2 = prop_get_symbol(prop);
+ if (strcmp(sym2->name, env))
+ menu_warn(current_entry, "redefining environment symbol from %s",
+ sym2->name);
+ return;
+ }
+
+ prop = prop_alloc(P_ENV, sym);
+ prop->expr = expr_alloc_symbol(sym_lookup(env, 1));
+
+ sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
+ sym_env_list->right.sym = sym;
+
+ p = getenv(env);
+ if (p)
+ sym_add_default(sym, p);
+ else
+ menu_warn(current_entry, "environment variable %s undefined", env);
+}
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index e1cad92..f8e73c0 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name)
/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
+ struct symbol *sym, *env_sym;
+ struct expr *e;
struct file *file;
FILE *out;
@@ -45,8 +47,25 @@ int file_write_dep(const char *name)
fprintf(out, "\t%s\n", file->name);
}
fprintf(out, "\ninclude/config/auto.conf: \\\n"
- "\t$(deps_config)\n\n"
- "$(deps_config): ;\n");
+ "\t$(deps_config)\n\n");
+
+ expr_list_for_each_sym(sym_env_list, e, sym) {
+ struct property *prop;
+ const char *value;
+
+ prop = sym_get_env_prop(sym);
+ env_sym = prop_get_symbol(prop);
+ if (!env_sym)
+ continue;
+ value = getenv(env_sym->name);
+ if (!value)
+ value = "";
+ fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
+ fprintf(out, "include/config/auto.conf: FORCE\n");
+ fprintf(out, "endif\n");
+ }
+
+ fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
rename("..config.tmp", name);
return 0;
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index 93538e5..4051639 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -41,4 +41,5 @@ option, T_OPTION, TF_COMMAND
on, T_ON, TF_PARAM
modules, T_OPT_MODULES, TF_OPTION
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
+env, T_OPT_ENV, TF_OPTION
%%
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index ab28b18..c9d26bc 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -53,10 +53,10 @@ kconf_id_hash (register const char *str, register unsigned int len)
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 18, 11, 5,
+ 49, 49, 49, 49, 49, 49, 49, 35, 35, 5,
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
- 5, 0, 30, 49, 0, 15, 0, 10, 49, 49,
- 25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+ 5, 0, 30, 49, 0, 15, 0, 10, 0, 49,
+ 10, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
@@ -89,6 +89,7 @@ kconf_id_hash (register const char *str, register unsigned int len)
struct kconf_id_strings_t
{
char kconf_id_strings_str2[sizeof("on")];
+ char kconf_id_strings_str3[sizeof("env")];
char kconf_id_strings_str5[sizeof("endif")];
char kconf_id_strings_str6[sizeof("option")];
char kconf_id_strings_str7[sizeof("endmenu")];
@@ -99,30 +100,31 @@ struct kconf_id_strings_t
char kconf_id_strings_str12[sizeof("default")];
char kconf_id_strings_str13[sizeof("def_bool")];
char kconf_id_strings_str14[sizeof("help")];
- char kconf_id_strings_str15[sizeof("bool")];
char kconf_id_strings_str16[sizeof("config")];
char kconf_id_strings_str17[sizeof("def_tristate")];
- char kconf_id_strings_str18[sizeof("boolean")];
+ char kconf_id_strings_str18[sizeof("hex")];
char kconf_id_strings_str19[sizeof("defconfig_list")];
char kconf_id_strings_str21[sizeof("string")];
char kconf_id_strings_str22[sizeof("if")];
char kconf_id_strings_str23[sizeof("int")];
- char kconf_id_strings_str24[sizeof("enable")];
char kconf_id_strings_str26[sizeof("select")];
char kconf_id_strings_str27[sizeof("modules")];
char kconf_id_strings_str28[sizeof("tristate")];
char kconf_id_strings_str29[sizeof("menu")];
char kconf_id_strings_str31[sizeof("source")];
char kconf_id_strings_str32[sizeof("comment")];
- char kconf_id_strings_str33[sizeof("hex")];
char kconf_id_strings_str35[sizeof("menuconfig")];
char kconf_id_strings_str36[sizeof("prompt")];
char kconf_id_strings_str37[sizeof("depends")];
+ char kconf_id_strings_str39[sizeof("bool")];
+ char kconf_id_strings_str41[sizeof("enable")];
+ char kconf_id_strings_str42[sizeof("boolean")];
char kconf_id_strings_str48[sizeof("mainmenu")];
};
static struct kconf_id_strings_t kconf_id_strings_contents =
{
"on",
+ "env",
"endif",
"option",
"endmenu",
@@ -133,25 +135,25 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
"default",
"def_bool",
"help",
- "bool",
"config",
"def_tristate",
- "boolean",
+ "hex",
"defconfig_list",
"string",
"if",
"int",
- "enable",
"select",
"modules",
"tristate",
"menu",
"source",
"comment",
- "hex",
"menuconfig",
"prompt",
"depends",
+ "bool",
+ "enable",
+ "boolean",
"mainmenu"
};
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
@@ -163,7 +165,7 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{
enum
{
- TOTAL_KEYWORDS = 31,
+ TOTAL_KEYWORDS = 32,
MIN_WORD_LENGTH = 2,
MAX_WORD_LENGTH = 14,
MIN_HASH_VALUE = 2,
@@ -174,7 +176,8 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{
{-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
- {-1}, {-1},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_OPT_ENV, TF_OPTION},
+ {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND},
@@ -185,17 +188,16 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN},
+ {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str24, T_SELECT, TF_COMMAND},
- {-1},
+ {-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
@@ -203,13 +205,16 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX},
- {-1},
+ {-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN},
+ {-1},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SELECT, TF_COMMAND},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_TYPE, TF_COMMAND, S_BOOLEAN},
+ {-1}, {-1}, {-1}, {-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
};
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 57/77] kconfig: use environment option
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (56 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 56/77] kconfig: environment symbol support Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 58/77] kbuild: minor scripts/decodecode update Sam Ravnborg
` (20 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Roman Zippel, Sam Ravnborg
From: Roman Zippel <zippel@linux-m68k.org>
Use the environment option to provide the ARCH symbol
and the KERNELVERSION symbol.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
init/Kconfig | 8 ++++++++
scripts/kconfig/symbol.c | 15 ---------------
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index b9d11a8..e7f2f41 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1,3 +1,11 @@
+config ARCH
+ string
+ option env="ARCH"
+
+config KERNELVERSION
+ string
+ option env="KERNELVERSION"
+
config DEFCONFIG_LIST
string
depends on !UML
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 99e3d02..3929e5b 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -47,7 +47,6 @@ void sym_init(void)
{
struct symbol *sym;
struct utsname uts;
- char *p;
static bool inited = false;
if (inited)
@@ -56,20 +55,6 @@ void sym_init(void)
uname(&uts);
- sym = sym_lookup("ARCH", 0);
- sym->type = S_STRING;
- sym->flags |= SYMBOL_AUTO;
- p = getenv("ARCH");
- if (p)
- sym_add_default(sym, p);
-
- sym = sym_lookup("KERNELVERSION", 0);
- sym->type = S_STRING;
- sym->flags |= SYMBOL_AUTO;
- p = getenv("KERNELVERSION");
- if (p)
- sym_add_default(sym, p);
-
sym = sym_lookup("UNAME_RELEASE", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 58/77] kbuild: minor scripts/decodecode update
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (57 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 57/77] kconfig: use environment option Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 59/77] kbuild: fix so modpost can now check any .o file Sam Ravnborg
` (19 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Randy Dunlap, Sam Ravnborg
From: Randy Dunlap <randy.dunlap@oracle.com>
Remove the tmp file when exiting. Noticed by Arjan van de Ven.
Catch mktemp failure and exit with message.
Trap kill or other signals and exit cleanly.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/decodecode | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/scripts/decodecode b/scripts/decodecode
index 1e1a8f6..235d393 100644
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -6,7 +6,19 @@
# e.g., to decode an i386 oops on an x86_64 system, use:
# AFLAGS=--32 decodecode < 386.oops
-T=`mktemp`
+cleanup() {
+ rm -f $T $T.s $T.o
+ exit 1
+}
+
+die() {
+ echo "$@"
+ exit 1
+}
+
+trap cleanup EXIT
+
+T=`mktemp` || die "cannot create temp file"
code=
while read i ; do
@@ -20,6 +32,7 @@ esac
done
if [ -z "$code" ]; then
+ rm $T
exit
fi
@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
echo $code >> $T.s
as $AFLAGS -o $T.o $T.s
objdump -S $T.o
-rm $T.o $T.s
+rm $T $T.s $T.o
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 59/77] kbuild: fix so modpost can now check any .o file
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (58 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 58/77] kbuild: minor scripts/decodecode update Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 60/77] kbuild: try harder to find symbol names in modpost Sam Ravnborg
` (18 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
It is very convinient to say:
scripts/mod/modpost mm/built-in.o
to check if any section mismatch errors occured
in mm/ (as an example).
Fix it so this is possible again.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 696d2a5..46660a4 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1299,7 +1299,8 @@ static void read_symbols(char *modname)
handle_modversions(mod, &info, sym, symname);
handle_moddevtable(mod, &info, sym, symname);
}
- if (is_vmlinux(modname) && vmlinux_section_warnings) {
+ if (!is_vmlinux(modname) ||
+ (is_vmlinux(modname) && vmlinux_section_warnings)) {
check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 60/77] kbuild: try harder to find symbol names in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (59 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 59/77] kbuild: fix so modpost can now check any .o file Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 61/77] kbuild: code refactoring " Sam Ravnborg
` (17 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
The relocation record sometimes contained an address
which was not an exactly match for a symbol.
Implment some simple logic such that if there
is a symbol within 20 bytes of the address contained
in the relocation record then print the name of this
symbol.
With this change modpost could find symbol names
for the remaining .init.text symbols in my
allyesconfig build for x86_64.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 19 +++++++++++++++++--
scripts/mod/modpost.h | 2 ++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 46660a4..902ee55 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -776,10 +776,13 @@ static int secref_whitelist(const char *modname, const char *tosec,
* In other cases the symbol needs to be looked up in the symbol table
* based on section and address.
* **/
-static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
+static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
Elf_Sym *relsym)
{
Elf_Sym *sym;
+ Elf_Sym *near = NULL;
+ Elf64_Sword distance = 20;
+ Elf64_Sword d;
if (relsym->st_name != 0)
return relsym;
@@ -790,8 +793,20 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
continue;
if (sym->st_value == addr)
return sym;
+ /* Find a symbol nearby - addr are maybe negative */
+ d = sym->st_value - addr;
+ if (d < 0)
+ d = addr - sym->st_value;
+ if (d < distance) {
+ distance = d;
+ near = sym;
+ }
}
- return NULL;
+ /* We need a close match */
+ if (distance < 20)
+ return near;
+ else
+ return NULL;
}
static inline int is_arm_mapping_symbol(const char *str)
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 0ffed17..999f15e 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -17,6 +17,7 @@
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Addr Elf32_Addr
+#define Elf_Sword Elf64_Sword
#define Elf_Section Elf32_Half
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
@@ -31,6 +32,7 @@
#define Elf_Shdr Elf64_Shdr
#define Elf_Sym Elf64_Sym
#define Elf_Addr Elf64_Addr
+#define Elf_Sword Elf64_Sxword
#define Elf_Section Elf64_Half
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 61/77] kbuild: code refactoring in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (60 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 60/77] kbuild: try harder to find symbol names in modpost Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 62/77] kbuild: introduce blacklisting " Sam Ravnborg
` (16 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Split a too long function up in smaller bits to make
prgram logic easier to follow.
A few related changes done due to parameter
changes.
No functional changes.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 242 ++++++++++++++++++++++++++++---------------------
1 files changed, 137 insertions(+), 105 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 902ee55..e463013 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -937,19 +937,19 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
}
static unsigned int *reloc_location(struct elf_info *elf,
- int rsection, Elf_Rela *r)
+ Elf_Shdr *sechdr, Elf_Rela *r)
{
Elf_Shdr *sechdrs = elf->sechdrs;
- int section = sechdrs[rsection].sh_info;
+ int section = sechdr->sh_info;
return (void *)elf->hdr + sechdrs[section].sh_offset +
(r->r_offset - sechdrs[section].sh_addr);
}
-static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
{
unsigned int r_typ = ELF_R_TYPE(r->r_info);
- unsigned int *location = reloc_location(elf, rsection, r);
+ unsigned int *location = reloc_location(elf, sechdr, r);
switch (r_typ) {
case R_386_32:
@@ -965,7 +965,7 @@ static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
return 0;
}
-static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
{
unsigned int r_typ = ELF_R_TYPE(r->r_info);
@@ -978,8 +978,8 @@ static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
case R_ARM_PC24:
/* From ARM ABI: ((S + A) | T) - P */
r->r_addend = (int)(long)(elf->hdr +
- elf->sechdrs[rsection].sh_offset +
- (r->r_offset - elf->sechdrs[rsection].sh_addr));
+ sechdr->sh_offset +
+ (r->r_offset - sechdr->sh_addr));
break;
default:
return 1;
@@ -987,10 +987,10 @@ static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
return 0;
}
-static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
{
unsigned int r_typ = ELF_R_TYPE(r->r_info);
- unsigned int *location = reloc_location(elf, rsection, r);
+ unsigned int *location = reloc_location(elf, sechdr, r);
unsigned int inst;
if (r_typ == R_MIPS_HI16)
@@ -1010,6 +1010,128 @@ static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
return 0;
}
+static void section_rela(const char *modname, struct elf_info *elf,
+ Elf_Shdr *sechdr, int section(const char *),
+ int section_ref_ok(const char *))
+{
+ Elf_Sym *sym;
+ Elf_Rela *rela;
+ Elf_Rela r;
+ unsigned int r_sym;
+ const char *fromsec;
+ const char * tosec;
+
+ Elf_Ehdr *hdr = elf->hdr;
+ Elf_Rela *start = (void *)hdr + sechdr->sh_offset;
+ Elf_Rela *stop = (void *)start + sechdr->sh_size;
+
+ const char *secstrings = (void *)hdr +
+ elf->sechdrs[hdr->e_shstrndx].sh_offset;
+
+ fromsec = secstrings + sechdr->sh_name;
+ fromsec += strlen(".rela");
+ /* if from section (name) is know good then skip it */
+ if (section_ref_ok(fromsec))
+ return;
+
+ for (rela = start; rela < stop; rela++) {
+ r.r_offset = TO_NATIVE(rela->r_offset);
+#if KERNEL_ELFCLASS == ELFCLASS64
+ if (hdr->e_machine == EM_MIPS) {
+ unsigned int r_typ;
+ r_sym = ELF64_MIPS_R_SYM(rela->r_info);
+ r_sym = TO_NATIVE(r_sym);
+ r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
+ r.r_info = ELF64_R_INFO(r_sym, r_typ);
+ } else {
+ r.r_info = TO_NATIVE(rela->r_info);
+ r_sym = ELF_R_SYM(r.r_info);
+ }
+#else
+ r.r_info = TO_NATIVE(rela->r_info);
+ r_sym = ELF_R_SYM(r.r_info);
+#endif
+ r.r_addend = TO_NATIVE(rela->r_addend);
+ sym = elf->symtab_start + r_sym;
+ /* Skip special sections */
+ if (sym->st_shndx >= SHN_LORESERVE)
+ continue;
+
+ tosec = secstrings +
+ elf->sechdrs[sym->st_shndx].sh_name;
+ if (section(tosec))
+ warn_sec_mismatch(modname, fromsec, elf, sym, r);
+ }
+}
+
+static void section_rel(const char *modname, struct elf_info *elf,
+ Elf_Shdr *sechdr, int section(const char *),
+ int section_ref_ok(const char *))
+{
+ Elf_Sym *sym;
+ Elf_Rel *rel;
+ Elf_Rela r;
+ unsigned int r_sym;
+ const char *fromsec;
+ const char * tosec;
+
+ Elf_Ehdr *hdr = elf->hdr;
+ Elf_Rel *start = (void *)hdr + sechdr->sh_offset;
+ Elf_Rel *stop = (void *)start + sechdr->sh_size;
+
+ const char *secstrings = (void *)hdr +
+ elf->sechdrs[hdr->e_shstrndx].sh_offset;
+
+ fromsec = secstrings + sechdr->sh_name;
+ fromsec += strlen(".rel");
+ /* if from section (name) is know good then skip it */
+ if (section_ref_ok(fromsec))
+ return;
+
+ for (rel = start; rel < stop; rel++) {
+ r.r_offset = TO_NATIVE(rel->r_offset);
+#if KERNEL_ELFCLASS == ELFCLASS64
+ if (hdr->e_machine == EM_MIPS) {
+ unsigned int r_typ;
+ r_sym = ELF64_MIPS_R_SYM(rel->r_info);
+ r_sym = TO_NATIVE(r_sym);
+ r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
+ r.r_info = ELF64_R_INFO(r_sym, r_typ);
+ } else {
+ r.r_info = TO_NATIVE(rel->r_info);
+ r_sym = ELF_R_SYM(r.r_info);
+ }
+#else
+ r.r_info = TO_NATIVE(rel->r_info);
+ r_sym = ELF_R_SYM(r.r_info);
+#endif
+ r.r_addend = 0;
+ switch (hdr->e_machine) {
+ case EM_386:
+ if (addend_386_rel(elf, sechdr, &r))
+ continue;
+ break;
+ case EM_ARM:
+ if (addend_arm_rel(elf, sechdr, &r))
+ continue;
+ break;
+ case EM_MIPS:
+ if (addend_mips_rel(elf, sechdr, &r))
+ continue;
+ break;
+ }
+ sym = elf->symtab_start + r_sym;
+ /* Skip special sections */
+ if (sym->st_shndx >= SHN_LORESERVE)
+ continue;
+
+ tosec = secstrings +
+ elf->sechdrs[sym->st_shndx].sh_name;
+ if (section(tosec))
+ warn_sec_mismatch(modname, fromsec, elf, sym, r);
+ }
+}
+
/**
* A module includes a number of sections that are discarded
* either when loaded or when used as built-in.
@@ -1028,108 +1150,18 @@ static void check_sec_ref(struct module *mod, const char *modname,
int section_ref_ok(const char *))
{
int i;
- Elf_Sym *sym;
Elf_Ehdr *hdr = elf->hdr;
Elf_Shdr *sechdrs = elf->sechdrs;
- const char *secstrings = (void *)hdr +
- sechdrs[hdr->e_shstrndx].sh_offset;
/* Walk through all sections */
for (i = 0; i < hdr->e_shnum; i++) {
- const char *name = secstrings + sechdrs[i].sh_name;
- const char *secname;
- Elf_Rela r;
- unsigned int r_sym;
/* We want to process only relocation sections and not .init */
- if (sechdrs[i].sh_type == SHT_RELA) {
- Elf_Rela *rela;
- Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset;
- Elf_Rela *stop = (void *)start + sechdrs[i].sh_size;
- name += strlen(".rela");
- if (section_ref_ok(name))
- continue;
-
- for (rela = start; rela < stop; rela++) {
- r.r_offset = TO_NATIVE(rela->r_offset);
-#if KERNEL_ELFCLASS == ELFCLASS64
- if (hdr->e_machine == EM_MIPS) {
- unsigned int r_typ;
- r_sym = ELF64_MIPS_R_SYM(rela->r_info);
- r_sym = TO_NATIVE(r_sym);
- r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
- r.r_info = ELF64_R_INFO(r_sym, r_typ);
- } else {
- r.r_info = TO_NATIVE(rela->r_info);
- r_sym = ELF_R_SYM(r.r_info);
- }
-#else
- r.r_info = TO_NATIVE(rela->r_info);
- r_sym = ELF_R_SYM(r.r_info);
-#endif
- r.r_addend = TO_NATIVE(rela->r_addend);
- sym = elf->symtab_start + r_sym;
- /* Skip special sections */
- if (sym->st_shndx >= SHN_LORESERVE)
- continue;
-
- secname = secstrings +
- sechdrs[sym->st_shndx].sh_name;
- if (section(secname))
- warn_sec_mismatch(modname, name,
- elf, sym, r);
- }
- } else if (sechdrs[i].sh_type == SHT_REL) {
- Elf_Rel *rel;
- Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset;
- Elf_Rel *stop = (void *)start + sechdrs[i].sh_size;
- name += strlen(".rel");
- if (section_ref_ok(name))
- continue;
-
- for (rel = start; rel < stop; rel++) {
- r.r_offset = TO_NATIVE(rel->r_offset);
-#if KERNEL_ELFCLASS == ELFCLASS64
- if (hdr->e_machine == EM_MIPS) {
- unsigned int r_typ;
- r_sym = ELF64_MIPS_R_SYM(rel->r_info);
- r_sym = TO_NATIVE(r_sym);
- r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
- r.r_info = ELF64_R_INFO(r_sym, r_typ);
- } else {
- r.r_info = TO_NATIVE(rel->r_info);
- r_sym = ELF_R_SYM(r.r_info);
- }
-#else
- r.r_info = TO_NATIVE(rel->r_info);
- r_sym = ELF_R_SYM(r.r_info);
-#endif
- r.r_addend = 0;
- switch (hdr->e_machine) {
- case EM_386:
- if (addend_386_rel(elf, i, &r))
- continue;
- break;
- case EM_ARM:
- if (addend_arm_rel(elf, i, &r))
- continue;
- break;
- case EM_MIPS:
- if (addend_mips_rel(elf, i, &r))
- continue;
- break;
- }
- sym = elf->symtab_start + r_sym;
- /* Skip special sections */
- if (sym->st_shndx >= SHN_LORESERVE)
- continue;
-
- secname = secstrings +
- sechdrs[sym->st_shndx].sh_name;
- if (section(secname))
- warn_sec_mismatch(modname, name,
- elf, sym, r);
- }
- }
+ if (sechdrs[i].sh_type == SHT_RELA)
+ section_rela(modname, elf, &elf->sechdrs[i],
+ section, section_ref_ok);
+ else if (sechdrs[i].sh_type == SHT_REL)
+ section_rel(modname, elf, &elf->sechdrs[i],
+ section, section_ref_ok);
}
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 62/77] kbuild: introduce blacklisting in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (61 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 61/77] kbuild: code refactoring " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 63/77] kbuild: check section names consistently " Sam Ravnborg
` (15 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Randy Dunlap, Adrian Bunk
Change the logic in modpost so we identify all the
bad combinations of sections that refer to other
sections.
Compared to the previous approach we are much less
dependent on knowledge of what additional sections
the tool chain uses and thus we can keep the false
positives low.
The implmentation is changed to use a table based
lookup and we now check all combinations in first
pass so we no longer need separate passes for init
and exit sections.
Tested that the same warnings are generated for
an allyesconfig build without CONFIG_HOTPLUG.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Adrian Bunk <bunk@kernel.org>
---
scripts/mod/modpost.c | 305 +++++++++++++++++++++----------------------------
1 files changed, 128 insertions(+), 177 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index e463013..6c206b9 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -605,6 +605,61 @@ static int strrcmp(const char *s, const char *sub)
return memcmp(s + slen - sublen, sub, sublen);
}
+/* if sym is empty or point to a string
+ * like ".[0-9]+" then return 1.
+ * This is the optional prefix added by ld to some sections
+ */
+static int number_prefix(const char *sym)
+{
+ if (*sym++ == '\0')
+ return 1;
+ if (*sym != '.')
+ return 0;
+ do {
+ char c = *sym++;
+ if (c < '0' || c > '9')
+ return 0;
+ } while (*sym);
+ return 1;
+}
+
+/* The pattern is an array of simple patterns.
+ * "foo" will match an exact string equal to "foo"
+ * "foo*" will match a string that begins with "foo"
+ * "foo$" will match a string equal to "foo" or "foo.1"
+ * where the '1' can be any number including several digits.
+ * The $ syntax is for sections where ld append a dot number
+ * to make section name unique.
+ */
+int match(const char *sym, const char * const pat[])
+{
+ const char *p;
+ while (*pat) {
+ p = *pat++;
+ const char *endp = p + strlen(p) - 1;
+
+ /* "foo*" */
+ if (*endp == '*') {
+ if (strncmp(sym, p, strlen(p) - 1) == 0)
+ return 1;
+ }
+ /* "foo$" */
+ else if (*endp == '$') {
+ if (strncmp(sym, p, strlen(p) - 1) == 0) {
+ if (number_prefix(sym + strlen(p) - 1))
+ return 1;
+ }
+ }
+ /* no wildcards */
+ else {
+ if (strcmp(p, sym) == 0)
+ return 1;
+ }
+ }
+ /* no match */
+ return 0;
+}
+
/*
* Functions used only during module init is marked __init and is stored in
* a .init.text section. Likewise data is marked __initdata and stored in
@@ -653,6 +708,68 @@ static int data_section(const char *name)
return 0;
}
+/* sections that we do not want to do full section mismatch check on */
+static const char *section_white_list[] =
+ { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
+
+#define INIT_DATA_SECTIONS ".init.data$"
+#define EXIT_DATA_SECTIONS ".exit.data$"
+
+#define INIT_TEXT_SECTIONS ".init.text$"
+#define EXIT_TEXT_SECTIONS ".exit.text$"
+
+#define INIT_SECTIONS INIT_DATA_SECTIONS, INIT_TEXT_SECTIONS
+#define EXIT_SECTIONS EXIT_DATA_SECTIONS, EXIT_TEXT_SECTIONS
+
+#define DATA_SECTIONS ".data$"
+#define TEXT_SECTIONS ".text$"
+
+struct sectioncheck {
+ const char *fromsec[20];
+ const char *tosec[20];
+};
+
+const struct sectioncheck sectioncheck[] = {
+/* Do not reference init/exit code/data from
+ * normal code and data
+ */
+{
+ .fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
+ .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }
+},
+/* Do not use exit code/data from init code */
+{
+ .fromsec = { INIT_SECTIONS, NULL },
+ .tosec = { EXIT_SECTIONS, NULL },
+},
+/* Do not use init code/data from exit code */
+{
+ .fromsec = { EXIT_SECTIONS, NULL },
+ .tosec = { INIT_SECTIONS, NULL }
+},
+/* Do not export init/exit functions or data */
+{
+ .fromsec = { "__ksymtab*", NULL },
+ .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }
+}
+};
+
+static int section_mismatch(const char *fromsec, const char *tosec)
+{
+ int i;
+ int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck);
+ const struct sectioncheck *check = §ioncheck[0];
+
+ for (i = 0; i < elems; i++) {
+ if (match(fromsec, check->fromsec) &&
+ match(tosec, check->tosec))
+ return 1;
+ check++;
+ }
+ return 0;
+}
+
+
/**
* Whitelist to allow certain references to pass with no warning.
*
@@ -695,18 +812,11 @@ static int data_section(const char *name)
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
*
- * Pattern 5:
- * Xtensa uses literal sections for constants that are accessed PC-relative.
- * Literal sections may safely reference their text sections.
- * (Note that the name for the literal section omits any trailing '.text')
- * tosec = <section>[.text]
- * fromsec = <section>.literal
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
const char *refsymname)
{
- int len;
const char **s;
const char *pat2sym[] = {
"driver",
@@ -757,15 +867,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (strcmp(refsymname, *s) == 0)
return 1;
- /* Check for pattern 5 */
- if (strrcmp(tosec, ".text") == 0)
- len = strlen(tosec) - strlen(".text");
- else
- len = strlen(tosec);
- if ((strncmp(tosec, fromsec, len) == 0) && (strlen(fromsec) > len) &&
- (strcmp(fromsec + len, ".literal") == 0))
- return 1;
-
return 0;
}
@@ -1011,8 +1112,7 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
}
static void section_rela(const char *modname, struct elf_info *elf,
- Elf_Shdr *sechdr, int section(const char *),
- int section_ref_ok(const char *))
+ Elf_Shdr *sechdr)
{
Elf_Sym *sym;
Elf_Rela *rela;
@@ -1031,7 +1131,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
fromsec = secstrings + sechdr->sh_name;
fromsec += strlen(".rela");
/* if from section (name) is know good then skip it */
- if (section_ref_ok(fromsec))
+ if (match(fromsec, section_white_list))
return;
for (rela = start; rela < stop; rela++) {
@@ -1059,14 +1159,13 @@ static void section_rela(const char *modname, struct elf_info *elf,
tosec = secstrings +
elf->sechdrs[sym->st_shndx].sh_name;
- if (section(tosec))
+ if (section_mismatch(fromsec, tosec))
warn_sec_mismatch(modname, fromsec, elf, sym, r);
}
}
static void section_rel(const char *modname, struct elf_info *elf,
- Elf_Shdr *sechdr, int section(const char *),
- int section_ref_ok(const char *))
+ Elf_Shdr *sechdr)
{
Elf_Sym *sym;
Elf_Rel *rel;
@@ -1085,7 +1184,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
fromsec = secstrings + sechdr->sh_name;
fromsec += strlen(".rel");
/* if from section (name) is know good then skip it */
- if (section_ref_ok(fromsec))
+ if (match(fromsec, section_white_list))
return;
for (rel = start; rel < stop; rel++) {
@@ -1127,7 +1226,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
tosec = secstrings +
elf->sechdrs[sym->st_shndx].sh_name;
- if (section(tosec))
+ if (section_mismatch(fromsec, tosec))
warn_sec_mismatch(modname, fromsec, elf, sym, r);
}
}
@@ -1145,9 +1244,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
* be discarded and warns about it.
**/
static void check_sec_ref(struct module *mod, const char *modname,
- struct elf_info *elf,
- int section(const char *),
- int section_ref_ok(const char *))
+ struct elf_info *elf)
{
int i;
Elf_Ehdr *hdr = elf->hdr;
@@ -1157,156 +1254,12 @@ static void check_sec_ref(struct module *mod, const char *modname,
for (i = 0; i < hdr->e_shnum; i++) {
/* We want to process only relocation sections and not .init */
if (sechdrs[i].sh_type == SHT_RELA)
- section_rela(modname, elf, &elf->sechdrs[i],
- section, section_ref_ok);
+ section_rela(modname, elf, &elf->sechdrs[i]);
else if (sechdrs[i].sh_type == SHT_REL)
- section_rel(modname, elf, &elf->sechdrs[i],
- section, section_ref_ok);
+ section_rel(modname, elf, &elf->sechdrs[i]);
}
}
-/*
- * Identify sections from which references to either a
- * .init or a .exit section is OK.
- *
- * [OPD] Keith Ownes <kaos@sgi.com> commented:
- * For our future {in}sanity, add a comment that this is the ppc .opd
- * section, not the ia64 .opd section.
- * ia64 .opd should not point to discarded sections.
- * [.rodata] like for .init.text we ignore .rodata references -same reason
- */
-static int initexit_section_ref_ok(const char *name)
-{
- const char **s;
- /* Absolute section names */
- const char *namelist1[] = {
- "__bug_table", /* used by powerpc for BUG() */
- "__ex_table",
- ".altinstructions",
- ".cranges", /* used by sh64 */
- ".fixup",
- ".machvec", /* ia64 + powerpc uses these */
- ".machine.desc",
- ".opd", /* See comment [OPD] */
- "__dbe_table",
- ".parainstructions",
- ".pdr",
- ".plt", /* seen on ARCH=um build on x86_64. Harmless */
- ".smp_locks",
- ".stab",
- ".m68k_fixup",
- ".xt.prop", /* xtensa informational section */
- ".xt.lit", /* xtensa informational section */
- NULL
- };
- /* Start of section names */
- const char *namelist2[] = {
- ".debug",
- ".eh_frame",
- ".note", /* ignore ELF notes - may contain anything */
- ".got", /* powerpc - global offset table */
- ".toc", /* powerpc - table of contents */
- NULL
- };
- /* part of section name */
- const char *namelist3 [] = {
- ".unwind", /* Sample: IA_64.unwind.exit.text */
- NULL
- };
-
- for (s = namelist1; *s; s++)
- if (strcmp(*s, name) == 0)
- return 1;
- for (s = namelist2; *s; s++)
- if (strncmp(*s, name, strlen(*s)) == 0)
- return 1;
- for (s = namelist3; *s; s++)
- if (strstr(name, *s) != NULL)
- return 1;
- return 0;
-}
-
-
-/*
- * Identify sections from which references to a .init section is OK.
- *
- * Unfortunately references to read only data that referenced .init
- * sections had to be excluded. Almost all of these are false
- * positives, they are created by gcc. The downside of excluding rodata
- * is that there really are some user references from rodata to
- * init code, e.g. drivers/video/vgacon.c:
- *
- * const struct consw vga_con = {
- * con_startup: vgacon_startup,
- *
- * where vgacon_startup is __init. If you want to wade through the false
- * positives, take out the check for rodata.
- */
-static int init_section_ref_ok(const char *name)
-{
- const char **s;
- /* Absolute section names */
- const char *namelist1[] = {
- "__dbe_table", /* MIPS generate these */
- "__ftr_fixup", /* powerpc cpu feature fixup */
- "__fw_ftr_fixup", /* powerpc firmware feature fixup */
- "__param",
- ".data.rel.ro", /* used by parisc64 */
- ".init",
- ".text.lock",
- NULL
- };
- /* Start of section names */
- const char *namelist2[] = {
- ".init.",
- ".pci_fixup",
- ".rodata",
- NULL
- };
-
- if (initexit_section_ref_ok(name))
- return 1;
-
- for (s = namelist1; *s; s++)
- if (strcmp(*s, name) == 0)
- return 1;
- for (s = namelist2; *s; s++)
- if (strncmp(*s, name, strlen(*s)) == 0)
- return 1;
-
- /* If section name ends with ".init" we allow references
- * as is the case with .initcallN.init, .early_param.init,
- * .taglist.init etc
- */
- if (strrcmp(name, ".init") == 0)
- return 1;
- return 0;
-}
-
-/*
- * Identify sections from which references to a .exit section is OK.
- */
-static int exit_section_ref_ok(const char *name)
-{
- const char **s;
- /* Absolute section names */
- const char *namelist1[] = {
- ".exit.data",
- ".exit.text",
- ".exitcall.exit",
- ".rodata",
- NULL
- };
-
- if (initexit_section_ref_ok(name))
- return 1;
-
- for (s = namelist1; *s; s++)
- if (strcmp(*s, name) == 0)
- return 1;
- return 0;
-}
-
static void read_symbols(char *modname)
{
const char *symname;
@@ -1347,10 +1300,8 @@ static void read_symbols(char *modname)
handle_moddevtable(mod, &info, sym, symname);
}
if (!is_vmlinux(modname) ||
- (is_vmlinux(modname) && vmlinux_section_warnings)) {
- check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
- check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
- }
+ (is_vmlinux(modname) && vmlinux_section_warnings))
+ check_sec_ref(mod, modname, &info);
version = get_modinfo(info.modinfo, info.modinfo_len, "version");
if (version)
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 63/77] kbuild: check section names consistently in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (62 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 62/77] kbuild: introduce blacklisting " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 64/77] all archs: consolidate init and exit sections in vmlinux.lds.h Sam Ravnborg
` (14 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Now that match() is introduced use it consistently so
we can share the section name definitions.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 146 ++++++++++++++++++++-----------------------------
1 files changed, 60 insertions(+), 86 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 6c206b9..986513d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -625,6 +625,7 @@ static int number_prefix(const char *sym)
/* The pattern is an array of simple patterns.
* "foo" will match an exact string equal to "foo"
+ * "*foo" will match a string that ends with "foo"
* "foo*" will match a string that begins with "foo"
* "foo$" will match a string equal to "foo" or "foo.1"
* where the '1' can be any number including several digits.
@@ -638,8 +639,13 @@ int match(const char *sym, const char * const pat[])
p = *pat++;
const char *endp = p + strlen(p) - 1;
+ /* "*foo" */
+ if (*p == '*') {
+ if (strrcmp(sym, p + 1) == 0)
+ return 1;
+ }
/* "foo*" */
- if (*endp == '*') {
+ else if (*endp == '*') {
if (strncmp(sym, p, strlen(p) - 1) == 0)
return 1;
}
@@ -660,54 +666,6 @@ int match(const char *sym, const char * const pat[])
return 0;
}
-/*
- * Functions used only during module init is marked __init and is stored in
- * a .init.text section. Likewise data is marked __initdata and stored in
- * a .init.data section.
- * If this section is one of these sections return 1
- * See include/linux/init.h for the details
- */
-static int init_section(const char *name)
-{
- if (strcmp(name, ".init") == 0)
- return 1;
- if (strncmp(name, ".init.", strlen(".init.")) == 0)
- return 1;
- return 0;
-}
-
-/*
- * Functions used only during module exit is marked __exit and is stored in
- * a .exit.text section. Likewise data is marked __exitdata and stored in
- * a .exit.data section.
- * If this section is one of these sections return 1
- * See include/linux/init.h for the details
- **/
-static int exit_section(const char *name)
-{
- if (strcmp(name, ".exit.text") == 0)
- return 1;
- if (strcmp(name, ".exit.data") == 0)
- return 1;
- return 0;
-
-}
-
-/*
- * Data sections are named like this:
- * .data | .data.rel | .data.rel.*
- * Return 1 if the specified section is a data section
- */
-static int data_section(const char *name)
-{
- if ((strcmp(name, ".data") == 0) ||
- (strcmp(name, ".data.rel") == 0) ||
- (strncmp(name, ".data.rel.", strlen(".data.rel.")) == 0))
- return 1;
- else
- return 0;
-}
-
/* sections that we do not want to do full section mismatch check on */
static const char *section_white_list[] =
{ ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
@@ -721,9 +679,50 @@ static const char *section_white_list[] =
#define INIT_SECTIONS INIT_DATA_SECTIONS, INIT_TEXT_SECTIONS
#define EXIT_SECTIONS EXIT_DATA_SECTIONS, EXIT_TEXT_SECTIONS
-#define DATA_SECTIONS ".data$"
+#define DATA_SECTIONS ".data$", ".data.rel$"
#define TEXT_SECTIONS ".text$"
+/* init data sections */
+static const char *init_data_sections[] = { INIT_DATA_SECTIONS, NULL };
+
+/* all init sections */
+static const char *init_sections[] = { INIT_SECTIONS, NULL };
+
+/* All init and exit sections (code + data) */
+static const char *init_exit_sections[] =
+ {INIT_SECTIONS, EXIT_SECTIONS, NULL };
+
+/* data section */
+static const char *data_sections[] = { DATA_SECTIONS, NULL };
+
+/* sections that may refer to an init/exit section with no warning */
+static const char *initref_sections[] =
+{
+ ".text.init.refok*",
+ ".exit.text.refok*",
+ ".data.init.refok*",
+ NULL
+};
+
+
+/* symbols in .data that may refer to init/exit sections */
+static const char *symbol_white_list[] =
+{
+ "*driver",
+ "*_template", /* scsi uses *_template a lot */
+ "*_timer", /* arm uses ops structures named _timer a lot */
+ "*_sht", /* scsi also used *_sht to some extent */
+ "*_ops",
+ "*_probe",
+ "*_probe_one",
+ "*_console",
+ NULL
+};
+
+static const char *head_sections[] = { ".head.text*", NULL };
+static const char *linker_symbols[] =
+ { "__init_begin", "_sinittext", "_einittext", NULL };
+
struct sectioncheck {
const char *fromsec[20];
const char *tosec[20];
@@ -817,55 +816,30 @@ static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
const char *refsymname)
{
- const char **s;
- const char *pat2sym[] = {
- "driver",
- "_template", /* scsi uses *_template a lot */
- "_timer", /* arm uses ops structures named _timer a lot */
- "_sht", /* scsi also used *_sht to some extent */
- "_ops",
- "_probe",
- "_probe_one",
- "_console",
- NULL
- };
-
- const char *pat3refsym[] = {
- "__init_begin",
- "_sinittext",
- "_einittext",
- NULL
- };
-
/* Check for pattern 0 */
- if ((strncmp(fromsec, ".text.init.refok", strlen(".text.init.refok")) == 0) ||
- (strncmp(fromsec, ".exit.text.refok", strlen(".exit.text.refok")) == 0) ||
- (strncmp(fromsec, ".data.init.refok", strlen(".data.init.refok")) == 0))
+ if (match(fromsec, initref_sections))
return 1;
/* Check for pattern 1 */
- if ((strcmp(tosec, ".init.data") == 0) &&
- (strncmp(fromsec, ".data", strlen(".data")) == 0) &&
+ if (match(tosec, init_data_sections) &&
+ match(fromsec, data_sections) &&
(strncmp(atsym, "__param", strlen("__param")) == 0))
return 1;
/* Check for pattern 2 */
- if ((init_section(tosec) || exit_section(tosec))
- && data_section(fromsec))
- for (s = pat2sym; *s; s++)
- if (strrcmp(atsym, *s) == 0)
- return 1;
+ if (match(tosec, init_exit_sections) &&
+ match(fromsec, data_sections) &&
+ match(atsym, symbol_white_list))
+ return 1;
/* Check for pattern 3 */
- if ((strcmp(fromsec, ".text.head") == 0) &&
- ((strcmp(tosec, ".init.data") == 0) ||
- (strcmp(tosec, ".init.text") == 0)))
+ if (match(fromsec, head_sections) &&
+ match(tosec, init_sections))
return 1;
/* Check for pattern 4 */
- for (s = pat3refsym; *s; s++)
- if (strcmp(refsymname, *s) == 0)
- return 1;
+ if (match(refsymname, linker_symbols))
+ return 1;
return 0;
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 64/77] all archs: consolidate init and exit sections in vmlinux.lds.h
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (63 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 63/77] kbuild: check section names consistently " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 65/77] compiler.h: introduce __section() Sam Ravnborg
` (13 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
This patch consolidate all definitions of .init.text, .init.data
and .exit.text, .exit.data section definitions in
the generic vmlinux.lds.h.
This is a preparational patch - alone it does not buy
us much good.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/alpha/kernel/vmlinux.lds.S | 8 ++++----
arch/arm/kernel/vmlinux.lds.S | 10 +++++-----
arch/avr32/kernel/vmlinux.lds.S | 8 ++++----
arch/blackfin/kernel/vmlinux.lds.S | 8 ++++----
arch/cris/arch-v10/vmlinux.lds.S | 8 ++++----
arch/cris/arch-v32/vmlinux.lds.S | 8 ++++----
arch/frv/kernel/vmlinux.lds.S | 14 +++++++-------
arch/h8300/kernel/vmlinux.lds.S | 8 ++++----
arch/ia64/kernel/vmlinux.lds.S | 8 ++++----
arch/m32r/kernel/vmlinux.lds.S | 12 ++++++------
arch/m68k/kernel/vmlinux-std.lds | 8 ++++----
arch/m68k/kernel/vmlinux-sun3.lds | 8 ++++----
arch/m68knommu/kernel/vmlinux.lds.S | 8 ++++----
arch/mips/kernel/vmlinux.lds.S | 8 ++++----
arch/parisc/kernel/vmlinux.lds.S | 8 ++++----
arch/powerpc/kernel/vmlinux.lds.S | 10 ++++++----
arch/ppc/kernel/vmlinux.lds.S | 8 ++++----
arch/s390/kernel/vmlinux.lds.S | 8 ++++----
arch/sh/kernel/vmlinux.lds.S | 8 ++++----
arch/sh64/kernel/vmlinux.lds.S | 8 ++++----
arch/sparc/kernel/vmlinux.lds.S | 8 ++++----
arch/sparc64/kernel/vmlinux.lds.S | 8 ++++----
arch/um/kernel/dyn.lds.S | 4 ++--
arch/um/kernel/uml.lds.S | 4 ++--
arch/v850/kernel/vmlinux.lds.S | 10 +++++-----
arch/x86/kernel/vmlinux_32.lds.S | 14 ++++++++++----
arch/x86/kernel/vmlinux_64.lds.S | 19 +++++++++++++------
arch/xtensa/kernel/vmlinux.lds.S | 9 +++++----
include/asm-generic/vmlinux.lds.h | 7 +++++++
29 files changed, 140 insertions(+), 117 deletions(-)
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 55c05b5..f13249b 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -46,11 +46,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(16);
@@ -136,8 +136,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 5ff5406..52221ef 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -30,7 +30,7 @@ SECTIONS
}
.init : { /* Init code and data */
- *(.init.text)
+ INIT_TEXT
_einittext = .;
__proc_info_begin = .;
*(.proc.info.init)
@@ -70,15 +70,15 @@ SECTIONS
__per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL
__init_begin = _stext;
- *(.init.data)
+ INIT_DATA
. = ALIGN(4096);
__init_end = .;
#endif
}
/DISCARD/ : { /* Exit code and data */
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
#ifndef CONFIG_MMU
*(.fixup)
@@ -129,7 +129,7 @@ SECTIONS
#ifdef CONFIG_XIP_KERNEL
. = ALIGN(4096);
__init_begin = .;
- *(.init.data)
+ INIT_DATA
. = ALIGN(4096);
__init_end = .;
#endif
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 11f08e3..481cfd4 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -27,19 +27,19 @@ SECTIONS
__init_begin = .;
_sinittext = .;
*(.text.reset)
- *(.init.text)
+ INIT_TEXT
/*
* .exit.text is discarded at runtime, not
* link time, to deal with references from
* __bug_table
*/
- *(.exit.text)
+ EXIT_TEXT
_einittext = .;
. = ALIGN(4);
__tagtable_begin = .;
*(.taglist.init)
__tagtable_end = .;
- *(.init.data)
+ INIT_DATA
. = ALIGN(16);
__setup_start = .;
*(.init.setup)
@@ -135,7 +135,7 @@ SECTIONS
* thrown away, as cleanup code is never called unless it's a module.
*/
/DISCARD/ : {
- *(.exit.data)
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 9b75bc8..8587224 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -91,13 +91,13 @@ SECTIONS
{
. = ALIGN(PAGE_SIZE);
__sinittext = .;
- *(.init.text)
+ INIT_TEXT
__einittext = .;
}
.init.data :
{
. = ALIGN(16);
- *(.init.data)
+ INIT_DATA
}
.init.setup :
{
@@ -198,8 +198,8 @@ SECTIONS
/DISCARD/ :
{
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
}
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S
index 97a7876..93c9f0e 100644
--- a/arch/cris/arch-v10/vmlinux.lds.S
+++ b/arch/cris/arch-v10/vmlinux.lds.S
@@ -57,10 +57,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@@ -109,8 +109,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.text.exit)
- *(.data.exit)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S
index b076c13..fead8c5 100644
--- a/arch/cris/arch-v32/vmlinux.lds.S
+++ b/arch/cris/arch-v32/vmlinux.lds.S
@@ -61,10 +61,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.text.exit)
- *(.data.exit)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index a17a81d..f42b328 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -28,14 +28,14 @@ SECTIONS
.init.text : {
*(.text.head)
#ifndef CONFIG_DEBUG_INFO
- *(.init.text)
- *(.exit.text)
- *(.exit.data)
+ INIT_TEXT
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
#endif
}
_einittext = .;
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(8);
__setup_start = .;
@@ -106,8 +106,8 @@ SECTIONS
LOCK_TEXT
#ifdef CONFIG_DEBUG_INFO
*(
- .init.text
- .exit.text
+ INIT_TEXT
+ EXIT_TEXT
.exitcall.exit
)
#endif
@@ -138,7 +138,7 @@ SECTIONS
.data : { /* Data */
DATA_DATA
*(.data.*)
- *(.exit.data)
+ EXIT_DATA
CONSTRUCTORS
}
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index a2e72d4..43a87b9 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -110,9 +110,9 @@ SECTIONS
. = ALIGN(0x4) ;
___init_begin = .;
__sinittext = .;
- *(.init.text)
+ INIT_TEXT
__einittext = .;
- *(.init.data)
+ INIT_DATA
. = ALIGN(0x4) ;
___setup_start = .;
*(.init.setup)
@@ -124,8 +124,8 @@ SECTIONS
___con_initcall_start = .;
*(.con_initcall.init)
___con_initcall_end = .;
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4);
___initramfs_start = .;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 757e419..80622ac 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -27,8 +27,8 @@ SECTIONS
{
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
*(.IA_64.unwind.exit.text)
*(.IA_64.unwind_info.exit.text)
@@ -119,12 +119,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET)
{
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
- { *(.init.data) }
+ { INIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 942a8c7..41b0785 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -76,10 +76,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@@ -100,8 +100,8 @@ SECTIONS
.altinstr_replacement : { *(.altinstr_replacement) }
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
- .exit.text : { *(.exit.text) }
- .exit.data : { *(.exit.data) }
+ .exit.text : { EXIT_TEXT }
+ .exit.data : { EXIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(4096);
@@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 59fe285..7537cc5 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -45,10 +45,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@@ -82,8 +82,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 4adffef..cdc313e 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -38,10 +38,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@@ -77,8 +77,8 @@ __init_begin = .;
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 07a0055..b44edb0 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -143,9 +143,9 @@ SECTIONS {
. = ALIGN(4096);
__init_begin = .;
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
- *(.init.data)
+ INIT_DATA
. = ALIGN(16);
__setup_start = .;
*(.init.setup)
@@ -170,8 +170,8 @@ SECTIONS {
} > INIT
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 5fc2398..b5470ce 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -114,11 +114,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@@ -144,10 +144,10 @@ SECTIONS
* references from .rodata
*/
.exit.text : {
- *(.exit.text)
+ EXIT_TEXT
}
.exit.data : {
- *(.exit.data)
+ EXIT_DATA
}
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(_PAGE_SIZE);
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 40d0ff9..50b4a3a 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -172,11 +172,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@@ -215,10 +215,10 @@ SECTIONS
* from .altinstructions and .eh_frame
*/
.exit.text : {
- *(.exit.text)
+ EXIT_TEXT
}
.exit.data : {
- *(.exit.data)
+ EXIT_DATA
}
#ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(PAGE_SIZE);
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index f66fa5d..0afb9e3 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -23,7 +23,7 @@ SECTIONS
/* Sections to be discarded. */
/DISCARD/ : {
*(.exitcall.exit)
- *(.exit.data)
+ EXIT_DATA
}
. = KERNELBASE;
@@ -76,17 +76,19 @@ SECTIONS
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
/* .exit.text is discarded at runtime, not link time,
* to deal with references from __bug_table
*/
- .exit.text : { *(.exit.text) }
+ .exit.text : {
+ EXIT_TEXT
+ }
.init.data : {
- *(.init.data);
+ INIT_DATA
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 98c1212..52b64fc 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -97,14 +97,14 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
/* .exit.text is discarded at runtime, not link time,
to deal with references from __bug_table */
- .exit.text : { *(.exit.text) }
+ .exit.text : { EXIT_TEXT }
.init.data : {
- *(.init.data);
+ INIT_DATA
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;
@@ -164,6 +164,6 @@ SECTIONS
/* Sections to be discarded. */
/DISCARD/ : {
*(.exitcall.exit)
- *(.exit.data)
+ EXIT_DATA
}
}
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 849120e..c62795f 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -91,7 +91,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
/*
@@ -99,11 +99,11 @@ SECTIONS
* to deal with references from __bug_table
*/
.exit.text : {
- *(.exit.text)
+ EXIT_TEXT
}
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(0x100);
.init.setup : {
@@ -150,7 +150,7 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.data)
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 0956fb3..4c20dd9 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -70,9 +70,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
_sinittext = .;
- .init.text : { *(.init.text) }
+ .init.text : { INIT_TEXT }
_einittext = .;
- .init.data : { *(.init.data) }
+ .init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
@@ -108,8 +108,8 @@ SECTIONS
* .exit.text is discarded at runtime, not link time, to deal with
* references from __bug_table
*/
- .exit.text : { *(.exit.text) }
- .exit.data : { *(.exit.data) }
+ .exit.text : { EXIT_TEXT }
+ .exit.data : { EXIT_DATA }
. = ALIGN(PAGE_SIZE);
.bss : {
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S
index f533a06..1696803 100644
--- a/arch/sh64/kernel/vmlinux.lds.S
+++ b/arch/sh64/kernel/vmlinux.lds.S
@@ -93,9 +93,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
_sinittext = .;
- .init.text : C_PHYS(.init.text) { *(.init.text) }
+ .init.text : C_PHYS(.init.text) { INIT_TEXT }
_einittext = .;
- .init.data : C_PHYS(.init.data) { *(.init.data) }
+ .init.data : C_PHYS(.init.data) { INIT_DATA }
. = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */
__setup_start = .;
.init.setup : C_PHYS(.init.setup) { *(.init.setup) }
@@ -130,8 +130,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index a8b4200..216147d 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -48,12 +48,12 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
__init_text_end = .;
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@@ -102,8 +102,8 @@ SECTIONS
_end = . ;
PROVIDE (end = .);
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 9fcd503..01f8096 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -56,11 +56,11 @@ SECTIONS
.init.text : {
__init_begin = .;
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
.init.data : {
- *(.init.data)
+ INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@@ -137,8 +137,8 @@ SECTIONS
PROVIDE (end = .);
/DISCARD/ : {
- *(.exit.text)
- *(.exit.data)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 3866f49..26090b7 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -17,7 +17,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
@@ -84,7 +84,7 @@ SECTIONS
#include "asm/common.lds.S"
- init.data : { *(.init.data) }
+ init.data : { INIT_DATA }
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 13df191..5828c1d 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -23,7 +23,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
. = ALIGN(4096);
@@ -48,7 +48,7 @@ SECTIONS
#include "asm/common.lds.S"
- init.data : { *(init.data) }
+ init.data : { INIT_DATA }
.data :
{
. = ALIGN(KERNEL_STACK_SIZE); /* init_task */
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index 6172599..d08cd1d 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -114,7 +114,7 @@
#define DATA_CONTENTS \
__sdata = . ; \
DATA_DATA \
- *(.exit.data) /* 2.5 convention */ \
+ EXIT_DATA /* 2.5 convention */ \
*(.data.exit) /* 2.4 convention */ \
. = ALIGN (16) ; \
*(.data.cacheline_aligned) \
@@ -157,9 +157,9 @@
. = ALIGN (4096) ; \
__init_start = . ; \
__sinittext = .; \
- *(.init.text) /* 2.5 convention */ \
+ INIT_TEXT /* 2.5 convention */ \
__einittext = .; \
- *(.init.data) \
+ INIT_DATA \
*(.text.init) /* 2.4 convention */ \
*(.data.init) \
INITCALL_CONTENTS \
@@ -170,7 +170,7 @@
#define ROMK_INIT_RAM_CONTENTS \
. = ALIGN (4096) ; \
__init_start = . ; \
- *(.init.data) /* 2.5 convention */ \
+ INIT_DATA /* 2.5 convention */ \
*(.data.init) /* 2.4 convention */ \
__init_end = . ; \
. = ALIGN (4096) ;
@@ -179,7 +179,7 @@
should go into ROM. */
#define ROMK_INIT_ROM_CONTENTS \
_sinittext = .; \
- *(.init.text) /* 2.5 convention */ \
+ INIT_TEXT /* 2.5 convention */ \
_einittext = .; \
*(.text.init) /* 2.4 convention */ \
INITCALL_CONTENTS \
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 7d72cce..84c913f 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -131,10 +131,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
__init_begin = .;
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
+ .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
+ INIT_DATA
+ }
. = ALIGN(16);
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
__setup_start = .;
@@ -169,8 +171,12 @@ SECTIONS
}
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
- .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
- .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
+ .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
+ EXIT_TEXT
+ }
+ .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
+ EXIT_DATA
+ }
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4096);
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index ba8ea97..ea53869 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -155,12 +155,15 @@ SECTIONS
__init_begin = .;
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
_sinittext = .;
- *(.init.text)
+ INIT_TEXT
_einittext = .;
}
- __initdata_begin = .;
- .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
- __initdata_end = .;
+ .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
+ __initdata_begin = .;
+ INIT_DATA
+ __initdata_end = .;
+ }
+
. = ALIGN(16);
__setup_start = .;
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
@@ -187,8 +190,12 @@ SECTIONS
}
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
- .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
- .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
+ .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
+ EXIT_TEXT
+ }
+ .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
+ EXIT_DATA
+ }
/* vdso blob that is mapped into user space */
vdso_start = . ;
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index ac4ed52..7d0f55a 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -136,13 +136,13 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
- *(.init.literal) *(.init.text)
+ *(.init.literal) INIT_TEXT
_einittext = .;
}
.init.data :
{
- *(.init.data)
+ INIT_DATA
. = ALIGN(0x4);
__tagtable_begin = .;
*(.taglist)
@@ -278,8 +278,9 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ :
{
- *(.exit.literal .exit.text)
- *(.exit.data)
+ *(.exit.literal)
+ EXIT_TEXT
+ EXIT_DATA
*(.exitcall.exit)
}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9f584cc..ae0166e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -183,6 +183,13 @@
*(.kprobes.text) \
VMLINUX_SYMBOL(__kprobes_text_end) = .;
+/* init and exit section handling */
+#define INIT_TEXT *(.init.text)
+#define INIT_DATA *(.init.data)
+#define EXIT_TEXT *(.exit.text)
+#define EXIT_DATA *(.exit.data)
+
+
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to
the beginning of the section so we begin them at 0. */
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 65/77] compiler.h: introduce __section()
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (64 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 64/77] all archs: consolidate init and exit sections in vmlinux.lds.h Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 66/77] Use separate sections for __dev/__cpu/__mem code/data Sam Ravnborg
` (12 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Add a new helper: __section() that makes a section definition
much shorter and more readable.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
include/linux/compiler.h | 5 +++++
include/linux/init.h | 26 +++++++++++++-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c68b67b..e0114a6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -175,4 +175,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#define __cold
#endif
+/* Simple shorthand for a section definition */
+#ifndef __section
+# define __section(S) __attribute__ ((__section__(#S)))
+#endif
+
#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/init.h b/include/linux/init.h
index 5141381..9980768 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
/* These are for everybody (although not all archs will actually
discard it in modules) */
-#define __init __attribute__ ((__section__ (".init.text"))) __cold
-#define __initdata __attribute__ ((__section__ (".init.data")))
-#define __exitdata __attribute__ ((__section__(".exit.data")))
-#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init __section(.init.text) __cold
+#define __initdata __section(.init.data)
+#define __exitdata __section(.exit.data)
+#define __exit_call __attribute_used__ __section(.exitcall.exit)
/* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a
@@ -55,14 +55,14 @@
* the init/exit section (code or data) is valid and will teach modpost
* not to issue a warning.
* The markers follow same syntax rules as __init / __initdata. */
-#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
-#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
-#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok")))
+#define __init_refok noinline __section(.text.init.refok)
+#define __initdata_refok __section(.data.init.refok)
+#define __exit_refok noinline __section(.exit.text.refok)
#ifdef MODULE
-#define __exit __attribute__ ((__section__(".exit.text"))) __cold
+#define __exit __section(.exit.text) __cold
#else
-#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold
+#define __exit __attribute_used__ __section(.exit.text) __cold
#endif
/* For assembly routines */
@@ -142,11 +142,11 @@ void prepare_namespace(void);
#define console_initcall(fn) \
static initcall_t __initcall_##fn \
- __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn
+ __attribute_used__ __section(.con_initcall.init)=fn
#define security_initcall(fn) \
static initcall_t __initcall_##fn \
- __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn
+ __attribute_used__ __section(.security_initcall.init) = fn
struct obs_kernel_param {
const char *str;
@@ -164,7 +164,7 @@ struct obs_kernel_param {
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
__attribute_used__ \
- __attribute__((__section__(".init.setup"))) \
+ __section(.init.setup) \
__attribute__((aligned((sizeof(long))))) \
= { __setup_str_##unique_id, fn, early }
@@ -242,7 +242,7 @@ void __init parse_early_param(void);
#endif
/* Data marked not to be saved by software suspend */
-#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
+#define __nosavedata __section(.data.nosave)
/* This means "can be init if no module support, otherwise module load
may call it." */
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 66/77] Use separate sections for __dev/__cpu/__mem code/data
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (65 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 65/77] compiler.h: introduce __section() Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 67/77] kbuild: introduce new option to enhance section mismatch analysis Sam Ravnborg
` (11 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg, Greg KH, Randy Dunlap, Adrian Bunk
Introducing separate sections for __dev* (HOTPLUG),
__cpu* (HOTPLUG_CPU) and __mem* (MEMORY_HOTPLUG)
allows us to do a much more reliable Section mismatch
check in modpost. We are no longer dependent on the actual
configuration of for example HOTPLUG.
This has the effect that all users see much more
Section mismatch warnings than before because they
were almost all hidden when HOTPLUG was enabled.
The advantage of this is that when building a piece
of code then it is much more likely that the Section
mismatch errors are spotted and the warnings will be
felt less random of nature.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg KH <greg@kroah.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Adrian Bunk <bunk@kernel.org>
---
include/asm-generic/vmlinux.lds.h | 88 ++++++++++++++++++++++++++++++++++---
include/linux/init.h | 77 ++++++++++++++++----------------
scripts/mod/modpost.c | 54 ++++++++++++++++------
3 files changed, 159 insertions(+), 60 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index ae0166e..e0a56fb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -9,10 +9,46 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8)
+/* The actual configuration determine if the init/exit sections
+ * are handled as text/data or they can be discarded (which
+ * often happens at runtime)
+ */
+#ifdef CONFIG_HOTPLUG
+#define DEV_KEEP(sec) *(.dev##sec)
+#define DEV_DISCARD(sec)
+#else
+#define DEV_KEEP(sec)
+#define DEV_DISCARD(sec) *(.dev##sec)
+#endif
+
+#ifdef CONFIG_HOTPLUG_CPU
+#define CPU_KEEP(sec) *(.cpu##sec)
+#define CPU_DISCARD(sec)
+#else
+#define CPU_KEEP(sec)
+#define CPU_DISCARD(sec) *(.cpu##sec)
+#endif
+
+#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
+ || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
+#define MEM_KEEP(sec) *(.mem##sec)
+#define MEM_DISCARD(sec)
+#else
+#define MEM_KEEP(sec)
+#define MEM_DISCARD(sec) *(.mem##sec)
+#endif
+
+
/* .data section */
#define DATA_DATA \
*(.data) \
*(.data.init.refok) \
+ DEV_KEEP(init.data) \
+ DEV_KEEP(exit.data) \
+ CPU_KEEP(init.data) \
+ CPU_KEEP(exit.data) \
+ MEM_KEEP(init.data) \
+ MEM_KEEP(exit.data) \
. = ALIGN(8); \
VMLINUX_SYMBOL(__start___markers) = .; \
*(__markers) \
@@ -132,6 +168,16 @@
*(__ksymtab_strings) \
} \
\
+ /* __*init sections */ \
+ __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
+ DEV_KEEP(init.rodata) \
+ DEV_KEEP(exit.rodata) \
+ CPU_KEEP(init.rodata) \
+ CPU_KEEP(exit.rodata) \
+ MEM_KEEP(init.rodata) \
+ MEM_KEEP(exit.rodata) \
+ } \
+ \
/* Built-in module parameters. */ \
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___param) = .; \
@@ -139,7 +185,6 @@
VMLINUX_SYMBOL(__stop___param) = .; \
VMLINUX_SYMBOL(__end_rodata) = .; \
} \
- \
. = ALIGN((align));
/* RODATA provided for backward compatibility.
@@ -159,7 +204,14 @@
ALIGN_FUNCTION(); \
*(.text) \
*(.text.init.refok) \
- *(.exit.text.refok)
+ *(.exit.text.refok) \
+ DEV_KEEP(init.text) \
+ DEV_KEEP(exit.text) \
+ CPU_KEEP(init.text) \
+ CPU_KEEP(exit.text) \
+ MEM_KEEP(init.text) \
+ MEM_KEEP(exit.text)
+
/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */
@@ -184,11 +236,35 @@
VMLINUX_SYMBOL(__kprobes_text_end) = .;
/* init and exit section handling */
-#define INIT_TEXT *(.init.text)
-#define INIT_DATA *(.init.data)
-#define EXIT_TEXT *(.exit.text)
-#define EXIT_DATA *(.exit.data)
+#define INIT_DATA \
+ *(.init.data) \
+ DEV_DISCARD(init.data) \
+ DEV_DISCARD(init.rodata) \
+ CPU_DISCARD(init.data) \
+ CPU_DISCARD(init.rodata) \
+ MEM_DISCARD(init.data) \
+ MEM_DISCARD(init.rodata)
+
+#define INIT_TEXT \
+ *(.init.text) \
+ DEV_DISCARD(init.text) \
+ CPU_DISCARD(init.text) \
+ MEM_DISCARD(init.text)
+
+#define EXIT_DATA \
+ *(.exit.data) \
+ DEV_DISCARD(exit.data) \
+ DEV_DISCARD(exit.rodata) \
+ CPU_DISCARD(exit.data) \
+ CPU_DISCARD(exit.rodata) \
+ MEM_DISCARD(exit.data) \
+ MEM_DISCARD(exit.rodata)
+#define EXIT_TEXT \
+ *(.exit.text) \
+ DEV_DISCARD(exit.text) \
+ CPU_DISCARD(exit.text) \
+ MEM_DISCARD(exit.text)
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to
diff --git a/include/linux/init.h b/include/linux/init.h
index 9980768..dcb66c7 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -60,18 +60,54 @@
#define __exit_refok noinline __section(.exit.text.refok)
#ifdef MODULE
-#define __exit __section(.exit.text) __cold
+#define __exitused
#else
-#define __exit __attribute_used__ __section(.exit.text) __cold
+#define __exitused __used
#endif
+#define __exit __section(.exit.text) __exitused __cold
+
+/* Used for HOTPLUG */
+#define __devinit __section(.devinit.text) __cold
+#define __devinitdata __section(.devinit.data)
+#define __devinitconst __section(.devinit.rodata)
+#define __devexit __section(.devexit.text) __exitused __cold
+#define __devexitdata __section(.devexit.data)
+#define __devexitconst __section(.devexit.rodata)
+
+/* Used for HOTPLUG_CPU */
+#define __cpuinit __section(.cpuinit.text) __cold
+#define __cpuinitdata __section(.cpuinit.data)
+#define __cpuinitconst __section(.cpuinit.rodata)
+#define __cpuexit __section(.cpuexit.text) __exitused __cold
+#define __cpuexitdata __section(.cpuexit.data)
+#define __cpuexitconst __section(.cpuexit.rodata)
+
+/* Used for MEMORY_HOTPLUG */
+#define __meminit __section(.meminit.text) __cold
+#define __meminitdata __section(.meminit.data)
+#define __meminitconst __section(.meminit.rodata)
+#define __memexit __section(.memexit.text) __exitused __cold
+#define __memexitdata __section(.memexit.data)
+#define __memexitconst __section(.memexit.rodata)
+
/* For assembly routines */
#define __INIT .section ".init.text","ax"
#define __INIT_REFOK .section ".text.init.refok","ax"
#define __FINIT .previous
+
#define __INITDATA .section ".init.data","aw"
#define __INITDATA_REFOK .section ".data.init.refok","aw"
+#define __DEVINIT .section ".devinit.text", "ax"
+#define __DEVINITDATA .section ".devinit.data", "aw"
+
+#define __CPUINIT .section ".cpuinit.text", "ax"
+#define __CPUINITDATA .section ".cpuinit.data", "aw"
+
+#define __MEMINIT .section ".meminit.text", "ax"
+#define __MEMINITDATA .section ".meminit.data", "aw"
+
#ifndef __ASSEMBLY__
/*
* Used for initialization calls..
@@ -254,43 +290,6 @@ void __init parse_early_param(void);
#define __initdata_or_module __initdata
#endif /*CONFIG_MODULES*/
-#ifdef CONFIG_HOTPLUG
-#define __devinit
-#define __devinitdata
-#define __devexit
-#define __devexitdata
-#else
-#define __devinit __init
-#define __devinitdata __initdata
-#define __devexit __exit
-#define __devexitdata __exitdata
-#endif
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define __cpuinit
-#define __cpuinitdata
-#define __cpuexit
-#define __cpuexitdata
-#else
-#define __cpuinit __init
-#define __cpuinitdata __initdata
-#define __cpuexit __exit
-#define __cpuexitdata __exitdata
-#endif
-
-#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
- || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
-#define __meminit
-#define __meminitdata
-#define __memexit
-#define __memexitdata
-#else
-#define __meminit __init
-#define __meminitdata __initdata
-#define __memexit __exit
-#define __memexitdata __exitdata
-#endif
-
/* Functions marked as __devexit may be discarded at kernel link time, depending
on config options. Newer versions of binutils detect references from
retained sections to discarded sections and flag an error. Pointers to
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 986513d..730b321 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -670,27 +670,41 @@ int match(const char *sym, const char * const pat[])
static const char *section_white_list[] =
{ ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
-#define INIT_DATA_SECTIONS ".init.data$"
-#define EXIT_DATA_SECTIONS ".exit.data$"
+#define ALL_INIT_DATA_SECTIONS \
+ ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
+#define ALL_EXIT_DATA_SECTIONS \
+ ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
-#define INIT_TEXT_SECTIONS ".init.text$"
-#define EXIT_TEXT_SECTIONS ".exit.text$"
+#define ALL_INIT_TEXT_SECTIONS \
+ ".init.text$", ".devinit.text$", ".cpuinit.text$", ".meminit.text$"
+#define ALL_EXIT_TEXT_SECTIONS \
+ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
-#define INIT_SECTIONS INIT_DATA_SECTIONS, INIT_TEXT_SECTIONS
-#define EXIT_SECTIONS EXIT_DATA_SECTIONS, EXIT_TEXT_SECTIONS
+#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS
+#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS
#define DATA_SECTIONS ".data$", ".data.rel$"
#define TEXT_SECTIONS ".text$"
+#define INIT_SECTIONS ".init.data$", ".init.text$"
+#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$"
+#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$"
+#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$"
+
+#define EXIT_SECTIONS ".exit.data$", ".exit.text$"
+#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$"
+#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$"
+#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$"
+
/* init data sections */
-static const char *init_data_sections[] = { INIT_DATA_SECTIONS, NULL };
+static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
/* all init sections */
-static const char *init_sections[] = { INIT_SECTIONS, NULL };
+static const char *init_sections[] = { ALL_INIT_SECTIONS, NULL };
/* All init and exit sections (code + data) */
static const char *init_exit_sections[] =
- {INIT_SECTIONS, EXIT_SECTIONS, NULL };
+ {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
/* data section */
static const char *data_sections[] = { DATA_SECTIONS, NULL };
@@ -734,22 +748,32 @@ const struct sectioncheck sectioncheck[] = {
*/
{
.fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
- .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }
+ .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
+},
+/* Do not reference init code/data from devinit/cpuinit/meminit code/data */
+{
+ .fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL },
+ .tosec = { INIT_SECTIONS, NULL }
+},
+/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
+{
+ .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
+ .tosec = { EXIT_SECTIONS, NULL }
},
/* Do not use exit code/data from init code */
{
- .fromsec = { INIT_SECTIONS, NULL },
- .tosec = { EXIT_SECTIONS, NULL },
+ .fromsec = { ALL_INIT_SECTIONS, NULL },
+ .tosec = { ALL_EXIT_SECTIONS, NULL },
},
/* Do not use init code/data from exit code */
{
- .fromsec = { EXIT_SECTIONS, NULL },
- .tosec = { INIT_SECTIONS, NULL }
+ .fromsec = { ALL_EXIT_SECTIONS, NULL },
+ .tosec = { ALL_INIT_SECTIONS, NULL }
},
/* Do not export init/exit functions or data */
{
.fromsec = { "__ksymtab*", NULL },
- .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }
+ .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
}
};
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 67/77] kbuild: introduce new option to enhance section mismatch analysis
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (66 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 66/77] Use separate sections for __dev/__cpu/__mem code/data Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 68/77] kbuild: link vmlinux.o before kallsyms passes Sam Ravnborg
` (10 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Setting the option DEBUG_SECTION_MISMATCH will
report additional section mismatch'es but this
should in the end makes it possible to get rid of
all of them.
See help text in lib/Kconfig.debug for details.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 5 +++++
lib/Kconfig.debug | 30 ++++++++++++++++++++++++++++++
scripts/Makefile.build | 9 +++++++--
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index e518ed6..1f22c1f 100644
--- a/Makefile
+++ b/Makefile
@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g
KBUILD_AFLAGS += -gdwarf-2
endif
+# We trigger additional mismatches with less inlining
+ifdef CONFIG_DEBUG_SECTION_MISMATCH
+KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
+endif
+
# Force gcc to behave correct even for buggy distributions
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a601093..c1fb0c6 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -79,6 +79,36 @@ config HEADERS_CHECK
exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
your build tree), to make sure they're suitable.
+config DEBUG_SECTION_MISMATCH
+ bool "Enable full Section mismatch analysis"
+ default y
+ help
+ The section mismatch analysis checks if there are illegal
+ references from one section to another section.
+ Linux will during link or during runtime drop some sections
+ and any use of code/data previously in these sections will
+ most likely result in an oops.
+ In the code functions and variables are annotated with
+ __init, __devinit etc. (see full list in include/linux/init.h)
+ which result in the code/data being placed in specific sections.
+ The section mismatch anaylsis are always done after a full
+ kernel build but enabling this options will in addition
+ do the following:
+ - Add the option -fno-inline-functions-called-once to gcc
+ When inlining a function annotated __init in a non-init
+ function we would loose the section information and thus
+ the analysis would not catch the illegal reference.
+ This options tell gcc to inline less but will also
+ result in a larger kernel.
+ - Run the section mismatch analysis for each module/built-in.o
+ When we run the section mismatch analysis on vmlinux.o we
+ looses valueable information about where the mismatch was
+ introduced.
+ Running the analysis for each module/built-in.o file
+ will tell where the mismatch happens much closer to the
+ source. The drawback is that we will report the same
+ mismatch at least twice.
+
config DEBUG_KERNEL
bool "Kernel debugging"
help
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index db38ef4..67fb453 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -103,6 +103,10 @@ ifneq ($(KBUILD_CHECKSRC),0)
endif
endif
+# Do section mismatch analysis for each module/built-in.o
+ifdef CONFIG_DEBUG_SECTION_MISMATCH
+ cmd_secanalysis = ; scripts/mod/modpost $@
+endif
# Compile C sources (.c)
# ---------------------------------------------------------------------------
@@ -268,7 +272,8 @@ ifdef builtin-target
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o
cmd_link_o_target = $(if $(strip $(obj-y)),\
- $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
+ $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
+ $(cmd_secanalysis),\
rm -f $@; $(AR) rcs $@)
$(builtin-target): $(obj-y) FORCE
@@ -316,7 +321,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@
-cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
+cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(cmd_link_multi-y)
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 68/77] kbuild: link vmlinux.o before kallsyms passes
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (67 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 67/77] kbuild: introduce new option to enhance section mismatch analysis Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 69/77] kbuild: use simpler section mismatch warnings in modpost Sam Ravnborg
` (9 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
link vmlinux.o so we may report section mismatch bugs before
we start with the real link - that may error out.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 1f22c1f..ae80713 100644
--- a/Makefile
+++ b/Makefile
@@ -798,7 +798,7 @@ define rule_vmlinux-modpost
endef
# vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
+vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
@@ -809,7 +809,9 @@ endif
$(call if_changed_rule,vmlinux__)
$(Q)rm -f .old_version
-vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+# build vmlinux.o first to catch section mismatch errors early
+$(kallsyms.o): vmlinux.o
+vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE
$(call if_changed_rule,vmlinux-modpost)
# The actual objects are generated when descending,
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 69/77] kbuild: use simpler section mismatch warnings in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (68 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 68/77] kbuild: link vmlinux.o before kallsyms passes Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 70/77] kbuild: introduce a few helpers " Sam Ravnborg
` (8 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
The typical layout is now:
WARNING: vmlinux.o(.text+0x372ec): Section mismatch: reference to .devinit.text:pci_scan_one_pbm in 'psycho_scan_bus'
This is first step towards more readable warnings.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 56 ++++++++++++++-----------------------------------
1 files changed, 16 insertions(+), 40 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 730b321..7dfd039 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -938,20 +938,16 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
* The ELF format may have a better way to detect what type of symbol
* it is, but this works for now.
**/
-static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
- const char *sec,
- Elf_Sym **before, Elf_Sym **after)
+static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
+ const char *sec)
{
Elf_Sym *sym;
+ Elf_Sym *near = NULL;
Elf_Ehdr *hdr = elf->hdr;
- Elf_Addr beforediff = ~0;
- Elf_Addr afterdiff = ~0;
+ Elf_Addr distance = ~0;
const char *secstrings = (void *)hdr +
elf->sechdrs[hdr->e_shstrndx].sh_offset;
- *before = NULL;
- *after = NULL;
-
for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
const char *symsec;
@@ -963,20 +959,15 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
if (!is_valid_name(elf, sym))
continue;
if (sym->st_value <= addr) {
- if ((addr - sym->st_value) < beforediff) {
- beforediff = addr - sym->st_value;
- *before = sym;
- } else if ((addr - sym->st_value) == beforediff) {
- *before = sym;
+ if ((addr - sym->st_value) < distance) {
+ distance = addr - sym->st_value;
+ near = sym;
+ } else if ((addr - sym->st_value) == distance) {
+ near = sym;
}
- } else {
- if ((sym->st_value - addr) < afterdiff) {
- afterdiff = sym->st_value - addr;
- *after = sym;
- } else if ((sym->st_value - addr) == afterdiff)
- *after = sym;
}
}
+ return near;
}
/**
@@ -988,7 +979,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
struct elf_info *elf, Elf_Sym *sym, Elf_Rela r)
{
const char *refsymname = "";
- Elf_Sym *before, *after;
+ Elf_Sym *where;
Elf_Sym *refsym;
Elf_Ehdr *hdr = elf->hdr;
Elf_Shdr *sechdrs = elf->sechdrs;
@@ -996,7 +987,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
sechdrs[hdr->e_shstrndx].sh_offset;
const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name;
- find_symbols_between(elf, r.r_offset, fromsec, &before, &after);
+ where = find_elf_symbol2(elf, r.r_offset, fromsec);
refsym = find_elf_symbol(elf, r.r_addend, sym);
if (refsym && strlen(elf->strtab + refsym->st_name))
@@ -1004,30 +995,15 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
/* check whitelist - we may ignore it */
if (secref_whitelist(modname, secname, fromsec,
- before ? elf->strtab + before->st_name : "",
+ where ? elf->strtab + where->st_name : "",
refsymname))
return;
- if (before && after) {
- warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
- "(between '%s' and '%s')\n",
- modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname,
- elf->strtab + before->st_name,
- elf->strtab + after->st_name);
- } else if (before) {
- warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
- "(after '%s')\n",
- modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname,
- elf->strtab + before->st_name);
- } else if (after) {
+ if (where) {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
- "before '%s' (at offset -0x%llx)\n",
+ "in '%s'\n",
modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname,
- elf->strtab + after->st_name,
- (unsigned long long)r.r_offset);
+ secname, refsymname, elf->strtab + where->st_name);
} else {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
modname, fromsec, (unsigned long long)r.r_offset,
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 70/77] kbuild: introduce a few helpers in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (69 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 69/77] kbuild: use simpler section mismatch warnings in modpost Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 71/77] kbuild: simplified warning report " Sam Ravnborg
` (7 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Introducing helpers to retreive symbol and section
names cleaned up the code a bit.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 73 +++++++++++++++++++++++++-----------------------
1 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7dfd039..e4099cd 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -605,6 +605,26 @@ static int strrcmp(const char *s, const char *sub)
return memcmp(s + slen - sublen, sub, sublen);
}
+static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
+{
+ return elf->strtab + sym->st_name;
+}
+
+static const char *sec_name(struct elf_info *elf, int shndx)
+{
+ Elf_Shdr *sechdrs = elf->sechdrs;
+ return (void *)elf->hdr +
+ elf->sechdrs[elf->hdr->e_shstrndx].sh_offset +
+ sechdrs[shndx].sh_name;
+}
+
+static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
+{
+ return (void *)elf->hdr +
+ elf->sechdrs[elf->hdr->e_shstrndx].sh_offset +
+ sechdr->sh_name;
+}
+
/* if sym is empty or point to a string
* like ".[0-9]+" then return 1.
* This is the optional prefix added by ld to some sections
@@ -943,17 +963,14 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
{
Elf_Sym *sym;
Elf_Sym *near = NULL;
- Elf_Ehdr *hdr = elf->hdr;
Elf_Addr distance = ~0;
- const char *secstrings = (void *)hdr +
- elf->sechdrs[hdr->e_shstrndx].sh_offset;
for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
const char *symsec;
if (sym->st_shndx >= SHN_LORESERVE)
continue;
- symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name;
+ symsec = sec_name(elf, sym->st_shndx);
if (strcmp(symsec, sec) != 0)
continue;
if (!is_valid_name(elf, sym))
@@ -978,24 +995,21 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
static void warn_sec_mismatch(const char *modname, const char *fromsec,
struct elf_info *elf, Elf_Sym *sym, Elf_Rela r)
{
- const char *refsymname = "";
Elf_Sym *where;
Elf_Sym *refsym;
- Elf_Ehdr *hdr = elf->hdr;
- Elf_Shdr *sechdrs = elf->sechdrs;
- const char *secstrings = (void *)hdr +
- sechdrs[hdr->e_shstrndx].sh_offset;
- const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name;
+ const char *refsymname = "";
+ const char *secname;
+ secname = sec_name(elf, sym->st_shndx);
where = find_elf_symbol2(elf, r.r_offset, fromsec);
refsym = find_elf_symbol(elf, r.r_addend, sym);
- if (refsym && strlen(elf->strtab + refsym->st_name))
- refsymname = elf->strtab + refsym->st_name;
+ if (refsym && strlen(sym_name(elf, refsym)))
+ refsymname = sym_name(elf, refsym);
/* check whitelist - we may ignore it */
if (secref_whitelist(modname, secname, fromsec,
- where ? elf->strtab + where->st_name : "",
+ where ? sym_name(elf, where) : "",
refsymname))
return;
@@ -1003,7 +1017,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"in '%s'\n",
modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname, elf->strtab + where->st_name);
+ secname, refsymname, sym_name(elf, where));
} else {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
modname, fromsec, (unsigned long long)r.r_offset,
@@ -1095,14 +1109,10 @@ static void section_rela(const char *modname, struct elf_info *elf,
const char *fromsec;
const char * tosec;
- Elf_Ehdr *hdr = elf->hdr;
- Elf_Rela *start = (void *)hdr + sechdr->sh_offset;
+ Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
Elf_Rela *stop = (void *)start + sechdr->sh_size;
- const char *secstrings = (void *)hdr +
- elf->sechdrs[hdr->e_shstrndx].sh_offset;
-
- fromsec = secstrings + sechdr->sh_name;
+ fromsec = sech_name(elf, sechdr);
fromsec += strlen(".rela");
/* if from section (name) is know good then skip it */
if (match(fromsec, section_white_list))
@@ -1111,7 +1121,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
for (rela = start; rela < stop; rela++) {
r.r_offset = TO_NATIVE(rela->r_offset);
#if KERNEL_ELFCLASS == ELFCLASS64
- if (hdr->e_machine == EM_MIPS) {
+ if (elf->hdr->e_machine == EM_MIPS) {
unsigned int r_typ;
r_sym = ELF64_MIPS_R_SYM(rela->r_info);
r_sym = TO_NATIVE(r_sym);
@@ -1131,8 +1141,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
if (sym->st_shndx >= SHN_LORESERVE)
continue;
- tosec = secstrings +
- elf->sechdrs[sym->st_shndx].sh_name;
+ tosec = sec_name(elf, sym->st_shndx);
if (section_mismatch(fromsec, tosec))
warn_sec_mismatch(modname, fromsec, elf, sym, r);
}
@@ -1148,14 +1157,10 @@ static void section_rel(const char *modname, struct elf_info *elf,
const char *fromsec;
const char * tosec;
- Elf_Ehdr *hdr = elf->hdr;
- Elf_Rel *start = (void *)hdr + sechdr->sh_offset;
+ Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
Elf_Rel *stop = (void *)start + sechdr->sh_size;
- const char *secstrings = (void *)hdr +
- elf->sechdrs[hdr->e_shstrndx].sh_offset;
-
- fromsec = secstrings + sechdr->sh_name;
+ fromsec = sech_name(elf, sechdr);
fromsec += strlen(".rel");
/* if from section (name) is know good then skip it */
if (match(fromsec, section_white_list))
@@ -1164,7 +1169,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
for (rel = start; rel < stop; rel++) {
r.r_offset = TO_NATIVE(rel->r_offset);
#if KERNEL_ELFCLASS == ELFCLASS64
- if (hdr->e_machine == EM_MIPS) {
+ if (elf->hdr->e_machine == EM_MIPS) {
unsigned int r_typ;
r_sym = ELF64_MIPS_R_SYM(rel->r_info);
r_sym = TO_NATIVE(r_sym);
@@ -1179,7 +1184,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
r_sym = ELF_R_SYM(r.r_info);
#endif
r.r_addend = 0;
- switch (hdr->e_machine) {
+ switch (elf->hdr->e_machine) {
case EM_386:
if (addend_386_rel(elf, sechdr, &r))
continue;
@@ -1198,8 +1203,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
if (sym->st_shndx >= SHN_LORESERVE)
continue;
- tosec = secstrings +
- elf->sechdrs[sym->st_shndx].sh_name;
+ tosec = sec_name(elf, sym->st_shndx);
if (section_mismatch(fromsec, tosec))
warn_sec_mismatch(modname, fromsec, elf, sym, r);
}
@@ -1221,11 +1225,10 @@ static void check_sec_ref(struct module *mod, const char *modname,
struct elf_info *elf)
{
int i;
- Elf_Ehdr *hdr = elf->hdr;
Elf_Shdr *sechdrs = elf->sechdrs;
/* Walk through all sections */
- for (i = 0; i < hdr->e_shnum; i++) {
+ for (i = 0; i < elf->hdr->e_shnum; i++) {
/* We want to process only relocation sections and not .init */
if (sechdrs[i].sh_type == SHT_RELA)
section_rela(modname, elf, &elf->sechdrs[i]);
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 71/77] kbuild: simplified warning report in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (70 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 70/77] kbuild: introduce a few helpers " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 72/77] kconfig: remove "enable" Sam Ravnborg
` (6 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
Refactor code so the warning report function
does nothing else than reporting warnings.
As a side effect some other code paths were cleaned
up by this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/mod/modpost.c | 104 ++++++++++++++++++++++++------------------------
1 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index e4099cd..0a80aca 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -607,7 +607,10 @@ static int strrcmp(const char *s, const char *sub)
static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
{
- return elf->strtab + sym->st_name;
+ if (sym)
+ return elf->strtab + sym->st_name;
+ else
+ return "";
}
static const char *sec_name(struct elf_info *elf, int shndx)
@@ -812,7 +815,6 @@ static int section_mismatch(const char *fromsec, const char *tosec)
return 0;
}
-
/**
* Whitelist to allow certain references to pass with no warning.
*
@@ -856,36 +858,35 @@ static int section_mismatch(const char *fromsec, const char *tosec)
* refsymname = __init_begin, _sinittext, _einittext
*
**/
-static int secref_whitelist(const char *modname, const char *tosec,
- const char *fromsec, const char *atsym,
- const char *refsymname)
+static int secref_whitelist(const char *fromsec, const char *fromsym,
+ const char *tosec, const char *tosym)
{
/* Check for pattern 0 */
if (match(fromsec, initref_sections))
- return 1;
+ return 0;
/* Check for pattern 1 */
if (match(tosec, init_data_sections) &&
match(fromsec, data_sections) &&
- (strncmp(atsym, "__param", strlen("__param")) == 0))
- return 1;
+ (strncmp(fromsym, "__param", strlen("__param")) == 0))
+ return 0;
/* Check for pattern 2 */
if (match(tosec, init_exit_sections) &&
match(fromsec, data_sections) &&
- match(atsym, symbol_white_list))
- return 1;
+ match(fromsym, symbol_white_list))
+ return 0;
/* Check for pattern 3 */
if (match(fromsec, head_sections) &&
match(tosec, init_sections))
- return 1;
+ return 0;
/* Check for pattern 4 */
- if (match(refsymname, linker_symbols))
- return 1;
+ if (match(tosym, linker_symbols))
+ return 0;
- return 0;
+ return 1;
}
/**
@@ -987,41 +988,49 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
return near;
}
-/**
+/*
* Print a warning about a section mismatch.
* Try to find symbols near it so user can find it.
* Check whitelist before warning - it may be a false positive.
- **/
-static void warn_sec_mismatch(const char *modname, const char *fromsec,
- struct elf_info *elf, Elf_Sym *sym, Elf_Rela r)
+ */
+static void report_sec_mismatch(const char *modname,
+ const char *fromsec,
+ unsigned long long fromaddr,
+ const char *fromsym,
+ const char *tosec, const char *tosym)
{
- Elf_Sym *where;
- Elf_Sym *refsym;
- const char *refsymname = "";
- const char *secname;
-
- secname = sec_name(elf, sym->st_shndx);
- where = find_elf_symbol2(elf, r.r_offset, fromsec);
-
- refsym = find_elf_symbol(elf, r.r_addend, sym);
- if (refsym && strlen(sym_name(elf, refsym)))
- refsymname = sym_name(elf, refsym);
-
- /* check whitelist - we may ignore it */
- if (secref_whitelist(modname, secname, fromsec,
- where ? sym_name(elf, where) : "",
- refsymname))
- return;
-
- if (where) {
+ if (strlen(tosym)) {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"in '%s'\n",
- modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname, sym_name(elf, where));
+ modname, fromsec, fromaddr,
+ tosec, tosym, fromsym);
} else {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
- modname, fromsec, (unsigned long long)r.r_offset,
- secname, refsymname);
+ modname, fromsec, fromaddr,
+ tosec, tosym);
+ }
+}
+
+static void check_section_mismatch(const char *modname, struct elf_info *elf,
+ Elf_Rela *r, Elf_Sym *sym, const char *fromsec)
+{
+ const char *tosec;
+
+ tosec = sec_name(elf, sym->st_shndx);
+ if (section_mismatch(fromsec, tosec)) {
+ const char *fromsym;
+ const char *tosym;
+
+ fromsym = sym_name(elf,
+ find_elf_symbol2(elf, r->r_offset, fromsec));
+ tosym = sym_name(elf,
+ find_elf_symbol(elf, r->r_addend, sym));
+
+ /* check whitelist - we may ignore it */
+ if (secref_whitelist(fromsec, fromsym, tosec, tosym)) {
+ report_sec_mismatch(modname, fromsec, r->r_offset,
+ fromsym, tosec, tosym);
+ }
}
}
@@ -1107,7 +1116,6 @@ static void section_rela(const char *modname, struct elf_info *elf,
Elf_Rela r;
unsigned int r_sym;
const char *fromsec;
- const char * tosec;
Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
Elf_Rela *stop = (void *)start + sechdr->sh_size;
@@ -1117,7 +1125,6 @@ static void section_rela(const char *modname, struct elf_info *elf,
/* if from section (name) is know good then skip it */
if (match(fromsec, section_white_list))
return;
-
for (rela = start; rela < stop; rela++) {
r.r_offset = TO_NATIVE(rela->r_offset);
#if KERNEL_ELFCLASS == ELFCLASS64
@@ -1140,10 +1147,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
/* Skip special sections */
if (sym->st_shndx >= SHN_LORESERVE)
continue;
-
- tosec = sec_name(elf, sym->st_shndx);
- if (section_mismatch(fromsec, tosec))
- warn_sec_mismatch(modname, fromsec, elf, sym, r);
+ check_section_mismatch(modname, elf, &r, sym, fromsec);
}
}
@@ -1155,7 +1159,6 @@ static void section_rel(const char *modname, struct elf_info *elf,
Elf_Rela r;
unsigned int r_sym;
const char *fromsec;
- const char * tosec;
Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
Elf_Rel *stop = (void *)start + sechdr->sh_size;
@@ -1202,10 +1205,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
/* Skip special sections */
if (sym->st_shndx >= SHN_LORESERVE)
continue;
-
- tosec = sec_name(elf, sym->st_shndx);
- if (section_mismatch(fromsec, tosec))
- warn_sec_mismatch(modname, fromsec, elf, sym, r);
+ check_section_mismatch(modname, elf, &r, sym, fromsec);
}
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 72/77] kconfig: remove "enable"
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (71 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 71/77] kbuild: simplified warning report " Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 73/77] kbuild: support ARCH=x86 in buildtar Sam Ravnborg
` (5 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Adrian Bunk, Roman Zippel, Sam Ravnborg
From: Adrian Bunk <bunk@kernel.org>
Kconfig had a synonym "enable" for "select" that was neither documented
nor used.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kconfig/zconf.gperf | 1 -
scripts/kconfig/zconf.hash.c_shipped | 38 ++++++++++++++++-----------------
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index 4051639..25ef5d0 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -35,7 +35,6 @@ int, T_TYPE, TF_COMMAND, S_INT
hex, T_TYPE, TF_COMMAND, S_HEX
string, T_TYPE, TF_COMMAND, S_STRING
select, T_SELECT, TF_COMMAND
-enable, T_SELECT, TF_COMMAND
range, T_RANGE, TF_COMMAND
option, T_OPTION, TF_COMMAND
on, T_ON, TF_PARAM
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index c9d26bc..5c73d51 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -1,4 +1,4 @@
-/* ANSI-C code produced by gperf version 3.0.2 */
+/* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf */
/* Computed positions: -k'1,3' */
@@ -53,10 +53,10 @@ kconf_id_hash (register const char *str, register unsigned int len)
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 35, 35, 5,
+ 49, 49, 49, 49, 49, 49, 49, 49, 11, 5,
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
5, 0, 30, 49, 0, 15, 0, 10, 0, 49,
- 10, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+ 25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
@@ -100,9 +100,10 @@ struct kconf_id_strings_t
char kconf_id_strings_str12[sizeof("default")];
char kconf_id_strings_str13[sizeof("def_bool")];
char kconf_id_strings_str14[sizeof("help")];
+ char kconf_id_strings_str15[sizeof("bool")];
char kconf_id_strings_str16[sizeof("config")];
char kconf_id_strings_str17[sizeof("def_tristate")];
- char kconf_id_strings_str18[sizeof("hex")];
+ char kconf_id_strings_str18[sizeof("boolean")];
char kconf_id_strings_str19[sizeof("defconfig_list")];
char kconf_id_strings_str21[sizeof("string")];
char kconf_id_strings_str22[sizeof("if")];
@@ -113,12 +114,10 @@ struct kconf_id_strings_t
char kconf_id_strings_str29[sizeof("menu")];
char kconf_id_strings_str31[sizeof("source")];
char kconf_id_strings_str32[sizeof("comment")];
+ char kconf_id_strings_str33[sizeof("hex")];
char kconf_id_strings_str35[sizeof("menuconfig")];
char kconf_id_strings_str36[sizeof("prompt")];
char kconf_id_strings_str37[sizeof("depends")];
- char kconf_id_strings_str39[sizeof("bool")];
- char kconf_id_strings_str41[sizeof("enable")];
- char kconf_id_strings_str42[sizeof("boolean")];
char kconf_id_strings_str48[sizeof("mainmenu")];
};
static struct kconf_id_strings_t kconf_id_strings_contents =
@@ -135,9 +134,10 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
"default",
"def_bool",
"help",
+ "bool",
"config",
"def_tristate",
- "hex",
+ "boolean",
"defconfig_list",
"string",
"if",
@@ -148,24 +148,25 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
"menu",
"source",
"comment",
+ "hex",
"menuconfig",
"prompt",
"depends",
- "bool",
- "enable",
- "boolean",
"mainmenu"
};
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
#ifdef __GNUC__
__inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
#endif
struct kconf_id *
kconf_id_lookup (register const char *str, register unsigned int len)
{
enum
{
- TOTAL_KEYWORDS = 32,
+ TOTAL_KEYWORDS = 31,
MIN_WORD_LENGTH = 2,
MAX_WORD_LENGTH = 14,
MIN_HASH_VALUE = 2,
@@ -188,10 +189,10 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
- {-1},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
@@ -205,16 +206,13 @@ kconf_id_lookup (register const char *str, register unsigned int len)
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
- {-1}, {-1},
+ {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX},
+ {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN},
- {-1},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SELECT, TF_COMMAND},
- {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_TYPE, TF_COMMAND, S_BOOLEAN},
- {-1}, {-1}, {-1}, {-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
};
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 73/77] kbuild: support ARCH=x86 in buildtar
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (72 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 72/77] kconfig: remove "enable" Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 74/77] remove __attribute_used__ Sam Ravnborg
` (4 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Daniel De Graaf, Sam Ravnborg
From: Daniel De Graaf <danieldegraaf@gmail.com>
Signed-off-by: Daniel De Graaf <danieldegraaf@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/package/buildtar | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index aa0ccdb..28574ae 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -69,8 +69,8 @@ cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
# Install arch-specific kernel image(s)
#
case "${ARCH}" in
- i386|x86_64)
- [ -f "${objtree}/arch/$ARCH/boot/bzImage" ] && cp -v -- "${objtree}/arch/$ARCH/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
+ x86|i386|x86_64)
+ [ -f "${objtree}/arch/x86/boot/bzImage" ] && cp -v -- "${objtree}/arch/x86/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
;;
alpha)
[ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 74/77] remove __attribute_used__
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (73 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 73/77] kbuild: support ARCH=x86 in buildtar Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 75/77] asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies Sam Ravnborg
` (3 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Adrian Bunk, Sam Ravnborg
From: Adrian Bunk <bunk@kernel.org>
Remove the deprecated __attribute_used__.
[Introduce __section in a few places to silence checkpatch /sam]
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/alpha/lib/dec_and_lock.c | 3 +--
arch/powerpc/boot/Makefile | 2 +-
arch/powerpc/kernel/sysfs.c | 2 +-
arch/powerpc/oprofile/op_model_power4.c | 6 +++---
arch/sparc64/kernel/unaligned.c | 2 +-
arch/um/include/init.h | 26 +++++++++++++-------------
drivers/rapidio/rio.h | 4 ++--
fs/compat_ioctl.c | 2 +-
include/asm-avr32/setup.h | 2 +-
include/asm-ia64/gcc_intrin.h | 2 +-
include/asm-sh/machvec.h | 2 +-
include/asm-sh/thread_info.h | 2 +-
include/asm-x86/thread_info_32.h | 2 +-
include/linux/compiler-gcc3.h | 2 --
include/linux/compiler-gcc4.h | 1 -
include/linux/compiler.h | 4 ----
include/linux/elfnote.h | 2 +-
include/linux/init.h | 11 +++++------
include/linux/module.h | 4 ++--
include/linux/moduleparam.h | 4 ++--
include/linux/pci.h | 2 +-
scripts/mod/modpost.c | 4 ++--
22 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/arch/alpha/lib/dec_and_lock.c b/arch/alpha/lib/dec_and_lock.c
index 6ae2500..0f5520d 100644
--- a/arch/alpha/lib/dec_and_lock.c
+++ b/arch/alpha/lib/dec_and_lock.c
@@ -30,8 +30,7 @@ _atomic_dec_and_lock: \n\
.previous \n\
.end _atomic_dec_and_lock");
-static int __attribute_used__
-atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
+static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
{
/* Slow path */
spin_lock(lock);
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 18e3271..4b1d98b 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -65,7 +65,7 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
quiet_cmd_copy_zlib = COPY $@
- cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
+ cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
quiet_cmd_copy_zlibheader = COPY $@
cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 25d9a96..c8127f8 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -158,7 +158,7 @@ static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \
return sprintf(buf, "%lx\n", val); \
} \
-static ssize_t __attribute_used__ \
+static ssize_t __used \
store_##NAME(struct sys_device *dev, const char *buf, size_t count) \
{ \
struct cpu *cpu = container_of(dev, struct cpu, sysdev); \
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index cddc250..446a8bb 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -172,15 +172,15 @@ static void power4_stop(void)
}
/* Fake functions used by canonicalize_pc */
-static void __attribute_used__ hypervisor_bucket(void)
+static void __used hypervisor_bucket(void)
{
}
-static void __attribute_used__ rtas_bucket(void)
+static void __used rtas_bucket(void)
{
}
-static void __attribute_used__ kernel_unknown_bucket(void)
+static void __used kernel_unknown_bucket(void)
{
}
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index 953be81..dc7bf1b 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -175,7 +175,7 @@ unsigned long compute_effective_address(struct pt_regs *regs,
}
/* This is just to make gcc think die_if_kernel does return... */
-static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs)
+static void __used unaligned_panic(char *str, struct pt_regs *regs)
{
die_if_kernel(str, regs);
}
diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index d4de7c0..cebc6ca 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -42,15 +42,15 @@ typedef void (*exitcall_t)(void);
/* These are for everybody (although not all archs will actually
discard it in modules) */
-#define __init __attribute__ ((__section__ (".init.text")))
-#define __initdata __attribute__ ((__section__ (".init.data")))
-#define __exitdata __attribute__ ((__section__(".exit.data")))
-#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init __section(.init.text)
+#define __initdata __section(.init.data)
+#define __exitdata __section(.exit.data)
+#define __exit_call __used __section(.exitcall.exit)
#ifdef MODULE
-#define __exit __attribute__ ((__section__(".exit.text")))
+#define __exit __section(.exit.text)
#else
-#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text")))
+#define __exit __used __section(.exit.text)
#endif
#endif
@@ -103,16 +103,16 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
* Mark functions and data as being only used at initialization
* or exit time.
*/
-#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init")))
-#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init")))
-#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init")))
-#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init")))
-#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit")))
+#define __uml_init_setup __used __section(.uml.setup.init)
+#define __uml_setup_help __used __section(.uml.help.init)
+#define __uml_init_call __used __section(.uml.initcall.init)
+#define __uml_postsetup_call __used __section(.uml.postsetup.init)
+#define __uml_exit_call __used __section(.uml.exitcall.exit)
#ifndef __KERNEL__
#define __define_initcall(level,fn) \
- static initcall_t __initcall_##fn __attribute_used__ \
+ static initcall_t __initcall_##fn __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
@@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
-#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
+#define __init_call __used __section(.initcall.init)
#endif
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index b242cee..80e3f03 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -31,8 +31,8 @@ extern struct rio_route_ops __end_rio_route_ops[];
/* Helpers internal to the RIO core code */
#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \
- static struct rio_route_ops __rio_route_ops __attribute_used__ \
- __attribute__((__section__(#section))) = { vid, did, add_hook, get_hook };
+ static struct rio_route_ops __rio_route_ops __used \
+ __section(section)= { vid, did, add_hook, get_hook };
/**
* DECLARE_RIO_ROUTE_OPS - Registers switch routing operations
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index da8cb3b..ffdc022 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1376,7 +1376,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg)
return -EINVAL;
}
-static __attribute_used__ int
+static __used int
ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
{
return -EINVAL;
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index b0828d4..ea3070f 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -110,7 +110,7 @@ struct tagtable {
int (*parse)(struct tag *);
};
-#define __tag __attribute_used__ __attribute__((__section__(".taglist.init")))
+#define __tag __used __attribute__((__section__(".taglist.init")))
#define __tagtable(tag, fn) \
static struct tagtable __tagtable_##fn __tag = { tag, fn }
diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
index e58d329..5b6665c 100644
--- a/include/asm-ia64/gcc_intrin.h
+++ b/include/asm-ia64/gcc_intrin.h
@@ -24,7 +24,7 @@
extern void ia64_bad_param_for_setreg (void);
extern void ia64_bad_param_for_getreg (void);
-register unsigned long ia64_r13 asm ("r13") __attribute_used__;
+register unsigned long ia64_r13 asm ("r13") __used;
#define ia64_setreg(regnum, val) \
({ \
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index 088698b..cc37539 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -68,6 +68,6 @@ extern struct sh_machine_vector sh_mv;
#define get_system_type() sh_mv.mv_name
#define __initmv \
- __attribute_used__ __attribute__((__section__ (".machvec.init")))
+ __used __section(.machvec.init)
#endif /* _ASM_SH_MACHVEC_H */
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 1f7e1de..89dbed0 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -68,7 +68,7 @@ struct thread_info {
#define init_stack (init_thread_union.stack)
/* how to get the current stack pointer from C */
-register unsigned long current_stack_pointer asm("r15") __attribute_used__;
+register unsigned long current_stack_pointer asm("r15") __used;
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index 22a8cbc..705abf2 100644
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -85,7 +85,7 @@ struct thread_info {
/* how to get the current stack pointer from C */
-register unsigned long current_stack_pointer asm("esp") __attribute_used__;
+register unsigned long current_stack_pointer asm("esp") __used;
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 2d8c0f4..e5eb795 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -7,10 +7,8 @@
#if __GNUC_MINOR__ >= 3
# define __used __attribute__((__used__))
-# define __attribute_used__ __used /* deprecated */
#else
# define __used __attribute__((__unused__))
-# define __attribute_used__ __used /* deprecated */
#endif
#if __GNUC_MINOR__ >= 4
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index ee7ca5d..0ab3a32 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -15,7 +15,6 @@
#endif
#define __used __attribute__((__used__))
-#define __attribute_used__ __used /* deprecated */
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index e0114a6..d0e17e1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
* Mark functions that are referenced only in inline assembly as __used so
* the code is emitted even though it appears to be unreferenced.
*/
-#ifndef __attribute_used__
-# define __attribute_used__ /* deprecated */
-#endif
-
#ifndef __used
# define __used /* unimplemented */
#endif
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index e831759..278e3ef 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -76,7 +76,7 @@
typeof(desc) _desc \
__attribute__((aligned(sizeof(Elf##size##_Word)))); \
} _ELFNOTE_PASTE(_note_, unique) \
- __attribute_used__ \
+ __used \
__attribute__((section(".note." name), \
aligned(sizeof(Elf##size##_Word)), \
unused)) = { \
diff --git a/include/linux/init.h b/include/linux/init.h
index dcb66c7..dde1eaa 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,7 +43,7 @@
#define __init __section(.init.text) __cold
#define __initdata __section(.init.data)
#define __exitdata __section(.exit.data)
-#define __exit_call __attribute_used__ __section(.exitcall.exit)
+#define __exit_call __used __section(.exitcall.exit)
/* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a
@@ -144,7 +144,7 @@ void prepare_namespace(void);
*/
#define __define_initcall(level,fn,id) \
- static initcall_t __initcall_##fn##id __attribute_used__ \
+ static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
/*
@@ -178,11 +178,11 @@ void prepare_namespace(void);
#define console_initcall(fn) \
static initcall_t __initcall_##fn \
- __attribute_used__ __section(.con_initcall.init)=fn
+ __used __section(.con_initcall.init) = fn
#define security_initcall(fn) \
static initcall_t __initcall_##fn \
- __attribute_used__ __section(.security_initcall.init) = fn
+ __used __section(.security_initcall.init) = fn
struct obs_kernel_param {
const char *str;
@@ -199,8 +199,7 @@ struct obs_kernel_param {
#define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
- __attribute_used__ \
- __section(.init.setup) \
+ __used __section(.init.setup) \
__attribute__((aligned((sizeof(long))))) \
= { __setup_str_##unique_id, fn, early }
diff --git a/include/linux/module.h b/include/linux/module.h
index 2cbc0b8..e6b6294 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
#define __CRC_SYMBOL(sym, sec) \
extern void *__crc_##sym __attribute__((weak)); \
static const unsigned long __kcrctab_##sym \
- __attribute_used__ \
+ __used \
__attribute__((section("__kcrctab" sec), unused)) \
= (unsigned long) &__crc_##sym;
#else
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
__attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \
static const struct kernel_symbol __ksymtab_##sym \
- __attribute_used__ \
+ __used \
__attribute__((section("__ksymtab" sec), unused)) \
= { (unsigned long)&sym, __kstrtab_##sym }
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 13410b2..8126e55 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
#define __module_cat(a,b) ___module_cat(a,b)
#define __MODULE_INFO(tag, name, info) \
static const char __module_cat(name,__LINE__)[] \
- __attribute_used__ \
+ __used \
__attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
#else /* !MODULE */
#define __MODULE_INFO(tag, name, info)
@@ -72,7 +72,7 @@ struct kparam_array
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
static const char __param_str_##name[] = prefix #name; \
static struct kernel_param const __param_##name \
- __attribute_used__ \
+ __used \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, { arg } }
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0dd93bb..ae10063 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -867,7 +867,7 @@ enum pci_fixup_pass {
/* Anonymous variables would be nice... */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
- static const struct pci_fixup __pci_fixup_##name __attribute_used__ \
+ static const struct pci_fixup __pci_fixup_##name __used \
__attribute__((__section__(#section))) = { vendor, device, hook };
#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0a80aca..e75739e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1445,7 +1445,7 @@ static int add_versions(struct buffer *b, struct module *mod)
buf_printf(b, "\n");
buf_printf(b, "static const struct modversion_info ____versions[]\n");
- buf_printf(b, "__attribute_used__\n");
+ buf_printf(b, "__used\n");
buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
for (s = mod->unres; s; s = s->next) {
@@ -1476,7 +1476,7 @@ static void add_depends(struct buffer *b, struct module *mod,
buf_printf(b, "\n");
buf_printf(b, "static const char __module_depends[]\n");
- buf_printf(b, "__attribute_used__\n");
+ buf_printf(b, "__used\n");
buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
buf_printf(b, "\"depends=");
for (s = mod->unres; s; s = s->next) {
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 75/77] asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (74 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 74/77] remove __attribute_used__ Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 76/77] kconfig: tristate choices with mixed tristate and boolean values Sam Ravnborg
` (2 subsequent siblings)
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Adrian Bunk, Sam Ravnborg
From: Adrian Bunk <bunk@kernel.org>
Simplify the dependencies on __mem{init,exit}* (ACPI_HOTPLUG_MEMORY requires
MEMORY_HOTPLUG).
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e0a56fb..2948530 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -29,8 +29,7 @@
#define CPU_DISCARD(sec) *(.cpu##sec)
#endif
-#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
- || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
+#if defined(CONFIG_MEMORY_HOTPLUG)
#define MEM_KEEP(sec) *(.mem##sec)
#define MEM_DISCARD(sec)
#else
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 76/77] kconfig: tristate choices with mixed tristate and boolean values
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (75 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 75/77] asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:03 ` [PATCH 77/77] kbuild: add verbose option to Section mismatch reporting in modpost Sam Ravnborg
2008-01-24 22:04 ` kbuild: Preparing for merge window Randy Dunlap
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Jan Beulich, Roman Zippel, Sam Ravnborg
From: Jan Beulich <jbeulich@novell.com>
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of offering
just the tristate options individually if the choice gets set to M, and
a normal boolean selection if the choice gets set to Y.
Also fix scripts/kconfig/conf's handling of children of choice values -
there may be more than one immediate child, and all of them need to be
processed.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: "Roman Zippel" <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
scripts/kconfig/conf.c | 4 ++--
scripts/kconfig/expr.c | 10 ++++++++--
| 38 +++++++++++++++++++++++++++++++++++---
3 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index d1a0368..fda6313 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -400,9 +400,9 @@ static int conf_choice(struct menu *menu)
continue;
}
sym_set_choice_value(sym, child->sym);
- if (child->list) {
+ for (child = child->list; child; child = child->next) {
indent += 2;
- conf(child->list);
+ conf(child);
indent -= 2;
}
return 1;
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 13788ad..579ece4 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
- fn(data, e->left.sym, e->left.sym->name);
+ if (e->left.sym->name)
+ fn(data, e->left.sym, e->left.sym->name);
+ else
+ fn(data, NULL, "<choice>");
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
- fn(data, e->left.sym, e->left.sym->name);
+ if (e->left.sym->name)
+ fn(data, e->left.sym, e->left.sym->name);
+ else
+ fn(data, NULL, "<choice>");
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e6ef171..fdad173 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -242,9 +242,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) {
current_entry = parent;
- menu_set_type(menu->sym->type);
+ if (sym->type == S_UNKNOWN)
+ menu_set_type(menu->sym->type);
current_entry = menu;
- menu_set_type(sym->type);
+ if (menu->sym->type == S_UNKNOWN)
+ menu_set_type(sym->type);
break;
}
}
@@ -329,7 +331,37 @@ void menu_finalize(struct menu *parent)
"values not supported");
}
current_entry = menu;
- menu_set_type(sym->type);
+ if (menu->sym->type == S_UNKNOWN)
+ menu_set_type(sym->type);
+ /* Non-tristate choice values of tristate choices must
+ * depend on the choice being set to Y. The choice
+ * values' dependencies were propagated to their
+ * properties above, so the change here must be re-
+ * propagated. */
+ if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
+ basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
+ basedep = expr_alloc_and(basedep, menu->dep);
+ basedep = expr_eliminate_dups(basedep);
+ menu->dep = basedep;
+ for (prop = menu->sym->prop; prop; prop = prop->next) {
+ if (prop->menu != menu)
+ continue;
+ dep = expr_alloc_and(expr_copy(basedep),
+ prop->visible.expr);
+ dep = expr_eliminate_dups(dep);
+ dep = expr_trans_bool(dep);
+ prop->visible.expr = dep;
+ if (prop->type == P_SELECT) {
+ struct symbol *es = prop_get_symbol(prop);
+ dep2 = expr_alloc_symbol(menu->sym);
+ dep = expr_alloc_and(dep2,
+ expr_copy(dep));
+ dep = expr_alloc_or(es->rev_dep.expr, dep);
+ dep = expr_eliminate_dups(dep);
+ es->rev_dep.expr = dep;
+ }
+ }
+ }
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* [PATCH 77/77] kbuild: add verbose option to Section mismatch reporting in modpost
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (76 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 76/77] kconfig: tristate choices with mixed tristate and boolean values Sam Ravnborg
@ 2008-01-24 22:03 ` Sam Ravnborg
2008-01-24 22:04 ` kbuild: Preparing for merge window Randy Dunlap
78 siblings, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:03 UTC (permalink / raw)
To: linux-kbuild; +Cc: Sam Ravnborg
If the config option CONFIG_SECTION_MISMATCH is not set and
we see a Section mismatch present the following to the user:
modpost: Found 1 section mismatch(es).
To see additional details select "Enable full Section mismatch analysis"
in the Kernel Hacking menu (CONFIG_SECTION_MISMATCH).
If the option CONFIG_SECTION_MISMATCH is selected
then be verbose in the Section mismatch reporting from mdopost.
Sample outputs:
WARNING: o-x86_64/vmlinux.o(.text+0x7396): Section mismatch in reference from the function discover_ebda() to the variable .init.data:ebda_addr
The function discover_ebda() references
the variable __initdata ebda_addr.
This is often because discover_ebda lacks a __initdata
annotation or the annotation of ebda_addr is wrong.
WARNING: o-x86_64/vmlinux.o(.data+0x74d58): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
The variable pci_serial_quirks references
the function __devexit pci_plx9050_exit()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,
WARNING: o-x86_64/vmlinux.o(__ksymtab+0x630): Section mismatch in reference from the variable __ksymtab_arch_register_cpu to the function .cpuinit.text:arch_register_cpu()
The symbol arch_register_cpu is exported and annotated __cpuinit
Fix this by removing the __cpuinit annotation of arch_register_cpu or drop the export.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
lib/Kconfig.debug | 2 +
scripts/Makefile.modpost | 1 +
scripts/mod/modpost.c | 255 ++++++++++++++++++++++++++++++++++++++++-----
3 files changed, 229 insertions(+), 29 deletions(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c1fb0c6..d930aec 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -108,6 +108,8 @@ config DEBUG_SECTION_MISMATCH
will tell where the mismatch happens much closer to the
source. The drawback is that we will report the same
mismatch at least twice.
+ - Enable verbose reporting from modpost to help solving
+ the section mismatches reported.
config DEBUG_KERNEL
bool "Kernel debugging"
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index d988f5d..65e707e 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -62,6 +62,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
+ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index e75739e..3cf1ba8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -28,6 +28,9 @@ static int vmlinux_section_warnings = 1;
/* Only warn about unresolved symbols */
static int warn_unresolved = 0;
/* How a symbol is exported */
+static int sec_mismatch_count = 0;
+static int sec_mismatch_verbose = 1;
+
enum export {
export_plain, export_unused, export_gpl,
export_unused_gpl, export_gpl_future, export_unknown
@@ -760,9 +763,23 @@ static const char *head_sections[] = { ".head.text*", NULL };
static const char *linker_symbols[] =
{ "__init_begin", "_sinittext", "_einittext", NULL };
+enum mismatch {
+ NO_MISMATCH,
+ TEXT_TO_INIT,
+ DATA_TO_INIT,
+ TEXT_TO_EXIT,
+ DATA_TO_EXIT,
+ XXXINIT_TO_INIT,
+ XXXEXIT_TO_EXIT,
+ INIT_TO_EXIT,
+ EXIT_TO_INIT,
+ EXPORT_TO_INIT_EXIT,
+};
+
struct sectioncheck {
const char *fromsec[20];
const char *tosec[20];
+ enum mismatch mismatch;
};
const struct sectioncheck sectioncheck[] = {
@@ -770,33 +787,54 @@ const struct sectioncheck sectioncheck[] = {
* normal code and data
*/
{
- .fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
- .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
+ .fromsec = { TEXT_SECTIONS, NULL },
+ .tosec = { ALL_INIT_SECTIONS, NULL },
+ .mismatch = TEXT_TO_INIT,
+},
+{
+ .fromsec = { DATA_SECTIONS, NULL },
+ .tosec = { ALL_INIT_SECTIONS, NULL },
+ .mismatch = DATA_TO_INIT,
+},
+{
+ .fromsec = { TEXT_SECTIONS, NULL },
+ .tosec = { ALL_EXIT_SECTIONS, NULL },
+ .mismatch = TEXT_TO_EXIT,
+},
+{
+ .fromsec = { DATA_SECTIONS, NULL },
+ .tosec = { ALL_EXIT_SECTIONS, NULL },
+ .mismatch = DATA_TO_EXIT,
},
/* Do not reference init code/data from devinit/cpuinit/meminit code/data */
{
.fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL },
- .tosec = { INIT_SECTIONS, NULL }
+ .tosec = { INIT_SECTIONS, NULL },
+ .mismatch = XXXINIT_TO_INIT,
},
/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
{
.fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
- .tosec = { EXIT_SECTIONS, NULL }
+ .tosec = { EXIT_SECTIONS, NULL },
+ .mismatch = XXXEXIT_TO_EXIT,
},
/* Do not use exit code/data from init code */
{
.fromsec = { ALL_INIT_SECTIONS, NULL },
.tosec = { ALL_EXIT_SECTIONS, NULL },
+ .mismatch = INIT_TO_EXIT,
},
/* Do not use init code/data from exit code */
{
.fromsec = { ALL_EXIT_SECTIONS, NULL },
- .tosec = { ALL_INIT_SECTIONS, NULL }
+ .tosec = { ALL_INIT_SECTIONS, NULL },
+ .mismatch = EXIT_TO_INIT,
},
/* Do not export init/exit functions or data */
{
.fromsec = { "__ksymtab*", NULL },
- .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
+ .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL },
+ .mismatch = EXPORT_TO_INIT_EXIT
}
};
@@ -809,10 +847,10 @@ static int section_mismatch(const char *fromsec, const char *tosec)
for (i = 0; i < elems; i++) {
if (match(fromsec, check->fromsec) &&
match(tosec, check->tosec))
- return 1;
+ return check->mismatch;
check++;
}
- return 0;
+ return NO_MISMATCH;
}
/**
@@ -989,47 +1027,197 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
}
/*
+ * Convert a section name to the function/data attribute
+ * .init.text => __init
+ * .cpuinit.data => __cpudata
+ * .memexitconst => __memconst
+ * etc.
+*/
+static char *sec2annotation(const char *s)
+{
+ if (match(s, init_exit_sections)) {
+ char *p = malloc(20);
+ char *r = p;
+
+ *p++ = '_';
+ *p++ = '_';
+ if (*s == '.')
+ s++;
+ while (*s && *s != '.')
+ *p++ = *s++;
+ *p = '\0';
+ if (*s == '.')
+ s++;
+ if (strstr(s, "rodata") != NULL)
+ strcat(p, "const ");
+ else if (strstr(s, "data") != NULL)
+ strcat(p, "data ");
+ else
+ strcat(p, " ");
+ return r; /* we leak her but we do not care */
+ } else {
+ return "";
+ }
+}
+
+static int is_function(Elf_Sym *sym)
+{
+ if (sym)
+ return ELF_ST_TYPE(sym->st_info) == STT_FUNC;
+ else
+ return 0;
+}
+
+/*
* Print a warning about a section mismatch.
* Try to find symbols near it so user can find it.
* Check whitelist before warning - it may be a false positive.
*/
-static void report_sec_mismatch(const char *modname,
+static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
const char *fromsec,
unsigned long long fromaddr,
const char *fromsym,
- const char *tosec, const char *tosym)
-{
- if (strlen(tosym)) {
- warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
- "in '%s'\n",
- modname, fromsec, fromaddr,
- tosec, tosym, fromsym);
- } else {
- warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
- modname, fromsec, fromaddr,
- tosec, tosym);
+ int from_is_func,
+ const char *tosec, const char *tosym,
+ int to_is_func)
+{
+ const char *from, *from_p;
+ const char *to, *to_p;
+ from = from_is_func ? "function" : "variable";
+ from_p = from_is_func ? "()" : "";
+ to = to_is_func ? "function" : "variable";
+ to_p = to_is_func ? "()" : "";
+
+ fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in"
+ " reference from the %s %s%s to the %s %s:%s%s\n",
+ modname, fromsec, fromaddr, from, fromsym, from_p,
+ to, tosec, tosym, to_p);
+
+ sec_mismatch_count++;
+ if (!sec_mismatch_verbose)
+ return;
+
+ switch (mismatch) {
+ case TEXT_TO_INIT:
+ fprintf(stderr,
+ "The function %s %s() references\n"
+ "the %s %s%s%s.\n"
+ "This is often because %s lacks a %s\n"
+ "annotation or the annotation of %s is wrong.\n",
+ sec2annotation(fromsec), fromsym,
+ to, sec2annotation(tosec), tosym, to_p,
+ fromsym, sec2annotation(tosec), tosym);
+ break;
+ case DATA_TO_INIT: {
+ const char **s = symbol_white_list;
+ fprintf(stderr,
+ "The variable %s references\n"
+ "the %s %s%s%s\n"
+ "If the reference is valid then annotate the\n"
+ "variable with __init* (see linux/init.h) "
+ "or name the variable:\n",
+ fromsym, to, sec2annotation(tosec), tosym, to_p);
+ while (*s)
+ fprintf(stderr, "%s, ", *s++);
+ fprintf(stderr, "\n");
+ break;
}
+ case TEXT_TO_EXIT:
+ fprintf(stderr,
+ "The function %s() references a %s in an exit section.\n"
+ "Often the %s %s%s has valid usage outside the exit section\n"
+ "and the fix is to remove the %sannotation of %s.\n",
+ fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym);
+ break;
+ case DATA_TO_EXIT: {
+ const char **s = symbol_white_list;
+ fprintf(stderr,
+ "The variable %s references\n"
+ "the %s %s%s%s\n"
+ "If the reference is valid then annotate the\n"
+ "variable with __exit* (see linux/init.h) or "
+ "name the variable:\n",
+ fromsym, to, sec2annotation(tosec), tosym, to_p);
+ while (*s)
+ fprintf(stderr, "%s, ", *s++);
+ fprintf(stderr, "\n");
+ break;
+ }
+ case XXXINIT_TO_INIT:
+ case XXXEXIT_TO_EXIT:
+ fprintf(stderr,
+ "The %s %s%s%s references\n"
+ "a %s %s%s%s.\n"
+ "If %s is only used by %s then\n"
+ "annotate %s with a matching annotation.\n",
+ from, sec2annotation(fromsec), fromsym, from_p,
+ to, sec2annotation(tosec), tosym, to_p,
+ fromsym, tosym, fromsym);
+ break;
+ case INIT_TO_EXIT:
+ fprintf(stderr,
+ "The %s %s%s%s references\n"
+ "a %s %s%s%s.\n"
+ "This is often seen when error handling "
+ "in the init function\n"
+ "uses functionality in the exit path.\n"
+ "The fix is often to remove the %sannotation of\n"
+ "%s%s so it may be used outside an exit section.\n",
+ from, sec2annotation(fromsec), fromsym, from_p,
+ to, sec2annotation(tosec), tosym, to_p,
+ sec2annotation(tosec), tosym, to_p);
+ break;
+ case EXIT_TO_INIT:
+ fprintf(stderr,
+ "The %s %s%s%s references\n"
+ "a %s %s%s%s.\n"
+ "This is often seen when error handling "
+ "in the exit function\n"
+ "uses functionality in the init path.\n"
+ "The fix is often to remove the %sannotation of\n"
+ "%s%s so it may be used outside an init section.\n",
+ from, sec2annotation(fromsec), fromsym, from_p,
+ to, sec2annotation(tosec), tosym, to_p,
+ sec2annotation(tosec), tosym, to_p);
+ break;
+ case EXPORT_TO_INIT_EXIT:
+ fprintf(stderr,
+ "The symbol %s is exported and annotated %s\n"
+ "Fix this by removing the %sannotation of %s "
+ "or drop the export.\n",
+ tosym, sec2annotation(tosec), sec2annotation(tosec), tosym);
+ case NO_MISMATCH:
+ /* To get warnings on missing members */
+ break;
+ }
+ fprintf(stderr, "\n");
}
static void check_section_mismatch(const char *modname, struct elf_info *elf,
Elf_Rela *r, Elf_Sym *sym, const char *fromsec)
{
const char *tosec;
+ enum mismatch mismatch;
tosec = sec_name(elf, sym->st_shndx);
- if (section_mismatch(fromsec, tosec)) {
- const char *fromsym;
+ mismatch = section_mismatch(fromsec, tosec);
+ if (mismatch != NO_MISMATCH) {
+ Elf_Sym *to;
+ Elf_Sym *from;
const char *tosym;
+ const char *fromsym;
- fromsym = sym_name(elf,
- find_elf_symbol2(elf, r->r_offset, fromsec));
- tosym = sym_name(elf,
- find_elf_symbol(elf, r->r_addend, sym));
+ from = find_elf_symbol2(elf, r->r_offset, fromsec);
+ fromsym = sym_name(elf, from);
+ to = find_elf_symbol(elf, r->r_addend, sym);
+ tosym = sym_name(elf, to);
/* check whitelist - we may ignore it */
if (secref_whitelist(fromsec, fromsym, tosec, tosym)) {
- report_sec_mismatch(modname, fromsec, r->r_offset,
- fromsym, tosec, tosym);
+ report_sec_mismatch(modname, mismatch,
+ fromsec, r->r_offset, fromsym,
+ is_function(from), tosec, tosym,
+ is_function(to));
}
}
}
@@ -1643,7 +1831,7 @@ int main(int argc, char **argv)
int opt;
int err;
- while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
+ while ((opt = getopt(argc, argv, "i:I:msSo:aw")) != -1) {
switch (opt) {
case 'i':
kernel_read = optarg;
@@ -1664,6 +1852,9 @@ int main(int argc, char **argv)
case 's':
vmlinux_section_warnings = 0;
break;
+ case 'S':
+ sec_mismatch_verbose = 0;
+ break;
case 'w':
warn_unresolved = 1;
break;
@@ -1708,6 +1899,12 @@ int main(int argc, char **argv)
if (dump_write)
write_dump(dump_write);
+ if (sec_mismatch_count && !sec_mismatch_verbose)
+ fprintf(stderr, "modpost: Found %d section mismatch(es).\n"
+ "To see additional details select \"Enable full "
+ "Section mismatch analysis\"\n"
+ "in the Kernel Hacking menu "
+ "(CONFIG_SECTION_MISMATCH).\n", sec_mismatch_count);
return err;
}
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread* Re: kbuild: Preparing for merge window
2008-01-24 21:58 kbuild: Preparing for merge window Sam Ravnborg
` (77 preceding siblings ...)
2008-01-24 22:03 ` [PATCH 77/77] kbuild: add verbose option to Section mismatch reporting in modpost Sam Ravnborg
@ 2008-01-24 22:04 ` Randy Dunlap
2008-01-24 22:09 ` Sam Ravnborg
2008-01-28 21:29 ` Sam Ravnborg
78 siblings, 2 replies; 100+ messages in thread
From: Randy Dunlap @ 2008-01-24 22:04 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kbuild, LKML
On Thu, 24 Jan 2008 22:58:13 +0100 Sam Ravnborg wrote:
> The following is the list of patches queued up for the merge window at the moment.
> I have during the last week done several modpost changes to make section ismatch
> warnings more reliable and I am happy with the modified modpost code now.
Hi Sam,
Can you add (if not already done) a paragraph to kconfig-language.txt
about the preference of using HAVE_feature in Kconfig files vs.
other spellings of that?
---
~Randy
^ permalink raw reply [flat|nested] 100+ messages in thread* Re: kbuild: Preparing for merge window
2008-01-24 22:04 ` kbuild: Preparing for merge window Randy Dunlap
@ 2008-01-24 22:09 ` Sam Ravnborg
2008-01-28 21:29 ` Sam Ravnborg
1 sibling, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-24 22:09 UTC (permalink / raw)
To: Randy Dunlap; +Cc: linux-kbuild, LKML
On Thu, Jan 24, 2008 at 02:04:22PM -0800, Randy Dunlap wrote:
> On Thu, 24 Jan 2008 22:58:13 +0100 Sam Ravnborg wrote:
>
> > The following is the list of patches queued up for the merge window at the moment.
> > I have during the last week done several modpost changes to make section ismatch
> > warnings more reliable and I am happy with the modified modpost code now.
>
>
> Hi Sam,
>
> Can you add (if not already done) a paragraph to kconfig-language.txt
> about the preference of using HAVE_feature in Kconfig files vs.
> other spellings of that?
Thanks for the reminder - will do it over the weekend.
Sam
^ permalink raw reply [flat|nested] 100+ messages in thread
* Re: kbuild: Preparing for merge window
2008-01-24 22:04 ` kbuild: Preparing for merge window Randy Dunlap
2008-01-24 22:09 ` Sam Ravnborg
@ 2008-01-28 21:29 ` Sam Ravnborg
1 sibling, 0 replies; 100+ messages in thread
From: Sam Ravnborg @ 2008-01-28 21:29 UTC (permalink / raw)
To: Randy Dunlap; +Cc: linux-kbuild, LKML
On Thu, Jan 24, 2008 at 02:04:22PM -0800, Randy Dunlap wrote:
> On Thu, 24 Jan 2008 22:58:13 +0100 Sam Ravnborg wrote:
>
> > The following is the list of patches queued up for the merge window at the moment.
> > I have during the last week done several modpost changes to make section ismatch
> > warnings more reliable and I am happy with the modified modpost code now.
>
>
> Hi Sam,
>
> Can you add (if not already done) a paragraph to kconfig-language.txt
> about the preference of using HAVE_feature in Kconfig files vs.
> other spellings of that?
I just added this and sent it off for pull. I wanted it included and
decided that review comments could be addressed in a follow-up patch.
Hopefully it is remotely understandable.
Sam
From ef8f5f34572a9adc9478840007d9fc4bcd7b6ad8 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Mon, 28 Jan 2008 21:49:46 +0100
Subject: [PATCH] kconfig: document use of HAVE_*
It has been discussed on lkml several times but we need
it documented as this is new stuff.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Documentation/kbuild/kconfig-language.txt | 36 +++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index a43fcc6..649cb87 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -330,6 +330,42 @@ This is a collection of Kconfig tips, most of which aren't obvious at
first glance and most of which have become idioms in several Kconfig
files.
+Adding common features and make the usage configurable
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+It is a common idiom to implement a feature/functionality that are
+relevant for some architectures but not all.
+The recommended way to do so is to use a config variable named HAVE_*
+that is defined in a common Kconfig file and selected by the relevant
+architectures.
+An example is the generic IOMAP functionality.
+
+We would in lib/Kconfig see:
+
+# Generic IOMAP is used to ...
+config HAVE_GENERIC_IOMAP
+
+config GENERIC_IOMAP
+ depends on HAVE_GENERIC_IOMAP && FOO
+
+And in lib/Makefile we would see:
+obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
+
+For each architecture using the generic IOMAP functionality we would see:
+
+config X86
+ select ...
+ select HAVE_GENERIC_IOMAP
+ select ...
+
+Note: we use the existing config option and avoid creating a new
+config variable to select HAVE_GENERIC_IOMAP.
+
+Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
+introduced to overcome the limitation of select which will force a
+config option to 'y' no matter the dependencies.
+The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
+situation where select forces a symbol equals to 'y'.
+
Build as module only
~~~~~~~~~~~~~~~~~~~~
To restrict a component build to module-only, qualify its config symbol
--
1.5.4.rc3.14.g44397
^ permalink raw reply related [flat|nested] 100+ messages in thread