mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>
Cc: linux-alpha@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] alpha: remove a.out support from tools/objstrip
Date: Thu, 23 Nov 2023 18:02:41 +0000	[thread overview]
Message-ID: <20231123180246.750674-2-dimitri.ledkov@canonical.com> (raw)
In-Reply-To: <20231123180246.750674-1-dimitri.ledkov@canonical.com>

As a.out support has been dropped from alpha port, drop a.out support
and make ELF support required.

Only performed a test build on x86 for native x86 and cross-compiled
for alpha.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 arch/alpha/boot/tools/objstrip.c | 52 ++++----------------------------
 1 file changed, 6 insertions(+), 46 deletions(-)

diff --git a/arch/alpha/boot/tools/objstrip.c b/arch/alpha/boot/tools/objstrip.c
index 7cf92d172d..91c0ad29e1 100644
--- a/arch/alpha/boot/tools/objstrip.c
+++ b/arch/alpha/boot/tools/objstrip.c
@@ -21,17 +21,12 @@
 
 #include <sys/fcntl.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-
-#include <linux/a.out.h>
-#include <linux/coff.h>
-#include <linux/param.h>
-#ifdef __ELF__
-# include <linux/elf.h>
-# define elfhdr elf64_hdr
-# define elf_phdr elf64_phdr
-# define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
-#endif
+
+#include <linux/elf.h>
+#define elfhdr elf64_hdr
+#define elf_phdr elf64_phdr
+#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
+
 
 /* bootfile size must be multiple of BLOCK_SIZE: */
 #define BLOCK_SIZE	512
@@ -55,13 +50,10 @@ main (int argc, char *argv[])
     size_t nwritten, tocopy, n, mem_size, fil_size, pad = 0;
     int fd, ofd, i, j, verbose = 0, primary = 0;
     char buf[8192], *inname;
-    struct exec * aout;		/* includes file & aout header */
     long offset;
-#ifdef __ELF__
     struct elfhdr *elf;
     struct elf_phdr *elf_phdr;	/* program header */
     unsigned long long e_entry;
-#endif
 
     prog_name = argv[0];
 
@@ -145,7 +137,6 @@ main (int argc, char *argv[])
 	exit(1);
     }
 
-#ifdef __ELF__
     elf = (struct elfhdr *) buf;
 
     if (memcmp(&elf->e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
@@ -192,37 +183,6 @@ main (int argc, char *argv[])
 		    prog_name, (long) elf_phdr->p_vaddr,
 		    elf_phdr->p_vaddr + fil_size, offset);
 	}
-    } else
-#endif
-    {
-	aout = (struct exec *) buf;
-
-	if (!(aout->fh.f_flags & COFF_F_EXEC)) {
-	    fprintf(stderr, "%s: %s is not in executable format\n",
-		    prog_name, inname);
-	    exit(1);
-	}
-
-	if (aout->fh.f_opthdr != sizeof(aout->ah)) {
-	    fprintf(stderr, "%s: %s has unexpected optional header size\n",
-		    prog_name, inname);
-	    exit(1);
-	}
-
-	if (N_MAGIC(*aout) != OMAGIC) {
-	    fprintf(stderr, "%s: %s is not an OMAGIC file\n",
-		    prog_name, inname);
-	    exit(1);
-	}
-	offset = N_TXTOFF(*aout);
-	fil_size = aout->ah.tsize + aout->ah.dsize;
-	mem_size = fil_size + aout->ah.bsize;
-
-	if (verbose) {
-	    fprintf(stderr, "%s: extracting %#016lx-%#016lx (at %lx)\n",
-		    prog_name, aout->ah.text_start,
-		    aout->ah.text_start + fil_size, offset);
-	}
     }
 
     if (lseek(fd, offset, SEEK_SET) != offset) {
-- 
2.34.1


  reply	other threads:[~2023-11-23 18:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 18:02 [PATCH 0/5] remove the last bits of a.out support Dimitri John Ledkov
2023-11-23 18:02 ` Dimitri John Ledkov [this message]
2023-11-23 18:02 ` [PATCH 2/5] alpha: stop shipping a.out.h uapi headers Dimitri John Ledkov
2023-11-23 18:02 ` [PATCH 3/5] m68k: " Dimitri John Ledkov
2023-11-23 18:48   ` Geert Uytterhoeven
2023-11-23 18:02 ` [PATCH 4/5] x86: " Dimitri John Ledkov
2023-11-30 19:25   ` Ingo Molnar
2023-11-23 18:02 ` [PATCH 5/5] uapi: remove a.out.h uapi header Dimitri John Ledkov
2023-11-24  6:00 ` [PATCH 0/5] remove the last bits of a.out support Eric W. Biederman
2023-11-24 14:36   ` Dimitri John Ledkov
2023-11-24 18:06     ` Dimitri John Ledkov
2023-11-25  4:31       ` Eric W. Biederman
2023-11-24 20:47   ` Michael Cree

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=20231123180246.750674-2-dimitri.ledkov@canonical.com \
    --to=dimitri.ledkov@canonical.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=geert@linux-m68k.org \
    --cc=hpa@zytor.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=mattst88@gmail.com \
    --cc=mingo@redhat.com \
    --cc=richard.henderson@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®