From 2cee6da4a145a06fe060ece78434dcc572827076 Mon Sep 17 00:00:00 2001 From: is Date: Tue, 24 Jan 2006 20:04:05 +0000 Subject: [PATCH] provide more space for relocs in the secondary bootblock. Guarantee that relocs and 16 bit pc-relative addressing works. --- sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c b/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c index 50ec5b75fdbf..7366a290578c 100644 --- a/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c +++ b/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c @@ -1,7 +1,7 @@ -/* $NetBSD: elf2bb.c,v 1.11 2005/12/11 12:16:36 christos Exp $ */ +/* $NetBSD: elf2bb.c,v 1.12 2006/01/24 20:04:05 is Exp $ */ /*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. + * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -206,7 +206,14 @@ main(int argc, char *argv[]) dprintf(("%d relocs\n", trsz/12)); if (sumsize == 0) { - bbsize = (tsz + dsz + bsz + 511) & ~511; + /* + * XXX overly cautious, but this guarantees that 16bit + * pc offsets and our relocs always work. + */ + bbsize = 32768; + if (bbsize < (tsz + dsz + bsz)) { + err(1, "%s: too big.", argv[0]); + } sumsize = bbsize / 512; }