Subject: Updates for RedHat 7.1/mips

From: "H . J . Lu" <[email-masked]>
Date: Tue, 23 Apr 2002 15:59:25 -0700

On Mon, Apr 22, 2002 at 08:38:49PM +0200, Hartvig Ekner wrote:
> Hi,
> 
> H . J . Lu writes:
> > 
> > On Mon, Apr 22, 2002 at 06:55:14PM +0200, Hartvig Ekner wrote:
> > > Hi H.J,
> > > 
> > > No, I did not compile myself, but used your binary (except for cracklib,
> > > where I used our natively compiled package instead). But I did replace
> > > ALL new updated packages at once during the upgrade.
> > > 
> > > However, I have also tried to install (-U) rpm*rpm and the popt rpm on a
> > > working system based on your original packages, and voila: the same error
> > > appears. So it does appear to be linked to the rpm RPM package.
> > > 
> > > The grep you asked for returns:
> > 
> > Thanks. I will fix those among other bugs I have been working on.
> 
> Great, thanks. Can you let me know as soon as the RPM problem has been fixed,
> so that I can continue the update of the installation images? BTW, are the
> other bugs you're working on something to wait for in this regard or not?
> 

I updated glibc, python, gcc, gdb, rpm, openssl, binutils and toolchain at

ftp://oss.sgi.com/pub/linux/mips/redhat/7.1/

Let know know if there are any problems.

H.J.

---

From: Hartvig Ekner <[email-masked]>
Date: Wed, 24 Apr 2002 15:35:16 +0200 (MET DST)

All the problems I reported are fixed (only tested LE so far). Thanks.

Currently recompiling glibc natively for the installation images.
We'll post a message here when our new installation images are ready.

/Hartvig

---

From: Geoffrey Espin <[email-masked]>
Date: Wed, 24 Apr 2002 13:53:39 -0700

> Let know know if there are any problems.

I've been using your old October toolchain-20011020-* quite happily.
So foolishly, I upgraded to this new toolchain*rpm for mipsel on i386.

When building a linux-mips.sourceforge.net -based kernel, if I
include CONFIG_PCI in the configuration, I get:

...
mipsel-linux-ld -G 0 -static -T arch/mips/ld.script.0x80002000 arch/mips/kernel/head.o arch/mips/kernel/init_task.o init/main.o init/version.o \
        --start-group \
        arch/mips/kernel/kernel.o arch/mips/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o arch/mips/math-emu/fpu_emulator.o arch/mips/ramdisk/ramdisk.o \
         drivers/char/char.o drivers/block/block.o drivers/misc/misc.o drivers/net/net.o drivers/media/media.o drivers/pci/driver.o drivers/mtd/mtdlink.o \
        net/network.o \
        arch/mips/lib/lib.a /home/espin/linux/lib/lib.a arch/mips/korva/korva.a
\
        --end-group \
        -o vmlinux
drivers/char/char.o(.data+0x3990): undefined reference to `local symbols in discarded section .text.exit'
make: *** [vmlinux] Error 1

If I don't include CONFIG_PCI the problem goes away.
It also sometimes complained about symbols in drivers/net/net.o.

I stumbled on:

   http://lists.debian.org/debian-devel/2001/debian-devel-200112/msg00768.html

which says that Alan Cox came up with enabling CONFIG_HOTPLUG as a workaround.
Seems to work.  :-/

Other useful suggestions found were to downgrade ones' binutils. :-)

Geoff
-- 
Geoffrey Espin
[email-masked]
--

---

From: "H . J . Lu" <[email-masked]>
Date: Wed, 24 Apr 2002 14:01:56 -0700

> make: *** [vmlinux] Error 1

That is a kernel bug which has been fixed in the newer kernel. From my
binutils release note:

Changes from binutils 2.11.92.0.10:

1. Update from binutils 2001 1121.
2. Fix a linker symbol version bug for common symbols.
3. Update handling relocations against the discarded sections. You may
need to apply the kernel patch enclosed here to your kernel source. If
you still see things like

drivers/char/char.o(.data+0x46b4): undefined reference to `local symbols in discarded
 section .text.exit'

in the final kernel link, that means you have compiled a driver into
the kernel which has a reference to the symbol in a discarded section.
Kernel 2.4.17 or above should work fine.

H.J.

---

From: Geoffrey Espin <[email-masked]>
Date: Wed, 24 Apr 2002 14:11:36 -0700

> Kernel 2.4.17 or above should work fine.

Sorry, I should have specified my kernel *IS* recently (Monday)
from linux-mips.sourceforge.net.  And it was previously sync'd
to oss.sgi.com on Sunday, 21Apr02.

    VERSION = 2
    PATCHLEVEL = 4
    SUBLEVEL = 18
    EXTRAVERSION = -mips

Hence my befuddlement.

I'll fix the cc list to l-m-k.

Geoff
-- 
Geoffrey Espin
[email-masked]
--

---

From: "H . J . Lu" <[email-masked]>
Date: Wed, 24 Apr 2002 14:18:40 -0700

> to oss.sgi.com on Sunday, 21Apr02.

Your kernel still have references to symbols in discarded sections. Please
read linux/include/linux/init.h:

/* 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
   __devexit functions must use __devexit_p(function_name), the wrapper will
   insert either the function_name or NULL, depending on the config options.
 */
#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x 
#else
#define __devexit_p(x) NULL
#endif

H.J.

---

From: Geoffrey Espin <[email-masked]>
Date: Wed, 24 Apr 2002 16:28:58 -0700

> read linux/include/linux/init.h:

Woops, I wasn't working in my latest OSS/SF tree, as I thought.
All compiles and runs well.  Sorry for the noise.  Thanks for
the new tools, H.J..

Geoff
-- 
Geoffrey Espin
[email-masked]
--

---

From: Keith Owens <[email-masked]>
Date: Thu, 25 Apr 2002 09:38:31 +1000

On Wed, 24 Apr 2002 13:53:39 -0700, 
>drivers/char/char.o(.data+0x3990): undefined reference to `local symbols in discarded section .text.exit'

Assuming that your kernel is up to date, it is likely to be a MIPS only
char driver that has not been converted to __devexit_p.  Run this
script to find the offending driver and correct the source code.

#!/usr/bin/perl -w
#
# reference_discarded.pl (C) Keith Owens 2001 <[email-masked]>
#
# 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");