In this issue:
filesystem endian converter?
Re: filesystem endian converter?
Locale errors on 5.0-CURRENT (sparc)
Re: Locale errors on 5.0-CURRENT (sparc)
terminal types - 5.0-RC2 install
Re: Locale errors on 5.0-CURRENT (sparc)
sparc64/46729: gethostbyname fails for NIS
Re: Locale errors on 5.0-CURRENT (sparc)
sparc64/46730: kldxref does not work
sparc64/46732: kernel linker cannot resolve dependencies
Re: Locale errors on 5.0-CURRENT (sparc)
----------------------------------------------------------------------
Date: Thu, 2 Jan 2003 11:49:52 -0500
From: Chris BeHanna <ch...@pennasoft.com>
Subject: filesystem endian converter?
Are there any tools to convert a filesystem created on a
little-endian machine for use on a big-endian machine, or vice-versa?
Can FreeBSD/sparc64 mount Solaris 8 UFS partitions, even if only
in read-only mode?
(For that matter, anyone know if FreeBSD/x86 can mount Solaris 8
x86 UFS partitions, even if only in read-only mode? I'm trying to
help out a co-worker whose Solaris 8 x86 box crashed. His new machine
is going to be FreeBSD 4.7, but he has two disks full of data to
recover.)
Thanks,
- --=20
Chris BeHanna http://www.pennasoft.com=20
Principal Consultant =20
PennaSoft Corporation =20
ch...@pennasoft.com =20
------------------------------
Date: Thu, 2 Jan 2003 14:45:27 -0500
From: Jake Burkholder <ja...@locore.ca>
Subject: Re: filesystem endian converter?
Apparently, On Thu, Jan 02, 2003 at 11:49:52AM -0500,
Chris BeHanna said words to the effect of;
> Are there any tools to convert a filesystem created on a
> little-endian machine for use on a big-endian machine, or vice-versa?
Ian Dowse (ied...@freebsd.org) wrote a program to do this on a file backed
memory file system. I don't know how well it would work on a large filesystem
or in place on disk though.
>
> Can FreeBSD/sparc64 mount Solaris 8 UFS partitions, even if only
> in read-only mode?
This should work, at least it used to, but you have to be really careful
about fscking solaris filesystem with freebsd fsck and vice versa. Read
only is the only thing that's really safe.
>
> (For that matter, anyone know if FreeBSD/x86 can mount Solaris 8
> x86 UFS partitions, even if only in read-only mode? I'm trying to
> help out a co-worker whose Solaris 8 x86 box crashed. His new machine
> is going to be FreeBSD 4.7, but he has two disks full of data to
> recover.)
Don't know. Since freebsd/sparc64 can (or could) read big endian solaris
filesystems, I don't see why not.
Jake
------------------------------
Date: Fri, 3 Jan 2003 12:00:57 +0000
From: Olafur Osvaldsson <o...@isnic.is>
Subject: Locale errors on 5.0-CURRENT (sparc)
Hi,
I'm having some problems with seting the locale on 5.0 wich I have set
up on sparc hardware...I'm pretty sure this is not sparc related but if
so please correct me.
On all my intel machines (4.*) I set the lang and locale by adding the
following to the default section in /etc/login.conf:
:charset=ISO-8859-1:\
:lang=is_IS.ISO_8859-1:\
and adding "LC_ALL=is_IS.ISO8859-1" to the setenv line.
This seems to have no effect on the 5.0 system as I get locale errors when
running any locale dependant programs...
When running man I get:
ctype locale: Invalid argument
When running perl I get:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = "is_IS.ISO8859-1",
LANG = "is_IS.ISO8859-1"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
So I made a simple program to see if I could set the locale to what I
wanted.
=================================================
#include <stdio.h>
#include <locale.h>
main(argc, argv)
int argc;
char *argv[];
{
printf("setlocale(LC_ALL, \"%s\") returns: %s\n",argv[1],setlocale(LC_ALL, argv[1]));
printf("setlocale(LC_TIME, \"%s\") returns: %s\n",argv[1],setlocale(LC_TIME, argv[1]));
printf("Testing: [áÃóđţćö]\n");
return 0;
}
=================================================
When run on the 5.0 system:
# ./locale-test is_IS.ISO8859-1
setlocale(LC_ALL, "is_IS.ISO8859-1") returns: (null)
setlocale(LC_TIME, "is_IS.ISO8859-1") returns: is_IS.ISO8859-1
Testing: [áÃóđţćö]
But when run on a 4.7-STABLE system it goes like this:
# ./locale-test is_IS.ISO8859-1
setlocale(LC_ALL, "is_IS.ISO8859-1") returns: is_IS.ISO8859-1
setlocale(LC_TIME, "is_IS.ISO8859-1") returns: is_IS.ISO8859-1
Testing: [áÃóđţćö]
The is_IS.ISO8859-1 locale is the same on both systems and I get the same
error when trying to set en_US.ISO8859-1 but if I try C it works fine on the
5.0 system:
# ./locale-test C
setlocale(LC_ALL, "C") returns: C
setlocale(LC_TIME, "C") returns: C
Testing: [áÃóđţćö]
I think there is some problem there but I don't have a free intel system to
test if 5.0 behaves the same there as on the sparc system.
I hope this all makes sense to someone else than just me.
/Oli
- --
Olafur Osvaldsson
Systems Administrator
Internet a Islandi hf.
Tel: +354 525-5291
Email: o...@isnic.is
------------------------------
Date: Fri, 3 Jan 2003 14:31:41 +0200
From: Peter Pentchev <ro...@ringlet.net>
Subject: Re: Locale errors on 5.0-CURRENT (sparc)
- --LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Jan 03, 2003 at 12:00:57PM +0000, Olafur Osvaldsson wrote:
> Hi,
> I'm having some problems with seting the locale on 5.0 wich I have set
> up on sparc hardware...I'm pretty sure this is not sparc related but if
> so please correct me.
[snip]
>=20
> When run on the 5.0 system:
>=20
> # ./locale-test is_IS.ISO8859-1
> setlocale(LC_ALL, "is_IS.ISO8859-1") returns: (null)
> setlocale(LC_TIME, "is_IS.ISO8859-1") returns: is_IS.ISO8859-1
> Testing: [???????]
FWIW, I can reproduce this on panther.FreeBSD.org, a sparc64 running
5.0-CURRENT as of December 6, 2001. All the other machines in the
FreeBSD cluster that I could test - ref5 (i386), pluto1 (IA-64), and
beast (alpha) - are able to set both the is_IS.ISO8859-1 and the
bg_BG.CP1251 locales correctly for both LC_ALL and LC_TIME. Only the
sparc64 machine is having trouble setting LC_ALL for any locale I tried.
G'luck,
Peter
- --=20
Peter Pentchev ro...@ringlet.net ro...@FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
This sentence would be seven words long if it were six words shorter.
- --LQksG6bCIzRHxTLp
Content-Type: application/pgp-signature
Content-Disposition: inline
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQE+FYKt7Ri2jRYZRVMRAuiVAJwJPK4XDZ1LxYfsVjM+By/G9qfKUwCgpTfs
/SreBmEUF4igxQ7dVoa9z38=
=g/Zf
- -----END PGP SIGNATURE-----
- --LQksG6bCIzRHxTLp--
------------------------------
Date: Fri, 03 Jan 2003 13:59:56 +0100
From: =?iso-8859-2?B?UGlvdHIgV2+8bmlhaw==?= <piotr....@cs.put.poznan.pl>
Subject: terminal types - 5.0-RC2 install
Hi,
I'm installing FreeBSD on Ultra5..
What type of terminal (in the beginning of installation) should I choise not
to get rubbish on the screen?
Piotr
- --
Piotr Woźniak
Instytut Informatyki PP
ul.Piotrowo 3A, 60-965 Poznan
------------------------------
Date: Fri, 3 Jan 2003 15:29:27 +0200
From: Peter Pentchev <ro...@ringlet.net>
Subject: Re: Locale errors on 5.0-CURRENT (sparc)
- --ZwgA9U+XZDXt4+m+
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Jan 03, 2003 at 02:31:41PM +0200, Peter Pentchev wrote:
> On Fri, Jan 03, 2003 at 12:00:57PM +0000, Olafur Osvaldsson wrote:
> > Hi,
> > I'm having some problems with seting the locale on 5.0 wich I have set
> > up on sparc hardware...I'm pretty sure this is not sparc related but if
> > so please correct me.
> [snip]
> >=20
> > When run on the 5.0 system:
> >=20
> > # ./locale-test is_IS.ISO8859-1
> > setlocale(LC_ALL, "is_IS.ISO8859-1") returns: (null)
> > setlocale(LC_TIME, "is_IS.ISO8859-1") returns: is_IS.ISO8859-1
> > Testing: [???????]
>=20
> FWIW, I can reproduce this on panther.FreeBSD.org, a sparc64 running
> 5.0-CURRENT as of December 6, 2001. All the other machines in the
> FreeBSD cluster that I could test - ref5 (i386), pluto1 (IA-64), and
> beast (alpha) - are able to set both the is_IS.ISO8859-1 and the
> bg_BG.CP1251 locales correctly for both LC_ALL and LC_TIME. Only the
> sparc64 machine is having trouble setting LC_ALL for any locale I tried.
Actually, I seem to have found the reason: on panther.FreeBSD.org, there
are no LC_CTYPE files for any locale, and setlocale(LC_ALL) attempts to
load, well, *all* locale type definitions, including LC_CTYPE. Thus, it
would (and does) return NULL with errno set to ENOENT for all locales...
The LC_CTYPE files are not there, because there is an explicit test for
the build architecture in src/share/Makefile, which excludes the
mklocale directory for sparc64; it was introduced in rev. 1.27 by David
O'Brien about 7 months ago. David, what exactly was the 'bad juju'
mentioned in the commit message, and is it still there? A test run of
'cvs up share/mklocale && cd share/mklocale && make' on panther seemed
to complete OK; I have not yet tested the resulting locale files though.
G'luck,
Peter
- --=20
Peter Pentchev ro...@ringlet.net ro...@FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
This sentence claims to be an Epimenides paradox, but it is lying.
- --ZwgA9U+XZDXt4+m+
Content-Type: application/pgp-signature
Content-Disposition: inline
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQE+FZA37Ri2jRYZRVMRAuZ6AJ0epcTsl2CXOT8FboOd8pB7rcKSEACeOLuM
AZyNgukAapIxuh/kjuK8IXY=
=4P70
- -----END PGP SIGNATURE-----
- --ZwgA9U+XZDXt4+m+--
------------------------------
Date: Fri, 3 Jan 2003 15:41:13 +0100 (CET)
From: Hartmut Brandt <bra...@fokus.gmd.de>
Subject: sparc64/46729: gethostbyname fails for NIS
>Number: 46729
>Category: sparc64
>Synopsis: gethostbyname fails for NIS
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-sparc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jan 03 06:50:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Hartmut Brandt
>Release: FreeBSD 5.0-CURRENT sparc64
>Organization:
FhI Fokus
>Environment:
System: FreeBSD catssrv.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #20: Fri Jan 3 14:08:11 CET 2003 h...@catssrv.fokus.gmd.de:/opt/obj/usr/src/sys/CATSSRV sparc64
>Description:
/usr/src/lib/libc/net/gethostbynis.c assumes, that an AF_INET address is
the same as an u_long. This is abviously false and leads to the effect, that
all IP addresses obtained via NIS are 0.0.0.0.
>How-To-Repeat:
Execute
ping host-with-name-via-nis
and observe that ping is able to resolve the name, but the printed address is
0.0.0.0.
>Fix:
Apply the following patch and recompile and install libc:
Index: gethostbynis.c
===================================================================
RCS file: /usr/ncvs/src/lib/libc/net/gethostbynis.c,v
retrieving revision 1.15
diff -c -r1.15 gethostbynis.c
*** gethostbynis.c 22 Mar 2002 21:52:29 -0000 1.15
- --- gethostbynis.c 3 Jan 2003 14:31:16 -0000
***************
*** 67,72 ****
- --- 67,73 ----
static struct hostent h;
static char *domain = (char *)NULL;
static char ypbuf[YPMAXRECORD + 2];
+ in_addr_t addr;
switch(af) {
case AF_INET:
***************
*** 104,110 ****
*cp++ = '\0';
h.h_addr_list = host_addrs;
h.h_addr = hostaddr;
! *((u_long *)h.h_addr) = inet_addr(result);
h.h_length = size;
h.h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
- --- 105,112 ----
*cp++ = '\0';
h.h_addr_list = host_addrs;
h.h_addr = hostaddr;
! addr = inet_addr(result);
! bcopy((char *)&addr, h.h_addr, size);
h.h_length = size;
h.h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
>Release-Note:
>Audit-Trail:
>Unformatted:
------------------------------
Date: Fri, 3 Jan 2003 14:53:32 +0000
From: Olafur Osvaldsson <o...@isnic.is>
Subject: Re: Locale errors on 5.0-CURRENT (sparc)
- --7iMSBzlTiPOCCT2k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Removing the exclude for sparc64 in src/share/Makefile rebuilding/installing
fixes this for me and I see nothing wrong with the is_IS.ISO8859-1 locale so
far.
Unless there is some real reason for excluding it I suggest that the sparc64
test is removed from that file.
/Oli
On Fri, 03 Jan 2003, Peter Pentchev wrote:
> The LC_CTYPE files are not there, because there is an explicit test for
> the build architecture in src/share/Makefile, which excludes the
> mklocale directory for sparc64; it was introduced in rev. 1.27 by David
> O'Brien about 7 months ago. David, what exactly was the 'bad juju'
> mentioned in the commit message, and is it still there? A test run of
> 'cvs up share/mklocale && cd share/mklocale && make' on panther seemed
> to complete OK; I have not yet tested the resulting locale files though.
- --=20
Olafur Osvaldsson
Systems Administrator
Internet a Islandi hf.
Tel: +354 525-5291
Email: o...@isnic.is
- --7iMSBzlTiPOCCT2k
Content-Type: application/pgp-signature
Content-Disposition: inline
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQE+FaPs8xNRBRknOFwRAlEvAJ9qlz9FIbHeEwaDm58CD/+v9gZfmQCfTPmA
54SAxrn3pNELpuyugB7sDXs=
=vLJg
- -----END PGP SIGNATURE-----
- --7iMSBzlTiPOCCT2k--
------------------------------
Date: Fri, 3 Jan 2003 16:09:37 +0100 (CET)
From: Hartmut Brandt <bra...@fokus.gmd.de>
Subject: sparc64/46730: kldxref does not work
>Number: 46730
>Category: sparc64
>Synopsis: kldxref does not work
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-sparc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jan 03 07:10:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Hartmut Brandt
>Release: FreeBSD 5.0-CURRENT sparc64
>Organization:
FhI Fokus
>Environment:
System: FreeBSD catssrv.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #20: Fri Jan 3 14:08:11 CET 2003 h...@catssrv.fokus.gmd.de:/opt/obj/usr/src/sys/CATSSRV sparc64
>Description:
kldxref fails to correctly read most kld files. The reason for this is that
kldxref assumes, that the ELF file containes only REL relocation records and
that only RELATIVE relocations need to be performed to read the module
meta data. If these two assumptions are true, effectively no relocation has
to be performed, because the module's load address is 0 in kldxref's case.
For sparc64 the first assumptions is certainly false, because sparc64
uses only RELA relocation records. Because of the missing relocation in this
case, the code tries to access 0 offsets in the file.
>How-To-Repeat:
Execute
kldxref /boot/kernel
and watch the error messages.
>Fix:
The following patch fixes the problem in the following way:
1. It reads the REL and RELA relocation records.
2. At the places where pointers are accessed in the object file two additional
routines are called that look whether relocation records exist for the object
file part that is to be red. If there are it applies the relocations.
The patch currently handles REL records of type R_I386_RELATIVE and RELA
records of type R_SPARC_RELATIVE. Alle other combinations result in a
warning message. This means that alpha and ia64 user will probably see warning
messages. This can be overcome by either adding the corresponding alpha
and ia64 relocation types (R_ALPHA_RELATIVE and R_IA64_REL64LSB (I suppose)) or
removing the warning message itself.
The entire handling of REL records could be removed, because it effectively is
a NOP a.t.m. I suggest leaving it, because if in the future other relocation
types refer to the file offsets in question, we will get a warning message.
Index: ef.c
===================================================================
RCS file: /usr/ncvs/src/usr.sbin/kldxref/ef.c,v
retrieving revision 1.5
diff -c -r1.5 ef.c
*** ef.c 17 Jul 2002 23:41:58 -0000 1.5
- --- ef.c 3 Jan 2003 14:56:09 -0000
***************
*** 151,157 ****
- --- 151,166 ----
Elf_Hashelt hashhdr[2];
/* int plttype = DT_REL;*/
int error;
+ Elf_Off rel_off;
+ Elf_Off rela_off;
+ int rel_sz;
+ int rela_sz;
+ int rel_entry;
+ int rela_entry;
+ rel_off = rela_off = 0;
+ rel_sz = rela_sz = 0;
+ rel_entry = rela_entry = 0;
for (dp = ef->ef_dyn; dp->d_tag != DT_NULL; dp++) {
switch (dp->d_tag) {
case DT_HASH:
***************
*** 187,192 ****
- --- 196,231 ----
if (dp->d_un.d_val != sizeof(Elf_Sym))
return EFTYPE;
break;
+ case DT_REL:
+ if (rel_off != 0)
+ warnx("second DT_REL entry ignored");
+ rel_off = dp->d_un.d_ptr;
+ break;
+ case DT_RELSZ:
+ if (rel_sz != 0)
+ warnx("second DT_RELSZ entry ignored");
+ rel_sz = dp->d_un.d_val;
+ break;
+ case DT_RELENT:
+ if (rel_entry != 0)
+ warnx("second DT_RELENT entry ignored");
+ rel_entry = dp->d_un.d_val;
+ break;
+ case DT_RELA:
+ if (rela_off != 0)
+ warnx("second DT_RELA entry ignored");
+ rela_off = dp->d_un.d_ptr;
+ break;
+ case DT_RELASZ:
+ if (rela_sz != 0)
+ warnx("second DT_RELASZ entry ignored");
+ rela_sz = dp->d_un.d_val;
+ break;
+ case DT_RELAENT:
+ if (rela_entry != 0)
+ warnx("second DT_RELAENT entry ignored");
+ rela_entry = dp->d_un.d_val;
+ break;
}
}
if (ef->ef_symoff == 0) {
***************
*** 210,218 ****
- --- 249,360 ----
warnx("can't load .dynstr section");
return EIO;
}
+ if (rel_off != 0) {
+ if (rel_entry == 0) {
+ warnx("%s: no DT_RELENT for DT_REL", ef->ef_name);
+ return (EFTYPE);
+ }
+ if (rel_entry != sizeof(Elf_Rel)) {
+ warnx("%s: inconsistent DT_RELENT value",
+ ef->ef_name);
+ return (EFTYPE);
+ }
+ if (rel_sz % rel_entry != 0) {
+ warnx("%s: inconsistent values for DT_RELSZ and "
+ "DT_RELENT", ef->ef_name);
+ return (EFTYPE);
+ }
+ if (ef_read_entry(ef, ef_get_offset(ef, rel_off), rel_sz,
+ (void **)&ef->ef_rel) != 0) {
+ warnx("%s: cannot load DT_REL section", ef->ef_name);
+ return (EIO);
+ }
+ ef->ef_relsz = rel_sz / rel_entry;
+ if (ef->ef_verbose)
+ warnx("%s: %d REL entries", ef->ef_name,
+ ef->ef_relsz);
+ }
+ if (rela_off != 0) {
+ if (rela_entry == 0) {
+ warnx("%s: no DT_RELAENT for DT_RELA", ef->ef_name);
+ return (EFTYPE);
+ }
+ if (rela_entry != sizeof(Elf_Rela)) {
+ warnx("%s: inconsistent DT_RELAENT value",
+ ef->ef_name);
+ return (EFTYPE);
+ }
+ if (rela_sz % rela_entry != 0) {
+ warnx("%s: inconsistent values for DT_RELASZ and "
+ "DT_RELAENT", ef->ef_name);
+ return (EFTYPE);
+ }
+ if (ef_read_entry(ef, ef_get_offset(ef, rela_off), rela_sz,
+ (void **)&ef->ef_rela) != 0) {
+ warnx("%s: cannot load DT_RELA section", ef->ef_name);
+ return (EIO);
+ }
+ ef->ef_relasz = rela_sz / rela_entry;
+ if (ef->ef_verbose)
+ warnx("%s: %d RELA entries", ef->ef_name,
+ ef->ef_relasz);
+ }
return 0;
}
+ /*
+ * Apply relocations to the values we got from the file.
+ */
+ static int
+ ef_reloc(elf_file_t ef, Elf_Off offset, size_t len, void *dest)
+ {
+ const Elf_Rel *r;
+ const Elf_Rela *a;
+ #ifdef R_SPARC_RELATIVE
+ Elf_Word w;
+ #endif
+
+ for (r = ef->ef_rel; r < &ef->ef_rel[ef->ef_relsz]; r++) {
+ if (r->r_offset >= offset && r->r_offset < offset + len) {
+ switch (ELF_R_TYPE(r->r_info)) {
+
+ #ifdef R_386_RELATIVE
+ case R_386_RELATIVE:
+ /* load address is 0 - nothing to do */
+ break;
+ #endif
+
+ default:
+ warnx("unhandled relocation type %u",
+ ELF_R_TYPE(r->r_info));
+ break;
+ }
+ }
+ }
+
+ for (a = ef->ef_rela; a < &ef->ef_rela[ef->ef_relasz]; a++) {
+ if (a->r_offset >= offset && a->r_offset < offset + len) {
+ switch (ELF_R_TYPE(a->r_info)) {
+
+ #ifdef R_SPARC_RELATIVE
+ case R_SPARC_RELATIVE:
+ /* load address is 0 */
+ w = a->r_addend;
+ memcpy((u_char *)dest + (a->r_offset - offset),
+ &w, sizeof(w));
+ break;
+ #endif
+
+ default:
+ warnx("unhandled relocation type %u",
+ ELF_R_TYPE(a->r_info));
+ break;
+ }
+ }
+ }
+ return (0);
+ }
+
int
ef_read(elf_file_t ef, Elf_Off offset, size_t len, void*dest)
{
***************
*** 259,264 ****
- --- 401,423 ----
}
int
+ ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len, void*dest)
+ {
+ u_long ofs = ef_get_offset(ef, offset);
+ int error;
+
+ if (ofs == 0) {
+ if (ef->ef_verbose)
+ warnx("ef_seg_read(%s): zero offset (%lx:%ld)",
+ ef->ef_name, (long)offset, ofs);
+ return EFAULT;
+ }
+ if ((error = ef_read(ef, ofs, len, dest)) != 0)
+ return (error);
+ return (ef_reloc(ef, offset, len, dest));
+ }
+
+ int
ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void**ptr)
{
int error;
***************
*** 267,272 ****
- --- 426,445 ----
if (*ptr == NULL)
return ENOMEM;
error = ef_seg_read(ef, offset, len, *ptr);
+ if (error)
+ free(*ptr);
+ return error;
+ }
+
+ int
+ ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, void**ptr)
+ {
+ int error;
+
+ *ptr = malloc(len);
+ if (*ptr == NULL)
+ return ENOMEM;
+ error = ef_seg_read_rel(ef, offset, len, *ptr);
if (error)
free(*ptr);
return error;
Index: ef.h
===================================================================
RCS file: /usr/ncvs/src/usr.sbin/kldxref/ef.h,v
retrieving revision 1.2
diff -c -r1.2 ef.h
*** ef.h 11 Apr 2002 09:30:15 -0000 1.2
- --- ef.h 3 Jan 2003 14:56:09 -0000
***************
*** 28,33 ****
- --- 28,37 ----
int ef_nsegs;
Elf_Phdr * ef_segs[2];
int ef_verbose;
+ Elf_Rel * ef_rel; /* relocation table */
+ int ef_relsz; /* number of entries */
+ Elf_Rela * ef_rela; /* relocation table */
+ int ef_relasz; /* number of entries */
} *elf_file_t;
__BEGIN_DECLS
***************
*** 36,42 ****
- --- 40,48 ----
int ef_read(elf_file_t ef, Elf_Off offset, size_t len, void* dest);
int ef_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void **ptr);
int ef_seg_read(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
+ int ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
int ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void**ptr);
+ int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, void**ptr);
int ef_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym);
__END_DECLS
Index: kldxref.c
===================================================================
RCS file: /usr/ncvs/src/usr.sbin/kldxref/kldxref.c,v
retrieving revision 1.4
diff -c -r1.4 kldxref.c
*** kldxref.c 22 Apr 2002 13:44:44 -0000 1.4
- --- kldxref.c 3 Jan 2003 14:56:09 -0000
***************
*** 229,238 ****
check(ef_lookup_symbol(&ef, "__stop_set_" MDT_SETNAME, &sym));
finish = sym->st_value;
entries = (finish - start) / sizeof(void *);
! check(ef_seg_read_entry(&ef, start, sizeof(*p) * entries, (void**)&p));
orgp = p;
while(entries--) {
! check(ef_seg_read(&ef, (Elf_Off)*p, sizeof(md), &md));
p++;
check(ef_seg_read(&ef, (Elf_Off)md.md_cval, sizeof(cval), cval));
cval[MAXMODNAME] = '\0';
- --- 229,239 ----
check(ef_lookup_symbol(&ef, "__stop_set_" MDT_SETNAME, &sym));
finish = sym->st_value;
entries = (finish - start) / sizeof(void *);
! check(ef_seg_read_entry_rel(&ef, start, sizeof(*p) * entries,
! (void**)&p));
orgp = p;
while(entries--) {
! check(ef_seg_read_rel(&ef, (Elf_Off)*p, sizeof(md), &md));
p++;
check(ef_seg_read(&ef, (Elf_Off)md.md_cval, sizeof(cval), cval));
cval[MAXMODNAME] = '\0';
>Release-Note:
>Audit-Trail:
>Unformatted:
------------------------------
Date: Fri, 3 Jan 2003 16:29:12 +0100 (CET)
From: Hartmut Brandt <bra...@fokus.gmd.de>
Subject: sparc64/46732: kernel linker cannot resolve dependencies
>Number: 46732
>Category: sparc64
>Synopsis: kernel linker cannot resolve dependencies
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-sparc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jan 03 07:30:03 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Hartmut Brandt
>Release: FreeBSD 5.0-CURRENT sparc64
>Organization:
FhI Fokus
>Environment:
System: FreeBSD catssrv.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #20: Fri Jan 3 14:08:11 CET 2003 h...@catssrv.fokus.gmd.de:/opt/obj/usr/src/sys/CATSSRV sparc64
>Description:
The kernel linker (kern_linker.c) needs to access module metadata in the
module it tries to load to resolve dependencies. This access involves pointers
and therefor relocation is needed to correctly access these pointers. The
kernel linker uses a routine linker_reloc_ptr, that assumes, that all relocation
of pointers is done via ELF REL relocation records, by adding the original
contents of the pointer to relocate (as red from the file) to the load address.
This does not work for sparc64 because sparc64 uses RELA records, where the
value to add is in the relocation records itself not in the location to be
relocated. This leads to the kernel linker access random locations in memory
and not beeing able to process dependency information.
An unrelated problem are some wrong printf format characters in the linker
debugging code.
>How-To-Repeat:
Compile the modules netgraph.ko and ng_socket.ko and try to load ng_socket via
kldload ng_socket
observer /var/log/message to contain a kernel message about an unresolved
external symbol.
>Fix:
The fix is to move the relocation entirely to the MD file, where it belongs to.
This is done, by removing all the relocation stuff from kern_linker.c and
expect elf linker link_elf.c to process all intra-module relocation before
the linker tries to access module metadata.
In link_elf.c there are two places affected. For preloaded modules local
relocations are processed just before returning to the linker and for
kldloaded modules before calling linker_load_dependencies. This is done
by a function link_elf_reloc_local, which loops through all relocation
records and calling the MD elf_reloc_local.
In the MD parts elf_reloc is split. elf_reloc_local processes all relocations
that are intra-module (R_*_RELATIVE) and ignores all others. elf_reloc
ignores all intra-module relocations and processes all others.
The first of the following two patches changes kern_linker, link_elf,
i386/i386/elf_machdep.c and sparc64/sparc64/elf_machdep.c in the way described.
This patch has been tested on both i386 and sparc64. It corrects also
some broken printf format strings for the debugging code.
The seconds patch applies to alpha/alpha/elf_machdep.c and
ia64/ia64/elf_machdep.c and has neither been compiled nor tested
(I have no IA64 or Alpha), but should be simple to verify.
- -------------- PATCH 1 -------------------------------------------
Index: kern/kern_linker.c
===================================================================
RCS file: /usr/ncvs/src/sys/kern/kern_linker.c,v
retrieving revision 1.101
diff -c -r1.101 kern_linker.c
*** kern/kern_linker.c 14 Dec 2002 08:18:05 -0000 1.101
- --- kern/kern_linker.c 3 Jan 2003 12:15:30 -0000
***************
*** 499,505 ****
* Give the module a chance to veto the unload.
*/
if ((error = module_unload(mod)) != 0) {
! KLD_DPF(FILE, ("linker_file_unload: module %x"
" vetoes unload\n", mod));
goto out;
} else
- --- 499,505 ----
* Give the module a chance to veto the unload.
*/
if ((error = module_unload(mod)) != 0) {
! KLD_DPF(FILE, ("linker_file_unload: module %p"
" vetoes unload\n", mod));
goto out;
} else
***************
*** 594,600 ****
size_t common_size = 0;
int i;
! KLD_DPF(SYM, ("linker_file_lookup_symbol: file=%x, name=%s, deps=%d\n",
file, name, deps));
if (LINKER_LOOKUP_SYMBOL(file, name, &sym) == 0) {
- --- 594,600 ----
size_t common_size = 0;
int i;
! KLD_DPF(SYM, ("linker_file_lookup_symbol: file=%p, name=%s, deps=%d\n",
file, name, deps));
if (LINKER_LOOKUP_SYMBOL(file, name, &sym) == 0) {
***************
*** 608,614 ****
common_size = symval.size;
else {
KLD_DPF(SYM, ("linker_file_lookup_symbol: symbol"
! ".value=%x\n", symval.value));
return (symval.value);
}
}
- --- 608,614 ----
common_size = symval.size;
else {
KLD_DPF(SYM, ("linker_file_lookup_symbol: symbol"
! ".value=%p\n", symval.value));
return (symval.value);
}
}
***************
*** 618,624 ****
name, 0);
if (address) {
KLD_DPF(SYM, ("linker_file_lookup_symbol:"
! " deps value=%x\n", address));
return (address);
}
}
- --- 618,624 ----
name, 0);
if (address) {
KLD_DPF(SYM, ("linker_file_lookup_symbol:"
! " deps value=%p\n", address));
return (address);
}
}
***************
*** 634,640 ****
STAILQ_FOREACH(cp, &file->common, link) {
if (strcmp(cp->name, name) == 0) {
KLD_DPF(SYM, ("linker_file_lookup_symbol:"
! " old common value=%x\n", cp->address));
return (cp->address);
}
}
- --- 634,640 ----
STAILQ_FOREACH(cp, &file->common, link) {
if (strcmp(cp->name, name) == 0) {
KLD_DPF(SYM, ("linker_file_lookup_symbol:"
! " old common value=%p\n", cp->address));
return (cp->address);
}
}
***************
*** 656,662 ****
STAILQ_INSERT_TAIL(&file->common, cp, link);
KLD_DPF(SYM, ("linker_file_lookup_symbol: new common"
! " value=%x\n", cp->address));
return (cp->address);
}
KLD_DPF(SYM, ("linker_file_lookup_symbol: fail\n"));
- --- 656,662 ----
STAILQ_INSERT_TAIL(&file->common, cp, link);
KLD_DPF(SYM, ("linker_file_lookup_symbol: new common"
! " value=%p\n", cp->address));
return (cp->address);
}
KLD_DPF(SYM, ("linker_file_lookup_symbol: fail\n"));
***************
*** 1106,1151 ****
return (mod);
}
- - /*
- - * This routine is cheap and nasty but will work for data pointers.
- - */
- - static void *
- - linker_reloc_ptr(linker_file_t lf, const void *offset)
- - {
- - return (lf->address + (uintptr_t)offset);
- - }
- -
- - /*
- - * Dereference MDT_VERSION metadata into module name and version
- - */
- - static void
- - linker_mdt_version(linker_file_t lf, struct mod_metadata *mp,
- - const char **modname, int *version)
- - {
- - struct mod_version *mvp;
- -
- - if (modname)
- - *modname = linker_reloc_ptr(lf, mp->md_cval);
- - if (version) {
- - mvp = linker_reloc_ptr(lf, mp->md_data);
- - *version = mvp->mv_version;
- - }
- - }
- -
- - /*
- - * Dereference MDT_DEPEND metadata into module name and mod_depend structure
- - */
- - static void
- - linker_mdt_depend(linker_file_t lf, struct mod_metadata *mp,
- - const char **modname, struct mod_depend **verinfo)
- - {
- -
- - if (modname)
- - *modname = linker_reloc_ptr(lf, mp->md_cval);
- - if (verinfo)
- - *verinfo = linker_reloc_ptr(lf, mp->md_data);
- - }
- -
static void
linker_addmodules(linker_file_t lf, struct mod_metadata **start,
struct mod_metadata **stop, int preload)
- --- 1106,1111 ----
***************
*** 1155,1171 ****
int ver;
for (mdp = start; mdp < stop; mdp++) {
! if (preload)
! mp = *mdp;
! else
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_VERSION)
continue;
! if (preload) {
! modname = mp->md_cval;
! ver = ((struct mod_version *)mp->md_data)->mv_version;
! } else
! linker_mdt_version(lf, mp, &modname, &ver);
if (modlist_lookup(modname, ver) != NULL) {
printf("module %s already present!\n", modname);
/* XXX what can we do? this is a build error. :-( */
- --- 1115,1125 ----
int ver;
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_VERSION)
continue;
! modname = mp->md_cval;
! ver = ((struct mod_version *)mp->md_data)->mv_version;
if (modlist_lookup(modname, ver) != NULL) {
printf("module %s already present!\n", modname);
/* XXX what can we do? this is a build error. :-( */
***************
*** 1249,1266 ****
resolves = 1; /* unless we know otherwise */
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_DEPEND)
continue;
! linker_mdt_depend(lf, mp, &modname, &verinfo);
for (nmdp = start; nmdp < stop; nmdp++) {
! nmp = linker_reloc_ptr(lf, *nmdp);
if (nmp->md_type != MDT_VERSION)
continue;
! linker_mdt_version(lf, nmp, &nmodname,
! NULL);
! nmodname = linker_reloc_ptr(lf,
! nmp->md_cval);
if (strcmp(modname, nmodname) == 0)
break;
}
- --- 1203,1218 ----
resolves = 1; /* unless we know otherwise */
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_DEPEND)
continue;
! modname = mp->md_cval;
! verinfo = mp->md_data;
for (nmdp = start; nmdp < stop; nmdp++) {
! nmp = *nmdp;
if (nmp->md_type != MDT_VERSION)
continue;
! nmodname = nmp->md_cval;
if (strcmp(modname, nmodname) == 0)
break;
}
***************
*** 1283,1293 ****
if (resolves) {
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_VERSION)
continue;
! linker_mdt_version(lf, mp,
! &modname, &nver);
if (modlist_lookup(modname,
nver) != NULL) {
printf("module %s already"
- --- 1235,1246 ----
if (resolves) {
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_VERSION)
continue;
! modname = mp->md_cval;
! nver = ((struct mod_version *)
! mp->md_data)->mv_version;
if (modlist_lookup(modname,
nver) != NULL) {
printf("module %s already"
***************
*** 1338,1347 ****
&stop, NULL);
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_DEPEND)
continue;
! linker_mdt_depend(lf, mp, &modname, &verinfo);
mod = modlist_lookup2(modname, verinfo);
mod->container->refs++;
error = linker_file_add_dependency(lf,
- --- 1291,1301 ----
&stop, NULL);
if (!error) {
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_DEPEND)
continue;
! modname = mp->md_cval;
! verinfo = mp->md_data;
mod = modlist_lookup2(modname, verinfo);
mod->container->refs++;
error = linker_file_add_dependency(lf,
***************
*** 1763,1772 ****
&count) != 0)
return (0);
for (mdp = start; mdp < stop; mdp++) {
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_VERSION)
continue;
! linker_mdt_version(lf, mp, &modname, &ver);
mod = modlist_lookup(modname, ver);
if (mod != NULL) {
printf("interface %s.%d already present in the KLD"
- --- 1717,1727 ----
&count) != 0)
return (0);
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_VERSION)
continue;
! modname = mp->md_cval;
! ver = ((struct mod_version *)mp->md_data)->mv_version;
mod = modlist_lookup(modname, ver);
if (mod != NULL) {
printf("interface %s.%d already present in the KLD"
***************
*** 1777,1792 ****
}
for (mdp = start; mdp < stop; mdp++) {
! mp = linker_reloc_ptr(lf, *mdp);
if (mp->md_type != MDT_DEPEND)
continue;
! linker_mdt_depend(lf, mp, &modname, &verinfo);
nmodname = NULL;
for (nmdp = start; nmdp < stop; nmdp++) {
! nmp = linker_reloc_ptr(lf, *nmdp);
if (nmp->md_type != MDT_VERSION)
continue;
! nmodname = linker_reloc_ptr(lf, nmp->md_cval);
if (strcmp(modname, nmodname) == 0)
break;
}
- --- 1732,1748 ----
}
for (mdp = start; mdp < stop; mdp++) {
! mp = *mdp;
if (mp->md_type != MDT_DEPEND)
continue;
! modname = mp->md_cval;
! verinfo = mp->md_data;
nmodname = NULL;
for (nmdp = start; nmdp < stop; nmdp++) {
! nmp = *nmdp;
if (nmp->md_type != MDT_VERSION)
continue;
! nmodname = nmp->md_cval;
if (strcmp(modname, nmodname) == 0)
break;
}
Index: kern/link_elf.c
===================================================================
RCS file: /usr/ncvs/src/sys/kern/link_elf.c,v
retrieving revision 1.68
diff -c -r1.68 link_elf.c
*** kern/link_elf.c 19 Nov 2002 22:12:42 -0000 1.68
- --- kern/link_elf.c 3 Jan 2003 11:34:31 -0000
***************
*** 116,121 ****
- --- 116,122 ----
static int link_elf_each_function_name(linker_file_t,
int (*)(const char *, void *),
void *);
+ static void link_elf_reloc_local(linker_file_t);
static kobj_method_t link_elf_methods[] = {
KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol),
***************
*** 488,493 ****
- --- 489,495 ----
linker_file_unload(lf);
return error;
}
+ link_elf_reloc_local(lf);
*result = lf;
return (0);
}
***************
*** 748,753 ****
- --- 750,757 ----
error = parse_dynamic(ef);
if (error)
goto out;
+ link_elf_reloc_local(lf);
+
error = linker_load_dependencies(lf);
if (error)
goto out;
***************
*** 1265,1268 ****
- --- 1269,1300 ----
return (0);
return ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps));
+ }
+
+ static void
+ link_elf_reloc_local(linker_file_t lf)
+ {
+ const Elf_Rel *rellim;
+ const Elf_Rel *rel;
+ const Elf_Rela *relalim;
+ const Elf_Rela *rela;
+ elf_file_t ef = (elf_file_t)lf;
+
+ /* Perform relocations without addend if there are any: */
+ if ((rel = ef->rel) != NULL) {
+ rellim = (const Elf_Rel *)((const char *)ef->rel + ef->relsize);
+ while (rel < rellim) {
+ elf_reloc_local(lf, rel, ELF_RELOC_REL);
+ rel++;
+ }
+ }
+
+ /* Perform relocations with addend if there are any: */
+ if ((rela = ef->rela) != NULL) {
+ relalim = (const Elf_Rela *)((const char *)ef->rela + ef->relasize);
+ while (rela < relalim) {
+ elf_reloc_local(lf, rela, ELF_RELOC_RELA);
+ rela++;
+ }
+ }
}
Index: sparc64/sparc64/elf_machdep.c
===================================================================
RCS file: /usr/ncvs/src/sys/sparc64/sparc64/elf_machdep.c,v
retrieving revision 1.12
diff -c -r1.12 elf_machdep.c
*** sparc64/sparc64/elf_machdep.c 2 Dec 2002 18:56:30 -0000 1.12
- --- sparc64/sparc64/elf_machdep.c 3 Jan 2003 11:26:10 -0000
***************
*** 235,240 ****
- --- 235,262 ----
};
#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t])
+ int
+ elf_reloc_local(linker_file_t lf, const void *data, int type)
+ {
+ const Elf_Rela *rela;
+ Elf_Addr value;
+ Elf_Addr *where;
+
+ if (type != ELF_RELOC_RELA)
+ return (-1);
+
+ rela = (const Elf_Rela *)data;
+ if (ELF_R_TYPE(rela->r_info) != R_SPARC_RELATIVE)
+ return (-1);
+
+ value = rela->r_addend + (Elf_Addr)lf->address;
+ where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset);
+
+ *where = value;
+
+ return (0);
+ }
+
/* Process one elf relocation with addend. */
int
elf_reloc(linker_file_t lf, const void *data, int type)
***************
*** 258,264 ****
rtype = ELF_R_TYPE(rela->r_info);
symidx = ELF_R_SYM(rela->r_info);
! if (rtype == R_SPARC_NONE)
return (0);
if (rtype == R_SPARC_JMP_SLOT || rtype == R_SPARC_COPY ||
- --- 280,286 ----
rtype = ELF_R_TYPE(rela->r_info);
symidx = ELF_R_SYM(rela->r_info);
! if (rtype == R_SPARC_NONE || rtype == R_SPARC_RELATIVE)
return (0);
if (rtype == R_SPARC_JMP_SLOT || rtype == R_SPARC_COPY ||
Index: i386/i386/elf_machdep.c
===================================================================
RCS file: /usr/ncvs/src/sys/i386/i386/elf_machdep.c,v
retrieving revision 1.12
diff -c -r1.12 elf_machdep.c
*** i386/i386/elf_machdep.c 19 Oct 2002 19:16:03 -0000 1.12
- --- i386/i386/elf_machdep.c 3 Jan 2003 11:25:49 -0000
***************
*** 86,93 ****
&freebsd_brand_info);
/* Process one elf relocation with addend. */
! int
! elf_reloc(linker_file_t lf, const void *data, int type)
{
Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
- --- 86,93 ----
&freebsd_brand_info);
/* Process one elf relocation with addend. */
! static int
! elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
{
Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
***************
*** 116,121 ****
- --- 116,130 ----
panic("unknown reloc type %d\n", type);
}
+ if (local) {
+ if (rtype == R_386_RELATIVE) { /* A + B */
+ addr = relocbase + addend;
+ if (*where != addr)
+ *where = addr;
+ }
+ return (0);
+ }
+
switch (rtype) {
case R_386_NONE: /* none */
***************
*** 156,165 ****
*where = addr;
break;
! case R_386_RELATIVE: /* B + A */
! addr = relocbase + addend;
! if (*where != addr)
! *where = addr;
break;
default:
- --- 165,171 ----
*where = addr;
break;
! case R_386_RELATIVE:
break;
default:
***************
*** 168,173 ****
- --- 174,191 ----
return -1;
}
return(0);
+ }
+
+ int
+ elf_reloc(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 0));
+ }
+
+ int
+ elf_reloc_local(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 1));
}
int
- -------------- PATCH 2 -------------------------------------------
Index: ia64/ia64/elf_machdep.c
===================================================================
RCS file: /usr/ncvs/src/sys/ia64/ia64/elf_machdep.c,v
retrieving revision 1.9
diff -c -r1.9 elf_machdep.c
*** ia64/ia64/elf_machdep.c 19 Oct 2002 19:30:38 -0000 1.9
- --- ia64/ia64/elf_machdep.c 3 Jan 2003 11:19:39 -0000
***************
*** 141,148 ****
}
/* Process one elf relocation with addend. */
! int
! elf_reloc(linker_file_t lf, const void *data, int type)
{
Elf_Addr relocbase = (Elf_Addr)lf->address;
Elf_Addr *where;
- --- 141,148 ----
}
/* Process one elf relocation with addend. */
! static int
! elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
{
Elf_Addr relocbase = (Elf_Addr)lf->address;
Elf_Addr *where;
***************
*** 179,184 ****
- --- 179,190 ----
panic("%s: invalid ELF relocation (0x%x)\n", __func__, type);
}
+ if (local) {
+ if (rtype == R_IA64_REL64LSB)
+ *where = relocbase + addend;
+ return (0);
+ }
+
switch (rtype) {
case R_IA64_NONE:
break;
***************
*** 199,205 ****
*where = addr;
break;
case R_IA64_REL64LSB: /* word64 LSB BD + A */
- - *where = relocbase + addend;
break;
case R_IA64_IPLTLSB:
addr = lookup_fdesc(lf, symidx);
- --- 205,210 ----
***************
*** 215,220 ****
- --- 220,237 ----
}
return (0);
+ }
+
+ int
+ elf_reloc(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 0));
+ }
+
+ int
+ elf_reloc_local(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 1));
}
int
Index: alpha/alpha/elf_machdep.c
===================================================================
RCS file: /usr/ncvs/src/sys/alpha/alpha/elf_machdep.c,v
retrieving revision 1.12
diff -c -r1.12 elf_machdep.c
*** alpha/alpha/elf_machdep.c 19 Oct 2002 19:16:02 -0000 1.12
- --- alpha/alpha/elf_machdep.c 3 Jan 2003 11:21:33 -0000
***************
*** 89,96 ****
&freebsd_brand_info);
/* Process one elf relocation with addend. */
! int
! elf_reloc(linker_file_t lf, const void *data, int type)
{
Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
- --- 89,96 ----
&freebsd_brand_info);
/* Process one elf relocation with addend. */
! static int
! elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
{
Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
***************
*** 119,124 ****
- --- 119,133 ----
panic("elf_reloc: unknown relocation mode %d\n", type);
}
+ if (local) {
+ if (rtype == R_ALPHA_RELATIVE) {
+ addr = relocbase + addend;
+ if (*where != addr)
+ *where = addr;
+ }
+ return (0);
+ }
+
switch (rtype) {
case R_ALPHA_NONE:
***************
*** 152,160 ****
break;
case R_ALPHA_RELATIVE:
- - addr = relocbase + addend;
- - if (*where != addr)
- - *where = addr;
break;
case R_ALPHA_COPY:
- --- 161,166 ----
***************
*** 171,176 ****
- --- 177,194 ----
return -1;
}
return(0);
+ }
+
+ int
+ elf_reloc(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 0));
+ }
+
+ int
+ elf_reloc_local(linker_file_t lf, const void *data, int type)
+ {
+ return (elf_reloc_internal(lf, data, type, 1));
}
int
>Release-Note:
>Audit-Trail:
>Unformatted:
------------------------------
Date: Fri, 3 Jan 2003 19:01:23 +0100
From: Thomas Moestl <tmo...@gmx.net>
Subject: Re: Locale errors on 5.0-CURRENT (sparc)
On Fri, 2003/01/03 at 15:29:27 +0200, Peter Pentchev wrote:
> On Fri, Jan 03, 2003 at 02:31:41PM +0200, Peter Pentchev wrote:
> > FWIW, I can reproduce this on panther.FreeBSD.org, a sparc64 running
> > 5.0-CURRENT as of December 6, 2001. All the other machines in the
> > FreeBSD cluster that I could test - ref5 (i386), pluto1 (IA-64), and
> > beast (alpha) - are able to set both the is_IS.ISO8859-1 and the
> > bg_BG.CP1251 locales correctly for both LC_ALL and LC_TIME. Only the
> > sparc64 machine is having trouble setting LC_ALL for any locale I tried.
>
> Actually, I seem to have found the reason: on panther.FreeBSD.org, there
> are no LC_CTYPE files for any locale, and setlocale(LC_ALL) attempts to
> load, well, *all* locale type definitions, including LC_CTYPE. Thus, it
> would (and does) return NULL with errno set to ENOENT for all locales...
>
> The LC_CTYPE files are not there, because there is an explicit test for
> the build architecture in src/share/Makefile, which excludes the
> mklocale directory for sparc64; it was introduced in rev. 1.27 by David
> O'Brien about 7 months ago. David, what exactly was the 'bad juju'
> mentioned in the commit message, and is it still there? A test run of
> 'cvs up share/mklocale && cd share/mklocale && make' on panther seemed
> to complete OK; I have not yet tested the resulting locale files though.
Yeah, I just noticed that, too. As far as I can tell, this is purely
historical, if I remember correctly mklocale did crash back then. I
will re-enable it.
- Thomas
- --
Thomas Moestl <tmo...@gmx.net> http://www.tu-bs.de/~y0015675/
<t...@FreeBSD.org> http://people.FreeBSD.org/~tmm/
PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C
------------------------------
End of freebsd-sparc-digest V5 #208
***********************************
To Unsubscribe: send mail to majo...@FreeBSD.org
with unsubscribe freebsd-sparc-digest in the body of the message