home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-14 | 130.8 KB | 4,702 lines |
- diff -rc --new-file binutils-1.8.x-base/Makefile binutils-1.8.x/Makefile
- *** binutils-1.8.x-base/Makefile Wed Nov 27 22:48:58 1991
- --- binutils-1.8.x/Makefile Thu Jan 1 00:00:00 1970
- ***************
- *** 1,150 ****
- - # Makefile for GNU binary-file utilities
- - # select a set of CFLAGS and PROGS, below, depending on the system type
- - # Copyright (C) 1989, Free Software Foundation, Inc.
- - #
- - # This file is part of the GNU binutils.
- - #
- - # The GNU binutils are free software; you can redistribute them and/or modify
- - # them under the terms of the GNU General Public License as published by
- - # the Free Software Foundation; either version 1, or (at your option)
- - # any later version.
- - #
- - # The GNU binutils are distributed in the hope that they 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 the GNU binutils; see the file COPYING. If not, write to
- - # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- -
- -
- - GNUCC = gcc -O
- - #CC = gcc -O
- - bindir=/usr/local/bin
- -
- - # for BSD systems
- - #CFLAGS = -g
- - # Don't add robotussin; it won't compile on BSD or GNU systems.
- - # objdump is not here because it (at least used to) not compile
- - # on most systems (trouble with N_DATADDR). I've fixed some of
- - # those problems, though.
- - PROGS = $(archpfx)gprof $(archpfx)ld $(archpfx)size \
- - $(archpfx)nm $(archpfx)strip $(archpfx)ar $(archpfx)ranlib
- -
- - # for USG systems using COFF_ENCAPSULATE
- - # also, you will want to make the target libc.a (but it takes a long time)
- - # Note that you should leave a copy of `ar' in this directory
- - # after you install it, since `ranlib' will try to run it from here.
- - CFLAGS = -DWYSE -DUSG -DCOFF_ENCAPSULATE -DPORTAR -DNON_NATIVE -DPIGNAL_MISSING
- - PROGS = ld size nm strip ar robotussin objdump ranlib gprof
- - SIGNAME = signame.o
- - # On ALTOS systems, add -DALTOS to CFLAGS.
- -
- - #it's better to move a copy of alloca into your libc than to risk getting some
- - #incompatiable functions from -lPW (like index()), but if you
- - #want to be lazy, uncomment this line
- - ALLOCALIBS = -lPW
- -
- - # For HP-UX systems
- - # Don't add robotussin; use hpxt instead.
- - # Note that you should leave a copy of `ar' in this directory
- - # after you install it, since `ranlib' will try to run it from here.
- - #CFLAGS = -g -Ihp-include -DUSG -DNON_NATIVE
- - #PROGS = ld size nm strip ar ranlib
- - #ALLOCALIBS = alloca.o
- -
- - # For the NeXT:
- - # Set GNUCC = cc
- - # Add -DHAVE_VPRINTF -DMACH_O to CFLAGS.
- - # Comment out MALLOC below to use the system's malloc().
- -
- - # Sun386:
- - # After applying these diffs, compile with -DPORTAR -DCOFF_ENCAPSULATE
- - # Depending on how you configure gcc, you might also want -Dnounderscore,
- - # though I did not wind up using it.
- -
- - # If you run out of stack space while running GNU ar or GNU ld (this
- - # manifests itself as a segment violation), you should link in alloca.c
- - # from the gcc sources, and get rid of the "#define alloca" in ar.c and
- - # ld.c; or you could try to get Sun to fix this annoying "feature".
- - #CFLAGS = -g -DCOFF_ENCAPSULATE -DPORTAR
- - #PROGS = ld size nm strip ar robotussin objdump ranlib gprof
- -
- - # nm tries to malloc enough space for the string table. The old GNU malloc
- - # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
- - # fail unnecessarily. I've also seen some unix malloc's fail, even when
- - # there is enough memory. So use the new GNU malloc.
- - #MALLOC = $(archpfx)gmalloc.o
- -
- - GNU_GETOPT = $(archpfx)getopt.o
- - GNU_GETOPT_LONG = $(archpfx)getopt.o $(archpfx)getopt1.o
- -
- - # C++ demangler
- - CPLUS_DEM = $(archpfx)cplus-dem.o
- -
- - LIBS=$(MALLOC) $(ALLOCALIBS) $(SIGNAME)
- -
- - all: $(PROGS)
- -
- - $(archpfx)ld: $(archpfx)ld.o $(GNU_GETOPT_LONG) $(CPLUS_DEM)
- - # LIBS is used here since ld needs to use alloca.
- - # Alternatively, compile it with GNU C--then the compiler handles alloca.
- - $(CC) $(CFLAGS) -o $(archpfx)ld $(archpfx)ld.o $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS)
- -
- - $(archpfx)size: $(archpfx)size.o
- - $(CC) $(CFLAGS) -o $(archpfx)size $(archpfx)size.o
- -
- - $(archpfx)nm: $(archpfx)nm.o $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(MALLOC)
- - $(CC) $(CFLAGS) -o $(archpfx)nm $(archpfx)nm.o \
- - $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS) $(MALLOC)
- -
- - $(archpfx)strip: $(archpfx)strip.o $(GNU_GETOPT_LONG)
- - $(CC) $(CFLAGS) -o $(archpfx)strip $(archpfx)strip.o $(GNU_GETOPT_LONG) $(LIBS)
- -
- - $(archpfx)ar: $(archpfx)ar.o
- - $(CC) $(CFLAGS) -o $(archpfx)ar $(archpfx)ar.o $(LIBS)
- -
- - $(archpfx)gprof: $(archpfx)gprof.o $(GNU_GETOPT_LONG) $(CPLUS_DEM)
- - $(GNUCC) $(CFLAGS) -o $(archpfx)gprof $(archpfx)gprof.o \
- - $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS)
- - $(archpfx)gprof.o: gprof.c gmon.h
- - $(GNUCC) $(CFLAGS) -c gprof.c $(OUTPUT_OPTION)
- -
- - $(archpfx)ranlib: $(archpfx)ranlib.o $(GNU_GETOPT_LONG)
- - $(CC) $(CFLAGS) -o $(archpfx)ranlib $(archpfx)ranlib.o $(GNU_GETOPT_LONG) $(LIBS)
- - $(archpfx)ranlib.o: ranlib.c
- - $(CC) -c $(CFLAGS) -DAR_PROG=\"/usr/local/gnu/binutils/ar\" ranlib.c $(OUTPUT_OPTION)
- -
- - $(archpfx)objdump: $(archpfx)objdump.o $(GNU_GETOPT_LONG) a.out.gnu.h
- - $(CC) $(CFLAGS) -o $(archpfx)objdump $(archpfx)objdump.o \
- - $(GNU_GETOPT_LONG) $(LIBS)
- -
- - # Robotussin is NOT part of `all'.
- - $(archpfx)robotussin: $(archpfx)robotussin.o
- - $(CC) $(CFLAGS) -o $(archpfx)robotussin $(archpfx)robotussin.o
- -
- - libc.a: $(archpfx)robotussin libconvert $(archpfx)ar
- - libconvert /lib/libc.a libc.a
- -
- - # usg-gnulib is the file gcc makes using the usg compiler
- - gnulib: $(archpfx)robotussin libconvert usg-gnulib $(archpfx)ar
- - libconvert usg-gnulib gnulib
- -
- - clean:
- - -rm -f *.o core
- - -rm -f $(archpfx)*.o
- - -rm -f $(PROGS)
- -
- - dist: binutils.tar.Z
- -
- - # Requires GNU tar.
- - binutils.tar.Z:
- - cd ..; tar -cohz -f binutils/binutils.tar.Z -T binutils/ARCHLIST
- -
- - .PHONY: install
- - install: $(PROGS)
- - for file in $(PROGS); do \
- - cp $$file $(bindir)/$${file}.new; \
- - mv $(bindir)/$${file}.new $(bindir)/$$file; \
- - done
- --- 0 ----
- diff -rc --new-file binutils-1.8.x-base/Makefile.in binutils-1.8.x/Makefile.in
- *** binutils-1.8.x-base/Makefile.in Thu Jan 1 00:00:00 1970
- --- binutils-1.8.x/Makefile.in Wed Nov 16 07:04:04 1994
- ***************
- *** 0 ****
- --- 1,138 ----
- + # Makefile for GNU binary-file utilities
- + # Copyright (C) 1989, Free Software Foundation, Inc.
- + #
- + # This file is part of the GNU binutils.
- + #
- + # The GNU binutils are free software; you can redistribute them and/or modify
- + # them under the terms of the GNU General Public License as published by
- + # the Free Software Foundation; either version 1, or (at your option)
- + # any later version.
- + #
- + # The GNU binutils are distributed in the hope that they 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 the GNU binutils; see the file COPYING. If not, write to
- + # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- +
- + #### Start of system configuration section. ####
- +
- + VPATH = @srcdir@
- + srcdir = @srcdir@
- +
- + # Common prefix for machine-independent installed files.
- + prefix = /gnu
- + # Common prefix for machine-dependent installed files.
- + exec_prefix = $(prefix)
- +
- + # Directory to install executables in.
- + bindir = $(exec_prefix)/bin
- + # Directory to install libraries in.
- + libdir = $(exec_prefix)/lib
- + # Directory to install the Info files in.
- + infodir = $(prefix)/info
- + # Directory to install the man page in.
- + mandir = $(prefix)/man/man$(manext)
- + # Number to put on the man page filename.
- + manext = 1
- +
- + # Program to install executables.
- + INSTALL_PROGRAM = @INSTALL_PROGRAM@
- + # Program to install data like man pages.
- + INSTALL_DATA = @INSTALL_DATA@
- + # Generic install program.
- + INSTALL = @INSTALL@
- +
- + CC = @CC@
- + CFLAGS = @CFLAGS@
- + DEFS = @DEFS@
- + LDFLAGS = @LDFLAGS@
- + LIBS = @LIBS@
- +
- + #### End of system configuration section. ####
- +
- + # -I. is needed to find config.h in the build directory.
- + .c.o:
- + $(CC) -c -I. -I$(srcdir) $(CFLAGS) $< $(OUTPUT_OPTION)
- +
- + #Don't include gprof.
- + PROGS = $(archpfx)ld $(archpfx)size \
- + $(archpfx)nm $(archpfx)strip $(archpfx)ar $(archpfx)ranlib
- +
- + GNU_GETOPT = $(archpfx)getopt.o
- + GNU_GETOPT_LONG = $(archpfx)getopt.o $(archpfx)getopt1.o
- +
- + # C++ demangler
- + CPLUS_DEM = $(archpfx)cplus-dem.o
- +
- + all: $(PROGS)
- +
- + $(archpfx)ld: $(archpfx)ld.o $(GNU_GETOPT_LONG) $(CPLUS_DEM)
- + $(CC) $(LDFLAGS) -o $(archpfx)ld $(archpfx)ld.o \
- + $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS)
- +
- + $(archpfx)size: $(archpfx)size.o
- + $(CC) $(LDFLAGS) -o $(archpfx)size $(archpfx)size.o $(LIBS)
- +
- + $(archpfx)nm: $(archpfx)nm.o $(GNU_GETOPT_LONG) $(CPLUS_DEM)
- + $(CC) $(LDFLAGS) -o $(archpfx)nm $(archpfx)nm.o \
- + $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS)
- +
- + $(archpfx)strip: $(archpfx)strip.o $(GNU_GETOPT_LONG)
- + $(CC) $(LDFLAGS) -o $(archpfx)strip $(archpfx)strip.o \
- + $(GNU_GETOPT_LONG) $(LIBS)
- +
- + $(archpfx)ar: $(archpfx)ar.o
- + $(CC) $(LDFLAGS) -o $(archpfx)ar $(archpfx)ar.o $(LIBS)
- +
- + $(archpfx)gprof: $(archpfx)gprof.o $(GNU_GETOPT_LONG) $(CPLUS_DEM)
- + $(CC) $(LDFLAGS) -o $(archpfx)gprof $(archpfx)gprof.o \
- + $(GNU_GETOPT_LONG) $(CPLUS_DEM) $(LIBS)
- +
- + $(archpfx)gprof.o: gprof.c gmon.h
- + $(CC) $(CFLAGS) -c gprof.c $(OUTPUT_OPTION)
- +
- + $(archpfx)ranlib: $(archpfx)ranlib.o $(GNU_GETOPT_LONG)
- + $(CC) $(LDFLAGS) -o $(archpfx)ranlib $(archpfx)ranlib.o \
- + $(GNU_GETOPT_LONG) $(LIBS)
- +
- + $(archpfx)ranlib.o: ranlib.c
- + $(CC) $(CFLAGS) -c -I. -I$(srcdir) \
- + -DAR_PROG=\"$(bindir)/ar\" $(srcdir)/ranlib.c $(OUTPUT_OPTION)
- +
- + $(archpfx)objdump: $(archpfx)objdump.o $(GNU_GETOPT_LONG) a.out.gnu.h
- + $(CC) $(LDFLAGS) -o $(archpfx)objdump $(archpfx)objdump.o \
- + $(GNU_GETOPT_LONG) $(LIBS)
- +
- + Makefile: config.status $(srcdir)/Makefile.in
- + $(SHELL) config.status
- +
- + # Robotussin is NOT part of `all'.
- + $(archpfx)robotussin: $(archpfx)robotussin.o
- + $(CC) $(LDFLAGS) -o $(archpfx)robotussin $(archpfx)robotussin.o
- +
- + libc.a: $(archpfx)robotussin libconvert $(archpfx)ar
- + libconvert /lib/libc.a libc.a
- +
- + # usg-gnulib is the file gcc makes using the usg compiler
- + gnulib: $(archpfx)robotussin libconvert usg-gnulib $(archpfx)ar
- + libconvert usg-gnulib gnulib
- +
- + clean:
- + -rm -f *.o core
- + -rm -f $(archpfx)*.o
- + -rm -f $(PROGS)
- +
- + dist: binutils.tar.Z
- +
- + # Requires GNU tar.
- + binutils.tar.Z:
- + cd ..; tar -cohz -f binutils/binutils.tar.Z -T binutils/ARCHLIST
- +
- + .PHONY: install
- + install: $(PROGS)
- + for file in $(PROGS); do \
- + $(INSTALL_PROGRAM) $${file} $(bindir)/$${file}; \
- + done
- diff -rc --new-file binutils-1.8.x-base/Product-Info binutils-1.8.x/Product-Info
- *** binutils-1.8.x-base/Product-Info Thu Jan 1 00:00:00 1970
- --- binutils-1.8.x/Product-Info Mon Jul 11 23:11:22 1994
- ***************
- *** 0 ****
- --- 1,21 ----
- + .name
- + binutils
- + .fullname
- + GNU binary file utilities
- + .type
- + Programmer Tool
- + .short
- + GNU binary file utilities.
- + .description
- + Various tools for operating on object and executable files. Includes "ld",
- + "size", "nm", "strip", "ar", "objdump", and "ranlib".
- + .version
- + 1.8.x
- + .author
- + Free Software Foundation
- + .requirements
- + Binary versions require ixemul.library.
- + .distribution
- + GNU Public License
- + .described-by
- + Fred Fish (fnf@amigalib.com)
- diff -rc --new-file binutils-1.8.x-base/ar.c binutils-1.8.x/ar.c
- *** binutils-1.8.x-base/ar.c Wed Jun 13 05:47:50 1990
- --- binutils-1.8.x/ar.c Sun Mar 5 15:26:32 1995
- ***************
- *** 736,741 ****
- --- 736,742 ----
- {
- if (tail->info.name == 0)
- continue;
- + #if 0
- if (!strncmp (tail->info.name, name, 13))
- {
- unsigned int eltlen = strlen (tail->info.name);
- ***************
- *** 751,756 ****
- --- 752,764 ----
- return tail;
- }
- }
- + #else
- + /* Don't consider length, the name is shortened later if needed. */
- + if (strcmp (tail->info.name, name) == 0)
- + {
- + return (tail);
- + }
- + #endif
- }
-
- return 0;
- ***************
- *** 992,1002 ****
- --- 1000,1020 ----
- #endif
- close (outdesc);
-
- + #ifndef amigados
- if (!appendflag)
- if (rename (tempname, archive))
- pfatal_with_name (tempname);
-
- close_archive ();
- + #else
- + /* we *have* to close the file before we rename it, because otherwise
- + * AmigaDOS will just abort with OBJECT_IN_USE_ERROR */
- + close_archive ();
- +
- + if (!appendflag)
- + if (rename (tempname, archive))
- + pfatal_with_name (tempname);
- + #endif
- }
-
- void
- ***************
- *** 1005,1029 ****
- struct mapelt *mapelt;
- {
- unsigned int namelen;
-
- /* Zero the header, then store in the data as text. */
- bzero ((char *) header, sizeof (*header));
-
- ! strncpy (header->ar_name, mapelt->info.name, sizeof (header->ar_name));
- ! namelen = strlen (mapelt->info.name);
- if (namelen >= sizeof (header->ar_name))
- {
- ! if (mapelt->info.name[namelen - 2] == '.' &&
- ! mapelt->info.name[namelen - 1] == 'o')
- {
- header->ar_name[sizeof (header->ar_name) - 3] = '.';
- header->ar_name[sizeof (header->ar_name) - 2] = 'o';
- }
- header->ar_name[sizeof (header->ar_name) - 1] = '\0';
- error ("member name `%s' truncated to `%s'",
- mapelt->info.name, header->ar_name);
- }
- -
- sprintf (header->ar_date, "%ld", mapelt->info.date);
- sprintf (header->ar_size, "%d", mapelt->info.size);
- sprintf (header->ar_uid, "%d", mapelt->info.uid);
- --- 1023,1063 ----
- struct mapelt *mapelt;
- {
- unsigned int namelen;
- + char *ar_name, *tmp;
- + extern char *strchr ();
-
- /* Zero the header, then store in the data as text. */
- bzero ((char *) header, sizeof (*header));
-
- ! /* Strip off leading directory components of the full pathname
- ! until the name either fits, or there are no more components.
- ! If the name is still to large, it is truncated from the right
- ! end later on. */
- ! ar_name = mapelt->info.name;
- ! while (((namelen = strlen (ar_name)) >= sizeof (header->ar_name)) &&
- ! ((tmp = strchr (ar_name, '/')) != NULL))
- ! {
- ! ar_name = tmp + 1;
- ! }
- !
- ! strncpy (header->ar_name, ar_name, sizeof (header->ar_name));
- ! namelen = strlen (ar_name);
- if (namelen >= sizeof (header->ar_name))
- {
- ! if (ar_name[namelen - 2] == '.' &&
- ! ar_name[namelen - 1] == 'o')
- {
- header->ar_name[sizeof (header->ar_name) - 3] = '.';
- header->ar_name[sizeof (header->ar_name) - 2] = 'o';
- }
- header->ar_name[sizeof (header->ar_name) - 1] = '\0';
- + }
- +
- + if (strncmp (header->ar_name, mapelt->info.name, sizeof (header->ar_name)) != 0)
- + {
- error ("member name `%s' truncated to `%s'",
- mapelt->info.name, header->ar_name);
- }
- sprintf (header->ar_date, "%ld", mapelt->info.date);
- sprintf (header->ar_size, "%d", mapelt->info.size);
- sprintf (header->ar_uid, "%d", mapelt->info.uid);
- ***************
- *** 1957,1962 ****
- --- 1991,1997 ----
- unsigned int size;
- {
- extern char *malloc ();
- +
- char *result = malloc (size);
- if (result == 0)
- fatal ("virtual memory exhausted", 0);
- ***************
- *** 1969,1974 ****
- --- 2004,2010 ----
- unsigned int size;
- {
- extern char *realloc ();
- +
- char *result = realloc (ptr, size);
- if (result == 0)
- fatal ("virtual memory exhausted");
- diff -rc --new-file binutils-1.8.x-base/configure binutils-1.8.x/configure
- *** binutils-1.8.x-base/configure Thu Jan 1 00:00:00 1970
- --- binutils-1.8.x/configure Tue Jun 21 22:39:22 1994
- ***************
- *** 0 ****
- --- 1,637 ----
- + #!/bin/sh
- + # Guess values for system-dependent variables and create Makefiles.
- + # Generated automatically using autoconf version 1.11
- + # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
- +
- + # This configure script 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, or (at your option)
- + # any later version.
- +
- + # This script 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- +
- + # Save the original args to write them into config.status later.
- + configure_args="$*"
- +
- + # Only options that might do something get documented.
- + ac_usage="Usage: configure [options] [host]
- + Options: [defaults in brackets after descriptions]
- + --build=BUILD configure for building on BUILD [BUILD=HOST]
- + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- + --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- + --exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
- + --help print this message
- + --host=HOST configure for HOST [guessed]
- + --prefix=PREFIX install host independent files in PREFIX [/usr/local]
- + --quiet, --silent do not print \`checking for...' messages
- + --srcdir=DIR find the sources in DIR [configure dir or ..]
- + --target=TARGET configure for TARGET [TARGET=HOST]
- + --verbose print results of checks
- + --version print the version of autoconf that created configure
- + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- + --x-includes=DIR X include files are in DIR
- + --x-libraries=DIR X library files are in DIR"
- +
- + # Initialize some variables set by options.
- + # The variables have the same names as the options, with
- + # dashes changed to underlines.
- + build=NONE
- + exec_prefix=
- + host=NONE
- + no_create=
- + nonopt=NONE
- + norecursion=
- + prefix=
- + program_prefix=
- + program_suffix=
- + program_transform_name=
- + silent=
- + srcdir=
- + target=NONE
- + verbose=
- + x_includes=
- + x_libraries=
- +
- + ac_prev=
- + for ac_option
- + do
- +
- + # If the previous option needs an argument, assign it.
- + if test -n "$ac_prev"; then
- + eval "$ac_prev=\$ac_option"
- + ac_prev=
- + continue
- + fi
- +
- + # Accept (but ignore some of) the important Cygnus configure
- + # options, so we can diagnose typos.
- +
- + case "$ac_option" in
- + -*=*) ac_optarg=`/bin/echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- + *) ac_optarg= ;;
- + esac
- +
- + case "$ac_option" in
- +
- + -build | --build | --buil | --bui | --bu | --b)
- + ac_prev=build ;;
- + -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
- + build="$ac_optarg" ;;
- +
- + -disable-* | --disable-*)
- + ac_feature=`/bin/echo $ac_option|sed -e 's/-*disable-//'`
- + # Reject names that aren't valid shell variable names.
- + if test -n "`/bin/echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- + /bin/echo "configure: $ac_feature: invalid feature name" >&2; exit 1
- + fi
- + ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
- + eval "enable_${ac_feature}=no" ;;
- +
- + -enable-* | --enable-*)
- + ac_feature=`/bin/echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- + # Reject names that aren't valid shell variable names.
- + if test -n "`/bin/echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- + /bin/echo "configure: $ac_feature: invalid feature name" >&2; exit 1
- + fi
- + ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
- + case "$ac_option" in
- + *=*) ;;
- + *) ac_optarg=yes ;;
- + esac
- + eval "enable_${ac_feature}='$ac_optarg'" ;;
- +
- + # For backward compatibility, recognize -exec-prefix and --exec_prefix.
- + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- + | --exec | --exe | --ex)
- + ac_prev=exec_prefix ;;
- + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- + | --exec=* | --exe=* | --ex=*)
- + exec_prefix="$ac_optarg" ;;
- +
- + -gas | --gas | --ga | --g)
- + with_gas=yes ;; # Obsolete; use --with-gas.
- +
- + -help | --help | --hel | --he)
- + cat << EOF
- + $ac_usage
- + EOF
- + exit 0 ;;
- +
- + -host | --host | --hos | --ho)
- + ac_prev=host ;;
- + -host=* | --host=* | --hos=* | --ho=*)
- + host="$ac_optarg" ;;
- +
- + -nfp | --nfp | --nf)
- + with_fp=no ;; # Obsolete; use --without-fp.
- +
- + -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- + | --no-cr | --no-c)
- + no_create=yes ;;
- +
- + -norecursion | --norecursion | --norecursio | --norecursi \
- + | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
- + norecursion=yes ;;
- +
- + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- + ac_prev=prefix ;;
- + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- + prefix="$ac_optarg" ;;
- +
- + -program-prefix | --program-prefix | --program-prefi | --program-pref \
- + | --program-pre | --program-pr | --program-p)
- + ac_prev=program_prefix ;;
- + -program-prefix=* | --program-prefix=* | --program-prefi=* \
- + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- + program_prefix="$ac_optarg" ;;
- +
- + -program-suffix | --program-suffix | --program-suffi | --program-suff \
- + | --program-suf | --program-su | --program-s)
- + ac_prev=program_suffix ;;
- + -program-suffix=* | --program-suffix=* | --program-suffi=* \
- + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- + program_suffix="$ac_optarg" ;;
- +
- + -program-transform-name | --program-transform-name \
- + | --program-transform-nam | --program-transform-na \
- + | --program-transform-n | --program-transform- \
- + | --program-transform | --program-transfor \
- + | --program-transfo | --program-transf \
- + | --program-trans | --program-tran \
- + | --progr-tra | --program-tr | --program-t)
- + ac_prev=program_transform_name ;;
- + -program-transform-name=* | --program-transform-name=* \
- + | --program-transform-nam=* | --program-transform-na=* \
- + | --program-transform-n=* | --program-transform-=* \
- + | --program-transform=* | --program-transfor=* \
- + | --program-transfo=* | --program-transf=* \
- + | --program-trans=* | --program-tran=* \
- + | --progr-tra=* | --program-tr=* | --program-t=*)
- + program_transform_name="$ac_optarg" ;;
- +
- + -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- + | -silent | --silent | --silen | --sile | --sil)
- + silent=yes ;;
- +
- + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- + ac_prev=srcdir ;;
- + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- + srcdir="$ac_optarg" ;;
- +
- + -target | --target | --targe | --targ | --tar | --ta | --t)
- + ac_prev=target ;;
- + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- + target="$ac_optarg" ;;
- +
- + -v | -verbose | --verbose | --verbos | --verbo | --verb)
- + verbose=yes ;;
- +
- + -version | --version | --versio | --versi | --vers)
- + /bin/echo "configure generated by autoconf version 1.11"
- + exit 0 ;;
- +
- + -with-* | --with-*)
- + ac_package=`/bin/echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- + # Reject names that aren't valid shell variable names.
- + if test -n "`/bin/echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- + /bin/echo "configure: $ac_package: invalid package name" >&2; exit 1
- + fi
- + ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
- + case "$ac_option" in
- + *=*) ;;
- + *) ac_optarg=yes ;;
- + esac
- + eval "with_${ac_package}='$ac_optarg'" ;;
- +
- + -without-* | --without-*)
- + ac_package=`/bin/echo $ac_option|sed -e 's/-*without-//'`
- + # Reject names that aren't valid shell variable names.
- + if test -n "`/bin/echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- + /bin/echo "configure: $ac_package: invalid package name" >&2; exit 1
- + fi
- + ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
- + eval "with_${ac_package}=no" ;;
- +
- + --x) with_x=yes ;; # Obsolete; use --with-x.
- +
- + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- + | --x-incl | --x-inc | --x-in | --x-i)
- + ac_prev=x_includes ;;
- + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- + x_includes="$ac_optarg" ;;
- +
- + -x-libraries | --x-libraries | --x-librarie | --x-librari \
- + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- + ac_prev=x_libraries ;;
- + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- + x_libraries="$ac_optarg" ;;
- +
- + -*) /bin/echo "configure: $ac_option: invalid option; use --help to show usage" >&2; exit 1
- + ;;
- +
- + *)
- + if test -n "`/bin/echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- + /bin/echo "configure: warning: $ac_option: invalid host type" >&2
- + fi
- + if test "x$nonopt" != xNONE; then
- + /bin/echo "configure: can only configure for one host and one target at a time" >&2; exit 1
- + fi
- + nonopt="$ac_option"
- + ;;
- +
- + esac
- + done
- +
- + if test -n "$ac_prev"; then
- + /bin/echo "configure: missing argument to --`/bin/echo $ac_prev | sed 's/_/-/g'`" >&2; exit 1
- + fi
- +
- + trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
- + trap 'rm -fr confdefs* $ac_clean_files' 0
- +
- + # Save the original args if we used an alternate arg parser.
- + ac_configure_temp="${configure_args-$*}"
- + # Strip out --no-create and --norecursion so they don't pile up.
- + configure_args=
- + for ac_arg in $ac_configure_temp; do
- + case "$ac_arg" in
- + -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- + | --no-cr | --no-c) ;;
- + -norecursion | --norecursion | --norecursio | --norecursi \
- + | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
- + *) configure_args="$configure_args $ac_arg" ;;
- + esac
- + done
- +
- + # NLS nuisances.
- + # These must not be set unconditionally because not all systems understand
- + # e.g. LANG=C (notably SCO).
- + if test "${LC_ALL+set}" = 'set'; then LC_ALL=C; export LC_ALL; fi
- + if test "${LANG+set}" = 'set'; then LANG=C; export LANG; fi
- +
- + # confdefs.h avoids OS command line length limits that DEFS can exceed.
- + rm -rf conftest* confdefs.h
- + # AIX cpp loses on an empty file, so make sure it contains at least a newline.
- + /bin/echo > confdefs.h
- +
- + # A filename unique to this package, relative to the directory that
- + # configure is in, which we can look for to find out if srcdir is correct.
- + ac_unique_file=ld.c
- +
- + # Find the source files, if location was not specified.
- + if test -z "$srcdir"; then
- + ac_srcdir_defaulted=yes
- + # Try the directory containing this script, then `..'.
- + ac_prog=$0
- + ac_confdir=`/bin/echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- + srcdir=$ac_confdir
- + if test ! -r $srcdir/$ac_unique_file; then
- + srcdir=..
- + fi
- + fi
- + if test ! -r $srcdir/$ac_unique_file; then
- + if test x$ac_srcdir_defaulted = xyes; then
- + /bin/echo "configure: can not find sources in ${ac_confdir} or .." >&2; exit 1
- + else
- + /bin/echo "configure: can not find sources in ${srcdir}" >&2; exit 1
- + fi
- + fi
- + ac_ext=c
- + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
- + ac_cpp='${CPP}'
- + ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1'
- +
- +
- +
- + # We want these before the checks, so the checks can modify their values.
- + test -z "$CFLAGS" && CFLAGS= auto_cflags=1
- + test -z "$LDFLAGS" && LDFLAGS=
- +
- + if test -z "$CC"; then
- + # Extract the first word of `gcc', so it can be a program name with args.
- + set ac_dummy gcc; ac_word=$2
- + test -n "$silent" || /bin/echo "checking for $ac_word"
- + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- + for ac_dir in $PATH; do
- + test -z "$ac_dir" && ac_dir=.
- + if test -f $ac_dir/$ac_word; then
- + CC="gcc"
- + break
- + fi
- + done
- + IFS="$ac_save_ifs"
- + fi
- + test -z "$CC" && CC="cc"
- + test -n "$CC" && test -n "$verbose" && /bin/echo " setting CC to $CC"
- +
- + # Find out if we are using GNU C, under whatever name.
- + cat > conftest.c <<EOF
- + #ifdef __GNUC__
- + yes
- + #endif
- + EOF
- + ${CC-cc} -E conftest.c > conftest.out 2>&1
- + if egrep yes conftest.out >/dev/null 2>&1; then
- + GCC=1 # For later tests.
- + fi
- + rm -f conftest*
- +
- +
- + # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
- + test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
- +
- +
- + test -n "$silent" || /bin/echo "checking how to run the C preprocessor"
- + if test -z "$CPP"; then
- + # This must be in double quotes, not single quotes, because CPP may get
- + # substituted into the Makefile and ``${CC-cc}'' will simply confuse
- + # make. It must be expanded now.
- + CPP="${CC-cc} -E"
- + cat > conftest.${ac_ext} <<EOF
- + #include "confdefs.h"
- + #include <stdio.h>
- + Syntax Error
- + EOF
- + # Some shells (Coherent) do redirections in the wrong order, so need
- + # the parens.
- + ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- + if test -z "$ac_err"; then
- + :
- + else
- + rm -rf conftest*
- + CPP="${CC-cc} -E -traditional-cpp"
- + cat > conftest.${ac_ext} <<EOF
- + #include "confdefs.h"
- + #include <stdio.h>
- + Syntax Error
- + EOF
- + # Some shells (Coherent) do redirections in the wrong order, so need
- + # the parens.
- + ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- + if test -z "$ac_err"; then
- + :
- + else
- + rm -rf conftest*
- + CPP=/lib/cpp
- + fi
- + rm -f conftest*
- + fi
- + rm -f conftest*
- + fi
- + test -n "$verbose" && /bin/echo " setting CPP to $CPP"
- +
- + if test -n "$GCC"; then
- + test -n "$silent" || /bin/echo "checking whether -traditional is needed"
- + ac_pattern="Autoconf.*'x'"
- + ac_prog='#include <sgtty.h>
- + Autoconf TIOCGETP'
- + cat > conftest.${ac_ext} <<EOF
- + #include "confdefs.h"
- + $ac_prog
- + EOF
- + eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- + if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
- + rm -rf conftest*
- + ac_need_trad=1
- +
- + fi
- + rm -f conftest*
- +
- +
- + if test -z "$ac_need_trad"; then
- + ac_prog='#include <termio.h>
- + Autoconf TCGETA'
- + cat > conftest.${ac_ext} <<EOF
- + #include "confdefs.h"
- + $ac_prog
- + EOF
- + eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- + if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
- + rm -rf conftest*
- + ac_need_trad=1
- +
- + fi
- + rm -f conftest*
- +
- + fi
- + test -n "$ac_need_trad" && CC="$CC -traditional"
- + fi
- +
- + # Make sure to not get the incompatible SysV /etc/install and
- + # /usr/sbin/install, which might be in PATH before a BSD-like install,
- + # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
- + # or the AFS install, which mishandles nonexistent args, or
- + # /usr/ucb/install on SVR4, which tries to use the nonexistent group
- + # `staff', or /sbin/install on IRIX which has incompatible command-line
- + # syntax. Sigh.
- + #
- + # On most BSDish systems install is in /usr/bin, not /usr/ucb
- + # anyway.
- + # This turns out not to be true, so the mere pathname isn't an indication
- + # of whether the program works. What we really need is a set of tests for
- + # the install program to see if it actually works in all the required ways.
- + #
- + # Avoid using ./install, which might have been erroneously created
- + # by make from ./install.sh.
- + if test -z "${INSTALL}"; then
- + test -n "$silent" || /bin/echo "checking for a BSD compatible install"
- + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- + for ac_dir in $PATH; do
- + case "$ac_dir" in
- + ''|.|/gnu/etc|/sbin|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
- + *)
- + # OSF1 and SCO ODT 3.0 have their own names for install.
- + for ac_prog in installbsd scoinst install; do
- + if test -f $ac_dir/$ac_prog; then
- + if test $ac_prog = install &&
- + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- + # AIX install. It has an incompatible calling convention.
- + # OSF/1 installbsd also uses dspmsg, but is usable.
- + :
- + else
- + INSTALL="$ac_dir/$ac_prog -c"
- + break 2
- + fi
- + fi
- + done
- + ;;
- + esac
- + done
- + IFS="$ac_save_ifs"
- + fi
- +
- + if test -z "$INSTALL"; then
- + # As a last resort, use the slow shell script.
- + for ac_dir in ${srcdir} ${srcdir}/.. ${srcdir}/../..; do
- + if test -f $ac_dir/install.sh; then
- + INSTALL="$ac_dir/install.sh -c"; break
- + fi
- + done
- + fi
- + if test -z "$INSTALL"; then
- + /bin/echo "configure: can not find install.sh in ${srcdir} or ${srcdir}/.. or ${srcdir}/../.." >&2; exit 1
- + fi
- + test -n "$verbose" && /bin/echo " setting INSTALL to $INSTALL"
- +
- + # Use test -z because SunOS4 sh mishandles ${INSTALL_PROGRAM-'${INSTALL}'}.
- + # It thinks the first close brace ends the variable substitution.
- + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
- + test -n "$verbose" && /bin/echo " setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
- +
- + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
- + test -n "$verbose" && /bin/echo " setting INSTALL_DATA to $INSTALL_DATA"
- +
- +
- +
- + # The preferred way to propogate these variables is regular @ substitutions.
- + if test -n "$prefix"; then
- + ac_prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
- + else
- + prefix=/usr/local
- + fi
- + if test -n "$exec_prefix"; then
- + ac_prsub="$ac_prsub
- + s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
- + else
- + exec_prefix='${prefix}' # Let make expand it.
- + fi
- +
- + # Any assignment to VPATH causes Sun make to only execute
- + # the first set of double-colon rules, so remove it if not needed.
- + # If there is a colon in the path, we need to keep it.
- + if test "x$srcdir" = x.; then
- + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
- + fi
- +
- + # Quote sed substitution magic chars in DEFS.
- + cat >conftest.def <<EOF
- + $DEFS
- + EOF
- + ac_escape_ampersand_and_backslash='s%[&\\]%\\&%g'
- + DEFS=`sed "$ac_escape_ampersand_and_backslash" <conftest.def`
- + rm -f conftest.def
- + # Substitute for predefined variables.
- +
- + trap 'rm -f config.status; exit 1' 1 2 15
- + /bin/echo creating config.status
- + # Some systems, like AmigaDOS, won't allow you to remove a script that is
- + # being executed, so just move it out of the way instead.
- + if test -f config.status; then mv config.status config.status.old; else true; fi
- + cat > config.status <<EOF
- + #!/bin/sh
- + # Generated automatically by configure.
- + # Run this file to recreate the current configuration.
- + # This directory was configured as follows,
- + # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
- + #
- + # $0 $configure_args
- +
- + ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]"
- + for ac_option
- + do
- + case "\$ac_option" in
- + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- + /bin/echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create
- + exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create ;;
- + -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- + /bin/echo "config.status generated by autoconf version 1.11"
- + exit 0 ;;
- + -help | --help | --hel | --he | --h)
- + /bin/echo "\$ac_cs_usage"; exit 0 ;;
- + *) /bin/echo "\$ac_cs_usage"; exit 1 ;;
- + esac
- + done
- +
- + trap 'rm -f Makefile; exit 1' 1 2 15
- + CC='$CC'
- + CFLAGS='$CFLAGS'
- + LDFLAGS='$LDFLAGS'
- + CPP='$CPP'
- + INSTALL='$INSTALL'
- + INSTALL_PROGRAM='$INSTALL_PROGRAM'
- + INSTALL_DATA='$INSTALL_DATA'
- + LIBS='$LIBS'
- + srcdir='$srcdir'
- + top_srcdir='$top_srcdir'
- + prefix='$prefix'
- + exec_prefix='$exec_prefix'
- + DEFS='$DEFS'
- + ac_prsub='$ac_prsub'
- + ac_vpsub='$ac_vpsub'
- + extrasub='$extrasub'
- + EOF
- + cat >> config.status <<\EOF
- +
- + ac_given_srcdir=$srcdir
- +
- + CONFIG_FILES=${CONFIG_FILES-"Makefile"}
- + for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
- + # Remove last slash and all that follows it. Not all systems have dirname.
- + ac_dir=`/bin/echo $ac_file|sed 's%/[^/][^/]*$%%'`
- + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- + # The file is in a subdirectory.
- + test ! -d "$ac_dir" && mkdir "$ac_dir"
- + ac_dir_suffix="/$ac_dir"
- + else
- + ac_dir_suffix=
- + fi
- +
- + # A "../" for each directory in $ac_dir_suffix.
- + ac_dots=`/bin/echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- + case "$ac_given_srcdir" in
- + .) srcdir=.
- + if test -z "$ac_dir_suffix"; then top_srcdir=.
- + else top_srcdir=`/bin/echo $ac_dots|sed 's%/$%%'`; fi ;;
- + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- + *) # Relative path.
- + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- + top_srcdir="$ac_dots$ac_given_srcdir" ;;
- + esac
- +
- + /bin/echo creating "$ac_file"
- + rm -f "$ac_file"
- + comment_str="Generated automatically from `/bin/echo $ac_file|sed 's|.*/||'`.in by configure."
- + case "$ac_file" in
- + *.c | *.h | *.C | *.cc | *.m ) /bin/echo "/* $comment_str */" > "$ac_file" ;;
- + * ) /bin/echo "# $comment_str" > "$ac_file" ;;
- + esac
- + sed -e "
- + $ac_prsub
- + $ac_vpsub
- + $extrasub
- + s%@CC@%$CC%g
- + s%@CFLAGS@%$CFLAGS%g
- + s%@LDFLAGS@%$LDFLAGS%g
- + s%@CPP@%$CPP%g
- + s%@INSTALL@%$INSTALL%g
- + s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
- + s%@INSTALL_DATA@%$INSTALL_DATA%g
- + s%@LIBS@%$LIBS%g
- + s%@srcdir@%$srcdir%g
- + s%@top_srcdir@%$top_srcdir%g
- + s%@prefix@%$prefix%g
- + s%@exec_prefix@%$exec_prefix%g
- + s%@DEFS@%$DEFS%
- + " $ac_given_srcdir/${ac_file}.in >> $ac_file
- + fi; done
- +
- +
- + exit 0
- + EOF
- + chmod +x config.status
- + # Some shells look in PATH for config.status without the "./".
- + test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} ./config.status
- +
- diff -rc --new-file binutils-1.8.x-base/configure.in binutils-1.8.x/configure.in
- *** binutils-1.8.x-base/configure.in Thu Jan 1 00:00:00 1970
- --- binutils-1.8.x/configure.in Sat Apr 30 17:42:42 1994
- ***************
- *** 0 ****
- --- 1,20 ----
- + dnl Process this file with autoconf to produce a configure script.
- + AC_INIT(ld.c)
- +
- + # We want these before the checks, so the checks can modify their values.
- + test -z "$CFLAGS" && CFLAGS= auto_cflags=1
- + test -z "$LDFLAGS" && LDFLAGS=
- +
- + AC_PROG_CC
- +
- + # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
- + test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
- +
- + AC_SUBST(CFLAGS)dnl
- + AC_SUBST(LDFLAGS)dnl
- +
- + AC_PROG_CPP
- + AC_GCC_TRADITIONAL
- + AC_PROG_INSTALL
- +
- + AC_OUTPUT(Makefile)
- diff -rc --new-file binutils-1.8.x-base/cplus-dem.c binutils-1.8.x/cplus-dem.c
- *** binutils-1.8.x-base/cplus-dem.c Wed Jun 13 05:42:34 1990
- --- binutils-1.8.x/cplus-dem.c Wed Sep 22 12:45:32 1993
- ***************
- *** 48,54 ****
- #include <ctype.h>
-
- #if !defined(sequent) && !defined(NeXT)
- ! #include <memory.h>
- #else
- #define memcpy(s1, s2, n) strncpy(s1, s2, n)
- #define memcmp(s1, s2, n) strncmp(s1, s2, n)
- --- 48,54 ----
- #include <ctype.h>
-
- #if !defined(sequent) && !defined(NeXT)
- ! /* #include <memory.h> */
- #else
- #define memcpy(s1, s2, n) strncpy(s1, s2, n)
- #define memcmp(s1, s2, n) strncmp(s1, s2, n)
- diff -rc --new-file binutils-1.8.x-base/ld.c binutils-1.8.x/ld.c
- *** binutils-1.8.x-base/ld.c Wed Nov 27 22:04:14 1991
- --- binutils-1.8.x/ld.c Thu Mar 23 23:30:14 1995
- ***************
- *** 16,24 ****
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* Written by Richard Stallman with some help from Eric Albert.
- ! Set, indirect, and warning symbol features added by Randy Smith. */
-
- #include <ar.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- --- 16,39 ----
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* Written by Richard Stallman with some help from Eric Albert.
- ! Set, indirect, and warning symbol features added by Randy Smith.
- ! Support for generation of Amiga load files added by Markus Wild.
- ! Flavor extension by Fred Fish
- ! Modified for AmigaDOS cross-linker by Philippe Brand
- ! Bug fixes by Matthias Fleischer
- ! Additional work by Gunther Nikl */
-
- + #ifdef amigados
- + #ifndef STANDARD_SEARCH_DIRS
- + #define STANDARD_SEARCH_DIRS "local:lib","local:os-lib","gnu:lib","gnu:os-lib"
- + #endif
- + #endif
- +
- + #if defined(amigados) && defined(CROSS_LINKER)
- + #include </usr/local/amigados/include/ar.h>
- + #else
- #include <ar.h>
- + #endif
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- ***************
- *** 30,35 ****
- --- 45,52 ----
- #ifndef sony_news
- #include <fcntl.h>
- #endif
- + /* JPB, 7 Jun 1992: MAXNAMLEN required for long name hack. */
- + #include <dirent.h>
-
- #if !defined(A_OUT) && !defined(MACH_O)
- #define A_OUT
- ***************
- *** 39,47 ****
- --- 56,99 ----
- #ifdef COFF_ENCAPSULATE
- #include "a.out.encap.h"
- #else
- + #if defined(amigados) && defined(CROSS_LINKER)
- + # include </usr/local/amigados/include/a.out.h>
- + #else
- #include <a.out.h>
- #endif
- #endif
- + #endif
- +
- + #ifdef MCH_AMIGA
- + #define HUNK_INSTEAD_OF_A_OUT
- + int number_of_code_hunk,
- + code_mem_type,
- + number_of_data_hunk,
- + data_mem_type,
- + number_of_bss_hunk,
- + bss_mem_type,
- + number_of_debug_hunk,
- + current_hunk = 0,
- + offset_of_debug_hunk,
- + amiga_symbols_only,
- + long_data_hunk = 1,
- + databss_together = 0,
- + numdatadata_relocs = 0,
- + output_datadata_relocs = 0,
- + datadata_relocs_offset = 0;
- + #define LONGSIZE(l) ((((l) + 3) & ~3) >> 2)
- + /* this is the private format of the debug-hunk: */
- + struct debug_hunk {
- + unsigned long id; /* Filesystem-imposed: HUNK_DEBUG (0x3f1) */
- + unsigned long len; /* "" : length in longs -> LONGSIZE(real_lenght) */
- + /* the following part is somehow a truncated exec-struct: */
- + unsigned long magic; /* should be ZMAGIC (just for fun:-)), to be recognised
- + * by the other tools as this special frame */
- + unsigned long syms; /* size of symbol-table */
- + unsigned long strs; /* size of string table */
- + /* here follows the actual data */
- + } dh;
- + #endif
-
- #ifdef MACH_O
- #ifndef A_OUT
- ***************
- *** 104,110 ****
- /* Name this program was invoked by. */
-
- char *progname;
- !
- /* System dependencies */
-
- /* Define this if names etext, edata and end should not start with `_'. */
- --- 156,162 ----
- /* Name this program was invoked by. */
-
- char *progname;
- !
- /* System dependencies */
-
- /* Define this if names etext, edata and end should not start with `_'. */
- ***************
- *** 190,195 ****
- --- 242,263 ----
- #endif /* mc68000. */
- #endif /* Sun. */
-
- + #ifdef amigados
- + /* same trick as with sun[23] */
- + /* Set the machine type according to the machine type of the .o files.
- + If they are all sun2 (68010), then the type of the executable is sun2.
- + If any is sun3 (68020), then the type of the executable is sun3.
- + This is consistent with the Sun loader and more useful than having
- + it depend on which machine you are on when you run ld. */
- + static int amiga_machtype = MID_SUN010;
- + #define INITIALIZE_HEADER outheader.a_machtype = amiga_machtype
- + #define READ_HEADER_HOOK(machtype) \
- + if (machtype == MID_SUN020) \
- + { \
- + amiga_machtype = MID_SUN020; \
- + }
- + #endif
- +
- #ifdef ALTOS
- #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020)
- #endif
- ***************
- *** 229,234 ****
- --- 297,306 ----
- #ifndef SEEK_CUR
- #define SEEK_CUR 1
- #endif
- + /* Phil.B: 1-Apr-94: same trick for SEEK_END */
- + #ifndef SEEK_END
- + #define SEEK_END L_XTND
- + #endif
-
- /*
- * Ok. Following are the relocation information macros. If your
- ***************
- *** 368,373 ****
- --- 440,446 ----
- #define RELOC_MEMORY_ADD_P(r) 1
- #undef RELOC_ADD_EXTRA
- #define RELOC_PCREL_P(r) ((r)->r_pcrel)
- + #define RELOC_BASEREL_P(r) ((r)->r_baserel)
- #define RELOC_VALUE_RIGHTSHIFT(r) 0
- #define RELOC_TARGET_SIZE(r) ((r)->r_length)
- #define RELOC_TARGET_BITPOS(r) 0
- ***************
- *** 384,390 ****
- #define LPREFIX 'L'
- #endif
-
- !
- /* Special global symbol types understood by GNU LD. */
-
- /* The following type indicates the definition of a symbol as being
- --- 457,463 ----
- #define LPREFIX 'L'
- #endif
-
- !
- /* Special global symbol types understood by GNU LD. */
-
- /* The following type indicates the definition of a symbol as being
- ***************
- *** 531,537 ****
- #endif
-
- #endif /* not __GNU_STAB__ */
- !
- /* Symbol table */
-
- /* Global symbol data is recorded in these structures,
- --- 604,610 ----
- #endif
-
- #endif /* not __GNU_STAB__ */
- !
- /* Symbol table */
-
- /* Global symbol data is recorded in these structures,
- ***************
- *** 684,690 ****
- symbol *edata_symbol_alt;
- symbol *etext_symbol_alt;
- symbol *end_symbol_alt;
- !
- /* Kinds of files potentially understood by the linker. */
-
- enum file_type { IS_UNKNOWN, IS_ARCHIVE, IS_A_OUT, IS_MACH_O };
- --- 757,771 ----
- symbol *edata_symbol_alt;
- symbol *etext_symbol_alt;
- symbol *end_symbol_alt;
- !
- ! #ifdef amigados
- ! symbol *sdata_symbol; /* the symbol __sdata */
- ! symbol *text_size_symbol;
- ! symbol *data_size_symbol;
- ! symbol *bss_size_symbol;
- ! symbol *datadata_reloc_symbol = 0;
- ! #endif
- !
- /* Kinds of files potentially understood by the linker. */
-
- enum file_type { IS_UNKNOWN, IS_ARCHIVE, IS_A_OUT, IS_MACH_O };
- ***************
- *** 820,826 ****
-
- /* Length of that vector. */
- int number_of_files;
- !
- /* When loading the text and data, we can avoid doing a close
- and another open between members of the same library.
-
- --- 901,907 ----
-
- /* Length of that vector. */
- int number_of_files;
- !
- /* When loading the text and data, we can avoid doing a close
- and another open between members of the same library.
-
- ***************
- *** 867,875 ****
- --- 948,961 ----
- #define DEFAULT_OUTPUT_STYLE OUTPUT_DEMAND_PAGED
- #endif
-
- + #if 0
- /* Descriptor for writing that file with `mywrite'. */
-
- int outdesc;
- + #endif
- +
- + /* use outstream instead of outdesc thru the whole file, it's MUCH faster.. */
- + FILE *outstream = (FILE *) 0;
-
- /* The following are computed by `digest_symbols'. */
-
- ***************
- *** 909,914 ****
- --- 995,1004 ----
- /* Pointer for in core storage for the above vectors, before they are
- written. */
- unsigned long *set_vectors;
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* which vector entry has to be relocated? */
- + unsigned char *rel_vectors;
- + #endif
-
- /* Amount of cleared space to leave at the end of the text segment. */
-
- ***************
- *** 929,935 ****
- int symbol_name_string_index;
- int library_member_offset;
- };
- !
- /* Record most of the command options. */
-
- /* Address we assume the text section will be loaded at.
- --- 1019,1025 ----
- int symbol_name_string_index;
- int library_member_offset;
- };
- !
- /* Record most of the command options. */
-
- /* Address we assume the text section will be loaded at.
- ***************
- *** 993,998 ****
- --- 1083,1092 ----
- /* Length of the vector `search_dirs'. */
- int n_search_dirs;
-
- + /* Vector of flavors to search for. */
- + char **flavors;
- + int n_flavors;
- +
- /* Non zero means to create the output executable.
- Cleared by nonfatal errors. */
- int make_executable;
- ***************
- *** 1007,1018 ****
- --- 1101,1118 ----
- struct glosym **cmdline_references;
- int cl_refs_allocated;
-
- + /* JPB, 7 Jun 1992: Global variable needed for long name hack. */
- + static int ar_hdr_size;
- +
- #ifndef bcopy
- void bcopy (), bzero ();
- #endif
- + #ifndef __STDC__
- char *malloc (), *realloc ();
- void free ();
- + #endif
-
- + char *getenv ();
- char *xmalloc ();
- char *xrealloc ();
- void usage ();
- ***************
- *** 1034,1039 ****
- --- 1134,1154 ----
- void write_output ();
- void write_header ();
- void write_text ();
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + void write_datadata_relocs ();
- + void write_hunk_header ();
- + void conditionally_rewrite_headers ();
- + void write_bss ();
- + void init_reloc_hunk ();
- + void add_to_reloc_hunk ();
- + void write_reloc_hunk ();
- + void init_symbol_hunks ();
- + void add_to_symbol_hunk ();
- + void write_symbol_hunk ();
- + void look_for_symbols ();
- + void look_for_file_symbols ();
- + void relocate_set_vectors ();
- + #endif
- void read_file_relocation ();
- void write_data ();
- void write_rel ();
- ***************
- *** 1045,1060 ****
- char *concat ();
- char *get_file_name ();
- symbol *getsym (), *getsym_soft ();
- !
- int
- main (argc, argv)
- char **argv;
- int argc;
- {
- page_size = getpagesize ();
- progname = argv[0];
-
- ! #ifdef RLIMIT_STACK
- /* Avoid dumping core on large .o files. */
- {
- struct rlimit rl;
- --- 1160,1187 ----
- char *concat ();
- char *get_file_name ();
- symbol *getsym (), *getsym_soft ();
- ! int compare_longs (), compare_strings ();
- !
- int
- main (argc, argv)
- char **argv;
- int argc;
- {
- + /* Phil.B 09-Jul-94: use 4KB as page size in order to be compatible with Gigamem
- + although getpagesize() is present in ixemul.library, we want to compile
- + without it */
- + #ifdef amigados
- + page_size = 4096;
- + #else
- page_size = getpagesize ();
- + #endif
- progname = argv[0];
-
- ! /* Phil.B 09-Jul-94: amigados doesn't have stack growing so this is not
- ! necessary and more than that disable ld to be compiled using libnix
- ! BTW as for now those functions returns 0 in ixemul.library.
- ! That's emulation! ;-) */
- ! #if defined(RLIMIT_STACK) && !defined(amigados)
- /* Avoid dumping core on large .o files. */
- {
- struct rlimit rl;
- ***************
- *** 1090,1095 ****
- --- 1217,1225 ----
- make_executable = 1;
- force_executable = 0;
- set_element_prefixes = 0;
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + amiga_symbols_only = 1;
- + #endif
-
- /* Initialize the cumulative counts of symbols. */
-
- ***************
- *** 1148,1158 ****
-
- exit (!make_executable);
- }
- !
- void add_cmdline_ref ();
-
- static struct option longopts[] =
- {
- {"d", 0, 0, 'd'},
- {"dc", 0, 0, 'd'}, /* For Sun compatibility. */
- {"dp", 0, 0, 'd'}, /* For Sun compatibility. */
- --- 1278,1318 ----
-
- exit (!make_executable);
- }
- !
- ! #ifdef amigados
- ! /* support hunk loading to a chip or fast memory */
- ! void set_mem_type(char *argstr, int memtype)
- ! {
- ! static char memstr[]="cdb";
- !
- ! if (!argstr)
- ! argstr=memstr;
- !
- ! if (strchr(argstr,'c')||strchr(argstr,'t'))
- ! code_mem_type=memtype;
- !
- ! if (strchr(argstr,'d'))
- ! data_mem_type=memtype;
- !
- ! if (strchr(argstr,'b'))
- ! bss_mem_type=memtype;
- ! }
- ! #endif
- !
- void add_cmdline_ref ();
-
- static struct option longopts[] =
- {
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + {"amiga-debug-hunk", 0, 0, 'a'},
- + {"databss-together", 0, 0, 'b'},
- + {"datadata-reloc", 0, 0, 'c'},
- + {"msmall-code", 0, 0, 129}, /* ignore.. */
- + {"flavor", 1, 0, 'f'},
- + {"chip",2, 0, 'g'},
- + {"fast",2, 0, 'h'},
- + {"shortdata", 0, 0, 'm'},
- + #endif
- {"d", 0, 0, 'd'},
- {"dc", 0, 0, 'd'}, /* For Sun compatibility. */
- {"dp", 0, 0, 'd'}, /* For Sun compatibility. */
- ***************
- *** 1207,1212 ****
- --- 1367,1385 ----
- /* First compute number_of_files so we know how long to make file_table.
- Also process most options completely. */
-
- + #ifdef amigados
- + /* Phil.B: 27-Feb-94 default is to strip all symbols if LDSTRIP is set */
- + if (getenv("LDSTRIP"))
- + strip_symbols = STRIP_ALL;
- +
- + /* G.Nikl: 10-Jun-94 if LDSHORTDATA is found a "short" data hunk will be
- + created. bss will be allocated via the hunk header. default is to dump
- + the bss part in the data area as zeros */
- +
- + if (getenv("LDSHORTDATA"))
- + long_data_hunk = 0;
- + #endif /* amigados */
- +
- while ((optc = getopt_long_only (argc, argv, SHORTOPTS, longopts, &longind))
- != EOF)
- {
- ***************
- *** 1224,1229 ****
- --- 1397,1416 ----
- number_of_files++;
- break;
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + case 'a':
- + amiga_symbols_only = 0;
- + break;
- +
- + case 'b':
- + databss_together = 1;
- + break;
- +
- + case 'c':
- + output_datadata_relocs = 1;
- + break;
- + #endif
- +
- case 'd':
- force_common_definition = 1;
- break;
- ***************
- *** 1236,1245 ****
- --- 1423,1451 ----
- add_cmdline_ref (entry_symbol);
- break;
-
- + case 'f':
- + n_flavors++;
- + flavors = (char **) xrealloc (flavors, n_flavors * sizeof (char *));
- + flavors[n_flavors - 1] = optarg;
- + break;
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + case 'g':
- + set_mem_type(optarg,1<<30);
- + break;
- +
- + case 'h':
- + set_mem_type(optarg,2<<30);
- + break;
- + #endif
- case 'l':
- number_of_files++;
- break;
-
- + case 'm':
- + long_data_hunk = 0;
- + break;
- +
- case 'n':
- if (output_style && output_style != OUTPUT_READONLY_TEXT)
- fatal ("illegal combination of -n with -N, -r, or -z", (char *) 0);
- ***************
- *** 1363,1368 ****
- --- 1569,1584 ----
- }
- }
-
- + if (n_flavors > 1)
- + {
- + register int i;
- +
- + if (trace_files)
- + for (i=0; i<n_flavors; i++)
- + fprintf (stderr, "Flavor #%d : %s\n", i, flavors[i]);
- + qsort (flavors, n_flavors, sizeof (char *), compare_strings);
- + }
- +
- if (!number_of_files)
- usage ("no input files", 0);
-
- ***************
- *** 1433,1439 ****
- n * sizeof (char *));
- }
- }
- !
-
- void
- add_cmdline_ref (sp)
- --- 1649,1655 ----
- n * sizeof (char *));
- }
- }
- !
-
- void
- add_cmdline_ref (sp)
- ***************
- *** 1478,1484 ****
- }
- return 0;
- }
- !
- /* Convenient functions for operating on one or all files being
- loaded. */
- void print_file_name ();
- --- 1694,1700 ----
- }
- return 0;
- }
- !
- /* Convenient functions for operating on one or all files being
- loaded. */
- void print_file_name ();
- ***************
- *** 1602,1609 ****
-
- for (i = 0; i < n_search_dirs; i++)
- {
- ! register char *string
- ! = concat (search_dirs[i], "/", entry->filename);
- desc = open (string, O_RDONLY, 0);
- if (desc > 0)
- {
- --- 1818,1836 ----
-
- for (i = 0; i < n_search_dirs; i++)
- {
- ! register char *string;
- !
- ! string = search_dirs[i];
- ! if (n_flavors > 0)
- ! {
- ! int count;
- ! for (count = 0; count < n_flavors; count++)
- ! {
- ! string = concat (string, "/", flavors[count]);
- ! }
- ! }
- ! string = concat (string, "/", entry->filename);
- ! if (trace_files) fprintf (stderr, "Look for %s\n", string);
- desc = open (string, O_RDONLY, 0);
- if (desc > 0)
- {
- ***************
- *** 1613,1618 ****
- --- 1840,1880 ----
- }
- free (string);
- }
- + /* Phil.B 30-Jul-94 if we couldn't find file using serch_dirs
- + then we try removing trailing path one by one */
- + if ((desc <= 0) && (n_flavors > 0))
- + {
- + if (trace_files) fprintf (stderr, "Climbing into flavors\n");
- + for (i = 0; i < n_search_dirs; i++)
- + {
- + register int j;
- + register char *string;
- +
- + for (j = n_flavors; j >= 0; j--)
- + {
- + int count;
- + string = search_dirs[i];
- + /* Phil.B 29-Jul-94 Special condition is made so that
- + if j = 0 we don't copy flavor because we want to test
- + search path without any flavor added. */
- + for (count = 1; count <= j ; count++)
- + {
- + string = concat (string, "/", flavors[count-1]);
- + }
- + string = concat (string, "/", entry->filename);
- + if (trace_files) fprintf (stderr, "Look for %s\n", string);
- + desc = open (string, O_RDONLY, 0);
- + if (desc > 0)
- + {
- + entry->filename = string;
- + entry->search_dirs_flag = 0;
- + break;
- + }
- + free (string);
- + }
- + if (desc > 0) break;
- + }
- + }
- }
- else
- desc = open (entry->filename, O_RDONLY, 0);
- ***************
- *** 1678,1684 ****
- }
- return result;
- }
- !
- /* Medium-level input routines for rel files. */
-
- /* Determine whether the given ENTRY is an archive, a BSD a.out file,
- --- 1940,1946 ----
- }
- return result;
- }
- !
- /* Medium-level input routines for rel files. */
-
- /* Determine whether the given ENTRY is an archive, a BSD a.out file,
- ***************
- *** 2044,2050 ****
- if (entry->strs_size != read (desc, entry->strings, entry->strs_size))
- fatal_with_file ("premature end of file in strings of ", entry);
- }
- !
- /* Read in the symbols of all input files. */
-
- void read_file_symbols (), read_entry_symbols (), read_entry_strings ();
- --- 2306,2312 ----
- if (entry->strs_size != read (desc, entry->strings, entry->strs_size))
- fatal_with_file ("premature end of file in strings of ", entry);
- }
- !
- /* Read in the symbols of all input files. */
-
- void read_file_symbols (), read_entry_symbols (), read_entry_strings ();
- ***************
- *** 2097,2103 ****
-
- file_close ();
- }
- !
- /* Enter the external symbol defs and refs of ENTRY in the hash table. */
-
- void
- --- 2359,2365 ----
-
- file_close ();
- }
- !
- /* Enter the external symbol defs and refs of ENTRY in the hash table. */
-
- void
- ***************
- *** 2120,2125 ****
- --- 2382,2397 ----
- if (SET_ELEMENT_P (p->n_type))
- {
- set_symbol_count++;
- +
- + /* Matthias Fleischer 25-Apr-94: fix bug in ld that prevents
- + symboltables for objects in the data hunk from working. */
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* Count pointers in the symbol table, too */
- + if ((p->n_type&~N_EXT)==N_SETD||
- + (p->n_type&~N_EXT)==N_SETB)
- + numdatadata_relocs++;
- + #endif
- +
- if (output_style != OUTPUT_RELOCATABLE)
- enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
- }
- ***************
- *** 2165,2170 ****
- --- 2437,2448 ----
-
- local_sym_count++;
- non_L_local_sym_count++;
- + #if 0
- + if (trace_files)
- + fprintf (stderr, "%d local syms, %d debug syms, %d gbl refs, %d gbl defs\n",
- + local_sym_count, debugger_sym_count, undefined_global_sym_count,
- + defined_global_sym_count);
- + #endif
- }
-
- /* Enter one global symbol in the hash table.
- ***************
- *** 2375,2381 ****
- return 0;
- }
-
- !
- /* Searching libraries */
-
- struct file_entry *decode_library_subfile ();
- --- 2653,2659 ----
- return 0;
- }
-
- !
- /* Searching libraries */
-
- struct file_entry *decode_library_subfile ();
- ***************
- *** 2452,2459 ****
- --- 2730,2762 ----
- && hdr1.ar_name[namelen] != '/';
- namelen++);
-
- + /* JPB, 7 Jun 1992: Support for long file names. Set the global variable
- + ar_hdr_size to the real length of the header.
- + The code for extracting the long name is pretty much stolen
- + from the BSD ar (archive.c, version 5.7).
- + This is a *really* ugly hack!
- + */
- + #if 1
- + ar_hdr_size = sizeof(struct ar_hdr);
- + if (!bcmp(hdr1.ar_name,AR_EFMT1,sizeof(AR_EFMT1) -1))
- + {
- + namelen = atoi(hdr1.ar_name + sizeof(AR_EFMT1) -1);
- + if (namelen <= 0 || namelen > MAXNAMLEN)
- + fatal_with_file("malformatted long name of archive member in ",library_entry);
- + ar_hdr_size += namelen;
- + name = (char *) xmalloc (namelen+1);
- + if (read(desc,name,namelen) != namelen)
- + fatal_with_file("malformatted long name of archive member in ",library_entry);
- + }
- + else
- + {
- + name = (char *) xmalloc (namelen+1);
- + strncpy (name, hdr1.ar_name, namelen);
- + }
- + #else
- name = (char *) xmalloc (namelen+1);
- strncpy (name, hdr1.ar_name, namelen);
- + #endif
- name[namelen] = 0;
-
- subentry->filename = name;
- ***************
- *** 2461,2467 ****
- --- 2764,2774 ----
- subentry->symbols = 0;
- subentry->strings = 0;
- subentry->subfiles = 0;
- + #if 1
- + subentry->starting_offset = subfile_offset + ar_hdr_size;
- + #else
- subentry->starting_offset = subfile_offset + sizeof hdr1;
- + #endif
- subentry->superfile = library_entry;
- subentry->library_flag = 0;
- subentry->header_read_flag = 0;
- ***************
- *** 2473,2479 ****
-
- return subentry;
- }
- !
- int subfile_wanted_p ();
-
- /* Search a library that has a __.SYMDEF member.
- --- 2780,2786 ----
-
- return subentry;
- }
- !
- int subfile_wanted_p ();
-
- /* Search a library that has a __.SYMDEF member.
- ***************
- *** 2622,2628 ****
-
- free (symdef_data);
- }
- !
-
- /* Handle a subentry for a file with no __.SYMDEF. */
-
- --- 2929,2935 ----
-
- free (symdef_data);
- }
- !
-
- /* Handle a subentry for a file with no __.SYMDEF. */
-
- ***************
- *** 2675,2685 ****
- if (!subentry) return;
-
- process_subentry (desc, subentry, entry, &prev);
- this_subfile_offset += member_length + sizeof (struct ar_hdr);
- if (this_subfile_offset & 1) this_subfile_offset++;
- }
- }
- !
- /* ENTRY is an entry for a library member.
- Its symbols have been read into core, but not entered.
- Return nonzero if we ought to load this member. */
- --- 2982,3000 ----
- if (!subentry) return;
-
- process_subentry (desc, subentry, entry, &prev);
- + #if 1
- + /* JPB, 7 Jun 1992: Can't count on sizeof(ar_hdr) to be the size of the entire
- + header: Long names extends the header. This is a *really*
- + ugly hack, using a global variable! */
- +
- + this_subfile_offset += member_length + ar_hdr_size;
- + #else
- this_subfile_offset += member_length + sizeof (struct ar_hdr);
- + #endif
- if (this_subfile_offset & 1) this_subfile_offset++;
- }
- }
- !
- /* ENTRY is an entry for a library member.
- Its symbols have been read into core, but not entered.
- Return nonzero if we ought to load this member. */
- ***************
- *** 2777,2783 ****
-
- return 0;
- }
- !
- void consider_file_section_lengths (), relocate_file_addresses ();
-
- /* Having entered all the global symbols and found the sizes of sections
- --- 3092,3098 ----
-
- return 0;
- }
- !
- void consider_file_section_lengths (), relocate_file_addresses ();
-
- /* Having entered all the global symbols and found the sizes of sections
- ***************
- *** 2800,2806 ****
- --- 3115,3125 ----
-
- initialize_text_start ();
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + text_size = 0;
- + #else
- text_size = text_header_size;
- + #endif
-
- /* Compute total size of sections */
-
- ***************
- *** 2809,2825 ****
- --- 3128,3164 ----
- /* If necessary, pad text section to full page in the file.
- Include the padding in the text segment size. */
-
- + #ifndef HUNK_INSTEAD_OF_A_OUT
- if (output_style == OUTPUT_READONLY_TEXT || output_style == OUTPUT_DEMAND_PAGED)
- {
- text_pad = ((text_size + page_size - 1) & (- page_size)) - text_size;
- text_size += text_pad;
- }
- + #endif
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* they go into text if they are required */
- + if (output_datadata_relocs && numdatadata_relocs)
- + {
- + if (datadata_reloc_symbol)
- + datadata_reloc_symbol->value = text_size;
- +
- + /* 1 long for the size, then the vector */
- + text_size += (1 + numdatadata_relocs) * 4;
- + }
- + #endif
-
- /* Now that the text_size is known, initialize the data start address;
- this depends on text_size as well as the output file format. */
-
- initialize_data_start ();
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + data_pad = 0;
- + #endif
- +
- +
- + #ifndef HUNK_INSTEAD_OF_A_OUT
- /* Make sure bss starts out aligned as much as anyone can want. */
- {
- int new_data_size = (data_size + sizeof(double) - 1) & ~(sizeof(double)-1);
- ***************
- *** 2827,2832 ****
- --- 3166,3172 ----
- data_pad += new_data_size - data_size;
- data_size = new_data_size;
- }
- + #endif
-
- /* Set up the set element vector */
-
- ***************
- *** 2836,2846 ****
- --- 3176,3196 ----
- for each symbol for the length word at the beginning of the
- vector, plus a word for each symbol for a zero at the end of
- the vector (for incremental linking). */
- + #if 0
- + /* I think this is the other way round !? ### mw */
- +
- set_sect_size
- = (2 * set_symbol_count + set_vector_count) * sizeof (unsigned long);
- + #else
- + set_sect_size
- + = (2 * set_vector_count + set_symbol_count) * sizeof (unsigned long);
- + #endif
- set_sect_start = data_start + data_size;
- data_size += set_sect_size;
- set_vectors = (unsigned long *) xmalloc (set_sect_size);
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + rel_vectors = (unsigned char *) xmalloc (set_sect_size/sizeof(unsigned long));
- + #endif
- setv_fill_count = 0;
- }
-
- ***************
- *** 2888,2894 ****
- --- 3238,3260 ----
- sp->multiply_defined = 1;
- multiple_def_count++;
- }
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* don't relocate absolute symbols in sets */
- + rel_vectors[setv_fill_count] = ( ((type & ~N_EXT) != N_SETA) );
- +
- + /* Matthias Fleischer 25-Apr-94: fix bug in ld that prevents
- + symboltables for objects in the data hunk from working. */
- +
- + /* This is some kind of hack, but doing this cleaner would be
- + much more complicated */
- + set_vectors[setv_fill_count++] = p->n_value
- + +( (type & ~N_EXT) == N_SETD ? text_size : 0 )
- + +( (type & ~N_EXT) == N_SETB ? data_size : 0 );
- + #else
- set_vectors[setv_fill_count++] = p->n_value;
- + #endif
- +
- }
- else if ((type & N_EXT) && type != (N_UNDF | N_EXT))
- {
- ***************
- *** 2931,2937 ****
- --- 3297,3309 ----
- + (align - 1)) & (- align))
- - data_size - data_start);
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + sp->value = bss_size;
- + if (databss_together)
- + sp->value += data_start + data_size;
- + #else
- sp->value = data_start + data_size + bss_size;
- + #endif
- sp->defined = N_BSS | N_EXT;
- bss_size += com;
- if (write_map)
- ***************
- *** 2951,2956 ****
- --- 3323,3329 ----
- unsigned long length_word_index
- = (sp->value - set_sect_start) / sizeof (unsigned long);
- unsigned long i, tmp;
- + unsigned char tmp2;
-
- set_vectors[length_word_index]
- = setv_fill_count - 1 - length_word_index;
- ***************
- *** 2964,2969 ****
- --- 3337,3349 ----
- set_vectors[length_word_index + i]
- = set_vectors[setv_fill_count - i];
- set_vectors[setv_fill_count - i] = tmp;
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* reverse relocation vector too! */
- + tmp2 = rel_vectors[length_word_index + i];
- + rel_vectors[length_word_index + i]
- + = rel_vectors[setv_fill_count - i];
- + rel_vectors[setv_fill_count - i] = tmp2;
- + #endif
- }
-
- set_vectors[setv_fill_count++] = 0;
- ***************
- *** 2994,2999 ****
- --- 3374,3392 ----
- etext_symbol_alt->value = etext_value;
- }
-
- + #ifdef amigados
- + {
- + if (sdata_symbol)
- + sdata_symbol->value = data_start;
- + if (text_size_symbol)
- + text_size_symbol->value = text_size;
- + if (data_size_symbol)
- + data_size_symbol->value = data_size;
- + if (bss_size_symbol)
- + bss_size_symbol->value = bss_size;
- + }
- + #endif
- +
- {
- int edata_value = data_start + data_size;
- if (edata_symbol)
- ***************
- *** 3013,3021 ****
- --- 3406,3416 ----
- if (specified_data_size && specified_data_size > data_size)
- data_pad_additional = specified_data_size - data_size;
-
- + #ifndef HUNK_INSTEAD_OF_A_OUT
- if (output_style == OUTPUT_DEMAND_PAGED)
- data_pad_additional =
- ((data_pad_additional + data_size + page_size - 1) & (- page_size)) - data_size;
- + #endif
-
- bss_size -= data_pad_additional;
- if (bss_size < 0) bss_size = 0;
- ***************
- *** 3024,3031 ****
-
- data_pad += data_pad_additional;
- }
- }
- !
- /* Accumulate the section sizes of input file ENTRY
- into the section sizes of the output file. */
-
- --- 3419,3462 ----
-
- data_pad += data_pad_additional;
- }
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* if there is some code, assign it next hunk_number */
- + if (text_size)
- + number_of_code_hunk = current_hunk++;
- + else
- + number_of_code_hunk = -1;
- +
- + if (data_size)
- + number_of_data_hunk = current_hunk++;
- + else
- + number_of_data_hunk = -1;
- +
- + if (bss_size)
- + number_of_bss_hunk = current_hunk++;
- + else
- + number_of_bss_hunk = -1;
- +
- + if (databss_together)
- + {
- + if (data_size && bss_size)
- + {
- + current_hunk --;
- + number_of_bss_hunk = number_of_data_hunk;
- + }
- + }
- +
- + if (strip_symbols != STRIP_ALL && !amiga_symbols_only)
- + number_of_debug_hunk = current_hunk++;
- + else
- + number_of_debug_hunk = -1;
- + if (trace_files)
- + fprintf (stderr, "text hunk %d, data hunk %d, bss hunk %d, debug hunk %d\n",
- + number_of_code_hunk, number_of_data_hunk, number_of_bss_hunk,
- + number_of_debug_hunk);
- + #endif
- }
- !
- /* Accumulate the section sizes of input file ENTRY
- into the section sizes of the output file. */
-
- ***************
- *** 3046,3051 ****
- --- 3477,3506 ----
-
- text_reloc_size += entry->text_reloc_size;
- data_reloc_size += entry->data_reloc_size;
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + if (! output_datadata_relocs)
- + return;
- +
- + /* have to guess at how many datadata-relocs we might have. This number
- + is larger than the real thing, because I have to include the references
- + to UNDF symbols as well. */
- + {
- + struct relocation_info *r, *re, *reloc;
- + int desc = file_open (entry);
- +
- + reloc = (struct relocation_info *) alloca (entry->data_reloc_size);
- + lseek (desc, entry->starting_offset + entry->data_reloc_offset, L_SET);
- + if (entry->data_reloc_size != read (desc, reloc, entry->data_reloc_size))
- + fatal_with_file ("premature eof in data relocation of ", entry);
- +
- + for (r = reloc, re = reloc + entry->data_reloc_size/sizeof(*re); r < re; r++)
- + if (RELOC_EXTERN_P (r) || ((RELOC_TYPE (r) & N_TYPE) != N_TEXT))
- + numdatadata_relocs ++;
- +
- + file_close ();
- + }
- + #endif
- }
-
- /* Determine where the sections of ENTRY go into the output file,
- ***************
- *** 3062,3068 ****
- for the portion of data_pad which overlaps with bss. If they had
- been, we would get the wrong results here. */
- entry->data_start_address += data_start;
- ! entry->bss_start_address += data_start + data_size;
-
- {
- register struct nlist *p;
- --- 3517,3528 ----
- for the portion of data_pad which overlaps with bss. If they had
- been, we would get the wrong results here. */
- entry->data_start_address += data_start;
- !
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! if (databss_together)
- ! #endif
- ! entry->bss_start_address += data_start + data_size;
- !
-
- {
- register struct nlist *p;
- ***************
- *** 3080,3087 ****
- case N_SETT:
- p->n_value += entry->text_start_address - entry->orig_text_address;
- break;
- - case N_DATA:
- case N_SETV:
- case N_SETD:
- /* Data segment symbol. Subtract the address of the
- data segment in the input file, and add the address
- --- 3540,3547 ----
- case N_SETT:
- p->n_value += entry->text_start_address - entry->orig_text_address;
- break;
- case N_SETV:
- + case N_DATA:
- case N_SETD:
- /* Data segment symbol. Subtract the address of the
- data segment in the input file, and add the address
- ***************
- *** 3098,3104 ****
- }
- }
- }
- !
- void describe_file_sections (), list_file_locals ();
-
- /* Print a complete or partial map of the output file. */
- --- 3558,3564 ----
- }
- }
- }
- !
- void describe_file_sections (), list_file_locals ();
-
- /* Print a complete or partial map of the output file. */
- ***************
- *** 3174,3180 ****
- entry->strings = 0; /* All done with them. */
- }
-
- !
- /* Static vars for do_warnings and subroutines of it */
- int list_unresolved_refs; /* List unresolved refs */
- int list_warning_symbols; /* List warning syms */
- --- 3634,3640 ----
- entry->strings = 0; /* All done with them. */
- }
-
- !
- /* Static vars for do_warnings and subroutines of it */
- int list_unresolved_refs; /* List unresolved refs */
- int list_warning_symbols; /* List warning syms */
- ***************
- *** 3192,3198 ****
- struct nlist *sym;
- };
-
- - void qsort ();
- /*
- * Helper routines for do_file_warnings.
- */
- --- 3652,3657 ----
- ***************
- *** 3672,3678 ****
- free (data_scan);
- entry->strings = 0; /* Since it will dissapear anyway. */
- }
- !
- do_warnings (outfile)
- FILE *outfile;
- {
- --- 4131,4137 ----
- free (data_scan);
- entry->strings = 0; /* Since it will dissapear anyway. */
- }
- !
- do_warnings (outfile)
- FILE *outfile;
- {
- ***************
- *** 3691,3697 ****
- if (list_unresolved_refs || list_multiple_defs)
- make_executable = 0;
- }
- !
- #ifdef A_OUT
-
- /* Stuff pertaining to creating a.out files. */
- --- 4150,4156 ----
- if (list_unresolved_refs || list_multiple_defs)
- make_executable = 0;
- }
- !
- #ifdef A_OUT
-
- /* Stuff pertaining to creating a.out files. */
- ***************
- *** 3712,3717 ****
- --- 4171,4181 ----
- {
- int magic;
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + text_start = 0;
- + return;
- + #endif
- +
- switch (output_style)
- {
- case OUTPUT_RELOCATABLE:
- ***************
- *** 3770,3775 ****
- --- 4234,4244 ----
- void
- initialize_a_out_data_start ()
- {
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + data_start = 0;
- + return;
- + #endif
- +
- outheader.a_text = text_size;
- #ifdef sequent
- outheader.a_text += N_ADDRADJ (outheader);
- ***************
- *** 3923,3947 ****
- void
- write_a_out_header ()
- {
- ! lseek (outdesc, 0L, 0);
-
- #ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- ! mywrite (&coffheader, sizeof coffheader, 1, outdesc);
- #endif
-
- ! mywrite (&outheader, sizeof (struct exec), 1, outdesc);
-
- /* Output whatever padding is required in the executable file
- between the header and the start of the text. */
-
- #ifndef COFF_ENCAPSULATE
- ! padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
- #endif
- }
-
- #endif
- !
- #ifdef MACH_O
-
- /* Stuff pertaining to creating Mach-O files. */
- --- 4392,4416 ----
- void
- write_a_out_header ()
- {
- ! fseek (outstream, 0L, 0);
-
- #ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- ! mywrite (&coffheader, sizeof coffheader, 1, outstream);
- #endif
-
- ! mywrite (&outheader, sizeof (struct exec), 1, outstream);
-
- /* Output whatever padding is required in the executable file
- between the header and the start of the text. */
-
- #ifndef COFF_ENCAPSULATE
- ! padfile (N_TXTOFF (outheader) - sizeof outheader, outstream);
- #endif
- }
-
- #endif
- !
- #ifdef MACH_O
-
- /* Stuff pertaining to creating Mach-O files. */
- ***************
- *** 4145,4151 ****
- #endif
- thread_state state;
-
- ! lseek (outdesc, 0L, 0);
-
-
- header.magic = MH_MAGIC;
- --- 4614,4620 ----
- #endif
- thread_state state;
-
- ! fseek (outstream, 0L, 0);
-
-
- header.magic = MH_MAGIC;
- ***************
- *** 4251,4257 ****
- #ifdef LC_SYMSEG
- m_object.symseg = symseg;
- #endif
- ! mywrite((char *) &m_object, 1, sizeof m_object, outdesc);
- break;
-
- default:
- --- 4720,4726 ----
- #ifdef LC_SYMSEG
- m_object.symseg = symseg;
- #endif
- ! mywrite((char *) &m_object, 1, sizeof m_object, outstream);
- break;
-
- default:
- ***************
- *** 4305,4311 ****
- #ifdef LC_SYMSEG
- m_exec.symseg = symseg;
- #endif
- ! mywrite((char *) &m_exec, 1, sizeof m_exec, outdesc);
- break;
- }
- }
- --- 4774,4780 ----
- #ifdef LC_SYMSEG
- m_exec.symseg = symseg;
- #endif
- ! mywrite((char *) &m_exec, 1, sizeof m_exec, outstream);
- break;
- }
- }
- ***************
- *** 4386,4392 ****
- }
-
- #endif
- !
- /* The following functions are simple switches according to the
- output style. */
-
- --- 4855,4861 ----
- }
-
- #endif
- !
- /* The following functions are simple switches according to the
- output style. */
-
- ***************
- *** 4484,4489 ****
- --- 4953,4962 ----
- void
- write_header ()
- {
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + conditionally_rewrite_headers ();
- + return;
- + #else
- #ifdef A_OUT
- if (output_file_type == IS_A_OUT)
- {
- ***************
- *** 4498,4506 ****
- return;
- }
- #endif
- fatal ("unknown output file type (enum file_type)", (char *) 0);
- }
- !
- /* Write the output file */
-
- void
- --- 4971,4980 ----
- return;
- }
- #endif
- + #endif
- fatal ("unknown output file type (enum file_type)", (char *) 0);
- }
- !
- /* Write the output file */
-
- void
- ***************
- *** 4519,4540 ****
- the way Unix ld works; I'm going to consider it a feature. */
- (void) unlink (output_filename);
-
- ! outdesc = open (output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- ! if (outdesc < 0) perror_name (output_filename);
-
- ! if (fstat (outdesc, &statbuf) < 0)
- perror_name (output_filename);
-
- filemode = statbuf.st_mode;
-
- chmod (output_filename, filemode & ~0111);
-
- /* Calculate the offsets of the various pieces of the output file. */
- compute_section_offsets ();
-
- /* Output the text and data segments, relocating as we go. */
- write_text ();
- write_data ();
-
- /* Output the merged relocation info, if requested with `-r'. */
- if (output_style == OUTPUT_RELOCATABLE)
- --- 4993,5061 ----
- the way Unix ld works; I'm going to consider it a feature. */
- (void) unlink (output_filename);
-
- ! outstream = fopen (output_filename, "w");
- ! if (outstream == 0) perror_name (output_filename);
-
- ! #ifndef MCH_AMIGA
- ! if (fstat (fileno (outstream), &statbuf) < 0)
- perror_name (output_filename);
-
- filemode = statbuf.st_mode;
-
- + /* this wouldn't work anyway, "file in use, error"... */
- chmod (output_filename, filemode & ~0111);
- + #endif
- +
- + /* on the Amiga, the following call DOES set the symbol offset, but
- + * it does it wrong, we'll be able to do it right, as soon as all the
- + * other data has been written.. */
-
- /* Calculate the offsets of the various pieces of the output file. */
- compute_section_offsets ();
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* get ready to collect information where all symbols
- + * go. Since this has to be done only once, we'll later be able to
- + * output the right symbol-hunk after the right (code/data/bss-)hunk. */
- + init_symbol_hunks ();
- + look_for_symbols ();
- + #endif
- +
- /* Output the text and data segments, relocating as we go. */
- write_text ();
- write_data ();
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + if (datadata_relocs_offset)
- + write_datadata_relocs ();
- +
- + write_bss ();
- + if (number_of_debug_hunk != -1)
- + {
- + /* ok, lets output the start of the debug hunk */
- + fseek (outstream, 0L, SEEK_END);
- + offset_of_debug_hunk = ftell (outstream);
- + if (trace_files)
- + fprintf (stderr, "Write debug hunk at 0x%x\n", offset_of_debug_hunk);
- + dh.id = 0x3f1; /* HUNK_DEBUG */
- + dh.len = 0; /* we'll fill this in later */
- + dh.magic = ZMAGIC; /* when wishes came true... */
- + dh.syms = outheader.a_syms;
- + mywrite(&dh, sizeof dh, 1, outstream);
- +
- + output_syms_offset = ftell (outstream);
- + output_strs_offset = output_syms_offset + dh.syms;
- +
- + /* since we later will seek forward and backward to fill in each files
- + * symbol- and string-table, we have to create the needed space, that
- + * will be seeked over, since on an empty file, lseek(fd, 10, 0) will
- + * position to byte 10 on Unix, but will just generate an error under
- + * AmigaDOS and stay at position 0. */
- +
- + /* this will just write garbage, but thats enough:-)) */
- + mywrite(&output_strs_offset, dh.syms+4, 1, outstream);
- + fseek (outstream, output_syms_offset, 0);
- + }
- + #endif
-
- /* Output the merged relocation info, if requested with `-r'. */
- if (output_style == OUTPUT_RELOCATABLE)
- ***************
- *** 4547,4568 ****
- are finalized. */
- compute_more_section_offsets ();
-
- /* Copy any GDB symbol segments from input files. */
- write_symsegs ();
-
- /* Now that everything is known about the output file, write its header. */
- write_header ();
-
- ! close (outdesc);
-
- mask = umask (0);
- umask (mask);
-
- if (chmod (output_filename, filemode | (0111 & ~mask)) == -1)
- perror_name (output_filename);
- }
- !
- void modify_location (), perform_relocation (), copy_text (), copy_data ();
-
- /* Relocate the text segment of each input file
- and write to the output file. */
- --- 5068,5101 ----
- are finalized. */
- compute_more_section_offsets ();
-
- + #ifndef HUNK_INSTEAD_OF_A_OUT
- + /* I don't support GDB-symbol segments, they aren't used anymore by
- + * the newer versions of gdb, BUT of course, if somebody needs them..
- + * that's exactly why I introduced the "dh.strs" Parameter, so that
- + * you could - as in Unix - append these segments at the end of the file */
- +
- /* Copy any GDB symbol segments from input files. */
- write_symsegs ();
- + #endif
-
- /* Now that everything is known about the output file, write its header. */
- write_header ();
-
- ! fclose (outstream);
-
- + #ifndef HUNK_INSTEAD_OF_A_OUT
- mask = umask (0);
- umask (mask);
-
- if (chmod (output_filename, filemode | (0111 & ~mask)) == -1)
- perror_name (output_filename);
- + #endif
- }
- !
- void modify_location (), perform_relocation (), copy_text (), copy_data ();
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + void write_hunk_header();
- + #endif
-
- /* Relocate the text segment of each input file
- and write to the output file. */
- ***************
- *** 4571,4587 ****
- write_text ()
- {
- if (trace_files)
- ! fprintf (stderr, "Copying and relocating text:\n\n");
-
- ! lseek (outdesc, output_text_offset + text_header_size, 0);
-
- each_full_file (copy_text, 0);
- file_close ();
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- ! padfile (text_pad, outdesc);
- }
-
- /* Read in all of the relocation information */
- --- 5104,5161 ----
- write_text ()
- {
- if (trace_files)
- ! fprintf (stderr, "Copying and relocating text at 0x%x:\n\n",
- ! ftell (outstream));
-
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! /* this is a definitive write, we don't need to rewrite this out, since
- ! * the yet undefined sizes of the reloc-hunks don't go into the
- ! * header-hunk */
- ! write_hunk_header(outstream);
- ! init_reloc_hunk();
- !
- ! /* and if there's no code-hunk, we can return here.. no sense in
- ! * complicately doing just nothing... */
- ! if (number_of_code_hunk == -1) return;
- !
- ! /* else start the code-hunk */
- ! {
- ! long code_header[2];
- ! code_header[0] = 0x3e9;
- ! code_header[1] = LONGSIZE(text_size);
- ! mywrite(code_header, 1, sizeof code_header, outstream);
- ! }
- ! #else
- ! fseek (outstream, output_text_offset + text_header_size, 0);
- ! #endif
-
- each_full_file (copy_text, 0);
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + if (output_datadata_relocs && numdatadata_relocs)
- + {
- + int i, zero = 0;
- + /* include the size-field, -> <= . The `real' values come later */
- + datadata_relocs_offset = ftell (outstream);
- + for (i = 0; i <= numdatadata_relocs; i ++)
- + mywrite (&zero, 1, sizeof (long), outstream);
- + }
- + #endif
- +
- file_close ();
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- ! padfile (text_pad, outstream);
- !
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! write_reloc_hunk();
- ! write_symbol_hunk(number_of_code_hunk);
- ! {
- ! long hunk_end = 0x3f2;
- ! mywrite(&hunk_end, 1, sizeof(long), outstream);
- ! }
- ! #endif
- }
-
- /* Read in all of the relocation information */
- ***************
- *** 4686,4700 ****
- fatal_with_file ("premature eof in text section of ", entry);
-
- /* Relocate the text according to the text relocation. */
- -
- perform_relocation (bytes, entry->text_start_address - entry->orig_text_address,
- entry->text_size, reloc, entry->text_reloc_size, entry);
-
- /* Write the relocated text to the output file. */
-
- ! mywrite (bytes, 1, entry->text_size, outdesc);
- }
- !
- /* Relocate the data segment of each input file
- and write to the output file. */
-
- --- 5260,5273 ----
- fatal_with_file ("premature eof in text section of ", entry);
-
- /* Relocate the text according to the text relocation. */
- perform_relocation (bytes, entry->text_start_address - entry->orig_text_address,
- entry->text_size, reloc, entry->text_reloc_size, entry);
-
- /* Write the relocated text to the output file. */
-
- ! mywrite (bytes, 1, entry->text_size, outstream);
- }
- !
- /* Relocate the data segment of each input file
- and write to the output file. */
-
- ***************
- *** 4702,4710 ****
- write_data ()
- {
- if (trace_files)
- ! fprintf (stderr, "Copying and relocating data:\n\n");
-
- ! lseek (outdesc, output_data_offset, 0);
-
- each_full_file (copy_data, 0);
- file_close ();
- --- 5275,5304 ----
- write_data ()
- {
- if (trace_files)
- ! fprintf (stderr, "Copying and relocating data at 0x%x:\n\n",
- ! ftell (outstream));
- !
- ! #ifndef HUNK_INSTEAD_OF_A_OUT
- ! fseek (outstream, output_data_offset, 0);
- ! #else
- ! /* just have to hope that the file is positioned correctly.. */
- ! init_reloc_hunk();
- ! /* start a data-hunk, if there is data to be output */
- ! if (number_of_data_hunk == -1) return;
-
- ! {
- ! long data_header[2];
- ! int size;
- ! data_header[0] = 0x3ea;
- ! size = LONGSIZE(data_size);
- ! /* create long data hunk? */
- ! if (long_data_hunk && databss_together)
- ! size=LONGSIZE(data_size+bss_size);
- ! data_header[1] = size;
- !
- ! mywrite(data_header, 1, sizeof data_header, outstream);
- ! }
- ! #endif
-
- each_full_file (copy_data, 0);
- file_close ();
- ***************
- *** 4713,4725 ****
- description of length of the set vector section. */
-
- if (set_vector_count)
- ! mywrite (set_vectors, 2 * set_symbol_count + set_vector_count,
- ! sizeof (unsigned long), outdesc);
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- ! padfile (data_pad, outdesc);
- }
-
- /* Read the data segment contents of ENTRY, relocate them,
- --- 5307,5351 ----
- description of length of the set vector section. */
-
- if (set_vector_count)
- ! {
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! /* this and mywrite later: inverted set_symbol_count and
- ! * set_vector_count, guess they were mixed up before ### mw */
- !
- ! relocate_set_vectors (set_vectors, rel_vectors,
- ! 2 * set_vector_count + set_symbol_count);
- ! #endif
- ! #if 0
- ! mywrite (set_vectors, 2 * set_symbol_count + set_vector_count,
- ! sizeof (unsigned long), outstream);
- ! #else
- ! mywrite (set_vectors, 2 * set_vector_count + set_symbol_count,
- ! sizeof (unsigned long), outstream);
- ! #endif
- ! }
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- ! padfile (data_pad, outstream);
- !
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- !
- ! if (long_data_hunk && databss_together && bss_size)
- ! {
- ! /* dump zeros */
- ! int i, zero = 0;
- ! for (i = 0; i < LONGSIZE(bss_size); i++)
- ! mywrite (&zero, 1, sizeof (long), outstream);
- ! }
- !
- ! write_reloc_hunk();
- ! write_symbol_hunk(number_of_data_hunk);
- ! {
- ! long hunk_end = 0x3f2;
- ! mywrite(&hunk_end, 1, sizeof(long), outstream);
- ! }
- ! #endif
- }
-
- /* Read the data segment contents of ENTRY, relocate them,
- ***************
- *** 4765,4776 ****
- if (entry->data_size != read (desc, bytes, entry->data_size))
- fatal_with_file ("premature eof in data section of ", entry);
-
- ! perform_relocation (bytes, entry->data_start_address - entry->orig_data_address,
- ! entry->data_size, reloc, entry->data_reloc_size, entry);
-
- ! mywrite (bytes, 1, entry->data_size, outdesc);
- }
- !
- /* Relocate ENTRY's text or data section contents.
- DATA is the address of the contents, in core.
- DATA_SIZE is the length of the contents.
- --- 5391,5406 ----
- if (entry->data_size != read (desc, bytes, entry->data_size))
- fatal_with_file ("premature eof in data section of ", entry);
-
- ! perform_relocation (bytes, entry->data_start_address
- ! #ifndef HUNK_INSTEAD_OF_A_OUT
- ! - entry->orig_data_address
- ! #endif
- ! ,
- ! entry->data_size, reloc, entry->data_reloc_size, entry);
-
- ! mywrite (bytes, 1, entry->data_size, outstream);
- }
- !
- /* Relocate ENTRY's text or data section contents.
- DATA is the address of the contents, in core.
- DATA_SIZE is the length of the contents.
- ***************
- *** 4796,4806 ****
- --- 5426,5445 ----
- int data_relocation = entry->data_start_address - entry->orig_data_address;
- int bss_relocation = entry->bss_start_address - entry->orig_bss_address;
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + int this_hunk;
- + #endif
- +
- for (; p < end; p++)
- {
- register int relocation = 0;
- register int addr = RELOC_ADDRESS(p);
- register unsigned int mask = 0;
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + int ext_abs;
- +
- + ext_abs = 0;
- + #endif
-
- if (addr >= data_size)
- fatal_with_file ("relocation address out of range in ", entry);
- ***************
- *** 4827,4848 ****
- relocation = 0;
- else
- relocation = sp->value;
- }
- else switch (RELOC_TYPE(p))
- {
- case N_TEXT:
- case N_TEXT | N_EXT:
- ! relocation = text_relocation;
- break;
-
- case N_DATA:
- case N_DATA | N_EXT:
- ! relocation = data_relocation;
- break;
-
- case N_BSS:
- case N_BSS | N_EXT:
- ! relocation = bss_relocation;
- break;
-
- case N_ABS:
- --- 5466,5545 ----
- relocation = 0;
- else
- relocation = sp->value;
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + if ((sp->defined & ~N_EXT) == N_ABS)
- + /* sort of a kludge.. the only external symbol (not pcrelative)
- + * we can really resolve.. */
- + ext_abs = 1;
- + else if ((sp->defined & ~N_EXT) == N_TEXT ||
- + (sp->defined & ~N_EXT) == N_SETT)
- + {
- + this_hunk = number_of_code_hunk;
- + if (RELOC_BASEREL_P (p))
- + {
- + fprintf (stderr, "symn = $%x, extern = %d, addr = $%lx.\n",
- + p->r_symbolnum, p->r_extern, p->r_address);
- + fatal_with_file ("base relative text relocation in ", entry);
- + }
- + }
- + else if ((sp->defined & ~N_EXT) == N_DATA ||
- + (sp->defined & ~N_EXT) == N_SETD ||
- + (sp->defined & ~N_EXT) == N_SETV)
- + {
- + this_hunk = number_of_data_hunk;
- + }
- + else if ((sp->defined & ~N_EXT) == N_BSS ||
- + (sp->defined & ~N_EXT) == N_UNDF ||
- + (sp->defined & ~N_EXT) == N_SETB)
- + {
- + this_hunk = number_of_bss_hunk;
- + }
- + else
- + fatal_with_file ("external symbol with unknown type $%x in ", entry, sp->defined);
- + #endif
- }
- else switch (RELOC_TYPE(p))
- {
- case N_TEXT:
- case N_TEXT | N_EXT:
- ! if (RELOC_BASEREL_P (p))
- ! {
- ! fprintf (stderr, "symn = $%x, extern = %d, addr = $%lx.\n",
- ! p->r_symbolnum, p->r_extern, p->r_address);
- ! fatal_with_file ("base relative text relocation in ", entry);
- ! }
- ! else
- ! relocation = text_relocation;
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! this_hunk = number_of_code_hunk;
- ! #endif
- break;
-
- case N_DATA:
- case N_DATA | N_EXT:
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! if (RELOC_BASEREL_P (p))
- ! relocation = entry->data_start_address;
- ! else
- ! #endif
- ! relocation = data_relocation;
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! this_hunk = number_of_data_hunk;
- ! #endif
- break;
-
- case N_BSS:
- case N_BSS | N_EXT:
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! if (RELOC_BASEREL_P (p))
- ! relocation = entry->bss_start_address - entry->data_size;
- ! else
- ! #endif
- ! relocation = bss_relocation;
- ! #ifdef HUNK_INSTEAD_OF_A_OUT
- ! this_hunk = number_of_bss_hunk;
- ! #endif
- break;
-
- case N_ABS:
- ***************
- *** 4854,4864 ****
- fatal_with_file ("nonexternal relocation code invalid in ", entry);
- }
-
- if (RELOC_PCREL_P(p))
- relocation -= pc_relocation;
-
- ! #ifdef RELOC_ADD_EXTRA
- ! relocation += RELOC_ADD_EXTRA(p);
- if (output_style == OUTPUT_RELOCATABLE)
- {
- /* If this RELOC_ADD_EXTRA is 0, it means that the
- --- 5551,5586 ----
- fatal_with_file ("nonexternal relocation code invalid in ", entry);
- }
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* in this case, ONLY relocate those pc-relative 32bit jumps, that
- + * gas generates, since they are position independent, this gives
- + * a HUGE.. 'if' inside of '#ifdef' oh well... */
- + if (RELOC_PCREL_P(p) || RELOC_BASEREL_P(p) || ext_abs) {
- +
- + /* VERY BIG KLUDGE AHEAD! Since this amiga hunk format is really
- + * limited, 8bit and 16bit references are always defined to be
- + * pc-relative (according to the AmigaDOS RM 2nd ed). BUT if such
- + * a symbol is resolved by an absolute symbol then it's not considered
- + * to be pc-relative any more. This is nowhere documented, but you
- + * couldn't get
- + * jsr _LVOOpen(a6)
- + * to work if you wouldn't do it this way. */
- + if (ext_abs) RELOC_PCREL_P(p) = 0;
- +
- + #endif
- if (RELOC_PCREL_P(p))
- relocation -= pc_relocation;
-
- ! /* if base relative, subtract 64k/2, so we get a larger range */
- ! if (RELOC_BASEREL_P(p))
- ! {
- ! if (! databss_together)
- ! fatal_with_file ("Reloc is base relative. Specify -databss-together in ", entry);
- ! relocation -= 0x7ffe;
- ! }
- !
- ! #ifdef RELOC_ADD_EXTRA
- ! relocation += RELOC_ADD_EXTRA(p);
- if (output_style == OUTPUT_RELOCATABLE)
- {
- /* If this RELOC_ADD_EXTRA is 0, it means that the
- ***************
- *** 4895,4901 ****
- /* Shift everything up to where it's going to be used */
- relocation <<= RELOC_TARGET_BITPOS(p);
- mask <<= RELOC_TARGET_BITPOS(p);
- -
- switch (RELOC_TARGET_SIZE(p))
- {
- case 0:
- --- 5617,5622 ----
- ***************
- *** 4903,4920 ****
- --- 5624,5662 ----
- relocation -= mask & *(char *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(char *) (data + addr);
- + if (relocation < -128 || relocation > 127)
- + fatal_with_file ("Byte reloc overflow in ", entry);
- +
- *(char *) (data + addr) &= ~mask;
- *(char *) (data + addr) |= relocation;
- break;
-
- case 1:
- + {
- + int r=relocation;
- +
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & *(short *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(short *) (data + addr);
- +
- + if (relocation < -32768 || relocation > 32767)
- + {
- + fprintf (stderr, "relocation = $%lx, bsr = %d, pcr = %d, r= $%lx\n",
- + relocation, RELOC_BASEREL_P(p), RELOC_PCREL_P (p), r);
- + fprintf (stderr, "textr = $%x, datar = $%x, bssr = $%x\n",
- + text_relocation, data_relocation, bss_relocation);
- + fprintf (stderr, "symn = $%x, extern = %d, addr = $%lx.\n",
- + p->r_symbolnum, p->r_extern, p->r_address);
- + fprintf (stderr, "data_size = %d, bss_size = %d.\n",
- + data_size, bss_size);
- + fatal_with_file ("Word reloc overflow in ", entry);
- + }
- +
- *(short *) (data + addr) &= ~mask;
- *(short *) (data + addr) |= relocation;
- break;
- + }
-
- case 2:
- #ifdef CROSS_LINKER
- ***************
- *** 4937,4942 ****
- --- 5679,5685 ----
- relocation -= mask & *(long *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(long *) (data + addr);
- +
- *(long *) (data + addr) &= ~mask;
- *(long *) (data + addr) |= relocation;
- #endif /* not CROSS_LINKER */
- ***************
- *** 4945,4953 ****
- default:
- fatal_with_file ("Unimplemented relocation field length in ", entry);
- }
- }
- }
- !
- /* For OUTPUT_RELOCATABLE only: write out the relocation,
- relocating the addresses-to-be-relocated. */
-
- --- 5688,5727 ----
- default:
- fatal_with_file ("Unimplemented relocation field length in ", entry);
- }
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* now finish this huge 'if' .. */
- + }
- + else
- + {
- + /* this only deals with 32bit relocs, the Amiga-loader
- + * doesn't support 1 or 2 byte relocs, they are only defined
- + * inside program-units (commonly known as object-files:-)) */
- +
- + if (RELOC_TARGET_SIZE(p) != 2)
- + fatal_with_file ("unsupported reloc-size in ", entry);
- +
- + /* Phil.B: 06-Apr-94 same kludge as above for host with stricter alignment
- + than the taget. */
- + #ifdef CROSS_LINKER
- + {
- + /* Thing to relocate. */
- + long thing;
- + bcopy (data + addr, &thing, sizeof (thing));
- + thing += relocation;
- + bcopy (&thing, data + addr, sizeof (thing));
- + }
- + #else
- + *(long *) (data + addr) += relocation;
- + #endif /* CROSS_LINKER */
- +
- + addr += pc_relocation;
- + add_to_reloc_hunk(this_hunk, addr);
- + }
- + #endif
- }
- }
- !
- /* For OUTPUT_RELOCATABLE only: write out the relocation,
- relocating the addresses-to-be-relocated. */
-
- ***************
- *** 4995,5007 ****
-
- /* Write out the relocations of all files, remembered from copy_text. */
-
- ! lseek (outdesc, output_trel_offset, 0);
- each_full_file (coptxtrel, 0);
-
- if (trace_files)
- fprintf (stderr, "\nWriting data relocation:\n\n");
-
- ! lseek (outdesc, output_drel_offset, 0);
- each_full_file (copdatrel, 0);
-
- if (trace_files)
- --- 5769,5781 ----
-
- /* Write out the relocations of all files, remembered from copy_text. */
-
- ! fseek (outstream, output_trel_offset, 0);
- each_full_file (coptxtrel, 0);
-
- if (trace_files)
- fprintf (stderr, "\nWriting data relocation:\n\n");
-
- ! fseek (outstream, output_drel_offset, 0);
- each_full_file (copdatrel, 0);
-
- if (trace_files)
- ***************
- *** 5076,5082 ****
- entry->text_reloc_size / sizeof (struct relocation_info));
- #endif
-
- ! mywrite (entry->textrel, 1, entry->text_reloc_size, outdesc);
- }
-
- void
- --- 5850,5856 ----
- entry->text_reloc_size / sizeof (struct relocation_info));
- #endif
-
- ! mywrite (entry->textrel, 1, entry->text_reloc_size, outstream);
- }
-
- void
- ***************
- *** 5155,5163 ****
- entry->data_reloc_size / sizeof (struct relocation_info));
- #endif
-
- ! mywrite (entry->datarel, 1, entry->data_reloc_size, outdesc);
- }
- !
- void write_file_syms ();
- void write_string_table ();
-
- --- 5929,5937 ----
- entry->data_reloc_size / sizeof (struct relocation_info));
- #endif
-
- ! mywrite (entry->datarel, 1, entry->data_reloc_size, outstream);
- }
- !
- void write_file_syms ();
- void write_string_table ();
-
- ***************
- *** 5192,5199 ****
- return index;
- }
-
- - FILE *outstream = (FILE *) 0;
- -
- /* Write the contents of `strtab_vector' into the string table.
- This is done once for each file's local&debugger symbols
- and once for the global symbols. */
- --- 5966,5971 ----
- ***************
- *** 5203,5212 ****
- {
- register int i;
-
- ! lseek (outdesc, output_strs_offset + output_strs_size, 0);
-
- if (!outstream)
- outstream = fdopen (outdesc, "w");
-
- for (i = 0; i < strtab_index; i++)
- {
- --- 5975,5986 ----
- {
- register int i;
-
- ! fseek (outstream, output_strs_offset + output_strs_size, 0);
-
- + #if 0
- if (!outstream)
- outstream = fdopen (outdesc, "w");
- + #endif
-
- for (i = 0; i < strtab_index; i++)
- {
- ***************
- *** 5220,5226 ****
- if (ferror (outstream))
- perror_name (output_filename);
- }
- !
- /* Write the symbol table and string table of the output file. */
-
- void
- --- 5994,6000 ----
- if (ferror (outstream))
- perror_name (output_filename);
- }
- !
- /* Write the symbol table and string table of the output file. */
-
- void
- ***************
- *** 5248,5253 ****
- --- 6022,6033 ----
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* this enables us to output "regular" amiga symbols without
- + * the BSD-like debug-hunk */
- + if (number_of_debug_hunk == -1) return;
- + #endif
- +
- /* Size of string table includes the bytes that store the size. */
- strtab_size = sizeof strtab_size;
-
- ***************
- *** 5370,5377 ****
-
- /* Output the buffer full of `struct nlist's. */
-
- ! lseek (outdesc, output_syms_offset + output_syms_size, 0);
- ! mywrite (buf, sizeof (struct nlist), bufp - buf, outdesc);
- output_syms_size += sizeof (struct nlist) * (bufp - buf);
-
- if (syms_written != nsyms)
- --- 6150,6157 ----
-
- /* Output the buffer full of `struct nlist's. */
-
- ! fseek (outstream, output_syms_offset + output_syms_size, 0);
- ! mywrite (buf, sizeof (struct nlist), bufp - buf, outstream);
- output_syms_size += sizeof (struct nlist) * (bufp - buf);
-
- if (syms_written != nsyms)
- ***************
- *** 5380,5393 ****
- /* Now the total string table size is known, so write it into the
- first word of the string table. */
-
- ! lseek (outdesc, output_strs_offset, 0);
- ! mywrite (&strtab_size, sizeof (int), 1, outdesc);
-
- /* Write the strings for the global symbols. */
-
- write_string_table ();
- }
- !
- /* Write the local and debugger symbols of file ENTRY.
- Increment *SYMS_WRITTEN_ADDR for each symbol that is written. */
-
- --- 6160,6173 ----
- /* Now the total string table size is known, so write it into the
- first word of the string table. */
-
- ! fseek (outstream, output_strs_offset, 0);
- ! mywrite (&strtab_size, sizeof (int), 1, outstream);
-
- /* Write the strings for the global symbols. */
-
- write_string_table ();
- }
- !
- /* Write the local and debugger symbols of file ENTRY.
- Increment *SYMS_WRITTEN_ADDR for each symbol that is written. */
-
- ***************
- *** 5489,5496 ****
-
- /* All the symbols are now in BUF; write them. */
-
- ! lseek (outdesc, output_syms_offset + output_syms_size, 0);
- ! mywrite (buf, sizeof (struct nlist), bufp - buf, outdesc);
- output_syms_size += sizeof (struct nlist) * (bufp - buf);
-
- /* Write the string-table data for the symbols just written,
- --- 6269,6276 ----
-
- /* All the symbols are now in BUF; write them. */
-
- ! fseek (outstream, output_syms_offset + output_syms_size, 0);
- ! mywrite (buf, sizeof (struct nlist), bufp - buf, outstream);
- output_syms_size += sizeof (struct nlist) * (bufp - buf);
-
- /* Write the string-table data for the symbols just written,
- ***************
- *** 5499,5505 ****
- write_string_table ();
- entry->strings = 0; /* Since it will dissapear anyway. */
- }
- !
- /* Copy any GDB symbol segments from the input files to the output file.
- The contents of the symbol segment is copied without change
- except that we store some information into the beginning of it. */
- --- 6279,6285 ----
- write_string_table ();
- entry->strings = 0; /* Since it will dissapear anyway. */
- }
- !
- /* Copy any GDB symbol segments from the input files to the output file.
- The contents of the symbol segment is copied without change
- except that we store some information into the beginning of it. */
- ***************
- *** 5509,5515 ****
- void
- write_symsegs ()
- {
- ! lseek (outdesc, output_symseg_offset, 0);
- each_file (write_file_symseg, 0);
- }
-
- --- 6289,6295 ----
- void
- write_symsegs ()
- {
- ! fseek (outstream, output_symseg_offset, 0);
- each_file (write_file_symseg, 0);
- }
-
- ***************
- *** 5544,5550 ****
-
- /* Write the modified root into the output file. */
-
- ! mywrite (&root, sizeof root, 1, outdesc);
-
- /* Copy the rest of the symbol segment unchanged. */
-
- --- 6324,6330 ----
-
- /* Write the modified root into the output file. */
-
- ! mywrite (&root, sizeof root, 1, outstream);
-
- /* Copy the rest of the symbol segment unchanged. */
-
- ***************
- *** 5557,5568 ****
- if (len != min (sizeof buffer, total))
- fatal_with_file ("premature end of file in symbol segment of ", entry);
- total -= len;
- ! mywrite (buffer, len, 1, outdesc);
- }
-
- file_close ();
- }
- !
- /* Define a special symbol (etext, edata, or end). NAME is the
- name of the symbol, with a leading underscore (whether or not this
- system uses such underscores). TYPE is its type (e.g. N_DATA | N_EXT).
- --- 6337,6348 ----
- if (len != min (sizeof buffer, total))
- fatal_with_file ("premature end of file in symbol segment of ", entry);
- total -= len;
- ! mywrite (buffer, len, 1, outstream);
- }
-
- file_close ();
- }
- !
- /* Define a special symbol (etext, edata, or end). NAME is the
- name of the symbol, with a leading underscore (whether or not this
- system uses such underscores). TYPE is its type (e.g. N_DATA | N_EXT).
- ***************
- *** 5616,5621 ****
- --- 6396,6427 ----
- symbol_define ("__etext", N_TEXT | N_EXT, &etext_symbol_alt);
- symbol_define ("__end", N_BSS | N_EXT, &end_symbol_alt);
-
- + #ifdef amigados
- + if (output_datadata_relocs)
- + symbol_define ("___datadata_relocs", N_TEXT | N_EXT, &datadata_reloc_symbol);
- +
- + symbol_define ("__sdata", N_DATA | N_EXT, &sdata_symbol);
- + symbol_define ("___text_size", N_ABS | N_EXT, &text_size_symbol);
- + symbol_define ("___data_size", N_ABS | N_EXT, &data_size_symbol);
- + symbol_define ("___bss_size", N_ABS | N_EXT, &bss_size_symbol);
- + {
- + symbol *a_symbol;
- + symbol_define ("___machtype", N_ABS | N_EXT, &a_symbol);
- + if (a_symbol)
- + a_symbol->value = amiga_machtype;
- +
- + symbol_define ("___databss_together", N_ABS | N_EXT, &a_symbol);
- + if (a_symbol)
- + a_symbol->value = databss_together;
- +
- + if (databss_together)
- + {
- + symbol_define ("___a4_init", N_DATA | N_EXT, &a_symbol);
- + if (a_symbol)
- + a_symbol->value = data_start + 0x7ffe;
- + }
- + }
- + #endif
- #ifdef sun
- {
- symbol *dynamic_symbol;
- ***************
- *** 5658,5664 ****
-
- return k;
- }
- !
- /* Get the symbol table entry for the global symbol named KEY.
- Create one if there is none. */
-
- --- 6464,6470 ----
-
- return k;
- }
- !
- /* Get the symbol table entry for the global symbol named KEY.
- Create one if there is none. */
-
- ***************
- *** 5725,5731 ****
-
- return 0;
- }
- !
- /* Report a usage error.
- Like fatal except prints a usage summary. */
-
- --- 6531,6537 ----
-
- return 0;
- }
- !
- /* Report a usage error.
- Like fatal except prints a usage summary. */
-
- ***************
- *** 5739,5750 ****
- --- 6545,6567 ----
- fprintf (stderr, string, arg);
- fprintf (stderr, "\n");
- }
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + fprintf (stderr, "\
- + Usage: %s [-d] [-dc] [-dp] [-e symbol] [-l lib] [-n] [-noinhibit-exec]\n\
- + [-nostdlib] [-o file] [-r] [-s] [-t] [-u symbol] [-x] [-y symbol]\n\
- + [-z] [-A file] [-Bstatic] [-D size] [-L libdir] [-M] [-N]\n\
- + [-S] [-T[{text,data}] addr] [-V prefix] [-X] \n\
- + [{-a,-amiga-debug-hunk}] [{-f,-flavor} flavor] [file...]\n\
- + [-chip {c,d,b}] [-fast {c,d,b}] [-m,-shortdata]\n",
- + progname);
- + #else
- fprintf (stderr, "\
- Usage: %s [-d] [-dc] [-dp] [-e symbol] [-l lib] [-n] [-noinhibit-exec]\n\
- [-nostdlib] [-o file] [-r] [-s] [-t] [-u symbol] [-x] [-y symbol]\n\
- [-z] [-A file] [-Bstatic] [-D size] [-L libdir] [-M] [-N]\n\
- [-S] [-T[{text,data}] addr] [-V prefix] [-X] [file...]\n",
- progname);
- + #endif
- exit (1);
- }
-
- ***************
- *** 5765,5776 ****
- followed by the filename of ENTRY. */
-
- void
- ! fatal_with_file (string, entry)
- char *string;
- struct file_entry *entry;
- {
- fprintf (stderr, "%s: ", progname);
- ! fprintf (stderr, string);
- print_file_name (entry, stderr);
- fprintf (stderr, "\n");
- exit (1);
- --- 6582,6593 ----
- followed by the filename of ENTRY. */
-
- void
- ! fatal_with_file (string, entry, arg)
- char *string;
- struct file_entry *entry;
- {
- fprintf (stderr, "%s: ", progname);
- ! fprintf (stderr, string, arg);
- print_file_name (entry, stderr);
- fprintf (stderr, "\n");
- exit (1);
- ***************
- *** 5784,5794 ****
- char *name;
- {
- extern int errno, sys_nerr;
- - extern char *sys_errlist[];
- char *s;
-
- if (errno < sys_nerr)
- ! s = concat ("", sys_errlist[errno], " for %s");
- else
- s = "cannot open %s";
- fatal (s, name);
- --- 6601,6610 ----
- char *name;
- {
- extern int errno, sys_nerr;
- char *s;
-
- if (errno < sys_nerr)
- ! s = concat ("", strerror (errno), " for %s");
- else
- s = "cannot open %s";
- fatal (s, name);
- ***************
- *** 5802,5812 ****
- struct file_entry *entry;
- {
- extern int errno, sys_nerr;
- - extern char *sys_errlist[];
- char *s;
-
- if (errno < sys_nerr)
- ! s = concat ("", sys_errlist[errno], " for ");
- else
- s = "cannot open ";
- fatal_with_file (s, entry);
- --- 6618,6627 ----
- struct file_entry *entry;
- {
- extern int errno, sys_nerr;
- char *s;
-
- if (errno < sys_nerr)
- ! s = concat ("", strerror (errno), " for ");
- else
- s = "cannot open ";
- fatal_with_file (s, entry);
- ***************
- *** 5824,5840 ****
- fprintf (stderr, "\n");
- }
-
- !
- /* Output COUNT*ELTSIZE bytes of data at BUF
- to the descriptor DESC. */
-
- void
- ! mywrite (buf, count, eltsize, desc)
- char *buf;
- int count;
- int eltsize;
- ! int desc;
- {
- register int val;
- register int bytes = count * eltsize;
-
- --- 6639,6656 ----
- fprintf (stderr, "\n");
- }
-
- !
- /* Output COUNT*ELTSIZE bytes of data at BUF
- to the descriptor DESC. */
-
- void
- ! mywrite (buf, count, eltsize, stream)
- char *buf;
- int count;
- int eltsize;
- ! FILE *stream;
- {
- + #if 0
- register int val;
- register int bytes = count * eltsize;
-
- ***************
- *** 5846,5860 ****
- buf += val;
- bytes -= val;
- }
- }
-
- ! /* Output PADDING zero-bytes to descriptor OUTDESC.
- PADDING may be negative; in that case, do nothing. */
-
- void
- ! padfile (padding, outdesc)
- int padding;
- ! int outdesc;
- {
- register char *buf;
- if (padding <= 0)
- --- 6662,6679 ----
- buf += val;
- bytes -= val;
- }
- + #else
- + fwrite (buf, eltsize, count, stream);
- + #endif
- }
-
- ! /* Output PADDING zero-bytes to descriptor OUTSTREAM.
- PADDING may be negative; in that case, do nothing. */
-
- void
- ! padfile (padding, outstream)
- int padding;
- ! FILE *outstream;
- {
- register char *buf;
- if (padding <= 0)
- ***************
- *** 5862,5868 ****
-
- buf = (char *) alloca (padding);
- bzero (buf, padding);
- ! mywrite (buf, padding, 1, outdesc);
- }
-
- /* Return a newly-allocated string
- --- 6681,6687 ----
-
- buf = (char *) alloca (padding);
- bzero (buf, padding);
- ! mywrite (buf, padding, 1, outstream);
- }
-
- /* Return a newly-allocated string
- ***************
- *** 5903,5910 ****
- xmalloc (size)
- int size;
- {
- register char *result = malloc (size);
- ! if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- }
- --- 6722,6730 ----
- xmalloc (size)
- int size;
- {
- + extern char *malloc();
- register char *result = malloc (size);
- ! if (!result && size)
- fatal ("virtual memory exhausted", 0);
- return result;
- }
- ***************
- *** 5916,5927 ****
- char *ptr;
- int size;
- {
- ! register char *result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- }
- !
- #ifdef USG
-
- void
- --- 6736,6748 ----
- char *ptr;
- int size;
- {
- ! extern char *malloc(), *realloc();
- ! register char *result = ptr ? realloc (ptr, size) : malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- }
- !
- #ifdef USG
-
- void
- ***************
- *** 5952,5954 ****
- --- 6773,7453 ----
- return 8192;
- }
- #endif
- +
- + #ifdef HUNK_INSTEAD_OF_A_OUT
- + /* the whole rest of the file is used for managment of hunks and subhunks.. */
- +
- + /* this is the amiga-equivalent of struct exec */
- + struct simple_hunk_header {
- + long id, /* this will be 0x3f3 */
- + zero,
- + table_size,
- + first_hunk,
- + last_hunk,
- + sizes[4]; /* there can be at most a code,data,bss & debug hunk */
- + };
- +
- + /* this writes out a hunk header, depending on the information collected
- + * so far, it will only create hunks, that really exist, so if your data-
- + * size is zero, you won't get a data-hunk at all. */
- +
- + void
- + write_hunk_header(outfd)
- + int outfd;
- + {
- + struct simple_hunk_header sh;
- + int this_hunk, header_size;
- +
- + sh.id = 0x3f3; /* HUNK_HEADER */
- + sh.zero = 0;
- + sh.table_size = current_hunk;
- + sh.first_hunk = 0;
- + sh.last_hunk = current_hunk - 1;
- +
- + this_hunk = 0;
- + if (number_of_code_hunk != -1)
- + sh.sizes[this_hunk++] = code_mem_type|LONGSIZE(text_size);
- +
- + if (number_of_data_hunk != -1)
- + {
- + int size = LONGSIZE(data_size);
- + if (databss_together)
- + {
- + if (long_data_hunk || !output_datadata_relocs)
- + size=LONGSIZE(data_size+bss_size);
- + if (data_mem_type == 0)
- + data_mem_type=bss_mem_type;
- + }
- + sh.sizes[this_hunk++] = data_mem_type|size;
- + }
- +
- + if (!databss_together && number_of_bss_hunk != -1)
- + sh.sizes[this_hunk++] = bss_mem_type|LONGSIZE(bss_size);
- +
- + if (number_of_debug_hunk != -1)
- + sh.sizes[this_hunk++] = 0; /* to be filled in later */
- +
- + header_size = sizeof(sh) - (4-this_hunk)*sizeof(long);
- + mywrite(&sh, 1, header_size, outfd);
- + }
- +
- + /* if we really write out a debug hunk, this fills in the remaining
- + * spots, that are known only at the end of load-file output */
- +
- + void
- + conditionally_rewrite_headers ()
- + {
- + long size_of_debug_hunk,
- + end_hunk = 0x3f2,
- + eof;
- +
- + /* if we don't want a debug hunk, just return */
- + if (number_of_debug_hunk == -1) return;
- +
- + /* while we're at it, since we started the debug-hunk, lets finish it
- + * now. */
- + fseek (outstream, 0L, 2);
- + eof = ftell (outstream);
- + dh.strs = eof - offset_of_debug_hunk - sizeof(dh) - dh.syms;
- + /* just to be sure, we HAVE to pad to a long-boundery */
- + if (eof & 3)
- + {
- + long zero = 0;
- +
- + mywrite(&zero, 4 - (eof & 3), 1, outstream);
- + eof = (eof + 3) & ~3;
- + }
- +
- + mywrite(&end_hunk, sizeof(long), 1, outstream);
- +
- + /* ok, so calculate the size of the debug hunk. This is the
- + * size of the debug_header plus the symbol and string tables,
- + * but it doesn't include the 2 longs, that identify the hunk and
- + * its length, whence the "- 2*sizeof(long)" */
- + size_of_debug_hunk = eof - offset_of_debug_hunk - 2*sizeof(long);
- + /* we actually need the size in longs.. */
- + size_of_debug_hunk = LONGSIZE(size_of_debug_hunk);
- +
- + /* now first patch the debug-hunk itself, afterwards the load-file header */
- + fseek (outstream, offset_of_debug_hunk, 0);
- + dh.len = size_of_debug_hunk;
- + mywrite(&dh, sizeof dh, 1, outstream);
- +
- + /* now the main header, this involves calculating, at which offset we
- + * find the index for the debug hunk */
- + fseek (outstream, (5 + number_of_debug_hunk)*sizeof(long), 0);
- + mywrite(&size_of_debug_hunk, sizeof(long), 1, outstream);
- + fseek (outstream, 0L, 2);
- + /* that's it! */
- + }
- +
- + /* this is the only information that we can store in a regular amiga
- + * symbol, just its value, nothing further, that's why I added the
- + * debug-hunk-feature */
- +
- + typedef struct {
- + char *sym_name;
- + long sym_offset;
- + } simple_symbol;
- +
- + /* we'll only define symbols after at most 3 hunks, ie. the code, data
- + * and bss hunk, but not after the debug hunk, whence the index 3 */
- +
- + simple_symbol *hunk_sym_tab[3];
- + int hunk_sym_tab_size[3], hunk_sym_tab_index[3];
- +
- + void
- + init_symbol_hunks()
- + {
- + int i;
- +
- + #if 0
- + if (trace_files) fprintf(stderr, "init_symbol_hunks()\n");
- + #endif
- +
- + for (i = 0; i < 3; i++)
- + {
- + hunk_sym_tab[i] =
- + (simple_symbol *) xmalloc((hunk_sym_tab_size[i] = 10) *
- + sizeof(simple_symbol));
- + hunk_sym_tab_index[i] = 0;
- + }
- + }
- +
- + /* this should go into libc, well, it wasn't there, so... */
- +
- + char *
- + strsave(str)
- + char *str;
- + {
- + char *cp;
- + int len = strlen(str);
- + if (len)
- + {
- + cp = xmalloc(len+1);
- + strcpy(cp, str);
- + }
- + else
- + cp = NULL;
- + return cp;
- + }
- +
- + void
- + add_to_symbol_hunk(hunk_num, name, offset)
- + int hunk_num;
- + char *name;
- + long offset;
- + {
- + if (hunk_num == -1) return;
- + if (hunk_num >= 3) fatal ("invalid hunk_number: %d\n", hunk_num);
- +
- + /* no checks for duplicate symbols. Since it is legitimate to have
- + * symbols with the same name, we can't strip them.. just make
- + * sure not to call this function multiple times with the same
- + * symbol, since it won't be detected, and you'll get several
- + * labels for the same offset...
- + */
- +
- + #if 0
- + if (trace_files) fprintf(stderr, "add_to_symbol_hunk(%d, %s, %d)\n",
- + hunk_num, name, offset);
- + #endif
- +
- + hunk_sym_tab[hunk_num][hunk_sym_tab_index[hunk_num]].sym_offset = offset;
- + hunk_sym_tab[hunk_num][hunk_sym_tab_index[hunk_num]++].sym_name =
- + strsave(name);
- +
- + if (hunk_sym_tab_index[hunk_num] == hunk_sym_tab_size[hunk_num])
- + hunk_sym_tab[hunk_num] = (simple_symbol *)
- + xrealloc(hunk_sym_tab[hunk_num],
- + (hunk_sym_tab_size[hunk_num] <<= 1) *
- + sizeof(simple_symbol));
- + }
- +
- + int
- + compare_simple_symbols(l1, l2)
- + simple_symbol *l1, *l2;
- + {
- + return l1->sym_offset - l2->sym_offset;
- + }
- +
- + /* this writes the symbol subhunk #hunk_num, you call this just after
- + * you created your {code,data,bss}-hunk */
- +
- + void
- + write_symbol_hunk(hunk_num)
- + int hunk_num;
- + {
- + int i, j;
- + simple_symbol *tab;
- + long size, index;
- +
- + if (hunk_num == -1) return;
- + if (hunk_num >= 3) fatal ("invalid hunk_number: %d\n", hunk_num);
- +
- + tab = hunk_sym_tab[hunk_num];
- + size = hunk_sym_tab_size[hunk_num];
- + index = hunk_sym_tab_index[hunk_num];
- +
- + /* kind of abused as general debug-flag:-) */
- + #if 0
- + if (trace_files) fprintf(stderr,
- + "wsh: hnum=%d,size=%d,index=%d\n",
- + hunk_num,size,index);
- + #endif
- +
- + if (index > 0)
- + {
- + qsort(tab, index, sizeof(simple_symbol), compare_simple_symbols);
- +
- + j = 0x3f0; /* HUNK_SYMBOL */
- + mywrite(&j, 1, sizeof(long), outstream);
- +
- + for (i = 0; i < index; i++)
- + {
- + register simple_symbol *ss = tab+i;
- + int len = strlen (ss->sym_name);
- +
- + j = LONGSIZE (len);
- + mywrite(&j, 1, sizeof(long), outstream);
- +
- + mywrite(ss->sym_name, 1, len, outstream);
- + if (len < 4*j)
- + padfile (4*j - len, outstream);
- +
- + mywrite(&(ss->sym_offset), 1, sizeof(long), outstream);
- + }
- +
- + j = 0;
- + mywrite(&j, 1, sizeof(long), outstream);
- + }
- + }
- +
- + /* now follow the quite similar routines for dealing with
- + * reloc-subhunks, the difference to the symbol-subhunks is, that reloc
- + * subhunks can be output only after the {code,data}-Hunks, AND there
- + * can be more than one after each of them */
- +
- + long *hunk_rel_tab[3]; /* Dynamically allocated tables of relocs */
- + long hunk_rel_tab_size[3]; /* Size (in longs) of allocation of each table */
- + long hunk_rel_tab_index[3]; /* Index of next free table entry */
- +
- + void
- + init_reloc_hunk()
- + {
- + int i;
- +
- + #if 0
- + if (trace_files) fprintf(stderr, "init_reloc_hunk()\n");
- + #endif
- +
- + for (i = 0; i < 3; i++)
- + {
- + hunk_rel_tab[i] =
- + (long *) xmalloc((hunk_rel_tab_size[i] = 10) * sizeof(long));
- + hunk_rel_tab_index[i] = 0;
- + }
- + }
- +
- + void
- + add_to_reloc_hunk(hunk_num, offset)
- + int hunk_num;
- + long offset;
- + {
- + /* no checks for duplicate symbols, they will show up when we sort
- + * the table, and we will strip them off before writing out the table */
- +
- + #if 0
- + if (trace_files) fprintf(stderr, "add_to_reloc_hunk(%d, %d)\n", hunk_num, offset);
- + #endif
- +
- + hunk_rel_tab[hunk_num][hunk_rel_tab_index[hunk_num]++] = offset;
- +
- + if (hunk_rel_tab_index[hunk_num] == hunk_rel_tab_size[hunk_num])
- + hunk_rel_tab[hunk_num] = (long *)
- + xrealloc(hunk_rel_tab[hunk_num],
- + (hunk_rel_tab_size[hunk_num] <<= 1) * sizeof(long));
- + }
- +
- + int
- + compare_longs(l1, l2)
- + long *l1, *l2;
- + {
- + return *l1 - *l2;
- + }
- +
- + int
- + compare_strings (s1p, s2p)
- + char **s1p;
- + char **s2p;
- + {
- + return (strcmp (*s1p, *s2p));
- + }
- +
- + void
- + write_reloc_hunk()
- + {
- + int i, j;
- + long *tab, size, index, nwritten, nleft, nwrite;
- + /* only write a hunk-header & -end, if we really output some relocs */
- + int did_start_hunk = 0;
- +
- + for (i = 0; i < 3; i++)
- + {
- + tab = hunk_rel_tab[i];
- + size = hunk_rel_tab_size[i];
- + index = hunk_rel_tab_index[i];
- +
- + /* kind of abused as general debug-flag:-) */
- + #if 0
- + if (trace_files) fprintf(stderr,
- + "wrh: i=%d,size=%d,index=%d\n",
- + i,size,index);
- + #endif
- + if (index > 0)
- + {
- + qsort(tab, index, sizeof(long), compare_longs);
- +
- + /* kick out duplicate symbols.. I don't know, what
- + * the loader would do, if it had to relocate the same
- + * address twice.. BTW: can this happen or can't it???? */
- + for (j = 0; j < index-1; )
- + {
- + if (tab[j] == tab[j+1])
- + bcopy(tab+j+1, tab+j, ((index--)-j-1)*sizeof(long));
- + else
- + j++;
- + }
- + hunk_rel_tab_index[i] = index;
- +
- + if (!did_start_hunk++)
- + {
- + j = 0x3ec; /* HUNK_RELOC32 */
- + mywrite(&j, 1, sizeof(long), outstream);
- + }
- +
- + /* Starting apparently with AmigaDOS 2.0, the number of
- + offsets per hunk number must not exceed 65536. So
- + split large tables into smaller ones. */
- + nwritten = 0;
- + nleft = index;
- + do
- + {
- + nwrite = min (nleft, 65536);
- + #if 0
- + if (trace_files)
- + fprintf (stderr, "wrh: nwritten %d, nleft %d, nwrite %d\n",
- + nwritten, nleft, nwrite);
- + #endif
- + mywrite(&nwrite, 1, sizeof(long), outstream);
- + mywrite(&i, 1, sizeof(long), outstream);
- + mywrite(tab + nwritten, 1, nwrite*sizeof(long), outstream);
- + nwritten += nwrite;
- + nleft -= nwrite;
- + } while (nleft > 0);
- + }
- + }
- + if (did_start_hunk)
- + {
- + j = 0;
- + mywrite(&j, 1, sizeof(long), outstream);
- + }
- + }
- +
- +
- + void
- + write_datadata_relocs ()
- + {
- + int numdd, i, prev;
- +
- + prev = ftell (outstream);
- + fseek (outstream, datadata_relocs_offset, L_SET);
- +
- + numdd = hunk_rel_tab_index[number_of_data_hunk];
- + if (numdd > numdatadata_relocs)
- + fatal ("found more data-data relocs than estimated!\n", 0);
- +
- + mywrite (&numdd, 1, sizeof (long), outstream);
- + if (numdd)
- + mywrite (hunk_rel_tab[number_of_data_hunk], numdd, sizeof (long), outstream);
- +
- + fseek (outstream, prev, L_SET);
- + }
- +
- +
- + /* create the bss hunk if needed */
- +
- + void
- + write_bss()
- + {
- + long bss_hunk[2];
- + if (!databss_together && bss_size)
- + {
- + if (trace_files)
- + fprintf (stderr, "Write BSS hunk at 0x%x\n", ftell (outstream));
- + bss_hunk[0] = 0x3eb;
- + bss_hunk[1] = LONGSIZE(bss_size);
- + mywrite(bss_hunk, 1, sizeof bss_hunk, outstream);
- + write_symbol_hunk(number_of_bss_hunk);
- + bss_hunk[0] = 0x3f2; /* HUNK_END */
- + mywrite(bss_hunk, 1, sizeof(long), outstream);
- + }
- + }
- +
- + /* this scans one object file for its symbols, and deposits them in
- + * the symbol-hunk tables for later output */
- +
- + void
- + look_for_file_syms (entry)
- + struct file_entry *entry;
- + {
- + register struct nlist *p = entry->symbols;
- + register struct nlist *end = p + entry->syms_size / sizeof (struct nlist);
- +
- + #if 0
- + /* don't do this, it only confuses most amiga disassemblers.. */
- +
- + /* Generate a local symbol for the start of this file's text. */
- +
- + if (discard_locals != DISCARD_ALL)
- + add_to_symbol_hunk(number_of_code_hunk, entry->local_sym_name,
- + entry->text_start_address);
- + #endif
- +
- + /* Read the file's string table. */
- +
- + entry->strings = (char *) alloca (entry->strs_size);
- + read_entry_strings (file_open (entry), entry);
- +
- + for (; p < end; p++)
- + {
- + register unsigned char type = p->n_type;
- + register int write = 0;
- + int this_hunk;
- + char *cp;
- +
- + /* WRITE gets 1 for a non-global symbol that should be written. */
- +
- + if (SET_ELEMENT_P (type)) /* This occurs even if global. These */
- + /* types of symbols are never written */
- + /* globally, though they are stored */
- + /* globally. */
- + write = output_style == OUTPUT_RELOCATABLE;
- + else if (!(type & (N_STAB | N_EXT)))
- + /* ordinary local symbol */
- + write = ((discard_locals != DISCARD_ALL)
- + && !(discard_locals == DISCARD_L &&
- + (p->n_un.n_strx + entry->strings)[0] == LPREFIX)
- + && type != N_WARNING);
- +
- + else if (!(type & N_EXT))
- + /* debugger symbol */
- + write = (strip_symbols == STRIP_NONE);
- +
- + /* skip STAB symbols if present */
- + write = write && !(type & N_STAB);
- +
- + /* those weird types are NOT output in the normal symbols:-)) */
- + write = write && (type != N_ABS && type != (N_ABS|N_EXT));
- +
- + /* don't know where those symbols come from, they're well suited to
- + * crash enforcer, and they're not `real' symbols anyway.. */
- + if (p->n_un.n_strx > entry->strs_size) continue;
- +
- + /* symbols that end with a dot are only useful for gdb,
- + * not for a normal amiga debugger (currently gcc_compiled. and
- + * gcc_compiled2.) so skip them in this section */
- +
- + /* check to see, whether this string ends with a dot */
- + if (write && p->n_un.n_strx)
- + {
- + cp = rindex (p->n_un.n_strx + entry->strings, '.');
- +
- + write = write && !(cp && !cp[1]);
- +
- + #if 0
- + printf ("%s >%s<\n", write ? "adding" : "skipping", p->n_un.n_strx + entry->strings);
- + #endif
- + }
- +
- + if (write)
- + {
- + if (p->n_un.n_strx)
- + {
- + switch (type & ~N_EXT)
- + {
- + case N_TEXT:
- + this_hunk = number_of_code_hunk;
- + break;
- + case N_SETV:
- + case N_DATA:
- + this_hunk = number_of_data_hunk;
- + break;
- + case N_UNDF:
- + case N_BSS:
- + this_hunk = number_of_bss_hunk;
- + break;
- + default:
- + error ("unknown type %d while trying to build lsymhunk", type);
- + goto skip1;
- + }
- +
- + add_to_symbol_hunk(this_hunk, p->n_un.n_strx + entry->strings,
- + p->n_value);
- + skip1: ;
- + }
- + }
- + }
- + }
- +
- + /* scan all input files for symbols and store them in the symbolhunk tables */
- +
- + void
- + look_for_symbols()
- + {
- + int this_hunk;
- + int i;
- + symbol *sp;
- +
- + if (strip_symbols == STRIP_ALL)
- + return;
- +
- + /* Write the local symbols defined by the various files. */
- +
- + each_file (look_for_file_syms, 0);
- + file_close ();
- +
- + /* Scan the symbol hash table, bucket by bucket. */
- +
- + for (i = 0; i < TABSIZE; i++)
- + for (sp = symtab[i]; sp; sp = sp->link)
- + {
- + struct nlist nl;
- +
- + /* Compute a `struct nlist' for the symbol. */
- +
- + nl.n_value = 0;
- +
- + if (sp->defined || sp->referenced)
- + {
- + /* common condition needs to be before undefined condition */
- + /* because unallocated commons are set undefined in */
- + /* digest_symbols */
- + if (sp->defined > 1) /* defined with known type */
- + {
- + /* If the target of an indirect symbol has been
- + defined and we are outputting an executable,
- + resolve the indirection; it's no longer needed */
- + if (output_style != OUTPUT_RELOCATABLE
- + && ((sp->defined & ~N_EXT) == N_INDR)
- + && (((symbol *) sp->value)->defined > 1))
- + {
- + symbol *newsp = (symbol *) sp->value;
- + nl.n_type = newsp->defined;
- + nl.n_value = newsp->value;
- + }
- + else
- + {
- + nl.n_type = sp->defined;
- + if (sp->defined != (N_INDR | N_EXT))
- + nl.n_value = sp->value;
- + else
- + nl.n_value = 0;
- + }
- + }
- + else if (sp->max_common_size) /* defined as common but not allocated. */
- + {
- + /* happens only with -r and not -d */
- + /* write out a common definition */
- + nl.n_type = N_UNDF | N_EXT;
- + nl.n_value = sp->max_common_size;
- + }
- + else if (!sp->defined) /* undefined -- legit only if -r */
- + {
- + nl.n_type = N_UNDF | N_EXT;
- + nl.n_value = 0;
- + }
- + else
- + fatal ("internal error: %s defined in mysterious way", sp->name);
- +
- + switch (nl.n_type & ~N_EXT)
- + {
- + case N_TEXT:
- + this_hunk = number_of_code_hunk;
- + break;
- + case N_SETV:
- + case N_DATA:
- + this_hunk = number_of_data_hunk;
- + break;
- + case N_UNDF:
- + case N_BSS:
- + this_hunk = number_of_bss_hunk;
- + break;
- + case N_ABS:
- + break;
- + default:
- + error ("unknown type %d while trying to build symhunk", nl.n_type);
- + goto skip2;
- + }
- +
- + /* sigh, there is no equivalent in the symbol section of a load
- + * file on the amiga, have to forget about those symbols */
- + if ((nl.n_type & ~N_EXT) == N_ABS)
- + continue;
- +
- + add_to_symbol_hunk(this_hunk, sp->name, nl.n_value);
- + skip2: ;
- + }
- + }
- + }
- +
- + void
- + relocate_set_vectors (vectors, relvectors, num_entries)
- + unsigned long *vectors;
- + unsigned char *relvectors;
- + int num_entries;
- + {
- + unsigned long i;
- + unsigned long offset = set_sect_start;
- + int hunk_num;
- +
- + while (num_entries-- > 0)
- + {
- + /* the number of entries for this symbol */
- + i = *vectors++; offset += 4; relvectors++;
- + while (num_entries --, i--)
- + {
- + /* relocation ok? */
- + if (*relvectors)
- + {
- + hunk_num = number_of_code_hunk;
- + if (*vectors >= text_size)
- + {
- + if (*vectors >= text_size + data_size)
- + {
- + hunk_num = number_of_bss_hunk;
- + if (databss_together)
- + *vectors -= text_size;
- + else
- + *vectors -= text_size + data_size;
- + }
- + else
- + {
- + hunk_num = number_of_data_hunk;
- + *vectors -= text_size;
- + }
- + }
- + add_to_reloc_hunk (hunk_num, offset);
- + }
- + ++vectors;
- + offset += 4;
- + ++relvectors;
- + }
- + /* check.. HAS to be zero */
- + if (*vectors)
- + fatal ("set-vector corrupt, num_entries = %d", num_entries);
- + vectors++; offset += 4; relvectors++; --num_entries;
- + }
- + }
- + #endif
- +
- diff -rc --new-file binutils-1.8.x-base/objdump.c binutils-1.8.x/objdump.c
- *** binutils-1.8.x-base/objdump.c Sat Dec 30 00:16:07 1989
- --- binutils-1.8.x/objdump.c Wed Sep 22 12:45:32 1993
- ***************
- *** 24,31 ****
- #include <stdio.h>
- #include "getopt.h"
-
- #ifndef COFF_ENCAPSULATE
- ! #include <a.out.h>
- /* Tell a.out.gnu.h not to try to redefine some things. */
- #define __STRUCT_EXEC_OVERRIDE__
- #define N_NLIST_DECLARED
- --- 24,35 ----
- #include <stdio.h>
- #include "getopt.h"
-
- + #ifdef MCH_AMIGA
- + #define getpagesize() 256
- + #endif
- +
- #ifndef COFF_ENCAPSULATE
- ! #include <sun/a.out.h>
- /* Tell a.out.gnu.h not to try to redefine some things. */
- #define __STRUCT_EXEC_OVERRIDE__
- #define N_NLIST_DECLARED
- diff -rc --new-file binutils-1.8.x-base/ranlib.c binutils-1.8.x/ranlib.c
- *** binutils-1.8.x-base/ranlib.c Thu Mar 1 00:18:42 1990
- --- binutils-1.8.x/ranlib.c Sat Feb 5 12:31:20 1994
- ***************
- *** 54,60 ****
- as the location of the GNU AR program. */
-
- char *prog = AR_PROG;
- ! char *prog_pref = "/usr/local/gnubin/ar";
-
- int
- main (argc, argv)
- --- 54,60 ----
- as the location of the GNU AR program. */
-
- char *prog = AR_PROG;
- ! char *prog_pref = "/gnu/bin/ar";
-
- int
- main (argc, argv)
- diff -rc --new-file binutils-1.8.x-base/strip.c binutils-1.8.x/strip.c
- *** binutils-1.8.x-base/strip.c Mon Jun 11 21:40:01 1990
- --- binutils-1.8.x/strip.c Wed Sep 22 12:45:42 1993
- ***************
- *** 71,77 ****
-
- /* If BSD, we can use `ftruncate'. */
-
- ! #ifndef USG
- #define HAVE_FTRUNCATE
- #endif
-
- --- 71,77 ----
-
- /* If BSD, we can use `ftruncate'. */
-
- ! #if !defined(USG) && !defined(MCH_AMIGA)
- #define HAVE_FTRUNCATE
- #endif
-
- ***************
- *** 287,294 ****
- --- 287,296 ----
- signal (SIGTERM, SIG_DFL);
-
- /* Handle any signal that came in while they were deferred. */
- + #ifndef MCH_AMIGA
- if (delayed_signal)
- kill (getpid (), delayed_signal);
- + #endif
- }
-
- /** Convenient functions for operating on one or all files being processed. */
- ***************
- *** 928,933 ****
- --- 930,936 ----
- }
-
- #ifdef USG
- + #ifndef MCH_AMIGA
-
- rename (from, to)
- char *from, *to;
- ***************
- *** 940,945 ****
- --- 943,949 ----
- return 0;
- }
-
- + #endif
- #endif
-
- usage ()
-