Subject: glibc 2.2 on MIPS

From: Christoph Martin <[email-masked]>
Date: Thu, 4 Jan 2001 21:42:44 +0100 (MET)

Hi Ralf,

On Thu, 12 Oct 2000 04:04:44 +0200, Ralf Baechle wrote:

> On Thu, Oct 12, 2000 at 12:24:21AM +0200, Florian Lohoff wrote:

> > We are trying :) I am currently basing all my Debian-mips(el) things
> > on glibc 2.0.6. It is the only stable solution right now. I am experimenting
> > with the glibc 2.1.94-3 debian source package which i managed to get
> > compiled with unmodified cvs binutils and gcc + the gcse patch.
> > 
> > Ralf reported bugs in the ld where he send me a patch. With that patch
> > i get a "Bus Error" from the ld.so within the glibc build.

> There patch is ok; you get those bus errors because there are bugs in
> both ld and binutils that in most cases compensate each other.  If you
> fix only one of them you get all sorts of funnies ...

I just tried to build glibc-2.2 (CVS-2000-12-28) for debian-mips and
it still has the "Bus Error" problem. We are currently using binutils
2.10.1.0.2 and gcc 2.95.2 + CVS from 2.95 branch. 

Can you please post both patches, so that we can verify which one is
missing in our build.

> Even with the fixes ld is not yet perfect - for example emacs and X still
> fail.

The gcc/binutils combination seams to work correctly as far as I can
see. I managed to compile xfree 4.0.2 linked agains 2.1.95-1.1. What
problems did you have with X?

Christoph

---

From: "Maciej W. Rozycki" <[email-masked]>
Date: Thu, 4 Jan 2001 22:34:40 +0100 (MET)

> Can you please post both patches, so that we can verify which one is

 The 2.2 release of glibc needs no patches.  The current CVS version is
even better as a few unrelated fixes has been applied meanwhile.

 For binutils 2.10.1 the following fix makes binaries be built as ld.so
expects.  Other fixes might be needed for 2.10.1 to work at all -- they
are all available from: 
ftp://ftp.ds2.pg.gda.pl/pub/macro/SRPMS/binutils-2.10.1-3.src.rpm (or use
a mirror at: ftp://ftp.rfc822.org/pub/mirror/ftp.ds2.pg.gda.pl/...).

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email-masked], PGP key available        +

binutils-2.10-mips-dyn-addend.patch
diff -up --recursive --new-file binutils-2.10.macro/bfd/elf32-mips.c binutils-2.10/bfd/elf32-mips.c
--- binutils-2.10.macro/bfd/elf32-mips.c	Sat Mar 11 02:23:10 2000
+++ binutils-2.10/bfd/elf32-mips.c	Sat Oct 28 17:19:52 2000
@@ -5675,15 +5675,16 @@ mips_elf_create_dynamic_relocation (outp
 	  /* The relocation we're building is section-relative.
 	     Therefore, the original addend must be adjusted by the
 	     section offset.  */
-	  *addendp += symbol - sec->output_section->vma;
+	  *addendp += section_offset;
 	  /* Now, the relocation is just against the section.  */
 	  symbol = sec->output_section->vma;
 	}
       
-      /* If the relocation was previously an absolute relocation, we
-	 must adjust it by the value we give it in the dynamic symbol
-	 table.  */
-      if (r_type != R_MIPS_REL32)
+      /* If the relocation was previously an absolute relocation and
+	 this symbol will not be referred to by the relocation, we must
+	 adjust it by the value we give it in the dynamic symbol table.
+	 Otherwise leave the job up to the dynamic linker.  */
+      if (!indx && r_type != R_MIPS_REL32)
 	*addendp += symbol;
 
       /* The relocation is always an REL32 relocation because we don't

---

From: Nicu Popovici <[email-masked]>
Date: Fri, 05 Jan 2001 11:38:27 -0500

Hello all,

My question is somehow related on the problems showed in this email. Sorry if this
will bother you.
I am trying to setup a cross toolchain for mips and  I have to use binutils 2.10
and gcc 2.95.2 and glibc2.1.3. Currently I am trying to setup binutils 2.10 with
egcs1.0.3a and with glibc.2.0.6 . Do you have any patches for binutils 2.10 or for
gcc2.95.2 for mips ? If you have and if you have some ideeas please tell me ..

Thank You
Nicu

---

From: Christoph Martin <[email-masked]>
Date: Fri, 5 Jan 2001 11:29:29 +0100 (MET)

> gcc2.95.2 for mips ? If you have and if you have some ideeas please tell me ..

Look for the patches in the respective archives on:

ftp.ds2.pg.gda.pl/pub/macro/SRPMS/

Christoph

---

From: Nicu Popovici <[email-masked]>
Date: Fri, 05 Jan 2001 18:03:21 -0500

Hello ,

I am bothering you again.
Related to gcc 2.95.2 --- it has any patches for porting to mips or not ? I mean ,
where do I find the patches for gcc-2.95.2 for mips if there are some files. I saw
that you said something like that "gcc 2.95.2 + CVS from 2.95 branch." What do you
mean ?

Regards,
Nicu

---

From: Christoph Martin <[email-masked]>
Date: Fri, 5 Jan 2001 22:10:31 +0100 (MET)

> that you said something like that "gcc 2.95.2 + CVS from 2.95 branch." What do you

"gcc 2.95.2 + CVS from 2.95 branch." is what debian has in its
gcc-2.95.2. The mips patches are - as I said - in the src.rpm's on
ftp.ds2.pg.gda.pl/pub/macro/SRPMS/ 

C