// SPDX-License-Identifier: GPL-2.0 /* * arch/alpha/boot/tools/objstrip.c * * Strip the object file headers/trailers from an executable (ELF or ECOFF). * * Copyright (C) 1996 David Mosberger-Tang.
*/ /* * Converts an ECOFF or ELF object file into a bootable file. The * object file must be a OMAGIC file (i.e., data and bss follow immediately * behind the text). See DEC "Assembly Language Programmer's Guide" * documentation for details. The SRM boot process is documented in * the Alpha AXP Architecture Reference Manual, Second Edition by * Richard L. Sites and Richard T. Witek.
*/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h>
if (read(fd, buf, sizeof(buf)) < 0) {
perror("read"); exit(1);
}
#ifdef __ELF__
elf = (struct elfhdr *) buf;
if (memcmp(&elf->e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) { if (elf->e_type != ET_EXEC) {
fprintf(stderr, "%s: %s is not an ELF executable\n",
prog_name, inname); exit(1);
} if (!elf_check_arch(elf)) {
fprintf(stderr, "%s: is not for this processor (e_machine=%d)\n",
prog_name, elf->e_machine); exit(1);
} if (elf->e_phnum != 1) {
fprintf(stderr, "%s: %d program headers (forgot to link with -N?)\n",
prog_name, elf->e_phnum);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.