* [PATCH] Fix scripts/namespace.pl portability
@ 2006-03-09 13:01 Ralf Baechle
2006-03-09 15:40 ` Ralf Baechle
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2006-03-09 13:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Andrew Morton
scripts/namespace.pl was assuming the nm and objdump tools to use are
always just named that which breaks things in a crosscompilation
environment.
Fixed by honouring $NM and $OBJDUMP if passed by make, otherwise
defaulting to just nm rsp. objdump just as we used to.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
scripts/namespace.pl | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index 88e30e8..59dcb25 100644
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -66,8 +66,14 @@ require 5; # at least perl 5
use strict;
use File::Find;
-my $nm = "/usr/bin/nm -p";
-my $objdump = "/usr/bin/objdump -s -j .comment";
+my $nm = "nm";
+$nm = "$ENV{'NM'}" if (exists($ENV{'NM'}));
+$nm = "$nm" . " -p";
+my $objdump = "objdump";
+
+$objdump = "$ENV{'OBJDUMP'}" if (exists($ENV{'OBJDUMP'}));
+$objdump = $objdump . " -s -j .comment";
+
my $srctree = "";
my $objtree = "";
$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix scripts/namespace.pl portability
2006-03-09 13:01 [PATCH] Fix scripts/namespace.pl portability Ralf Baechle
@ 2006-03-09 15:40 ` Ralf Baechle
2006-03-09 16:33 ` Sam Ravnborg
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2006-03-09 15:40 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Andrew Morton
On Thu, Mar 09, 2006 at 01:01:50PM +0000, Ralf Baechle wrote:
> scripts/namespace.pl was assuming the nm and objdump tools to use are
> always just named that which breaks things in a crosscompilation
> environment.
>
> Fixed by honouring $NM and $OBJDUMP if passed by make, otherwise
> defaulting to just nm rsp. objdump just as we used to.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Atsushi Nemoto pointed me to http://lkml.org/lkml/2005/9/20/68. This
old patch which seems more complete than mine but made it into the kernel.
I just refreshed the patch and added the bits to ensure namespace.pl
uses the right nm binary also - Keith's original patch only fixed the
objdump use.
From: Keith Owens <kaos@ocs.com.au>
Those scripts are meant to work even when they are invoked by hand,
without OBJDUMP being defined in the environment. This is the correct
fix.
Signed-off-by: Keith Owens <kaos@ocs.com.au>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
scripts/namespace.pl | 16 ++++++++++++++--
scripts/reference_discarded.pl | 10 ++++++++--
scripts/reference_init.pl | 10 ++++++++--
3 files changed, 30 insertions(+), 6 deletions(-)
Index: linux-mips/scripts/namespace.pl
===================================================================
--- linux-mips.orig/scripts/namespace.pl 2006-03-09 15:27:52.000000000 +0000
+++ linux-mips/scripts/namespace.pl 2006-03-09 15:33:59.000000000 +0000
@@ -66,12 +66,24 @@ require 5; # at least perl 5
use strict;
use File::Find;
-my $nm = "/usr/bin/nm -p";
-my $objdump = "/usr/bin/objdump -s -j .comment";
my $srctree = "";
my $objtree = "";
$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));
+my $nm;
+if (exists($ENV{'NM'})) {
+ $nm = $ENV{'NM'};
+} else {
+ $nm = 'nm';
+}
+$nm .= ' -p';
+my $objdump;
+if (exists($ENV{'OBJDUMP'})) {
+ $objdump = $ENV{'OBJDUMP'};
+} else {
+ $objdump = 'objdump';
+}
+$objdump .= ' -s -j .comment';
if ($#ARGV != -1) {
print STDERR "usage: $0 takes no parameters\n";
Index: linux-mips/scripts/reference_discarded.pl
===================================================================
--- linux-mips.orig/scripts/reference_discarded.pl 2006-02-20 21:48:11.000000000 +0000
+++ linux-mips/scripts/reference_discarded.pl 2006-03-09 15:28:02.000000000 +0000
@@ -14,11 +14,17 @@ my $object;
my $line;
my $ignore;
my $errorcount;
+my $objdump;
+if (exists($ENV{'OBJDUMP'})) {
+ $objdump = $ENV{'OBJDUMP'};
+} else {
+ $objdump = 'objdump';
+}
$| = 1;
# printf("Finding objects, ");
-open(OBJDUMP_LIST, "find . -name '*.o' | xargs objdump -h |") || die "getting objdump list failed";
+open(OBJDUMP_LIST, "find . -name '*.o' | xargs $objdump -h |") || die "getting objdump list failed";
while (defined($line = <OBJDUMP_LIST>)) {
chomp($line);
if ($line =~ /:\s+file format/) {
@@ -79,7 +85,7 @@ foreach $object (keys(%object)) {
$errorcount = 0;
foreach $object (keys(%object)) {
my $from;
- open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object";
+ open(OBJDUMP, "$objdump -r $object|") || die "cannot objdump -r $object";
while (defined($line = <OBJDUMP>)) {
chomp($line);
if ($line =~ /RELOCATION RECORDS FOR /) {
Index: linux-mips/scripts/reference_init.pl
===================================================================
--- linux-mips.orig/scripts/reference_init.pl 2006-02-20 21:48:11.000000000 +0000
+++ linux-mips/scripts/reference_init.pl 2006-03-09 15:28:02.000000000 +0000
@@ -22,11 +22,17 @@ my %object;
my $object;
my $line;
my $ignore;
+my $objdump;
+if (exists($ENV{'OBJDUMP'})) {
+ $objdump = $ENV{'OBJDUMP'};
+} else {
+ $objdump = 'objdump';
+}
$| = 1;
printf("Finding objects, ");
-open(OBJDUMP_LIST, "find . -name '*.o' | xargs objdump -h |") || die "getting objdump list failed";
+open(OBJDUMP_LIST, "find . -name '*.o' | xargs $objdump -h |") || die "getting objdump list failed";
while (defined($line = <OBJDUMP_LIST>)) {
chomp($line);
if ($line =~ /:\s+file format/) {
@@ -81,7 +87,7 @@ printf("ignoring %d conglomerate(s)\n",
printf("Scanning objects\n");
foreach $object (sort(keys(%object))) {
my $from;
- open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object";
+ open(OBJDUMP, "$objdump -r $object|") || die "cannot objdump -r $object";
while (defined($line = <OBJDUMP>)) {
chomp($line);
if ($line =~ /RELOCATION RECORDS FOR /) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix scripts/namespace.pl portability
2006-03-09 15:40 ` Ralf Baechle
@ 2006-03-09 16:33 ` Sam Ravnborg
0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2006-03-09 16:33 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Linus Torvalds, linux-kernel, Andrew Morton
On Thu, Mar 09, 2006 at 03:40:30PM +0000, Ralf Baechle wrote:
> On Thu, Mar 09, 2006 at 01:01:50PM +0000, Ralf Baechle wrote:
>
> > scripts/namespace.pl was assuming the nm and objdump tools to use are
> > always just named that which breaks things in a crosscompilation
> > environment.
> >
> > Fixed by honouring $NM and $OBJDUMP if passed by make, otherwise
> > defaulting to just nm rsp. objdump just as we used to.
> >
> > Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>
> Atsushi Nemoto pointed me to http://lkml.org/lkml/2005/9/20/68. This
> old patch which seems more complete than mine but made it into the kernel.
> I just refreshed the patch and added the bits to ensure namespace.pl
> uses the right nm binary also - Keith's original patch only fixed the
> objdump use.
>
> From: Keith Owens <kaos@ocs.com.au>
>
> Those scripts are meant to work even when they are invoked by hand,
> without OBJDUMP being defined in the environment. This is the correct
> fix.
Hi Ralf. In my kbuild tree I have this fixed already:
my $nm = ($ENV{'NM'} || "nm") . " -p";
my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
Patch is from Aaron Brooks.
The reference_init.pl + reference_discarded.pl are subject for removal
since the check has been moved to modpost.
Sam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-09 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-09 13:01 [PATCH] Fix scripts/namespace.pl portability Ralf Baechle
2006-03-09 15:40 ` Ralf Baechle
2006-03-09 16:33 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox