PERFORCE change 49977 for review

Peter Wemm peter at FreeBSD.org
Tue Mar 30 09:21:11 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=49977

Change 49977 by peter at peter_daintree on 2004/03/30 09:21:07

	GC some crud

Affected files ...

.. //depot/projects/hammer/sys/kern/link_elf_obj.c#7 edit

Differences ...

==== //depot/projects/hammer/sys/kern/link_elf_obj.c#7 (text+ko) ====

@@ -207,14 +207,8 @@
 	Elf_Ehdr *hdr;
 	caddr_t firstpage;
 	int nbytes, i;
-	Elf_Phdr *phdr;
-	Elf_Phdr *phlimit;
-	Elf_Phdr *segs[2];
 	int nsegs;
-	caddr_t mapbase;
 	size_t mapsize;
-	Elf_Off base_offset;
-	Elf_Addr base_vaddr;
 	Elf_Addr base_vlimit;
 	int error = 0;
 	int resid, flags;
@@ -232,6 +226,7 @@
 
 	shdr = NULL;
 	lf = NULL;
+	mapsize = 0;
 
 	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td);
 	flags = FREAD;
@@ -321,13 +316,7 @@
 		error = ENOMEM;
 		goto out;
 	}
-
 	ef = (elf_file_t) lf;
-	ef->address = malloc(mapsize, M_LINKER, M_WAITOK);
-	if (!ef->address) {
-		error = ENOMEM;
-		goto out;
-	}
 
 	/*
 	 * Scan the program header entries, and save key information.
@@ -502,33 +491,6 @@
 
 /* XXX *************** STEP 4 GOES HERE ************* XXX */
 
-	/*
-	 * Allocate the entire address space of the object, to stake out our
-	 * contiguous region, and to establish the base address for relocation.
-	 */
-	base_offset = trunc_page(segs[0]->p_offset);
-	base_vaddr = trunc_page(segs[0]->p_vaddr);
-	base_vlimit = round_page(segs[1]->p_vaddr + segs[1]->p_memsz);
-	mapsize = base_vlimit - base_vaddr;
-
-	mapbase = ef->address;
-
-	/*
-	 * Read the text and data sections and zero the bss.
-	 */
-	for (i = 0; i < 2; i++) {
-		caddr_t segbase = mapbase + segs[i]->p_vaddr - base_vaddr;
-		error = vn_rdwr(UIO_READ, nd.ni_vp,
-		    segbase, segs[i]->p_filesz, segs[i]->p_offset,
-		    UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, NOCRED,
-		    &resid, td);
-		if (error) {
-			goto out;
-		}
-		bzero(segbase + segs[i]->p_filesz,
-		    segs[i]->p_memsz - segs[i]->p_filesz);
-	}
-
 	lf->address = ef->address;
 	lf->size = mapsize;
 


More information about the p4-projects mailing list