Toolchain upgrade and portability improvements.
upgrade to NetBSD CVS release from 2012/10/17 12:00:00 UTC Makefiles updates to imporve portability Made sure to be consistent in the usage of braces/parenthesis at least on a per file basis. For variables, it is recommended to continue to use braces.
This commit is contained in:
@@ -11,10 +11,7 @@ BRANDING?= \
|
||||
--with-bugurl="http://www.NetBSD.org/support/send-pr.html" \
|
||||
--with-lib-path="=/usr/lib" --with-sysroot
|
||||
|
||||
# LSC FIXME: We are now using the triple i386-elf-minix instead of
|
||||
# elf32-i386-minix which is the correct one for us...
|
||||
CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} --disable-nls \
|
||||
--target=${MACHINE_ARCH}-elf-minix \
|
||||
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
|
||||
--disable-werror \
|
||||
${BRANDING}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
$NetBSD: patch-aa,v 1.3 2006/01/07 23:59:46 wiz Exp $
|
||||
|
||||
--- configure.orig Thu Apr 6 21:49:25 2006
|
||||
+++ configure
|
||||
@@ -899,7 +899,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline
|
||||
# know that we are building the simulator.
|
||||
# binutils, gas and ld appear in that order because it makes sense to run
|
||||
# "make check" in that particular order.
|
||||
-host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
|
||||
+host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
|
||||
|
||||
# libgcj represents the runtime libraries only used by gcj.
|
||||
libgcj="target-libffi \
|
||||
@@ -1,34 +0,0 @@
|
||||
$NetBSD: patch-ab,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- bfd/configure.orig Fri Jun 23 18:17:03 2006
|
||||
+++ bfd/configure
|
||||
@@ -11499,7 +11499,7 @@ if test "${target}" = "${host}"; then
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
COREFILE=''
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
@@ -13097,6 +13097,7 @@ do
|
||||
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
+ bfd_elf32_i386_dragonfly_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
|
||||
@@ -13218,10 +13219,12 @@ do
|
||||
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
|
||||
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
|
||||
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
+ i386dragonfly_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
|
||||
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
|
||||
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
|
||||
i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;;
|
||||
+ bfd_elf32_i386_minix_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
i386msdos_vec) tb="$tb i386msdos.lo" ;;
|
||||
i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;;
|
||||
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
|
||||
@@ -1,23 +0,0 @@
|
||||
$NetBSD: patch-ac,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- bfd/config.bfd.orig Wed Apr 5 12:41:57 2006
|
||||
+++ bfd/config.bfd
|
||||
@@ -503,7 +503,7 @@ case "${targ}" in
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
targ_defvec=bfd_elf32_i386_freebsd_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
|
||||
@@ -611,6 +611,9 @@ case "${targ}" in
|
||||
;;
|
||||
i[3-7]86-none-*)
|
||||
targ_defvec=i386coff_vec
|
||||
+ ;;
|
||||
+ i[3-7]86-*-minix)
|
||||
+ targ_defvec=bfd_elf32_i386_minix_vec
|
||||
;;
|
||||
i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
|
||||
targ_defvec=i386aout_vec
|
||||
@@ -1,29 +0,0 @@
|
||||
$NetBSD: patch-ad,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- gas/configure.tgt.orig Wed Apr 5 12:41:57 2006
|
||||
+++ gas/configure.tgt
|
||||
@@ -191,7 +191,7 @@ case ${generic_target} in
|
||||
i386-*-freebsdaout*) fmt=aout em=386bsd ;;
|
||||
i386-*-freebsd[12].*) fmt=aout em=386bsd ;;
|
||||
i386-*-freebsd[12]) fmt=aout em=386bsd ;;
|
||||
- i386-*-freebsd* | i386-*-kfreebsd*-gnu)
|
||||
+ i386-*-freebsd* | i386-*-kfreebsd*-gnu | i386-*-dragonfly*)
|
||||
fmt=elf em=freebsd ;;
|
||||
i386-*-sysv*) fmt=coff ;;
|
||||
i386-*-sco3.2v5*coff) fmt=coff ;;
|
||||
@@ -213,6 +213,7 @@ case ${generic_target} in
|
||||
i386-*-nto-qnx*) fmt=elf ;;
|
||||
i386-*-*nt*) fmt=coff em=pe ;;
|
||||
i386-*-chaos) fmt=elf ;;
|
||||
+ i386-*-minix*) fmt=elf em=minix ;;
|
||||
i386-*-rdos*) fmt=elf ;;
|
||||
|
||||
i860-*-*) fmt=elf endian=little ;;
|
||||
@@ -382,6 +384,7 @@ case ${generic_target} in
|
||||
|
||||
*-*-aout | *-*-scout) fmt=aout ;;
|
||||
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
|
||||
+ *-*-dragonfly*) fmt=elf em=freebsd ;;
|
||||
*-*-bsd*) fmt=aout em=sun3 ;;
|
||||
*-*-generic) fmt=generic ;;
|
||||
*-*-xray | *-*-hms) fmt=coff ;;
|
||||
@@ -1,33 +0,0 @@
|
||||
$NetBSD: patch-ae,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- ld/configure.tgt.orig Wed Apr 5 12:41:57 2006
|
||||
+++ ld/configure.tgt
|
||||
@@ -145,6 +145,8 @@ i[3-7]86-*-bsd) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-bsd386) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-bsdi*) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-aout) targ_emul=i386aout ;;
|
||||
+i[3-7]86-*-minix) targ_emul=elf_i386_minix
|
||||
+ targ_extra_emuls="elf_i386" ;;
|
||||
i[3-7]86-*-linux*aout*) targ_emul=i386linux
|
||||
targ_extra_emuls=elf_i386
|
||||
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` ;;
|
||||
@@ -194,7 +197,7 @@ x86_64-*-elf*) targ_emul=elf_x86_64
|
||||
i[3-7]86-*-kaos*) targ_emul=elf_i386 ;;
|
||||
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
|
||||
targ_emul=i386bsd ;;
|
||||
-i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
targ_emul=elf_i386_fbsd
|
||||
targ_extra_emuls="elf_i386 i386bsd" ;;
|
||||
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
|
||||
@@ -583,6 +586,10 @@ case "${target}" in
|
||||
|
||||
*-*-freebsd*)
|
||||
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
|
||||
+ ;;
|
||||
+
|
||||
+*-*-dragonfly*)
|
||||
+ NATIVE_LIB_DIRS='/lib /usr/lib'
|
||||
;;
|
||||
|
||||
hppa*64*-*-hpux11*)
|
||||
@@ -1,94 +0,0 @@
|
||||
$NetBSD: patch-af,v 1.1 2007/08/14 09:08:07 rillig Exp $
|
||||
|
||||
--- gas/read.c.orig 2005-11-17 07:29:28.000000000 +0000
|
||||
+++ gas/read.c
|
||||
@@ -1279,7 +1279,7 @@ s_align (int arg, int bytes_p)
|
||||
unsigned int align_limit = ALIGN_LIMIT;
|
||||
unsigned int align;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
offsetT fill = 0;
|
||||
int max;
|
||||
int fill_p;
|
||||
@@ -1423,7 +1423,7 @@ s_comm_internal (int param,
|
||||
offsetT temp, size;
|
||||
symbolS *symbolP = NULL;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0'; /* XXX: gcc -Wuninitialized */
|
||||
expressionS exp;
|
||||
|
||||
if (flag_mri)
|
||||
@@ -1538,7 +1538,7 @@ s_mri_common (int small ATTRIBUTE_UNUSED
|
||||
symbolS *sym;
|
||||
offsetT align;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (!flag_mri)
|
||||
{
|
||||
@@ -1807,7 +1807,7 @@ s_fail (int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
offsetT temp;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -1929,7 +1929,7 @@ s_globl (int ignore ATTRIBUTE_UNUSED)
|
||||
int c;
|
||||
symbolS *symbolP;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -2881,7 +2881,7 @@ s_space (int mult)
|
||||
expressionS val;
|
||||
char *p = 0;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
int bytes;
|
||||
|
||||
#ifdef md_flush_pending_output
|
||||
@@ -3057,7 +3057,7 @@ s_float_space (int float_type)
|
||||
int flen;
|
||||
char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -3134,7 +3134,7 @@ void
|
||||
s_struct (int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -3514,7 +3514,7 @@ cons_worker (register int nbytes, /* 1=.
|
||||
int c;
|
||||
expressionS exp;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
#ifdef md_flush_pending_output
|
||||
md_flush_pending_output ();
|
||||
@@ -5010,7 +5010,7 @@ void
|
||||
equals (char *sym_name, int reassign)
|
||||
{
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
input_line_pointer++;
|
||||
if (*input_line_pointer == '=')
|
||||
@@ -1,21 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- bfd/aoutx.h.orig Thu Mar 16 12:20:15 2006
|
||||
+++ bfd/aoutx.h
|
||||
@@ -383,6 +383,7 @@ DESCRIPTION
|
||||
Swap the information in an internal exec header structure
|
||||
@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
|
||||
*/
|
||||
+#ifndef NAME_swap_exec_header_out
|
||||
void
|
||||
NAME (aout, swap_exec_header_out) (bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
@@ -398,6 +399,8 @@ NAME (aout, swap_exec_header_out) (bfd *abfd,
|
||||
PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
|
||||
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
|
||||
}
|
||||
+#define NAME_swap_exec_header_out NAME(aout,swap_exec_header_out)
|
||||
+#endif
|
||||
|
||||
/* Make all the section for an a.out file. */
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- bfd/elf32-i386.c.orig Sat Apr 8 22:57:22 2006
|
||||
+++ bfd/elf32-i386.c
|
||||
@@ -3922,6 +3922,11 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
|
||||
#undef TARGET_LITTLE_NAME
|
||||
#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
|
||||
|
||||
+#undef TARGET_LITTLE_SYM
|
||||
+#define TARGET_LITTLE_SYM bfd_elf32_i386_minix_vec
|
||||
+#undef TARGET_LITTLE_NAME
|
||||
+#define TARGET_LITTLE_NAME "elf32-i386-minix"
|
||||
+
|
||||
/* The kernel recognizes executables as valid only if they carry a
|
||||
"FreeBSD" label in the ELF header. So we put this label on all
|
||||
executables and (for simplicity) also all other object files. */
|
||||
@@ -3946,6 +3951,11 @@ elf_i386_post_process_headers (bfd *abfd,
|
||||
#define elf_backend_post_process_headers elf_i386_post_process_headers
|
||||
#undef elf32_bed
|
||||
#define elf32_bed elf32_i386_fbsd_bed
|
||||
+
|
||||
+#undef elf_backend_post_process_headers
|
||||
+#define elf_backend_post_process_headers elf_i386_post_process_headers
|
||||
+#undef elf32_bed
|
||||
+#define elf32_bed elf32_i386_minix_bed
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
||||
@@ -1,330 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- bfd/i386minix.c.orig Sat Feb 26 00:58:30 2011
|
||||
+++ bfd/i386minix.c
|
||||
@@ -0,0 +1,325 @@
|
||||
+/* BFD back-end for i386 minix a.out binaries.
|
||||
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003
|
||||
+ Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of BFD, the Binary File Descriptor library.
|
||||
+
|
||||
+This program is free software; you can redistribute it and/or modify
|
||||
+it under the terms of the GNU General Public License as published by
|
||||
+the Free Software Foundation; either version 2 of the License, or
|
||||
+(at your option) any later version.
|
||||
+
|
||||
+This program is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with this program; if not, write to the Free Software
|
||||
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/***************/
|
||||
+/* EXEC FORMAT */
|
||||
+/***************/
|
||||
+#include <a.out.h>
|
||||
+
|
||||
+#define external_exec exec
|
||||
+#define EXEC_BYTES_SIZE sizeof( struct exec )
|
||||
+
|
||||
+#define OMAGIC 0407 /* Object file or impure executable. */
|
||||
+#define NMAGIC 0410 /* Code indicating pure executable. */
|
||||
+#define ZMAGIC 0x0301 /* Code indicating demand-paged executable. */
|
||||
+#define BMAGIC 0415 /* Used by a b.out object. */
|
||||
+
|
||||
+#ifndef QMAGIC
|
||||
+#define QMAGIC 0314
|
||||
+#endif
|
||||
+# ifndef N_BADMAG
|
||||
+# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
||||
+ && N_MAGIC(x) != NMAGIC \
|
||||
+ && N_MAGIC(x) != ZMAGIC \
|
||||
+ && N_MAGIC(x) != QMAGIC)
|
||||
+# endif /* N_BADMAG */
|
||||
+
|
||||
+#define N_HEADER_IN_TEXT(x) 0
|
||||
+
|
||||
+#define N_TXTOFF(x) EXEC_BYTES_SIZE
|
||||
+#define N_TXTADDR(x) 0
|
||||
+
|
||||
+#define N_TXTSIZE(x) ((x).a_text)
|
||||
+#ifdef SUPPORT_SEP
|
||||
+#define MINIX_IS_SEP(x) 0 /*-> gcv.c HCLICK STUFF*/
|
||||
+#define N_DATADDR(x) (MINIX_IS_SEP(x) ? align((x).a_text,HCLICK) : (x).a_text )
|
||||
+#else
|
||||
+#define N_DATADDR(x) ((x).a_text)
|
||||
+#endif
|
||||
+
|
||||
+/* Are these values correct? */
|
||||
+#define TARGET_PAGE_SIZE 1
|
||||
+#define SEGMENT_SIZE 1
|
||||
+
|
||||
+#define DEFAULT_STACK 5 * 1024 * 1024 /* 5 MB stack */
|
||||
+
|
||||
+#define DEFAULT_ARCH bfd_arch_i386
|
||||
+
|
||||
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
||||
+ remove whitespace added here, and thus will fail to concatenate
|
||||
+ the tokens. */
|
||||
+#define MY(OP) CONCAT2 (i386minix_,OP)
|
||||
+#define NAME(a,b) i386minix_32_##b
|
||||
+#define TARGETNAME "a.out-i386-minix"
|
||||
+#define NO_WRITE_HEADER_KLUDGE 1
|
||||
+
|
||||
+#define ARCH_SIZE 32
|
||||
+
|
||||
+#include "bfd.h"
|
||||
+#include "sysdep.h"
|
||||
+/*#include "libbfd.h"*/
|
||||
+#include "aout/aout64.h"
|
||||
+#include "libaout.h"
|
||||
+
|
||||
+
|
||||
+#define i386minix_32_get_section_contents _bfd_generic_get_section_contents
|
||||
+
|
||||
+#define SET_ARCH_MACH(abfd, exec) \
|
||||
+ bfd_set_arch_mach(abfd, DEFAULT_ARCH, 0)
|
||||
+
|
||||
+static bfd_boolean i386minix_write_object_contents PARAMS ((bfd *));
|
||||
+#define MY_write_object_contents i386minix_write_object_contents
|
||||
+
|
||||
+static int MY(swap_exec_header_in) PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
|
||||
+static void MY(swap_exec_header_out) PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
|
||||
+
|
||||
+#define NAME_swap_exec_header_in MY(swap_exec_header_in)
|
||||
+#define NAME_swap_exec_header_out MY(swap_exec_header_out)
|
||||
+
|
||||
+#define MY_object_p MY(object_p)
|
||||
+static const bfd_target * MY(object_p) (bfd *);
|
||||
+
|
||||
+
|
||||
+static bfd_boolean MY (set_sizes) PARAMS ((bfd *));
|
||||
+
|
||||
+#define MY_backend_data &MY(backend_data)
|
||||
+static const struct aout_backend_data MY(backend_data) = {
|
||||
+ 0, /* zmagic contiguous */
|
||||
+ 1, /* text incl header */
|
||||
+ 0, /* entry is text address */
|
||||
+ 0, /* exec_hdr_flags */
|
||||
+ 0, /* text vma? */
|
||||
+ MY(set_sizes),
|
||||
+ 1, /* exec header not counted */
|
||||
+ 0, /* add_dynamic_symbols */
|
||||
+ 0, /* add_one_symbol */
|
||||
+ 0, /* link_dynamic_object */
|
||||
+ 0, /* write_dynamic_symbol */
|
||||
+ 0, /* check_dynamic_reloc */
|
||||
+ 0 /* finish_dynamic_link */
|
||||
+};
|
||||
+
|
||||
+#include "aoutx.h"
|
||||
+
|
||||
+#include "aout-target.h"
|
||||
+
|
||||
+/****************/
|
||||
+/* WRITE HEADER */
|
||||
+/****************/
|
||||
+static void
|
||||
+MY(swap_exec_header_out) (abfd, execp, bytes)
|
||||
+ bfd *abfd;
|
||||
+ struct internal_exec *execp;
|
||||
+ struct external_exec *bytes;
|
||||
+{
|
||||
+ int total;
|
||||
+ int stack;
|
||||
+
|
||||
+ /* Now fill in fields in the raw data, from the fields in the exec struct. */
|
||||
+ H_PUT_16 (abfd, N_MAGIC(*execp), bytes->a_magic);
|
||||
+
|
||||
+ bytes->a_flags = 0;
|
||||
+ if ( bytes->a_syms )
|
||||
+ bytes->a_flags |= A_NSYM;
|
||||
+
|
||||
+ bytes->a_cpu = A_I80386;
|
||||
+
|
||||
+ bytes->a_hdrlen = EXEC_BYTES_SIZE;
|
||||
+
|
||||
+ bytes->a_unused = 0;
|
||||
+ bytes->a_version = 0;
|
||||
+
|
||||
+ PUT_WORD (abfd, execp->a_text , &bytes->a_text);
|
||||
+ PUT_WORD (abfd, execp->a_data , &bytes->a_data);
|
||||
+ PUT_WORD (abfd, execp->a_bss , &bytes->a_bss);
|
||||
+ PUT_WORD (abfd, execp->a_entry , &bytes->a_entry);
|
||||
+
|
||||
+ stack = DEFAULT_STACK;
|
||||
+ total = execp->a_data + execp->a_bss + stack;
|
||||
+#if 0
|
||||
+ if ( MINIX_IS_SEP( abfd ) )
|
||||
+ bytes->a_flags |= A_SEP;
|
||||
+ else
|
||||
+#endif
|
||||
+ total += execp->a_text;
|
||||
+
|
||||
+ PUT_WORD (abfd, total , &bytes->a_total);
|
||||
+ PUT_WORD (abfd, execp->a_syms , &bytes->a_syms);
|
||||
+ PUT_WORD (abfd, execp->a_trsize, &bytes->a_trsize);
|
||||
+ PUT_WORD (abfd, execp->a_drsize, &bytes->a_drsize);
|
||||
+
|
||||
+ bytes->a_tbase = bytes->a_dbase = 0;
|
||||
+}
|
||||
+
|
||||
+#define i386minix_32_swap_exec_header_out MY(swap_exec_header_out)
|
||||
+/* WRITE_HEADERS calls NAME(aout,swap_exec_header_out)
|
||||
+ which I need to overwrite. Unfortunately aoutx.h doesn't have a
|
||||
+ NAME_swap_exec_header_out like it does for -_in.
|
||||
+ So I have to redefine the outcome of NAME(aout,swap_exec_header_out) to
|
||||
+ my own function before using WRITE_HEADERS */
|
||||
+
|
||||
+/* Set the machine type correctly. */
|
||||
+static bfd_boolean
|
||||
+i386minix_write_object_contents (abfd)
|
||||
+ bfd *abfd;
|
||||
+{
|
||||
+ struct external_exec exec_bytes;
|
||||
+ struct internal_exec *execp = exec_hdr (abfd);
|
||||
+
|
||||
+ N_SET_MACHTYPE (*execp, M_386);
|
||||
+
|
||||
+ obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
+
|
||||
+ WRITE_HEADERS (abfd, execp);
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+/* undo renaming to be able to include aoutx.h */
|
||||
+#undef i386minix_32_swap_exec_header_out
|
||||
+
|
||||
+/***************/
|
||||
+/* READ HEADER */
|
||||
+/***************/
|
||||
+/* define if aoutx.h is included: */
|
||||
+/* UNTRUE: but including it generates a conflict with swap_exe_header_out, so don't include it */
|
||||
+
|
||||
+/* return -1 if header is wrong
|
||||
+ * otherwise return the bytes left to read */
|
||||
+static int
|
||||
+MY(swap_exec_header_in) (abfd, bytes, execp)
|
||||
+ bfd *abfd;
|
||||
+ struct external_exec *bytes;
|
||||
+ struct internal_exec *execp;
|
||||
+{
|
||||
+ /* The internal_exec structure has some fields that are unused in this
|
||||
+ configuration (IE for i960), so ensure that all such uninitialized
|
||||
+ fields are zero'd out. There are places where two of these structs
|
||||
+ are memcmp'd, and thus the contents do matter. */
|
||||
+ memset ((PTR) execp, 0, sizeof (struct internal_exec));
|
||||
+ /* Now fill in fields in the execp, from the bytes in the raw data. */
|
||||
+
|
||||
+ /*fill a_info*/
|
||||
+ N_SET_MAGIC(*execp, H_GET_16 (abfd, bytes->a_magic));
|
||||
+ N_SET_MACHTYPE(*execp, M_386);
|
||||
+ N_SET_FLAGS(*execp, 0);
|
||||
+
|
||||
+ /*check integrity*/
|
||||
+ if ( N_BADMAG( *execp ) )
|
||||
+ return -1;
|
||||
+
|
||||
+ if ( bytes->a_cpu != A_I80386 )
|
||||
+ return -1;
|
||||
+
|
||||
+ if ( bytes->a_hdrlen < A_MINHDR )
|
||||
+ return -1;
|
||||
+
|
||||
+#if 0
|
||||
+ if ( bytes->a_flags & A_SEP )
|
||||
+ dosomething();
|
||||
+#endif
|
||||
+
|
||||
+ /*fill the rest*/
|
||||
+ execp->a_text = GET_WORD (abfd, &bytes->a_text);
|
||||
+ execp->a_data = GET_WORD (abfd, &bytes->a_data);
|
||||
+ execp->a_bss = GET_WORD (abfd, &bytes->a_bss);
|
||||
+ execp->a_syms = GET_WORD (abfd, &bytes->a_syms);
|
||||
+ execp->a_entry = GET_WORD (abfd, &bytes->a_entry);
|
||||
+
|
||||
+ if ( bytes->a_hdrlen < A_MINHDR + 2 * sizeof(long) )
|
||||
+ return bytes->a_hdrlen - A_MINHDR;
|
||||
+
|
||||
+ if (bfd_bread (&bytes->a_trsize, 2 * sizeof(long), abfd) != 2 * sizeof(long))
|
||||
+ return -1;
|
||||
+
|
||||
+ execp->a_trsize = GET_WORD (abfd, &bytes->a_trsize);
|
||||
+ execp->a_drsize = GET_WORD (abfd, &bytes->a_drsize);
|
||||
+
|
||||
+ bfd_seek (abfd, -2 * sizeof(long), SEEK_CUR);
|
||||
+
|
||||
+ /*store other fields of external_exec?*/
|
||||
+ return bytes->a_hdrlen - A_MINHDR;
|
||||
+}
|
||||
+
|
||||
+static const bfd_target *
|
||||
+MY(object_p) (abfd)
|
||||
+ bfd *abfd;
|
||||
+{
|
||||
+ struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
+ struct internal_exec exec; /* Cleaned-up exec header */
|
||||
+ const bfd_target *target;
|
||||
+ int left;
|
||||
+ bfd_size_type amt = A_MINHDR;
|
||||
+
|
||||
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
|
||||
+ {
|
||||
+ if (bfd_get_error () != bfd_error_system_call)
|
||||
+ bfd_set_error (bfd_error_wrong_format);
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* let MY(swap_exec_header_in) check the header */
|
||||
+ if ( (left = MY(swap_exec_header_in) (abfd, &exec_bytes, &exec)) == -1 )
|
||||
+ {
|
||||
+ /* incorrect header */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* skip rest of header */
|
||||
+ if ( bfd_seek( abfd, left, SEEK_CUR ) )
|
||||
+ return 0;
|
||||
+
|
||||
+ target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
|
||||
+
|
||||
+ int adjust = (A_MINHDR + left) - EXEC_BYTES_SIZE;
|
||||
+
|
||||
+ /* adjust file positions with the bytes left to be read from the header */
|
||||
+ obj_textsec (abfd)->filepos += adjust;
|
||||
+ obj_datasec (abfd)->filepos += adjust;
|
||||
+
|
||||
+ obj_textsec (abfd)->rel_filepos += adjust;
|
||||
+ obj_datasec (abfd)->rel_filepos += adjust;
|
||||
+
|
||||
+ obj_sym_filepos (abfd) += adjust;
|
||||
+ obj_str_filepos (abfd) += adjust;
|
||||
+
|
||||
+ adata(abfd).exec_bytes_size = A_MINHDR + left;
|
||||
+
|
||||
+#ifdef ENTRY_CAN_BE_ZERO
|
||||
+ /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
|
||||
+ * means that it isn't obvious if EXEC_P should be set.
|
||||
+ * All of the following must be true for an executable:
|
||||
+ * There must be no relocations, the bfd can be neither an
|
||||
+ * archive nor an archive element, and the file must be executable. */
|
||||
+
|
||||
+ if (exec.a_trsize + exec.a_drsize == 0
|
||||
+ && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
|
||||
+ {
|
||||
+ struct stat buf;
|
||||
+#ifndef S_IXUSR
|
||||
+#define S_IXUSR 0100 /* Execute by owner. */
|
||||
+#endif
|
||||
+ if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
|
||||
+ abfd->flags |= EXEC_P;
|
||||
+ }
|
||||
+#endif /* ENTRY_CAN_BE_ZERO */
|
||||
+
|
||||
+ return target;
|
||||
+}
|
||||
@@ -1,12 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- bfd/targets.c.orig Wed Apr 5 12:41:57 2006
|
||||
+++ bfd/targets.c
|
||||
@@ -696,6 +696,7 @@ extern const bfd_target i386linux_vec;
|
||||
extern const bfd_target i386lynx_aout_vec;
|
||||
extern const bfd_target i386lynx_coff_vec;
|
||||
extern const bfd_target i386mach3_vec;
|
||||
+extern const bfd_target bfd_elf32_i386_minix_vec;
|
||||
extern const bfd_target i386msdos_vec;
|
||||
extern const bfd_target i386netbsd_vec;
|
||||
extern const bfd_target i386os9k_vec;
|
||||
@@ -1,13 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- config.guess.orig Mon Jan 16 17:34:37 2006
|
||||
+++ config.guess
|
||||
@@ -820,7 +820,7 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
- echo ${UNAME_MACHINE}-pc-minix
|
||||
+ echo i386-pc-minix
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
@@ -1,15 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- gas/config/tc-i386.h.orig Mon Feb 27 15:35:37 2006
|
||||
+++ gas/config/tc-i386.h
|
||||
@@ -59,6 +59,10 @@ extern unsigned long i386_mach (void);
|
||||
#define ELF_TARGET_FORMAT "elf32-i386-vxworks"
|
||||
#endif
|
||||
|
||||
+#ifdef TE_MINIX
|
||||
+#define ELF_TARGET_FORMAT "elf32-i386-minix"
|
||||
+#endif
|
||||
+
|
||||
#ifndef ELF_TARGET_FORMAT
|
||||
#define ELF_TARGET_FORMAT "elf32-i386"
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- gas/config/te-minix.h.orig Sat Feb 26 00:58:30 2011
|
||||
+++ gas/config/te-minix.h
|
||||
@@ -0,0 +1,11 @@
|
||||
+#define TE_MINIX 1
|
||||
+
|
||||
+/* Added these, because if we don't know what we're targeting we may
|
||||
+ need an assembler version of libgcc, and that will use local
|
||||
+ labels. */
|
||||
+#define LOCAL_LABELS_DOLLAR 1
|
||||
+#define LOCAL_LABELS_FB 1
|
||||
+
|
||||
+#define ELF_TARGET_FORMAT "elf32-i386-minix"
|
||||
+
|
||||
+#include "obj-format.h"
|
||||
@@ -1,15 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- gas/configure.orig Thu Apr 6 21:49:31 2006
|
||||
+++ gas/configure
|
||||
@@ -3370,6 +3370,10 @@ freebsd* | kfreebsd*-gnu)
|
||||
fi
|
||||
;;
|
||||
|
||||
+minix*)
|
||||
+ lt_cv_deplibs_check_method=pass_all
|
||||
+ ;;
|
||||
+
|
||||
gnu*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
@@ -1,23 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- ld/Makefile.in.orig Sat Jun 3 04:45:50 2006
|
||||
+++ ld/Makefile.in
|
||||
@@ -458,6 +458,7 @@ ALL_EMULATIONS = \
|
||||
ei386linux.o \
|
||||
ei386lynx.o \
|
||||
ei386mach.o \
|
||||
+ eelf_i386_minix.o \
|
||||
ei386moss.o \
|
||||
ei386msdos.o \
|
||||
ei386nbsd.o \
|
||||
@@ -1862,6 +1864,10 @@ ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \
|
||||
ei386mach.c: $(srcdir)/emulparams/i386mach.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386mach "$(tdir_i386mach)"
|
||||
+eelf_i386_minix.c: $(srcdir)/emulparams/elf_i386_minix.sh \
|
||||
+ $(srcdir)/emulparams/elf_i386.sh \
|
||||
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
+ ${GENSCRIPTS} elf_i386_minix "$(tdir_elf_i386_minix)"
|
||||
ei386moss.c: $(srcdir)/emulparams/i386moss.sh \
|
||||
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386moss "$(tdir_i386moss)"
|
||||
@@ -1,8 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/elf_i386_minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/elf_i386_minix.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+. ${srcdir}/emulparams/elf_i386.sh
|
||||
+. ${srcdir}/emulparams/elf_minix.sh
|
||||
+OUTPUT_FORMAT="elf32-i386-minix"
|
||||
@@ -1,6 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/elf_minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/elf_minix.sh
|
||||
@@ -0,0 +1 @@
|
||||
+ELF_INTERPRETER_NAME=\"/usr/libexec/ld-elf.so.1\"
|
||||
@@ -1,11 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/i386minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/i386minix.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+SCRIPT_NAME=aout
|
||||
+OUTPUT_FORMAT="a.out-i386-minix"
|
||||
+TARGET_PAGE_SIZE=1
|
||||
+TEXT_START_ADDR=0
|
||||
+NONPAGED_TEXT_START_ADDR=0
|
||||
+ARCH=i386
|
||||
@@ -1,16 +0,0 @@
|
||||
$NetBSD$
|
||||
|
||||
Fix build with gcc-4.5.
|
||||
|
||||
--- gas/app.c.orig 2006-03-10 10:57:18.000000000 +0000
|
||||
+++ gas/app.c
|
||||
@@ -563,7 +563,8 @@ do_scrub_chars (int (*get) (char *, int)
|
||||
{
|
||||
as_warn (_("end of file in string; '%c' inserted"), quotechar);
|
||||
state = old_state;
|
||||
- UNGET ('\n');
|
||||
+ if (from > input_buffer)
|
||||
+ UNGET ('\n');
|
||||
PUT (quotechar);
|
||||
}
|
||||
else if (ch == quotechar)
|
||||
Reference in New Issue
Block a user