summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2020-05-18 16:29:20 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2020-05-18 16:29:20 +0000
commit4e4fe16e3bc59be6357c3399794e13a98aebaf0d (patch)
tree7b19ba100a10b7d3c5af108da8489f3a362483fd /sys/arch
parent5fc1374d3e6856ad048d5615dca25410228c1e79 (diff)
Move boot.mac into the Attic.
ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/stand/boot.mac/Makefile48
-rw-r--r--sys/arch/macppc/stand/boot.mac/elf32_powerpc_merge.x67
-rw-r--r--sys/arch/macppc/stand/boot.mac/fixcoff.c195
3 files changed, 0 insertions, 310 deletions
diff --git a/sys/arch/macppc/stand/boot.mac/Makefile b/sys/arch/macppc/stand/boot.mac/Makefile
deleted file mode 100644
index 9a1d8e97367..00000000000
--- a/sys/arch/macppc/stand/boot.mac/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2019/11/28 00:17:12 bluhm Exp $
-# $NetBSD: Makefile,v 1.1 1996/09/30 16:35:05 ws Exp $
-
-S= ${.CURDIR}/../../../..
-R= ..
-.PATH: $(.CURDIR)/$(R)
-RELOC= E00000
-ENTRY= _entry
-NOMAN=
-PROG= boot.mac
-CFLAGS+= -D_STANDALONE
-SRCS= Locore.c main.c ofdev.c net.c netif_of.c netudp.c
-SRCS+= alloc.c cache.c hfs.c fchmod.c arc4.c
-SRCS+= boot.c conf.c cmd.c vars.c ctime.c strtol.c
-
-INSTALL_STRIP=
-BINDIR= /usr/mdec
-OBJCOPY?= objcopy
-OBJCOPY_ARGS= -O aixcoff-rs6000 -R .comment -R .note
-LDFLAGS= -nopie -znorelro -X -Ttext ${RELOC} -e $(ENTRY)
-LDFLAGS+= -T ${.CURDIR}/elf32_powerpc_merge.x -Bstatic
-
-.PATH: ${S}/stand/boot
-.PATH: ${S}/lib/libsa
-SRCS+= getchar.c hexdump.c strtoll.c
-
-.PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern
-SRCS+= strlcpy.c memcpy.c memmove.c strlen.c strrchr.c strlcat.c ashrdi3.c
-SRCS+= moddi3.c
-
-CPPFLAGS+= -I. -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
-CPPFLAGS+= -DRELOC=0x${RELOC} -DCONSPEED=57600
-# for booting PCI Powermacs
-CPPFLAGS+= -DXCOFF_GLUE
-CFLAGS+= -fno-pie
-
-LIBS!= cd $(.CURDIR)/$(R); $(MAKE) libdep
-CLEANFILES= fixcoff
-
-$(PROG): $(OBJS) $(LIBS) fixcoff
- $(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o ${.TARGET}
- ${OBJCOPY} ${OBJCOPY_ARGS} ${.TARGET}
- ${.OBJDIR}/fixcoff ${.TARGET}
-
-fixcoff: fixcoff.c
- ${HOSTCC} -I${.CURDIR} -o fixcoff ${.CURDIR}/fixcoff.c
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/macppc/stand/boot.mac/elf32_powerpc_merge.x b/sys/arch/macppc/stand/boot.mac/elf32_powerpc_merge.x
deleted file mode 100644
index 8da4867b675..00000000000
--- a/sys/arch/macppc/stand/boot.mac/elf32_powerpc_merge.x
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: elf32_powerpc_merge.x,v 1.2 2013/07/16 08:03:18 mpi Exp $ */
-OUTPUT_ARCH(powerpc)
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = + SIZEOF_HEADERS;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .rel.text : { *(.rel.text) }
- .rela.text : { *(.rela.text) }
- .rel.data : { *(.rel.data) }
- .rela.data : { *(.rela.data) }
- .rel.rodata : { *(.rel.rodata) }
- .rela.rodata : { *(.rela.rodata) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.ctors : { *(.rel.ctors) }
- .rela.ctors : { *(.rela.ctors) }
- .rel.dtors : { *(.rel.dtors) }
- .rela.dtors : { *(.rela.dtors) }
- .rel.bss : { *(.rel.bss) }
- .rela.bss : { *(.rela.bss) }
- .rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
- .init : { *(.init) } =0
- .plt : { *(.plt) }
- .text :
- {
- *(.text)
- *(.rodata)
- *(.rodata.*)
- *(.rodata1)
- *(.got1)
- }
- .fini : { *(.fini) } =0
- .ctors : { *(.ctors) }
- .dtors : { *(.dtors) }
- _etext = .;
- PROVIDE (etext = .);
- /* Read-write section, merged into data segment: */
- . = (. + 0x0FFF) & 0xFFFFF000;
- .data :
- {
- *(.data)
- *(.data1)
- *(.sdata)
- *(.sdata2)
- *(.got.plt) *(.got)
- *(.dynamic)
- CONSTRUCTORS
- }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- .bss :
- {
- *(.sbss) *(.scommon)
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
-}
-
diff --git a/sys/arch/macppc/stand/boot.mac/fixcoff.c b/sys/arch/macppc/stand/boot.mac/fixcoff.c
deleted file mode 100644
index ba5495c7f6f..00000000000
--- a/sys/arch/macppc/stand/boot.mac/fixcoff.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $OpenBSD: fixcoff.c,v 1.3 2019/09/02 23:40:29 kettenis Exp $ */
-/* $NetBSD: fixcoff.c,v 1.10 2006/04/07 02:34:55 gdamore Exp $ */
-
-/*
- * Copyright (c) 1999 National Aeronautics & Space Administration
- * All rights reserved.
- *
- * This software was written by William Studenmund of the
- * Numerical Aerospace Similation Facility, NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the National Aeronautics & Space Administration
- * nor the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB-
- * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This program fixes up the extended xcoff headers generated when an elf
- * file is turned into an xcoff one with the current objcopy. It should
- * go away someday, when objcopy will correctly fix up the output xcoff
- *
- * Partially inspired by hack-coff, written by Paul Mackerras.
- */
-
-#include <err.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/endian.h>
-
-struct filehdr {
-#define U802WRMAGIC 0730
-#define U802ROMAGIC 0735
-#define U802TOCMAGIC 0737
- char f_magic[2];
- char f_nsect[2];
- char f_time[4];
- char f_symtab[4];
- char f_nsyms[4];
- char f_opthdr[2];
- char f_flags[2];
-};
-
-struct sectionhdr {
- char s_name[8];
- char s_paddr[4];
- char s_vaddr[4];
- char s_size[4];
- char s_section[4];
- char s_reloc[4];
- char s_lineno[4];
- char s_nreloc[2];
- char s_nlineno[2];
- char s_flags[4];
-};
-
-struct aouthdr {
- char magic[2];
- char vstamp[2];
- char tsize[4];
- char dsize[4];
- char bsize[4];
- char entry[4];
- char text_start[4];
- char data_start[4];
-#define SMALL_AOUTSZ 28
- char o_toc[4];
- char o_snentry[2];
- char o_sntext[2];
- char o_sndata[2];
- char o_sntoc[2];
- char o_snloader[2];
- char o_snbss[2];
- char o_algntext[2];
- char o_algndata[2];
- char o_modtype[2];
- char o_cputype[2];
- char o_maxstack[4];
- char o_maxdata[4];
- char o_resv2[12];
-};
-#define RS6K_AOUTHDR_ZMAGIC 0x010B
-
-char *progname;
-
-void
-usage(char *prog)
-{
- fprintf(stderr, "Usage: %s [-h] | [<file to fix>]\n", prog);
-}
-
-void
-help(char *prog)
-{
- fprintf(stderr, "%s\tis designed to fix the xcoff headers in a\n",prog);
- fprintf(stderr,
-"\tbinary generated using objcopy from a non-xcoff source.\n");
- usage(prog);
- exit(0);
-}
-
-int
-main(int argc, char *argv[])
-{
- int fd, i, n, ch;
- struct filehdr fh;
- struct aouthdr aoh;
- struct sectionhdr sh;
-
- progname = argv[0];
- while ((ch = getopt(argc, argv, "h")) != -1)
- switch (ch) {
- case 'h':
- help(progname);
- }
-
- argc -= optind;
- argv += optind;
-
- if (argc != 1) {
- usage(progname);
- exit(1);
- }
-
- if ((fd = open(argv[0], O_RDWR, 0)) == -1)
- err(1, "%s", argv[0]);
-
- /*
- * Make sure it looks like an xcoff file..
- */
- if (read(fd, &fh, sizeof(fh)) != sizeof(fh))
- err(1, "%s reading header", argv[0]);
-
- i = betoh16(*(uint16_t *)fh.f_magic);
- if ((i != U802WRMAGIC) && (i != U802ROMAGIC) && (i != U802TOCMAGIC))
- errx(1, "%s: not a valid xcoff file", argv[0]);
-
- /* Does the AOUT "Optional header" make sense? */
- i = betoh16(*(uint16_t *)fh.f_opthdr);
-
- if (i == SMALL_AOUTSZ)
- errx(1, "%s: file has small \"optional\" header, inappropriate for use with %s", argv[0], progname);
- else if (i != sizeof(aoh))
- errx(1, "%s: invalid \"optional\" header", argv[0]);
-
- if (read(fd, &aoh, i) != i)
- err(1, "%s reading \"optional\" header", argv[0]);
-
- /* Now start filing in the AOUT header */
- *(uint16_t *)aoh.magic = htobe16(RS6K_AOUTHDR_ZMAGIC);
- n = betoh16(*(uint16_t *)fh.f_nsect);
-
- for (i = 0; i < n; i++) {
- if (read(fd, &sh, sizeof(sh)) != sizeof(sh))
- err(1, "%s reading section headers", argv[0]);
- if (strcmp(sh.s_name, ".text") == 0) {
- *(uint16_t *)(aoh.o_snentry) = htobe16(i+1);
- *(uint16_t *)(aoh.o_sntext) = htobe16(i+1);
- } else if (strcmp(sh.s_name, ".data") == 0) {
- *(uint16_t *)(aoh.o_sndata) = htobe16(i+1);
- } else if (strcmp(sh.s_name, ".bss") == 0) {
- *(uint16_t *)(aoh.o_snbss) = htobe16(i+1);
- }
- }
-
- /* now write it out */
- if (pwrite(fd, &aoh, sizeof(aoh), sizeof(struct filehdr)) !=
- sizeof(aoh))
- err(1, "%s writing modified header", argv[0]);
- close(fd);
- exit(0);
-}