Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 2003 17:28:00 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28280 for review
Message-ID:  <200304060128.h361S0oo051897@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28280

Change 28280 by peter@peter_overcee on 2003/04/05 17:27:31

	Use the correct strings.  It's elf32_foo, not 32_foo.

Affected files ...

.. //depot/projects/hammer/sys/boot/common/load_elf.c#6 edit

Differences ...

==== //depot/projects/hammer/sys/boot/common/load_elf.c#6 (text+ko) ====

@@ -71,8 +71,8 @@
 static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef);
 static char	*fake_modname(const char *name);
 
-const char	*__elfN(kerneltype) = __XSTRING(__ELF_WORD_SIZE) "kernel";
-const char	*__elfN(moduletype) = __XSTRING(__ELF_WORD_SIZE) "module";
+const char	*__elfN(kerneltype) = "elf" __XSTRING(__ELF_WORD_SIZE) " kernel";
+const char	*__elfN(moduletype) = "elf" __XSTRING(__ELF_WORD_SIZE) " module";
 
 /*
  * Attempt to load the file (file) as an ELF module.  It will be stored at
@@ -134,12 +134,12 @@
     if (ehdr->e_type == ET_DYN) {
 	/* Looks like a kld module */
 	if (kfp == NULL) {
-	    printf(__XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n");
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n");
 	    err = EPERM;
 	    goto oerr;
 	}
 	if (strcmp(__elfN(kerneltype), kfp->f_type)) {
-	    printf(__XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module with kernel type '%s'\n", kfp->f_type);
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module with kernel type '%s'\n", kfp->f_type);
 	    err = EPERM;
 	    goto oerr;
 	}
@@ -155,7 +155,7 @@
     } else if (ehdr->e_type == ET_EXEC) {
 	/* Looks like a kernel */
 	if (kfp != NULL) {
-	    printf(__XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
 	    err = EPERM;
 	    goto oerr;
 	}
@@ -164,7 +164,7 @@
 	 */
 	dest = ehdr->e_entry;
 	if (dest == 0) {
-	    printf(__XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
 	    err = EPERM;
 	    goto oerr;
 	}
@@ -180,7 +180,7 @@
      */
     fp = file_alloc();
     if (fp == NULL) {
-	    printf(__XSTRING(__ELF_WORD_SIZE) "_loadfile: cannot allocate module info\n");
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: cannot allocate module info\n");
 	    err = EPERM;
 	    goto out;
     }
@@ -266,7 +266,7 @@
     ef->off = off;
 
     if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) {
-	printf(__XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n");
+	printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n");
 	goto out;
     }
     phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff);
@@ -300,12 +300,12 @@
 	if (phdr[i].p_filesz > fpcopy) {
 	    if (lseek(ef->fd, (off_t)(phdr[i].p_offset + fpcopy),
 		      SEEK_SET) == -1) {
-		printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadexec: cannot seek\n");
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadexec: cannot seek\n");
 		goto out;
 	    }
 	    if (archsw.arch_readin(ef->fd, phdr[i].p_vaddr + off + fpcopy,
 		phdr[i].p_filesz - fpcopy) != (ssize_t)(phdr[i].p_filesz - fpcopy)) {
-		printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadexec: archsw.readin failed\n");
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadexec: archsw.readin failed\n");
 		goto out;
 	    }
 	}
@@ -320,7 +320,7 @@
 	    /* no archsw.arch_bzero */
 	    buf = malloc(PAGE_SIZE);
 	    if (buf == NULL) {
-		printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadimage: malloc() failed\n");
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: malloc() failed\n");
 		goto out;
 	    }
 	    bzero(buf, PAGE_SIZE);
@@ -358,12 +358,12 @@
     if (shdr == NULL)
 	goto nosyms;
     if (lseek(ef->fd, (off_t)ehdr->e_shoff, SEEK_SET) == -1) {
-	printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadimage: cannot lseek() to section headers");
+	printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: cannot lseek() to section headers");
 	goto nosyms;
     }
     result = read(ef->fd, shdr, chunk);
     if (result < 0 || (size_t)result != chunk) {
-	printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadimage: read section headers failed");
+	printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: read section headers failed");
 	goto nosyms;
     }
     symtabindex = -1;
@@ -428,14 +428,14 @@
 #endif
 
 	if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) {
-	    printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not seek for symbols - skipped!");
+	    printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not seek for symbols - skipped!");
 	    lastaddr = ssym;
 	    ssym = 0;
 	    goto nosyms;
 	}
 	result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size);
 	if (result < 0 || (size_t)result != shdr[i].sh_size) {
-	    printf("\n" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped!");
+	    printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped!");
 	    lastaddr = ssym;
 	    ssym = 0;
 	    goto nosyms;
@@ -644,7 +644,7 @@
     return h;
 }
 
-static const char __elfN(bad_symtable)[] = __XSTRING(__ELF_WORD_SIZE) "_lookup_symbol: corrupt symbol table\n";
+static const char __elfN(bad_symtable)[] = "elf" __XSTRING(__ELF_WORD_SIZE) "_lookup_symbol: corrupt symbol table\n";
 int
 __elfN(lookup_symbol)(struct preloaded_file *fp, elf_file_t ef, const char* name,
 		  Elf_Sym *symp)



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