All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: ian.campbell@citrix.com, ian.jackson@eu.citrix.com,
	jbeulich@suse.com, xen-devel@lists.xenproject.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v3 4/5] mkelf32: Remove the 32-bit hypervisor support.
Date: Thu, 11 Feb 2016 22:08:26 -0500	[thread overview]
Message-ID: <1455246507-5589-5-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1455246507-5589-1-git-send-email-konrad.wilk@oracle.com>

We do not compile 32-bit hypervisor anymore so the code for
the ELFCLASS32 is effectively dead.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/arch/x86/boot/mkelf32.c | 88 +++++++++++++++------------------------------
 1 file changed, 28 insertions(+), 60 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index b369222..993a7ee 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -3,7 +3,7 @@
  * 
  * Usage: elf-prefix <in-image> <out-image> <load-base>
  * 
- * Converts an Elf32 or Elf64 executable binary <in-image> into a simple Elf32
+ * Converts an Elf64 executable binary <in-image> into a simple Elf32
  * image <out-image> comprising a single chunk to be loaded at <load-base>. 
  */
 
@@ -235,7 +235,6 @@ int main(int argc, char **argv)
     int        bytes, todo, i;
 
     Elf32_Ehdr in32_ehdr;
-    Elf32_Phdr in32_phdr;
 
     Elf64_Ehdr in64_ehdr;
     Elf64_Phdr in64_phdr;
@@ -271,70 +270,39 @@ int main(int argc, char **argv)
     big_endian = (*(u16 *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
 
     endianadjust_ehdr32(&in32_ehdr);
-    switch ( in32_ehdr.e_ident[EI_CLASS] )
+    if ( in32_ehdr.e_ident[EI_CLASS] != ELFCLASS64 )
     {
-    case ELFCLASS32:
-        if ( in32_ehdr.e_phentsize != sizeof(in32_phdr) )
-        {
-            fprintf(stderr, "Bad program header size (%d != %d).\n",
-                    (int)in32_ehdr.e_phentsize, (int)sizeof(in32_phdr));
-            return 1;
-        }
-
-        if ( in32_ehdr.e_phnum != 1 )
-        {
-            fprintf(stderr, "Expect precisely 1 program header; found %d.\n",
-                    (int)in32_ehdr.e_phnum);
-            return 1;
-        }
-
-        (void)lseek(infd, in32_ehdr.e_phoff, SEEK_SET);
-        do_read(infd, &in32_phdr, sizeof(in32_phdr));
-        endianadjust_phdr32(&in32_phdr);
-
-        (void)lseek(infd, in32_phdr.p_offset, SEEK_SET);
-        dat_siz = (u32)in32_phdr.p_filesz;
-
-        /* Do not use p_memsz: it does not include BSS alignment padding. */
-        /*mem_siz = (u32)in32_phdr.p_memsz;*/
-        mem_siz = (u32)(final_exec_addr - in32_phdr.p_vaddr);
-        break;
-
-    case ELFCLASS64:
-        (void)lseek(infd, 0, SEEK_SET);
-        do_read(infd, &in64_ehdr, sizeof(in64_ehdr));
-        endianadjust_ehdr64(&in64_ehdr);
-
-        if ( in64_ehdr.e_phentsize != sizeof(in64_phdr) )
-        {
-            fprintf(stderr, "Bad program header size (%d != %d).\n",
-                    (int)in64_ehdr.e_phentsize, (int)sizeof(in64_phdr));
-            return 1;
-        }
+        fprintf(stderr, "Bad program header class - we only do 64-bit!.\n");
+        return 1;
+    }
+    (void)lseek(infd, 0, SEEK_SET);
+    do_read(infd, &in64_ehdr, sizeof(in64_ehdr));
+    endianadjust_ehdr64(&in64_ehdr);
 
-        if ( in64_ehdr.e_phnum != 1 )
-        {
-            fprintf(stderr, "Expect precisly 1 program header; found %d.\n",
-                    (int)in64_ehdr.e_phnum);
-            return 1;
-        }
+    if ( in64_ehdr.e_phentsize != sizeof(in64_phdr) )
+    {
+        fprintf(stderr, "Bad program header size (%d != %d).\n",
+                (int)in64_ehdr.e_phentsize, (int)sizeof(in64_phdr));
+        return 1;
+    }
 
-        (void)lseek(infd, in64_ehdr.e_phoff, SEEK_SET);
-        do_read(infd, &in64_phdr, sizeof(in64_phdr));
-        endianadjust_phdr64(&in64_phdr);
+    if ( in64_ehdr.e_phnum != 1 )
+    {
+        fprintf(stderr, "Expect precisly 1 program header; found %d.\n",
+                (int)in64_ehdr.e_phnum);
+        return 1;
+    }
 
-        (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
-        dat_siz = (u32)in64_phdr.p_filesz;
+    (void)lseek(infd, in64_ehdr.e_phoff, SEEK_SET);
+    do_read(infd, &in64_phdr, sizeof(in64_phdr));
+    endianadjust_phdr64(&in64_phdr);
 
-        /* Do not use p_memsz: it does not include BSS alignment padding. */
-        /*mem_siz = (u32)in64_phdr.p_memsz;*/
-        mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
-        break;
+    (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
+    dat_siz = (u32)in64_phdr.p_filesz;
 
-    default:
-        fprintf(stderr, "Input image must be a 32- or 64-bit Elf image.\n");
-        return 1;
-    }
+    /* Do not use p_memsz: it does not include BSS alignment padding. */
+    /*mem_siz = (u32)in64_phdr.p_memsz;*/
+    mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
 
     /*
      * End the image on a page boundary. This gets round alignment bugs
-- 
2.4.3

  parent reply	other threads:[~2016-02-12  3:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12  3:08 [PATCH v3] Requisite paches for xSplice v3 (not yet posted) Konrad Rzeszutek Wilk
2016-02-12  3:08 ` [PATCH v3 1/5] hypervisor/arm/keyhandler: Declare struct cpu_user_regs; Konrad Rzeszutek Wilk
2016-02-12  8:51   ` Jan Beulich
2016-02-12 14:06     ` Konrad Rzeszutek Wilk
2016-02-12 14:54       ` Jan Beulich
2016-02-12 11:37   ` Stefano Stabellini
2016-02-12 12:20     ` Jan Beulich
2016-02-12 12:46       ` Stefano Stabellini
2016-02-12 14:53         ` Jan Beulich
2016-02-12  3:08 ` [PATCH v3 2/5] arm/config: Declare ELFSIZE_[32|64] respectively Konrad Rzeszutek Wilk
2016-02-12 11:26   ` Stefano Stabellini
2016-02-12 14:17     ` Konrad Rzeszutek Wilk
2016-02-12 15:04       ` Jan Beulich
2016-02-12 15:26         ` Stefano Stabellini
2016-02-12 15:56           ` Konrad Rzeszutek Wilk
2016-02-12 15:57             ` Stefano Stabellini
2016-02-12 17:50               ` Konrad Rzeszutek Wilk
2016-03-16 17:32             ` Julien Grall
2016-03-16 17:52               ` Konrad Rzeszutek Wilk
2016-03-16 18:08                 ` Julien Grall
2016-03-16 19:21                   ` Konrad Rzeszutek Wilk
2016-03-17  1:16                     ` Konrad Rzeszutek Wilk
2016-03-17 11:04                       ` Julien Grall
2016-03-17 18:52                         ` Konrad Rzeszutek Wilk
2016-02-12  3:08 ` [PATCH v3 3/5] build: remove .config from /boot when uninstalling Konrad Rzeszutek Wilk
2016-02-12 14:11   ` Doug Goldstein
2016-02-12  3:08 ` Konrad Rzeszutek Wilk [this message]
2016-02-12  3:08 ` [PATCH v3 5/5] mkelf32: Close those file descriptors in the error paths Konrad Rzeszutek Wilk
2016-02-18 16:29   ` Jan Beulich
2016-02-18 16:39     ` Ian Jackson
2016-02-18 16:45       ` Jan Beulich
2016-02-18 21:12         ` Konrad Rzeszutek Wilk
2016-02-19 11:39           ` Jan Beulich
2016-02-19 11:42           ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455246507-5589-5-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.