Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2005 01:04:37 +0300
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Dag-Erling Sm?rgrav <des@des.no>
Cc:        cvs-src@freebsd.org, "Bjoern A. Zeeb" <bz@freebsd.org>, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/conf kern.post.mk kmod.mk
Message-ID:  <20051027220437.GA54382@ip.net.ua>
In-Reply-To: <86vezi1w6l.fsf@xps.des.no>
References:  <200510271424.j9REOkr8091913@repoman.freebsd.org> <Pine.BSF.4.53.0510271714530.91525@e0-0.zab2.int.zabbadoz.net> <20051027174042.GK68470@ip.net.ua> <864q723dqt.fsf@xps.des.no> <20051027204816.GX68470@ip.net.ua> <86vezi1w6l.fsf@xps.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 27, 2005 at 11:34:10PM +0200, Dag-Erling Sm?rgrav wrote:
> Ruslan Ermilov <ru@FreeBSD.org> writes:
> > sys/kern/link_elf_obj.c is what's used with current format module
> > objects on amd64.  Can you see a problem there?
>=20
> Yes.  AFAICT, it should select sections based on the presence of the
> SHF_ALLOC bit in sh_flags.  See if the attached patch helps.
>=20
Fantastic.  :-)

I was just about to test the following patch:

%%%
Index: link_elf_obj.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/kern/link_elf_obj.c,v
retrieving revision 1.89
diff -u -p -r1.89 link_elf_obj.c
--- link_elf_obj.c	28 Aug 2005 05:38:40 -0000	1.89
+++ link_elf_obj.c	27 Oct 2005 22:00:00 -0000
@@ -228,6 +228,8 @@ link_elf_link_preload(linker_class_t cls
 		switch (shdr[i].sh_type) {
 		case SHT_PROGBITS:
 		case SHT_NOBITS:
+			if (!(shdr[i].sh_flags & SHF_ALLOC))
+				break;
 			ef->nprogtab++;
 			break;
 		case SHT_SYMTAB:
@@ -298,6 +300,8 @@ link_elf_link_preload(linker_class_t cls
 		switch (shdr[i].sh_type) {
 		case SHT_PROGBITS:
 		case SHT_NOBITS:
+			if (!(shdr[i].sh_flags & SHF_ALLOC))
+				break;
 			ef->progtab[pb].addr =3D (void *)shdr[i].sh_addr;
 			if (shdr[i].sh_type =3D=3D SHT_PROGBITS)
 				ef->progtab[pb].name =3D "<<PROGBITS>>";
@@ -499,6 +503,8 @@ link_elf_load_file(linker_class_t cls, c
 		switch (shdr[i].sh_type) {
 		case SHT_PROGBITS:
 		case SHT_NOBITS:
+			if (!(shdr[i].sh_flags & SHF_ALLOC))
+				break;
 			ef->nprogtab++;
 			break;
 		case SHT_SYMTAB:
@@ -621,6 +627,8 @@ link_elf_load_file(linker_class_t cls, c
 		switch (shdr[i].sh_type) {
 		case SHT_PROGBITS:
 		case SHT_NOBITS:
+			if (!(shdr[i].sh_flags & SHF_ALLOC))
+				break;
 			alignmask =3D shdr[i].sh_addralign - 1;
 			mapsize +=3D alignmask;
 			mapsize &=3D ~alignmask;
@@ -674,6 +682,8 @@ link_elf_load_file(linker_class_t cls, c
 		switch (shdr[i].sh_type) {
 		case SHT_PROGBITS:
 		case SHT_NOBITS:
+			if (!(shdr[i].sh_flags & SHF_ALLOC))
+				break;
 			alignmask =3D shdr[i].sh_addralign - 1;
 			mapbase +=3D alignmask;
 			mapbase &=3D ~alignmask;
%%%


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--C7zPtVaVf+AK4Oqc
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDYU71qRfpzJluFF4RAuPbAKCJPa7wUjR5G8u2dx9e7Tl+wyMx6QCfW1P7
f+kyBY+TVRZK7UKDrRQS/PA=
=VG7j
-----END PGP SIGNATURE-----

--C7zPtVaVf+AK4Oqc--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051027220437.GA54382>