cvs commit: src/sys/conf kern.post.mk kmod.mk

Ruslan Ermilov ru at freebsd.org
Thu Oct 27 15:09:10 PDT 2005


On Thu, Oct 27, 2005 at 11:34:10PM +0200, Dag-Erling Sm?rgrav wrote:
> Ruslan Ermilov <ru at 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?
> 
> Yes.  AFAICT, it should select sections based on the presence of the
> SHF_ALLOC bit in sh_flags.  See if the attached patch helps.
> 
Fantastic.  :-)

I was just about to test the following patch:

%%%
Index: link_elf_obj.c
===================================================================
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 = (void *)shdr[i].sh_addr;
 			if (shdr[i].sh_type == SHT_PROGBITS)
 				ef->progtab[pb].name = "<<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 = shdr[i].sh_addralign - 1;
 			mapsize += alignmask;
 			mapsize &= ~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 = shdr[i].sh_addralign - 1;
 			mapbase += alignmask;
 			mapbase &= ~alignmask;
%%%


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20051028/d577ad40/attachment.bin


More information about the cvs-src mailing list