Bug 67468

Summary: cpqarray.o contains undefined reference
Product: [Retired] Red Hat Linux Reporter: Petr Kubecka <pkubecka>
Component: binutilsAssignee: Dave Jones <davej>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: pfrields
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-27 23:14:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Kubecka 2002-06-25 20:02:06 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)

Description of problem:
Compiling cpqarray into kernel fails.
This applies to kernel release 2.4.18-5 only. 2.4.18-4 was fine.






Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Compile with CONFIG_BLK_CPQ_DA=y
2.
3.
	

Actual Results:  drivers/block/block.o(.data+0xc74): undefined reference to 
`local symbols in discarded section .text.exit'
make[1]: *** [kallsyms] Error 1

Additional info:

using a perl script I was able to find out that:

Error: ./cpqarray.o .data refers to 00000174 R_386_32                .text.exit

See included script:
#!/usr/bin/perl -w
#
# reference_discarded.pl (C) Keith Owens 2001 <kaos.au>
#
# List dangling references to vmlinux discarded sections.

use strict;
die($0 . " takes no arguments\n") if($#ARGV >= 0);

my %object;
my $object;
my $line;
my $ignore;

$| = 1;

printf("Finding objects, ");
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/) {
		($object = $line) =~ s/:.*//;
		$object{$object}->{'module'} = 0;
		$object{$object}->{'size'} = 0;
		$object{$object}->{'off'} = 0;
	}
	if ($line =~ /^\s*\d+\s+\.modinfo\s+/) {
		$object{$object}->{'module'} = 1;
	}
	if ($line =~ /^\s*\d+\s+\.comment\s+/) {
		($object{$object}->{'size'}, $object{$object}->{'off'}) = (split
(' ', $line))[2,5]; 
	}
}
close(OBJDUMP_LIST);
printf("%d objects, ", scalar keys(%object));
$ignore = 0;
foreach $object (keys(%object)) {
	if ($object{$object}->{'module'}) {
		++$ignore;
		delete($object{$object});
	}
}
printf("ignoring %d module(s)\n", $ignore);

# Ignore conglomerate objects, they have been built from multiple objects and we
# only care about the individual objects.  If an object has more than one GCC:
# string in the comment section then it is conglomerate.  This does not filter
# out conglomerates that consist of exactly one object, can't be helped.

printf("Finding conglomerates, ");
$ignore = 0;
foreach $object (keys(%object)) {
	if (exists($object{$object}->{'off'})) {
		my ($off, $size, $comment, $l);
		$off = hex($object{$object}->{'off'});
		$size = hex($object{$object}->{'size'});
		open(OBJECT, "<$object") || die "cannot read $object";
		seek(OBJECT, $off, 0) || die "seek to $off in $object failed";
		$l = read(OBJECT, $comment, $size);
		die "read $size bytes from $object .comment failed" if ($l != 
$size);
		close(OBJECT);
		if ($comment =~ /GCC\:.*GCC\:/m) {
			++$ignore;
			delete($object{$object});
		}
	}
}
printf("ignoring %d conglomerate(s)\n", $ignore);

printf("Scanning objects\n");
foreach $object (keys(%object)) {
	my $from;
	open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object";
	while (defined($line = <OBJDUMP>)) {
		chomp($line);
		if ($line =~ /RELOCATION RECORDS FOR /) {
			($from = $line) =~ s/.*\[([^]]*).*/$1/;
		}
		if (($line =~ /\.text\.exit$/ ||
		     $line =~ /\.data\.exit$/ ||
		     $line =~ /\.exitcall\.exit$/) &&
		    ($from !~ /\.text\.exit$/ &&
		     $from !~ /\.data\.exit$/ &&
		     $from !~ /\.exitcall\.exit$/)) {
			printf("Error: %s %s refers to %s\n", $object, $from, 
$line);
		}
	} close(OBJDUMP);
}
printf("Done\n");


It should be relatively easy to fix with a simple patch.

Comment 1 Petr Kubecka 2002-06-27 11:36:27 UTC
This problem is related to binutils.

To solve this issue the following patch must be applied:

--- /usr/src/linux-2.4.18-5/drivers/block/cpqarray.c.old	Thu Jun 27 
12:25:12 2002
+++ /usr/src/linux-2.4.18-5/drivers/block/cpqarray.c	Thu Jun 27 00:15:53 2002
@@ -603,7 +603,7 @@
 static struct pci_driver cpqarray_pci_driver = {
         name:   "cpqarray",
         probe:  cpqarray_init_one,
-        remove:  cpqarray_remove_one,
+        remove:  __devexit_p(cpqarray_remove_one),
         id_table:  cpqarray_pci_device_id,
 };