recording file death

This commit is contained in:
K. Richard Pixley 1992-12-08 04:59:31 +00:00
parent a362ee2363
commit 43bbd567f2
382 changed files with 0 additions and 120121 deletions

View File

@ -1,149 +0,0 @@
#
# Copyright (C) 1990, 1991 Free Software Foundation, Inc.
#
# This file is part of BFD, the Binary File Diddler.
#
# BFD 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 1, or (at your option)
# any later version.
#
# BFD 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 BFD; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
# $Id$
srcdir=../common
VPATH=../common
RANLIB = ranlib
CSWITCHES = -g # -Wall
CC=gcc -Wall
#__sun4__#CDEFINES=-DHOST_SYS=SUN4_SYS
#__sun3__#CDEFINES=-DHOST_SYS=SUN3_SYS
#__dgux__#CDEFINES=-DHOST_SYS=DGUX_SYS
#__dgux__#RANLIB=echo
INCDIR = ${srcdir}/../../include-cygnus
CSEARCH = -I$(INCDIR)
TARG = libbfd.a
CFLAGS = $(CDEFINES) $(CSEARCH) $(CSWITCHES)
BFD_LIBS = libbfd.o opncls.o bfd.o archive.o targets.o cache.o archures.o obstack.o
BFD_BACKENDS = oasys.o ieee.o srec.o sunos.o icoff.o b.out.o m88k-bcs.o
BFD_H=$(INCDIR)/bfd.h
SYSDEP_H=$(INCDIR)/sysdep.h
# C source files that correspond to .o's.
CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
sunos.c icoff.c b.out.c srec.c oasys.c ieee.c m88k-bcs.c
all: $(TARG)
POINTOS = $(BFD_LIBS) $(BFD_BACKENDS)
$(TARG): $(POINTOS)
rm -f $(TARG)
ar clq $(TARG) $(BFD_LIBS) $(BFD_BACKENDS)
$(RANLIB) $(TARG)
tags etags: TAGS
TAGS: .force
etags $(INCDIR)/*.h *.h *.c
clean:
rm -f $(BFD_LIBS) $(BFD_BACKENDS) *~ core libbfd.a
clobber realclean: clean
rm -f libbfd.a TAGS
$(BFD_LIBS) $(BFD_BACKENDS): libbfd.h $(BFD_H)
archive.o : archive.c libbfd.h $(BFD_H) $(SYSDEP_H)
archures.o : archures.c $(BFD_H) $(SYSDEP_H) archures.h
b.out.o : b.out.c libbfd.h $(BFD_H) $(SYSDEP_H) liba.out.h archures.h
m88k-bcs.o: m88k-bcs.c libbfd.h $(BFD_H) $(SYSDEP_H) libcoff.h coff-code.h archures.h
bfd.o : bfd.c libbfd.h $(BFD_H) $(SYSDEP_H)
cache.o : cache.c libbfd.h $(BFD_H) $(SYSDEP_H)
coff.o : coff.c
cplus-dem.o : cplus-dem.c
filemode.o : filemode.c
icoff.o : icoff.c libbfd.h $(BFD_H) $(SYSDEP_H) libcoff.h coff-code.h archures.h
libbfd.o : libbfd.c libbfd.h $(BFD_H) $(SYSDEP_H)
misc.o : misc.c
opncls.o : opncls.c libbfd.h $(BFD_H) $(SYSDEP_H)
sunos.o : sunos.c libbfd.h $(BFD_H) $(SYSDEP_H) liba.out.h
targets.o : targets.c libbfd.h $(BFD_H) $(SYSDEP_H)
obstack.o:obstack.c
ieee.o:ieee.c
oasys.o:oasys.c
srec.o:srec.c
version.c: FORCE
rm -f version.c
echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > version.c
# This target should be invoked before building a new release.
# 'VERSION' file must be present and contain a string of the form "x.y"
#
roll:
@V=`cat VERSION` ; \
MAJ=`sed 's/\..*//' VERSION` ; \
MIN=`sed 's/.*\.//' VERSION` ; \
V=$$MAJ.`expr $$MIN + 1` ; \
rm -f VERSION ; \
echo $$V >VERSION ; \
echo Version $$V
# Dummy target to force execution of dependent targets.
#
.force:
FORCE:
# 'G960BASE' will be defined at invocation
install:
make ${TARG} OPT=-O
# Target to uncomment host-specific lines in this makefile. Such lines must
# have the following string beginning in column 1: #__<hostname>__#
# Original Makefile is backed up as 'Makefile.old'.
#
# Invoke with: make make HOST=xxx
#
make:
-@if test $(HOST)x = x ; then \
echo 'Specify "make make HOST=???"'; \
exit 1; \
fi ; \
grep -s "^#The next line was generated by 'make make'" Makefile; \
if test $$? = 0 ; then \
echo "Makefile has already been processed with 'make make'";\
exit 1; \
fi ; \
mv -f Makefile Makefile.old; \
echo "# " >Makefile ;\
echo "# " >>Makefile ;\
echo "# D A N G E R" >>Makefile ;\
echo "# " >>Makefile ;\
echo "# This file was created by make make, change the source in ../common" >>Makefile ; \
echo "#The next line was generated by 'make make'" >>Makefile ; \
echo "HOST=$(HOST)" >>Makefile ; \
echo >>Makefile ; \
sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
Makefile: ../common/Makefile
mv Makefile Makefile.backup
cp ../common/Makefile .
$(MAKE) "HOST=$(HOST)" make

1500
bfd/aout.c

File diff suppressed because it is too large Load Diff

View File

View File

@ -1,35 +0,0 @@
/* Intel 960 machine types */
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
BFD 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 1, or (at your option)
any later version.
BFD 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 BFD; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
Machine architecture and type definitions for BFD.
These definitions are only used inside the BFD package. External programs
access them by calling bfd_scan_arch_mach() and bfd_arch_mach_string().
The architectures themselves are defined in bfd.h since they are an
enum needed for BFD structs. Numeric machine types are simply used
as-is, e.g. 68020. Non-numeric machine types like "i960CA" have
names in this file. */
/* $Id$ */

View File

@ -1,12 +0,0 @@
# NOTE: BEGIN pattern gives errors if other than 1st line;
# END ditto if other than last.
BEGIN { print "@c ------------------------------START TEXT FROM " FILENAME }
#
# Keep /*doc* blocks (terminated by either */ or *-*/)
/^\/\*doc\*/,/^\*\/|^\*-\*\//
#
# Also keep two kinds of /*proto blocks
/^\/\*proto\*/,/^\*\/|^\*-\*\//
/^\/\*proto-internal\*/,/^\*\/|^\*-\*\//
#
END { print "@c ------------------------------END TEXT FROM " FILENAME }

View File

@ -1,8 +0,0 @@
# Awk filter, 1st filter for BFD internal prototype file extraction
#
# keep /*proto-internal blocks
/^\/\*proto-internal\*/,/^\*\/|^\*-\*\//
#
# Apparent bug in sed can discard last line in some situations; therefore
# make last line harmless.
END { print "\n" }

View File

@ -1,8 +0,0 @@
# Awk filter, 1st filter for BFD prototype file extraction
#
# keep /*proto blocks
/^\/\*proto\*/,/^\*\/|^\*-\*\//
#
# Apparent bug in sed can discard last line in some situations; therefore
# make last line harmless.
END { print "\n" }

View File

@ -1,705 +0,0 @@
This file contains -*- Text -*-.
BFD is a set of routines for reading and writing binary files.
The user should call only the interface routines at the end of bfd.h.
The one I'm working out of is /4/gumby/bfd/bfd.h
Sample "strip" program using BFD:
#include "bfd.h"
doit ()
{
ibfd = bfd_openr(...)
obfd = bfd_openw(...)
bfd_check_format (ibfd, object);
bfd_set_format (obfd, object);
bfd_set_arch_mach (obfd, ...)
bfd_set_start_address (obfd, ...)
etc...
[optionally:
asymbol * foo = malloc (get_symtab_upper_bound (ibfd));
bfd_canonicalize_symtab (ibfd, foo);
<sort foo, frob foo, etc, using asymbol def from bfd.h>
bfd_set_symtab (obfd, foo, updated_symbol_count);
]
bfd_map_over_sections (abfd, setup, NULL);
bfd_map_over_sections (abfd, cleaner, NULL);
bfd_close (obfd);
bfd_close (ibfd);
}
setup (ibfd, sect)
{
osect = make_section (obfd, bfd_section_name (ibfd, sect));
bfd_set_section_size (obfd, osect, bfd_section_size (ibfd, sect));
...
}
cleaner (ibfd, sect)
{
osect = bfd_get_section_by_name (obfd,
bfd_section_name (ibfd, sect));
bfd_copy_section (ibfd, sect, obfd, osect);
[perhaps: bfd_set_reloc (osect, NULL, 0); ]
}
BFD is a package for manipulating binary files required for developing
programs. It implements a group of structured operations designed to
shield the programmer from the underlying representation of these
binary files. It understands object (compiled) files, archive
libraries, and core files. It is designed to work in a variety of
target environments.
To use the library, include bfd.h and link with libbfd.a.
A bfd iteself is a representation for a particular file. It is opened
in a manner similar to a file; code then manipulates it rather than
the raw files.
BFD makes a distinction between TARGETS (families of file formats) and
FORMATS (individual file formats). For instance, the "sun4os4" target
can handle core, object and archive formats of files. The exact
layout of the different formats depends on the target environment.
The target "default" means the first one known (usually used for
environments that only support one format, or where the common format
is known at compile or link time). The target NULL means the one
specified at runtime in the environment variable GNUTARGET; if that is
null or not defined then the first entry in the target list is chosen
(on output), or all targets are searched (on input) to find a matching
one..
Most programs should use the target NULL.
There is a way to get a list of the names of all the targets:
char** bfd_target_list ()
This function returns a freshly-malloced list of all the
defined targets (or NULL if it could not malloc). The names
are read-only. You could use this to prompt the user, or
perhaps to error-check.
char * bfd_format_string (bfd_format format)
This function will give you a printable, single-word description
(like "core" or "archive") for a bfd format.
Error handling
General rules:
functions which are boolean return true on success and false on failure
(unless they're a predicate). Functions which return pointers to
objects return NULL on error. The specifics are documented with each
function.
If a function fails, you should check the variable bfd_error. If the
value is no_error, then check the C variable errno just as you would
with any other program. The other values bfd_error may take on are
documented in bfd.h.
If you would prefer a comprehensible string for the error message, use
the function bfd_errmsg:
char * bfd_errmsg (error_tag)
This function returns a read-only string which documents the error
code. If the error code is no_error then it will return a string
depending on the value of errno.
bfd_perror() is like the perror() function except it understands
bfd_error.
Operations on bfds themselves
bfd * bfd_openr (char *filename, char *target);
bfd * bfd_fdopenr (int fd, char *target, char *filename);
Open a binary file for reading. TARGET is the type of the file,
a char string like "sun4os4" or "elf". (Note this is not the
"function" of the file, e.g. an object versus a core file
versus an archive, but instead describes how all these files
are encoded.) Returns a new bfd or NULL upon failure.
bfd * bfd_openw (char *filename, char *target);
Open a file named `filename' for writing. If an existing
file has the same name, then it will be overwritten by a
successful bfd_close on the returned bfd. Will return either
a new bfd or NULL upon failure.
boolean bfd_close (bfd *abfd);
Close a BFD opened for either reading or writing. May involve
several filesystem operations, depending on the data format;
some things may not be known to the system until file-closing
time. Returns true if it successfully wrote the file, false
if not. A false return will not leave a partially-written
file behind with the name supplied to bfd_openw.
On a bfd open for reading will generally successfully
complete.
It is an error to call this on a file opened from inside an
archive.
FIXME -- show which error codes may be recoverable and
followed by another call to bfd_close!
The defined formats are specified by the enumeration bfd_format.
boolean bfd_check_format (bfd *abfd, bfd_format format);
This routine must be called after a bfd_openr. It sets up
internal data structures based on the contents of the file.
It returns FALSE if the file is not really in the specified
format.
boolean bfd_set_format (bfd *abfd, bfd_format format);
This routine must be called after a bfd_openw. It sets up
internal data structures for the proper format of file.
It returns FALSE if that format is not supported for output
(e.g. core files).
The following macros may be used to obtain information about a bfd:
bfd_get_filename -- returns a pointer to a null-terminated string
which names the bfd's file, or NULL if that is not known.
Don't side-effect this string!
bfd_get_format -- returns the format code for the bfd.
bfd_get_target -- returns the string which names the bfd's target.
bfd_get_mtime -- returns an time_t indicating the modification time of an
input bfd, if that could be determined, or 0 of not.
Object files have certain properties. For input bfds, these
properties may be read at any time. For output bfds you should set
them before you begin building any sections.
bfd_vma bfd_get_start_address (bfd *abfd);
Returns the address in an object file where execution will begin.
boolean bfd_set_start_address (bfd *abfd, int vma);
Set the address where execution will start in an object file.
If the address you select is incorrect for your architecture
(for instance, if it's required to be on a page_boundary and
your supplied starting address is not, then you may get the
invalid_operation error. It is not always possible to
generate an error in this case.
An object file has an architecture, which is the general instruction
set of the instructions that it contains. Architectures are defined in
enum bfd_architecture in bfd.h. New architectures can be added by
putting them in the enum, updating architectures.c, and adding code to
handle them for the object files that know that architecture. The
bfd_architecture values are not stored in files, but are only used
within the BFD library and its callers.
An object file also has a machine type, which is the specific machine
within the architecture. For example, if the architecture is bfd_arch_m68k,
the Motorola 68000 series, then the machine type might be 68010, the mc68010
chip. For architectures such as the SPARC where specific versions of
the architecture exist, the version number should probably be used.
Particular object file formats may or may not store the machine architecture
and type. When copying an object file, you should copy these fields.
Most callers of BFD will not need to know the particular values that
these fields contain, but will instead propagate them from file to file,
or compare the architectures from two files.
enum bfd_architecture bfd_get_architecture (bfd *abfd);
unsigned long bfd_get_machine (bfd *abfd);
Get the machine type and architecture.
boolean bfd_set_arch_mach (bfd *abfd, enum bfd_architecture arch,
unsigned long machine);
Set the architecture and machine type. The result is true
if the object file can exactly represent the specified type.
The result is false otherwise.
boolean bfd_arch_compatible (bfd *abfd, bfd *bbfd,
enum bfd_architecture *res_arch,
unsigned long *res_machine);
Decides whether two BFD's contain compatible architectures and
machine types. If the result is TRUE and the res_arch and
res_machine pointers are non-NULL, the resulting "merged"
architecture and machine type are returned through the pointers.
A linker could call this to decide whether two object files
can be linked, and to deterine the arch and machine type of
the resulting file.
char * bfd_printable_arch_mach (enum bfd_architecture arch,
unsigned long machine);
Returns a printable string that represents the particular
combination of architecture and machine type.
boolean bfd_scan_arch_mach (char *string, enum bfd_architecture *archp,
unsigned long *machinep);
Examines a printable string and tries to extract an
architecture and machine type from it. The intended use is for
parsing specifications from the user, e.g. command line
arguments. The result is true if a known architecture was
found, and the resulting architecture and machine type are
stored through the argument pointers. Note that an
architecture scannable by this function might not be
representable by the particular object file format in use.
(i.e. bfd_set_arch_mach might return false).
There are also a number of boolean flags which apply to object bfds.
flagword bfd_get_file_flags (bfd *abfd);
returns a flagword containing the bfd's flags.
boolean bfd_set_file_flags (bfd *abfd, flagword flags,
boolean on_or_off);
sets (on_or_off == true) or clears (on_or_off == false) the flags
specified by flagword. All other flags are unaffected.
Some flag combinations don't make sense; It is not always
possible to detect them (since they may depend on other information).
Returns true if the flags could be modified as requested,
false if not. Upon a false return, no flags will have been
altered.
flagword bfd_applicable_file_flags (bfd *abfd);
returns a flagword with bits set for all the flags which are
meaningful for the bfd.
The flags are:
HAS_RELOC -- file contains unresolved relocation information.
EXEC_P -- file can be executed. These two may both be on in the
case of some dynamically-linked binaries.
HAS_LINENO -- has line number information.
HAS_DEBUG -- has debugging information.
HAS_SYMS -- has any symbols.
HAS_LOCALS -- has local symbols.
DYNAMIC -- binary is dynamically linked.
WP_TEXT -- text is write-protected
D_PAGED -- binary should be demand-paged
These flags are one bit wide and may be OR-ed together with |.
If you are building a large application with bfd there may be data
specific to your program that you may wish to associate with a bfd.
Rather than require you to build a parallel table structure, bfd
provides a void* pointer in each bfd for arbitrary user data. The
macro bfd_usrdata (bfd *abfd) extracts these data; you may set them
with = (ie bfd_usrdata (my_bfd) = frob_it (my_bfd, moon_phase);).
Object and core files have sections.
File sections are represented by opaque pointers. You may map over
the sections of a file or you may ask for one by name. Note that not
all files may have all the possible sections.
Section pointers are valid from the time you get them until the bfd
to which they refer is closed.
When doing output, you must set up all the file's sections before
outputting to any. All that means is that all the file's sections
must have already been created and their size set before output
commences.
Each section contains some small information, plus three chunks of
data in the object file: contents, relocation, and line numbers.
In some file formats (e.g. a.out), the line number part is always
empty, and line number information (if any) is instead recorded in
the symbol table.
sec_ptr bfd_get_section_by_name (bfd *abfd, char *name);
Returns a section named NAME, or NULL if none by that name
exists. Works on input and output bfds.
sec_ptr bfd_make_section (bfd *abfd, char *name);
Creates a section named name in the output bfd abfd.
returns NULL if it cannot create the section (if, for instance,
the output format does not permit such a section). If a
section with that name already exists, it is returned; a new
one with the same name is NOT created.
unsigned int bfd_count_sections (bfd *abfd)
This function returns the number of sections in the bfd abfd.
void bfd_map_over_sections (bfd *abfd, void (*operation)(),
void *user_storage);
This is how you operate on all sections of an input file.
Pass in a function pointer. The function will be called for each
section of the file, in random order. It will be passed
three arguments: the bfd, the sec_ptr for the section, and
whatever was passed in as user_storage.
char * bfd_section_name (bfd *abfd, sec_ptr ptr);
Produces the name of a section, e.g. ".text" or ".data".
This will produce arbitrary names for files with extensible
section names (e.g. COFF, ELF) so don't assume that you will
only see a few values here.
long bfd_section_size (bfd *abfd, sec_ptr ptr);
The size of a section in bytes. Result == -1 for error.
boolean bfd_set_section_size (bfd *abfd, sec_ptr section unsigned long size);
Set the size of a section. This must be done before any data
transfer is done for the section.
bfd_vma bfd_section_vma (bfd *abfd, sec_ptr ptr);
Virtual memory address where a section "belongs".
boolean bfd_set_section_vma (bfd *abfd, bfd_vma vma);
Set the virtual memory address of a section.
int bfd_get_section_alignment (bfd *abfd, sec_ptr ptr);
returns the alignment of a section. If alignment is not
possible, return value is undefined.
boolean bfd_set_section_alignment (bfd *abfd, sec_ptr ptr, int alignment)
returns true if it can set the section to the requested value.
Alignment is an integer; it refers to the power of two
specifying the byte boundary we want (ie 0 is byte-aligned; 4
is word aligned). If the requested alignment is not available
any existing value is unchanged.
Sections have properties just as object files may:
flagword bfd_get_section_flags (bfd *abfd, sec_ptr section);
returns a flagword containing the section's flags.
boolean bfd_set_section_flags (bfd *abfd, sec_ptr section,
flagword flags, boolean on_or_off);
sets (on_or_off == true) or clears (on_or_off == false) the flags
specified by flagword. All other flags are unaffected.
Some flag combinations don't make sense; It is not always
possible to detect them (since they may depend on other information).
Returns true if the flags could me modified as requested,
false if not. Unpon a false return, no flags will have been
altered.
flagword bfd_applicable_section_flags (bfd *abfd);
returns a flagword with bits set for all the flags which are
meaningful for a section.
The flags are:
SEC_BALIGN -- segment can be byte-aligned.
SEC_RELOC -- segment should be relocated.
SEC_ALLOC -- when converted into a memory image with the intent of
constructing a runable process, memory space will be
allocated for this section.
SEC_LOAD -- when converted into a memory image with the intent of
constructing a runable process, section contents will be
copied from the object file into memory. When this flag
is set, SEC_ALLOC is guaranteed to also be set.
SEC_HAS_CONTENTS -- The contents of this section exist in the
object file. Sections whose contents do not exist in the
object file may still have their contents read. On read,
a segment filled with zeroes will be invented to satisfy
the read request. It is an error to attempt to set the
contents of a section that has no contents.
These last three probably need some explanation. In a traditional,
native unix object format, there are three real sections, text, data,
and bss. The text section will be allocated memory on exec, and will
be loaded from file into memory on exec. So the flags for a
traditional unix text section would typically be at least (SEC_ALLOC |
SEC_LOAD | SEC_HAS_CONTENTS). The data section has basically these
same traits. The bss section, however is a little different. It is
not relocated, and it is not loaded from file on exec, but it is
allocated memory on exec. Thus, its flags would be more like
(SEC_ALLOC). It is possible to have a section which is the converse
of the bss section. That is, (SEC_HAS_CONTENTS & ~SEC_ALLOC). This
could be anything from profiling information or notes from one pass of
a toolchain to another to time and version stamp information.
Note that the section flags currently lack information on position
dependance.
boolean bfd_get_section_contents (bfd *abfd, sec_ptr section,
unsigned char *location,
int offset, int count);
Stores count bytes from the section's contents starting at
offset from within those contents. The values are stored into
location. Returns true if it could do so. Supplying invalid
values for offset and count will produce unpredictable results.
boolean bfd_set_section_contents (bfd *abfd, sec_ptr section,
unsigned char *location,
int offset, int count);
Stores count bytes from location into offset within the
section contents. You need not write all the contents contiguously
(that is, you may write words 5-7 followed by 0-4 if you
wish). However once you start writing into a section, any
other sections into which you have previously written are
considered finished, and you may not write in them any more.
*** Line numbers ***
bfd_get_section_lineno_size (bfd *abfd, sec_ptr section);
Returns how many bytes of line numbers are associated with this
section.
bfd_set_section_lineno_size (bfd *abfd, sec_ptr section, unsigned long val);
Sets the number of bytes of line numbers that this section should
contain.
boolean bfd_get_section_linenos (bfd *abfd, sec_ptr section,
unsigned char *location,
int offset, int count);
Same as get_section_contents, except that it works on the linenos
for this section.
boolean bfd_set_section_linenos (bfd *abfd, sec_ptr section,
unsigned char *location,
int offset, int count);
Same as set_section_contents, except that it works on the linenos
for this section.
As with files, you may associate arbitrary program-specific data with
a section of a bfd. The following two functions are provided for
manipulating these data:
void * bfd_get_section_userdata (bfd *abfd, sec_ptr section)
Returns whatever was stored in section's user data, or NULL if nothing.
boolean bfd_set_section_userdata (bfd *abfd, sec_ptr section, void *contents)
Set the section contents. Returns true if it can, false if not.
Core files
Core files are currently only supported for reading.
Apart from opening them, looking at the various sections (generally
the .data, .stack, and .regs sections; maybe a .user_struct section
eventually), you can make some queries about the status of the core
file, detailed below. The ".regs" section contains the general and
floating point registers of the process that died, in some machine-
specific order and format "intended to be unsurprising to someone who
knows the machine".
char * bfd_core_file_failing_command (bfd *abfd);
The command name of the program that failed, creating the core file.
The result is NULL if BFD can't figure out what the failing command was.
int bfd_core_file_failing_signal (bfd *abfd);
The signal number which caused the program to die, causing the
core file to be created. It will be positive if valid.
boolean core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd);
For debuggers, checks whether a core file "matches" (is likely to
have come from) an executable file. This will not be perfect on
most systems, but will just provide a way to reject gross mismatches.
Archives.
An archive is a special file which can contain other files.
Originally it was intended to be a general way to group files, the way
tar is today. But now it is used almost exclusively to hold object
files.
An archive may be opened for reading or writing just like any other
bfd. Once it is open for reading you may obtain bfds for each of the
files contained within it with the following function:
bfd * bfd_openr_next_archived_file (bfd *arch_bfd, bfd *last_file);
If called with NULL as the second argument, returns the first
file contained in the archive arch_bfd. If called with a file
contained within arch_bfd, returns the one which follows that
one, or NULL if it was the last. Returns NULL also if the
bfd supplied as last_file did not come from the archive arch_bfd.
Any bfd open for read may be placed in an output archive. When the
output archive is closed, the contents will be placed into the
archive.
You control the order of files in an archive. You set the first one
with the following function:
boolean bfd_set_archive_head (bfd *output_archive, bfd *new_head)
This function sets the first file in the archive
output_archive to be the bfd new_head.
bfd's contain a pointer called next, which is bfd *. It is used by
bfd_close when an archive is closed to decide which file should next
go into the archive. So to place a group of files into an archive,
open bfds for each of them, chain them together using the next pointer
in the order you desire (be sure to store NULL into the final one's
next pointer), then do bfd_set_archive_head with the head of the
chain. The next pointer may be freely smashed at any time; it is only
looked at when closing an output archive.
bfds for files contained within archives are normal bfds; you can do
any input operations on them that you can do with a normal bfd.
bfd_my_archive is a macro which takes an input bfd and returns NULL if
it lives in the filesystem and a bfd if it is contained in an archive.
In the latter case, the returned bfd is the archive itself.
Archives containing only object files may have a "map" -- a table in
the front which maps external symbols to the files which contain them.
Archive maps will refer only to object files; if an archive contains a
file which is not an archive that file will of course not appear in
the map.
boolean bfd_has_map (bfd *archive_bfd)
This macro takes a bfd of an archive and returns true or
false depending on whether the bfd has a map. For output
bfds this may be set to true or false, depending on whether
you want the map to be maintained or not. For some targets,
setting this to false will cause no map to be generated; for
others it will merely cause an empty map to be created, since
a map is required by that target.
For archives with maps you may use the following function:
int bfd_get_next_mapent (bfd *abfd, int prev, char **name)
You may use this to step through all the entries in the archive
map. Supply BFD_NO_MORE_SYMBOLS as the 'prev' entry to get the
first entry; then use successive returned values from this
function to get the succeeding ones. The name of the next entry
will be stored through the pointer name.
This function returns BFD_NO_MORE_SYMBOLS when there are no more
entries or on error.
bfd * bfd_get_elt_at_index (abfd, int index)
This function takes an index as returned by bfd_get_next_mapent
and returns the bfd which corresponds to that entry. Returns NULL
on error.
Symbol and relocation information.
Symbol-table information is the area of greatest incompatibility.
bfd has a canonical symbol representation; all formats are parsed into
and out of it.
Note that canonicalize_symtab takes a pointer to an array of pointers
to canonical symbols. This is necessary so that the end of the array
can be marked with NULL. You may shuffle the pointers and you may
clobber the symbol contents. But don't move the symbols themselves.
unsigned int bfd_get_symtab_upper_bound (bfd *abfd);
Returns the maximum number of bytes that would be taken by
the output of canonicalize_symtab. Returns 0 on error.
unsigned int bfd_canonicalize_symtab (bfd *abfd, asymbol **location);
Produces a symbol table in canonical format at LOCATION, which
must be of size specified by get_symtab_upper_bound bytes.
Not all those bytes may be used. Returns the number of
symbol pointers written. Returns 0 upon error.
boolean bfd_set_symtab (bfd *outbfd, asymbol **location,
unsigned int symcount);
Takes a generic symbol table and an output bfd. Used to set
the symbol table for an output bfd. Do not change the table
after using this function (although the storage may be
reclaimed once the bfd has been closed).
If you're done with the symbol table you can tell bfd about it by
calling bfd_reclaim_symbol_table, which takes a bfd. Calling this
function will also reclaim any relocation entries you may have
requested. If you don't use this function, bfd will keep around all
symbol information until the bfd is closed.
Similarly, relocations have a canonical format. See the file bfd.h for
the exact definition. It is similar to the sun-4 relocation format.
Please note that:
o - Each relocation has a pointer to a generic symbol.
o - Not all values of reloc_type are supported for all targets. There
is a bitvector which explains which are; you can index into it by
relocation type. The macro which extracts it is bfd_valid_reloc_types.
Since relocation information is saved on a per-section basis, the
interface is slightly different from that of the symbol table:
unsigned int get_reloc_upper_bound (bfd *abfd, sec_ptr asect);
Returns the maximum number of bytes that would be taken by
the output of canonicalize_reloc. Returns 0 on error.
unsigned int canonicalize_reloc (bfd *abfd, sec_ptr asect, arelent *location);
Produces a relocation table in canonical format at LOCATION,
which must be of size specified by get_reloc_upper_bound
bytes. Not all those bytes may be used. Returns the number
of entries written. Returns 0 upon error.
boolean bfd_set_reloc (bfd *outbfd, sec_ptr asect, arelent *location,
unsigned int count);
Takes a generic reloc table and an output bfd. Used to set
the reloc table for an output bfd. Do not change the table
after using this function (although the storage may be
reclaimed once the bfd has been closed).
Byte-swapping
Unfortunately, not all machines have the same byte order. Worse,
storage layout is in general highly machine-dependent. Although bfd
can hide that from you in most cases, it cannot do so with the section
contents, since they are totally uninterpreted. Hence you must
byte-swap those data yourself. This is not usually much of an issue
since you should just generate your data in the correct byte order.
[THIS IS WRONG AND ALSO DOES NOT REFLECT THE CODE WHICH IS CORRECT]
Fortunately, bfd can tell if byte-swapping or realignment is required
at all! The macro bfd_bit_twiddle_required takes a pointer to a bfd
and returns true if byte-swapping is required, false if not.
However if you don't wish to check this you may just use the following
functions which will do the conversions required:
long bfd_getlong (bfd *abfd, unsigned char *ptr);
bfd_putlong (bfd *abfd, unsigned char *ptr, long time);
short bfd_getshort (bfd *abfd, unsigned char *ptr);
bfd_putshort (bfd *abfd, unsigned char *ptr, short stop);
These functions take a pointer that points to data which is,
or will be, part of a section contents. They extract numbers
from the data, or insert numbers into the data. The argument
or result is in the host's number format; the data stored at
the pointer or retrieved from it is in the target's number format.
Typically this transfer is either a no-op or is a byte-swap;
sometimes it involves an access to a "misaligned" location from
the host's point of view..

File diff suppressed because it is too large Load Diff

View File

@ -1,492 +0,0 @@
\input texinfo
@setfilename bfdinfo
@c $Id$
@syncodeindex fn cp
@ifinfo
This file documents the BFD library.
Copyright (C) 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
@ignore
Permission is granted to process this file through Tex and print the
results, provided the printed document carries copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, subject to the terms
of the GNU General Public License, which includes the provision that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end ifinfo
@iftex
@c@finalout
@setchapternewpage on
@c@setchapternewpage odd
@settitle LIB BFD, the Binary File Descriptor Library
@titlepage
@title{libbfd}
@subtitle{The Binary File Descriptor Library}
@sp 1
@subtitle First Edition---BFD version < 2.0
@subtitle April 1991
@author {Steve Chamberlain}
@author {Cygnus Support}
@page
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
\xdef\manvers{\$Revision$} % For use in headers, footers too
{\parskip=0pt
\hfill Cygnus Support\par
\hfill steve\@cygnus.com\par
\hfill {\it BFD}, \manvers\par
\hfill \TeX{}info \texinfoversion\par
}
\global\parindent=0pt % Steve likes it this way
@end tex
@vskip 0pt plus 1filll
Copyright @copyright{} 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, subject to the terms
of the GNU General Public License, which includes the provision that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end titlepage
@end iftex
@node Top, Overview, (dir), (dir)
@ifinfo
This file documents the binary file descriptor library libbfd.
@end ifinfo
@menu
* Overview:: Overview of BFD
* History:: History of BFD
* Backends:: Backends
* Porting:: Porting
* Future:: Future
* Index:: Index
BFD body:
* Memory usage::
* Sections::
* Symbols::
* Archives::
* Formats::
* Relocations::
* Core Files::
* Targets::
* Architecturs::
* Opening and Closing::
* Internal::
* File Caching::
BFD backends:
* a.out backends::
* coff backends::
@end menu
@node Overview, History, Top, Top
@chapter Introduction
@cindex BFD
@cindex what is it?
BFD is a package for manipulating binary files required for developing
programs. It implements a group of structured operations designed to
shield the programmer from the underlying representation of these
binary files. It understands object (compiled) files, archive
libraries, and core files. It is designed to work in a variety of
target environments.
Most simply put, BFD is a package which allows applications to use the
same routines to operate on object files whatever the object file
format.
BFD is split into two parts; the front end and the many back ends.
@itemize @bullet
@item
The front end of BFD provides the interface to the user. It manages
memory, and various canonical data structures. The front end also
decides which back end to use, and when to call back end routines.
@item
The back ends provide BFD its view of the real world. A different
object file format can be supported simply by creating a new BFD back
end and adding it to the library. Each back end provides a set of calls
which the BFD front end can use to maintain its canonical form. The back
ends also may keep around information for their own use, for greater
efficiency.
@end itemize
@node History, How It Works, Overview,Top
@section History
One spur behind BFD was the desire, on the part of the GNU 960 team at
Intel Oregon, for interoperability of applications on their COFF and
b.out file formats. Cygnus was providing GNU support for the team, and
Cygnus was contracted to provide the required functionality.
The name came from a conversation David Wallace was having with Richard
Stallman about the library: RMS said that it would be quite hard---David
said ``BFD''. Stallman was right, but the name stuck.
At the same time, Ready Systems wanted much the same thing, but for
different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
coff.
BFD was first implemented by Steve Chamberlain (steve@@cygnus.com),
John Gilmore (gnu@@cygnus.com), K. Richard Pixley (rich@@cygnus.com) and
David Wallace (gumby@@cygnus.com) at Cygnus Support in Palo Alto,
California.
@node How It Works, History, Porting, Top
@section How It Works
To use the library, include @code{bfd.h} and link with @code{libbfd.a}.
BFD provides a common interface to the parts of an object file
for a calling application.
When an application sucessfully opens a target file (object, archive or
whatever) a pointer to an internal structure is returned. This pointer
points to a structure called @code{bfd}, described in
@code{include/bfd.h}. Our convention is to call this pointer a BFD, and
instances of it within code @code{abfd}. All operations on
the target object file are applied as methods to the BFD. The mapping is
defined within @code{bfd.h} in a set of macros, all beginning
@samp{bfd_}.
In short, a BFD is a representation for a particular file. It is opened
in a manner similar to a file; code then manipulates it rather than the
raw files.
For example, this sequence would do what you would probably expect:
return the number of sections in an object file attached to a BFD
@code{abfd}.
@lisp
@cartouche
#include "bfd.h"
unsigned int number_of_sections(abfd)
bfd *abfd;
@{
return bfd_count_sections(abfd);
@}
@end cartouche
@end lisp
The abstraction used within BFD is that an object file has a header,
a number of sections containing raw data, a set of relocations, and some
symbol information. Also, BFDs opened for archives have the
additional attribute of an index and contain subordinate BFDs. This approach is
fine for a.out and coff, but loses efficiency when applied to formats
such as S-records and IEEE-695.
@cindex targets
@cindex formats
BFD makes a distinction between @dfn{targets} (families of file
formats) and @dfn{formats} (individual file formats). For instance,
the @code{"sun4os4"} target can handle core, object and archive formats of
files. The exact layout of the different formats depends on the target
environment.
The target @code{"default"} means the first one known (usually used for
environments that only support one format, or where the common format
is known at compile or link time). The target @code{NULL} means the one
specified at runtime in the environment variable @code{GNUTARGET}; if that is
null or not defined then, on output, the first entry in the target list
is chosen; or, on input, all targets are searched to find a matching
one.
Most programs should use the target @code{NULL}. See the descriptions
of @code{bfd_target_list} and @code{bfd_format_string} for functions to
inquire on targets and formats.
@section What BFD Version 1 Can Do
As different information from the the object files is required,
BFD reads from different sections of the file and processes them.
For example a very common operation for the linker is processing symbol
tables. Each BFD back end provides a routine for converting
between the object file's representation of symbols and an internal
canonical format. When the linker asks for the symbol table of an object
file, it calls through the memory pointer to the relevant BFD
back end routine which reads and converts the table into a canonical
form. The linker then operates upon the canonical form. When the link is
finished and the linker writes the output file's symbol table,
another BFD back end routine is called which takes the newly
created symbol table and converts it into the chosen output format.
@node BFD information loss, Mechanism, BFD outline, BFD
@subsection Information Loss
@emph{Some information is lost due to the nature of the file format.} The output targets
supported by BFD do not provide identical facilities, and
information which may be described in one form has nowhere to go in
another format. One example of this is alignment information in
@code{b.out}. There is nowhere in an @code{a.out} format file to store
alignment information on the contained data, so when a file is linked
from @code{b.out} and an @code{a.out} image is produced, alignment
information will not propagate to the output file. (The linker will
still use the alignment information internally, so the link is performed
correctly).
Another example is COFF section names. COFF files may contain an
unlimited number of sections, each one with a textual section name. If
the target of the link is a format which does not have many sections (eg
@code{a.out}) or has sections without names (eg the Oasys format) the
link cannot be done simply. You can circumvent this problem by
describing the desired input-to-output section mapping with the linker command
language.
@emph{Information can be lost during canonicalization.} The BFD
internal canonical form of the external formats is not exhaustive; there
are structures in input formats for which there is no direct
representation internally. This means that the BFD back ends
cannot maintain all possible data richness through the transformation
between external to internal and back to external formats.
This limitation is only a problem when an application reads one
format and writes another. Each BFD back end is responsible for
maintaining as much data as possible, and the internal BFD
canonical form has structures which are opaque to the BFD core,
and exported only to the back ends. When a file is read in one format,
the canonical form is generated for BFD and the application. At the
same time, the back end saves away any information which may otherwise
be lost. If the data is then written back in the same format, the back
end routine will be able to use the canonical form provided by the
BFD core as well as the information it prepared earlier. Since
there is a great deal of commonality between back ends, this mechanism
is very useful. There is no information lost for this reason when
linking or copying big endian COFF to little endian COFF, or @code{a.out} to
@code{b.out}. When a mixture of formats is linked, the information is
only lost from the files whose format differs from the destination.
@node Mechanism, , BFD information loss, BFD
@subsection Mechanism
The greatest potential for loss of information is when there is least
overlap between the information provided by the source format, that
stored by the canonical format, and the information needed by the
destination format. A brief description of the canonical form may help
you appreciate what kinds of data you can count on preserving across
conversions.
@cindex BFD canonical format
@cindex internal object-file format
@table @emph
@item files
Information on target machine architecture, particular implementation
and format type are stored on a per-file basis. Other information
includes a demand pageable bit and a write protected bit. Note that
information like Unix magic numbers is not stored here---only the magic
numbers' meaning, so a @code{ZMAGIC} file would have both the demand
pageable bit and the write protected text bit set. The byte order of
the target is stored on a per-file basis, so that big- and little-endian
object files may be linked with one another.
@c FIXME: generalize above from "link"?
@item sections
Each section in the input file contains the name of the section, the
original address in the object file, various flags, size and alignment
information and pointers into other BFD data structures.
@item symbols
Each symbol contains a pointer to the object file which originally
defined it, its name, its value, and various flag bits. When a
BFD back end reads in a symbol table, the back end relocates all
symbols to make them relative to the base of the section where they were
defined. This ensures that each symbol points to its containing
section. Each symbol also has a varying amount of hidden data to contain
private data for the BFD back end. Since the symbol points to the
original file, the private data format for that symbol is accessible.
@code{gld} can operate on a collection of symbols of wildly different
formats without problems.
Normal global and simple local symbols are maintained on output, so an
output file (no matter its format) will retain symbols pointing to
functions and to global, static, and common variables. Some symbol
information is not worth retaining; in @code{a.out} type information is
stored in the symbol table as long symbol names. This information would
be useless to most COFF debuggers; the linker has command line switches
to allow users to throw it away.
There is one word of type information within the symbol, so if the
format supports symbol type information within symbols (for example COFF,
IEEE, Oasys) and the type is simple enough to fit within one word
(nearly everything but aggregates) the information will be preserved.
@item relocation level
Each canonical BFD relocation record contains a pointer to the symbol to
relocate to, the offset of the data to relocate, the section the data
is in and a pointer to a relocation type descriptor. Relocation is
performed effectively by message passing through the relocation type
descriptor and symbol pointer. It allows relocations to be performed
on output data using a relocation method only available in one of the
input formats. For instance, Oasys provides a byte relocation format.
A relocation record requesting this relocation type would point
indirectly to a routine to perform this, so the relocation may be
performed on a byte being written to a COFF file, even though 68k COFF
has no such relocation type.
@item line numbers
Object formats can contain, for debugging purposes, some form of mapping
between symbols, source line numbers, and addresses in the output file.
These addresses have to be relocated along with the symbol information.
Each symbol with an associated list of line number records points to the
first record of the list. The head of a line number list consists of a
pointer to the symbol, which allows divination of the address of the
function whose line number is being described. The rest of the list is
made up of pairs: offsets into the section and line numbers. Any format
which can simply derive this information can pass it successfully
between formats (COFF, IEEE and Oasys).
@end table
@c FIXME: what is this line about? Do we want introductory remarks
@c FIXME... on back ends? commented out for now.
@c What is a backend
@node BFD front end, BFD back end, Mechanism, Top
@chapter BFD front end
@include bfd.texi
@node Memory Usage, Errors, bfd, Top
@section Memory Usage
BFD keeps all its internal structures in obstacks. There is one obstack
per open BFD file, into which the current state is stored. When a BFD is
closed, the obstack is deleted, and so everything which has been
allocated by libbfd for the closing file will be thrown away.
BFD will not free anything created by an application, but pointers into
@code{bfd} structures will be invalidated on a @code{bfd_close}; for example,
after a @code{bfd_close} the vector passed to
@code{bfd_canonicalize_symtab} will still be around, since it has been
allocated by the application, but the data that it pointed to will be
lost.
The general rule is not to close a BFD until all operations dependent
upon data from the BFD have been completed, or all the data from within
the file has been copied. To help with the management of memory, there is a function
(@code{bfd_alloc_size}) which returns the number of bytes in obstacks
associated with the supplied BFD. This could be used to select the
greediest open BFD, close it to reclaim the memory, perform some
operation and reopen the BFD again, to get a fresh copy of the data
structures.
@node Errors, Sections, Memory Usage, Top
@section Error Handling
@cindex errors
In general, a boolean function returns true on success and false on failure
(unless it's a predicate). Functions which return pointers to
objects return @code{NULL} on error. The specifics are documented with each
function.
If a function fails, you should check the variable @code{bfd_error}. If
the value is @code{no_error}, then check the C variable @code{errno}
just as you would with any other program. Other values for
@code{bfd_error} are documented in @file{bfd.h}.
@findex bfd_errmsg
If you would prefer a comprehensible string for the error message, use
the function @code{bfd_errmsg}:
@example
char * bfd_errmsg (error_tag)
@end example
This function returns a read-only string which documents the error
code. If the error code is @code{no_error} then it will return a string
depending on the value of @code{errno}.
@findex bfd_perror
@code{bfd_perror()} is like the @code{perror()} function except it understands
@code{bfd_error}.
@node Sections, Symbols, Errors, Top
@include section.texi
@node Symbols, Archives ,Sections, To
@include syms.texi
@node Archives, Formats, Symbols, Top
@include archive.texi
@node Formats, Relocations, Archives, Top
@include format.texi
@node Relocations, Core Files,Formats, Top
@include reloc.texi
@node Core Files, Targets, Relocations, Top
@include core.texi
@node Targets, Architectures, Core Files, Top
@include targets.texi
@node Architectures, Opening and Closing, Targets, Top
@include archures.texi
@node Opening and Closing, Internal, Architectures, Top
@include opncls.texi
@node Internal, File Caching, Opening and Closing, Top
@include libbfd.texi
@node File Caching, Top, Internal, Top
@include cache.texi
@chapter BFD back end
@node BFD back end, ,BFD front end, Top
@menu
* What to put where
* a.out backends::
* coff backends::
* oasys backend::
* ieee backend::
* srecord backend::
@end menu
@node What to Put Where, aout backends, BFD back end, BFD back end
All of BFD lives in one directory.
@node aout backends, coff backends, What to Put Where, BFD back end
@include aoutx.texi
@node coff backends, oasys backends, aout backends, BFD back end
@include coffcode.texi
@node Index, , BFD, Top
@unnumbered Index
@printindex cp
@tex
% I think something like @colophon should be in texinfo. In the
% meantime:
\long\def\colophon{\hbox to0pt{}\vfill
\centerline{The body of this manual is set in}
\centerline{\fontname\tenrm,}
\centerline{with headings in {\bf\fontname\tenbf}}
\centerline{and examples in {\tt\fontname\tentt}.}
\centerline{{\it\fontname\tenit\/} and}
\centerline{{\sl\fontname\tensl\/}}
\centerline{are used for emphasis.}\vfill}
\page\colophon
% Blame: pesch@cygnus.com, 28mar91.
@end tex
@contents
@bye

View File

@ -1,8 +0,0 @@
# sed script for BFD header files
# Merge adjacent blank lines. Loop til no change.
:blin
/^$/,/^ *[^ ]*.*$/{
/^$/N
s/^ *\n *$//
}
t blin

File diff suppressed because it is too large Load Diff

View File

@ -1,601 +0,0 @@
/* All the swapping routines:
*/
static void
DEFUN(swap_reloc_in,(abfd, reloc_src, reloc_dst),
bfd *abfd AND
RELOC *reloc_src AND
struct internal_reloc *reloc_dst)
{
reloc_dst->r_vaddr = bfd_h_getlong(abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = bfd_h_getlong(abfd, reloc_src->r_symndx);
reloc_dst->r_type = bfd_h_getshort(abfd, reloc_src->r_type);
#if M88
reloc_dst->r_offset = bfd_h_getshort(abfd, reloc_src->r_offset);
#endif
}
static void
DEFUN(swap_reloc_out,(abfd, reloc_src, reloc_dst),
bfd *abfd AND
struct internal_reloc *reloc_src AND
struct external_reloc *reloc_dst)
{
bfd_h_putlong(abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
bfd_h_putlong(abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
bfd_h_putshort(abfd, reloc_src->r_type, reloc_dst->r_type);
#if M88
bfd_h_putshort(abfd, reloc_src->r_offset, reloc_dst->r_offset);
#endif
}
static void
DEFUN(swap_filehdr_in,(abfd, filehdr_src, filehdr_dst),
bfd *abfd AND
FILHDR *filehdr_src AND
struct internal_filehdr *filehdr_dst)
{
filehdr_dst->f_magic = bfd_h_get_x(abfd, filehdr_src->f_magic);
filehdr_dst->f_nscns = bfd_h_get_x(abfd,filehdr_src-> f_nscns);
filehdr_dst->f_timdat = bfd_h_get_x(abfd,filehdr_src-> f_timdat);
filehdr_dst->f_symptr = bfd_h_get_x(abfd,filehdr_src-> f_symptr);
filehdr_dst->f_nsyms = bfd_h_get_x(abfd,filehdr_src-> f_nsyms);
filehdr_dst->f_opthdr = bfd_h_get_x(abfd,filehdr_src-> f_opthdr);
filehdr_dst->f_flags = bfd_h_get_x(abfd,filehdr_src-> f_flags);
}
static void
DEFUN(swap_filehdr_out,(abfd, filehdr_in, filehdr_out),
bfd *abfd AND
struct internal_filehdr *filehdr_in AND
FILHDR *filehdr_out)
{
bfd_h_put_x(abfd, filehdr_in->f_magic, filehdr_out->f_magic);
bfd_h_put_x(abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
bfd_h_put_x(abfd, filehdr_in->f_timdat, filehdr_out->f_timdat);
bfd_h_put_x(abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
bfd_h_put_x(abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
bfd_h_put_x(abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
bfd_h_put_x(abfd, filehdr_in->f_flags, filehdr_out->f_flags);
}
static void
DEFUN(bfd_coff_swap_sym_in,(abfd, ext, in),
bfd *abfd AND
SYMENT *ext AND
struct internal_syment *in)
{
if( ext->e.e_name[0] == 0) {
in->_n._n_n._n_zeroes = 0;
in->_n._n_n._n_offset = bfd_h_getlong(abfd, ext->e.e.e_offset);
}
else {
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
}
in->n_value = bfd_h_get_x(abfd, ext->e_value);
in->n_scnum = bfd_h_get_x(abfd, ext->e_scnum);
in->n_type = bfd_h_get_x(abfd, ext->e_type);
in->n_sclass = bfd_h_get_x(abfd, ext->e_sclass);
in->n_numaux = bfd_h_get_x(abfd, ext->e_numaux);
}
static void
DEFUN(bfd_coff_swap_sym_out,(abfd,in, ext),
bfd *abfd AND
struct internal_syment *in AND
SYMENT *ext)
{
if(in->_n._n_name[0] == 0) {
bfd_h_putlong(abfd, 0, ext->e.e.e_zeroes);
bfd_h_putlong(abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
}
else {
memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
}
bfd_h_put_x(abfd, in->n_value , ext->e_value);
bfd_h_put_x(abfd, in->n_scnum , ext->e_scnum);
bfd_h_put_x(abfd, in->n_type , ext->e_type);
bfd_h_put_x(abfd, in->n_sclass , ext->e_sclass);
bfd_h_put_x(abfd, in->n_numaux , ext->e_numaux);
}
static void
DEFUN(bfd_coff_swap_aux_in,(abfd, ext, type, class, in),
bfd *abfd AND
AUXENT *ext AND
int type AND
int class AND
union internal_auxent *in)
{
switch (class) {
case C_FILE:
if (ext->x_file.x_fname[0] == 0) {
in->x_file.x_n.x_zeroes = 0;
in->x_file.x_n.x_offset = bfd_h_getlong(abfd, ext->x_file.x_n.x_offset);
}
break;
case C_STAT:
#ifdef C_LEAFSTAT
case C_LEAFSTAT:
#endif
case C_HIDDEN:
if (type == T_NULL) {
in->x_scn.x_scnlen = bfd_h_get_x(abfd, ext->x_scn.x_scnlen);
in->x_scn.x_nreloc = bfd_h_get_x(abfd, ext->x_scn.x_nreloc);
in->x_scn.x_nlinno = bfd_h_get_x(abfd, ext->x_scn.x_nlinno);
break;
}
default:
in->x_sym.x_tagndx = bfd_h_get_x(abfd, ext->x_sym.x_tagndx);
in->x_sym.x_tvndx = bfd_h_get_x(abfd, ext->x_sym.x_tvndx);
if (ISARY(type) || class == C_BLOCK) {
in->x_sym.x_fcnary.x_ary.x_dimen[0] = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
else {
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
in->x_sym.x_fcnary.x_fcn.x_endndx = bfd_h_get_x(abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN(type)) {
in->x_sym.x_misc.x_fsize = bfd_h_get_x(abfd, ext->x_sym.x_misc.x_fsize);
}
else {
in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_x(abfd, ext->x_sym.x_misc.x_lnsz.x_lnno);
in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_x(abfd, ext->x_sym.x_misc.x_lnsz.x_size);
}
}
}
static void
DEFUN(bfd_coff_swap_aux_out,(abfd, in, type, class, ext),
bfd *abfd AND
union internal_auxent *in AND
int type AND
int class AND
AUXENT *ext)
{
switch (class) {
case C_FILE:
if (in->x_file.x_fname[0] == 0) {
bfd_h_put_x(abfd, 0, ext->x_file.x_n.x_zeroes );
bfd_h_put_x(abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
}
break;
case C_STAT:
#ifdef C_LEAFSTAT
case C_LEAFSTAT:
#endif
case C_HIDDEN:
if (type == T_NULL) {
bfd_h_put_x(abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen);
bfd_h_put_x(abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc);
bfd_h_put_x(abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno);
break;
}
default:
bfd_h_put_x(abfd, in->x_sym.x_tagndx, ext->x_sym.x_tagndx);
bfd_h_put_x(abfd, in->x_sym.x_tvndx , ext->x_sym.x_tvndx);
if (ISARY(type) || class == C_BLOCK) {
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
else {
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
bfd_h_put_x(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx, ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN(type)) {
bfd_h_put_x(abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
}
else {
bfd_h_put_x(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext->x_sym.x_misc.x_lnsz.x_lnno);
bfd_h_put_x(abfd, in->x_sym.x_misc.x_lnsz.x_size, ext->x_sym.x_misc.x_lnsz.x_size);
}
}
}
static void
DEFUN(bfd_coff_swap_lineno_in,(abfd, ext, in),
bfd *abfd AND
LINENO *ext AND
struct internal_lineno *in)
{
in->l_addr.l_symndx = bfd_h_get_x(abfd, ext->l_addr.l_symndx);
in->l_lnno = bfd_h_get_x(abfd, ext->l_lnno);
}
static void
DEFUN(bfd_coff_swap_lineno_out,(abfd, in, ext),
bfd *abfd AND
struct internal_lineno *in AND
struct external_lineno *ext)
{
bfd_h_put_x(abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
bfd_h_put_x(abfd, in->l_lnno, ext->l_lnno);
}
static void
DEFUN(swap_aouthdr_in,(abfd, aouthdr_ext, aouthdr_int),
bfd *abfd AND
AOUTHDR *aouthdr_ext AND
struct internal_aouthdr *aouthdr_int)
{
aouthdr_int->magic = bfd_h_get_x(abfd, aouthdr_ext->magic);
aouthdr_int->vstamp = bfd_h_get_x(abfd, aouthdr_ext->vstamp);
aouthdr_int->tsize = bfd_h_get_x(abfd, aouthdr_ext->tsize);
aouthdr_int->dsize = bfd_h_get_x(abfd, aouthdr_ext->dsize);
aouthdr_int->bsize = bfd_h_get_x(abfd, aouthdr_ext->bsize);
aouthdr_int->entry = bfd_h_get_x(abfd, aouthdr_ext->entry);
aouthdr_int->text_start = bfd_h_get_x(abfd, aouthdr_ext->text_start);
aouthdr_int->data_start = bfd_h_get_x(abfd, aouthdr_ext->data_start);
#ifdef I960
aouthdr_int->tagentries = bfd_h_get_x(abfd, aouthdr_ext->tagentries);
#endif
}
static void
DEFUN(swap_aouthdr_out,(abfd, aouthdr_in, aouthdr_out),
bfd *abfd AND
struct internal_aouthdr *aouthdr_in AND
AOUTHDR *aouthdr_out)
{
bfd_h_put_x(abfd, aouthdr_in->magic, aouthdr_out->magic);
bfd_h_put_x(abfd, aouthdr_in->vstamp, aouthdr_out->vstamp);
bfd_h_put_x(abfd, aouthdr_in->tsize, aouthdr_out->tsize);
bfd_h_put_x(abfd, aouthdr_in->dsize, aouthdr_out->dsize);
bfd_h_put_x(abfd, aouthdr_in->bsize, aouthdr_out->bsize);
bfd_h_put_x(abfd, aouthdr_in->entry, aouthdr_out->entry);
bfd_h_put_x(abfd, aouthdr_in->text_start, aouthdr_out->text_start);
bfd_h_put_x(abfd, aouthdr_in->data_start, aouthdr_out->data_start);
#ifdef I960
bfd_h_put_x(abfd, aouthdr_in->tagentries, aouthdr_out->tagentries);
#endif
}
static void
DEFUN(swap_scnhdr_in,(abfd, scnhdr_ext, scnhdr_int),
bfd *abfd AND
SCNHDR *scnhdr_ext AND
struct internal_scnhdr *scnhdr_int)
{
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name));
scnhdr_int->s_vaddr = bfd_h_get_x(abfd, scnhdr_ext->s_vaddr);
scnhdr_int->s_paddr = bfd_h_get_x(abfd, scnhdr_ext->s_paddr);
scnhdr_int->s_size = bfd_h_get_x(abfd, scnhdr_ext->s_size);
scnhdr_int->s_scnptr = bfd_h_get_x(abfd, scnhdr_ext->s_scnptr);
scnhdr_int->s_relptr = bfd_h_get_x(abfd, scnhdr_ext->s_relptr);
scnhdr_int->s_lnnoptr = bfd_h_get_x(abfd, scnhdr_ext->s_lnnoptr);
scnhdr_int->s_nreloc = bfd_h_get_x(abfd, scnhdr_ext->s_nreloc);
scnhdr_int->s_nlnno = bfd_h_get_x(abfd, scnhdr_ext->s_nlnno);
scnhdr_int->s_flags = bfd_h_get_x(abfd, scnhdr_ext->s_flags);
#ifdef I960
scnhdr_int->s_align = bfd_h_get_x(abfd, scnhdr_ext->s_align);
#endif
}
static void
DEFUN(swap_scnhdr_out,(abfd, scnhdr_int, scnhdr_ext),
bfd *abfd AND
struct internal_scnhdr *scnhdr_int AND
SCNHDR *scnhdr_ext)
{
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
bfd_h_put_x(abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr);
bfd_h_put_x(abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr);
bfd_h_put_x(abfd, scnhdr_int->s_size, scnhdr_ext->s_size);
bfd_h_put_x(abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr);
bfd_h_put_x(abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
bfd_h_put_x(abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
bfd_h_put_x(abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
bfd_h_put_x(abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
bfd_h_put_x(abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
#ifdef I960
bfd_h_put_x(abfd, scnhdr_int->s_align, scnhdr_ext->s_align);
#endif
}
/*
initialize a section structure with information peculiar to this
particular implementation of coff
*/
static boolean
DEFUN(coff_new_section_hook,(abfd_ignore, section_ignore),
bfd *abfd_ignore AND
asection *section_ignore)
{
#ifdef MC88MAGIC
/* FIXME, shouldn't this ifdef be on something that says we are
actually COMPILING FOR an 88K coff file, rather than simply
knowing its magic number? */
/* Align to at least 16 bytes */
section_ignore->alignment_power = 4;
#endif
#if M68
section_ignore->alignment_power = 3;
#endif
return true;
}
/* Take a section header read from a coff file (in HOST byte order),
and make a BFD "section" out of it. */
static boolean
DEFUN(make_a_section_from_file,(abfd, hdr),
bfd *abfd AND
struct internal_scnhdr *hdr)
{
asection *return_section;
{
/* Assorted wastage to null-terminate the name, thanks AT&T! */
char *name = bfd_alloc(abfd, sizeof (hdr->s_name)+1);
if (name == NULL) {
bfd_error = no_memory;
return false;
}
strncpy(name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
name[sizeof (hdr->s_name)] = 0;
return_section = bfd_make_section(abfd, name);
}
/* s_paddr is presumed to be = to s_vaddr */
#define assign(to, from) return_section->to = hdr->from
assign(vma, s_vaddr);
/* assign (vma, s_vaddr); */
assign(size, s_size);
assign(filepos, s_scnptr);
assign(rel_filepos, s_relptr);
assign(reloc_count, s_nreloc);
#ifdef I960
{
/* FIXME, use a temp var rather than alignment_power */
assign(alignment_power, s_align);
{
unsigned int i;
for (i = 0; i < 32; i++) {
if ((1 << i) >= (int) (return_section->alignment_power)) {
return_section->alignment_power = i;
break;
}
}
}
}
#endif
assign(line_filepos, s_lnnoptr);
/*
return_section->linesize = hdr->s_nlnno * sizeof (struct lineno);
*/
#undef assign
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
return_section->next = (asection *) NULL;
if ((hdr->s_flags & STYP_TEXT) || (hdr->s_flags & STYP_DATA))
return_section->flags = (SEC_LOAD | SEC_ALLOC);
else if (hdr->s_flags & STYP_BSS)
return_section->flags = SEC_ALLOC;
if (hdr->s_nreloc != 0)
return_section->flags |= SEC_RELOC;
if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS;
return true;
}
static boolean
DEFUN(coff_mkobject,(abfd),
bfd *abfd)
{
set_tdata (abfd, bfd_zalloc (abfd,sizeof(coff_data_type)));
if (coff_data(abfd) == 0) {
bfd_error = no_memory;
return false;
}
coff_data(abfd)->relocbase = 0;
return true;
}
static
bfd_target *
DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
bfd *abfd AND
unsigned nscns AND
struct internal_filehdr *internal_f AND
struct internal_aouthdr *internal_a)
{
coff_data_type *coff;
size_t readsize; /* length of file_info */
SCNHDR *external_sections;
/* Build a play area */
if (coff_mkobject(abfd) != true)
return 0;
coff = coff_data(abfd);
external_sections = (SCNHDR *)bfd_alloc(abfd, readsize = (nscns * SCNHSZ));
if (bfd_read((PTR)external_sections, 1, readsize, abfd) != readsize) {
goto fail;
}
/* Now copy data as required; construct all asections etc */
coff->symbol_index_slew = 0;
coff->relocbase =0;
coff->raw_syment_count = 0;
coff->raw_linenos = 0;
coff->raw_syments = 0;
coff->sym_filepos =0;
coff->flags = internal_f->f_flags;
if (nscns != 0) {
unsigned int i;
for (i = 0; i < nscns; i++) {
struct internal_scnhdr tmp;
swap_scnhdr_in(abfd, external_sections + i, &tmp);
make_a_section_from_file(abfd,&tmp);
}
}
/* Determine the machine architecture and type. */
abfd->obj_machine = 0;
switch (internal_f->f_magic) {
#ifdef MIPS
#ifdef MIPSEBMAGIC
case SMIPSEBMAGIC:
case SMIPSELMAGIC:
case MIPSEBUMAGIC:
case MIPSELUMAGIC:
case MIPSEBMAGIC:
case MIPSELMAGIC:
abfd->obj_arch = bfd_arch_mips;
abfd->obj_machine = 0;
break;
#endif
#endif
#ifdef MC68MAGIC
case MC68MAGIC:
case M68MAGIC:
abfd->obj_arch = bfd_arch_m68k;
abfd->obj_machine = 68020;
break;
#endif
#ifdef MC88MAGIC
case MC88MAGIC:
case MC88DMAGIC:
case MC88OMAGIC:
abfd->obj_arch = bfd_arch_m88k;
abfd->obj_machine = 88100;
break;
#endif
#ifdef I960
#ifdef I960ROMAGIC
case I960ROMAGIC:
case I960RWMAGIC:
abfd->obj_arch = bfd_arch_i960;
switch (F_I960TYPE & internal_f->f_flags)
{
default:
case F_I960CORE:
abfd->obj_machine = bfd_mach_i960_core;
break;
case F_I960KB:
abfd->obj_machine = bfd_mach_i960_kb_sb;
break;
case F_I960MC:
abfd->obj_machine = bfd_mach_i960_mc;
break;
case F_I960XA:
abfd->obj_machine = bfd_mach_i960_xa;
break;
case F_I960CA:
abfd->obj_machine = bfd_mach_i960_ca;
break;
case F_I960KA:
abfd->obj_machine = bfd_mach_i960_ka_sa;
break;
}
break;
#endif
#endif
default: /* Unreadable input file type */
abfd->obj_arch = bfd_arch_obscure;
break;
}
if (!(internal_f->f_flags & F_RELFLG))
abfd->flags |= HAS_RELOC;
if ((internal_f->f_flags & F_EXEC))
abfd->flags |= EXEC_P;
if (!(internal_f->f_flags & F_LNNO))
abfd->flags |= HAS_LINENO;
if (!(internal_f->f_flags & F_LSYMS))
abfd->flags |= HAS_LOCALS;
bfd_get_symcount(abfd) = internal_f->f_nsyms;
if (internal_f->f_nsyms)
abfd->flags |= HAS_SYMS;
coff->sym_filepos = internal_f->f_symptr;
coff->symbols = (coff_symbol_type *) NULL;
bfd_get_start_address(abfd) = internal_f->f_opthdr ? internal_a->entry : 0;
return abfd->xvec;
fail:
bfd_release(abfd, coff);
return (bfd_target *)NULL;
}
static bfd_target *
DEFUN(coff_object_p,(abfd),
bfd *abfd)
{
int nscns;
FILHDR filehdr;
AOUTHDR opthdr;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
bfd_error = system_call_error;
/* figure out how much to read */
if (bfd_read((PTR) &filehdr, 1, FILHSZ, abfd) != FILHSZ)
return 0;
swap_filehdr_in(abfd, &filehdr, &internal_f);
if (BADMAG(internal_f)) {
bfd_error = wrong_format;
return 0;
}
nscns =internal_f.f_nscns;
if (internal_f.f_opthdr) {
if (bfd_read((PTR) &opthdr, 1,AOUTSZ, abfd) != AOUTSZ) {
return 0;
}
swap_aouthdr_in(abfd, &opthdr, &internal_a);
}
/* Seek past the opt hdr stuff */
bfd_seek(abfd, internal_f.f_opthdr + FILHSZ, SEEK_SET);
/* if the optional header is NULL or not the correct size then
quit; the only difference I can see between m88k dgux headers (MC88DMAGIC)
and Intel 960 readwrite headers (I960WRMAGIC) is that the
optional header is of a different size.
But the mips keeps extra stuff in it's opthdr, so dont check
when doing that
*/
#ifndef MIPS
if (internal_f.f_opthdr != 0 && AOUTSZ != internal_f.f_opthdr)
return (bfd_target *)NULL;
#endif
return coff_real_object_p(abfd, nscns, &internal_f, &internal_a);
}

View File

@ -1,123 +0,0 @@
/* Byte-swapping routines for COFF files */
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
BFD 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 1, or (at your option) any later version.
BFD 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
BFD; see the file COPYING. If not, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Most of this hacked by Steve Chamberlain, steve@cygnus.com */
#if 0
#include <ansidecl.h>
#include "intel-coff.h"
#include "bfd.h"
#include "libcoff.h" /* to allow easier abstraction-breaking */
#define sp(x) bfd_h_put_x(abfd, x, &x)
/* All the generic swapping routines:
FIXME
These routines cater for the sizes and alignments and offsets of
all the contained fields. Because of this, the fields can change
size, so these should be phased out to use the ones specific to the
file format.
*/
void
DEFUN(bfd_coff_swap_name,(abfd, ptr),
bfd *abfd AND
long *ptr)
{
if (ptr[0] == 0) {
/* There is an index which needs to be swapped */
bfd_h_put_x(abfd, ptr[1], (ptr + 1));
}
else {
/* This is a string .. leave it alone */
}
}
void
DEFUN(bfd_coff_swap_sym,(abfd, se),
bfd *abfd AND
struct internal_syment *se)
{
bfd_coff_swap_name(abfd, (long*)(se->n_name));
bfd_h_put_x(abfd, se->n_value, &se->n_value);
bfd_h_put_x(abfd, se->n_scnum, &se->n_scnum);
bfd_h_put_x(abfd, se->n_type, &se->n_type);
bfd_h_put_x(abfd, se->n_sclass, &se->n_sclass);
bfd_h_put_x(abfd, se->n_numaux, &se->n_numaux);
}
void
DEFUN(bfd_coff_swap_aux,(abfd, au, type, class),
bfd *abfd AND
struct internal_auxent *au AND
int type AND
int class)
{
switch (class) {
case C_FILE:
bfd_coff_swap_name(abfd, (long *)(&au->x_file.x_n));
break;
case C_STAT:
#ifdef C_LEAFSTAT
case C_LEAFSTAT:
#endif
case C_HIDDEN:
if (type == T_NULL) {
sp(au->x_scn.x_scnlen);
sp(au->x_scn.x_nreloc);
sp(au->x_scn.x_nlinno);
break;
}
default:
sp(au->x_sym.x_tagndx);
sp(au->x_sym.x_tvndx);
if (ISARY(type) || class == C_BLOCK) {
sp(au->x_sym.x_fcnary.x_ary.x_dimen[0]);
sp(au->x_sym.x_fcnary.x_ary.x_dimen[1]);
sp(au->x_sym.x_fcnary.x_ary.x_dimen[2]);
sp(au->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
else {
sp(au->x_sym.x_fcnary.x_fcn.x_lnnoptr);
sp(au->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN(type)) {
sp(au->x_sym.x_misc.x_fsize);
}
else {
sp(au->x_sym.x_misc.x_lnsz.x_lnno);
sp(au->x_sym.x_misc.x_lnsz.x_size);
}
}
}
void
DEFUN(bfd_coff_swap_lineno,(abfd, lineno),
bfd *abfd AND
struct internal_lineno *lineno)
{
sp(lineno->l_addr.l_symndx);
sp(lineno->l_lnno);
}
#endif

446
bfd/config.sub vendored
View File

@ -1,446 +0,0 @@
#!/bin/sh
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration (e.g. a typo).
# Please email any bugs, comments, and/or additions to this file to:
# configure@cygnus.com
# decode aliases into canonical names
case "$1" in
# cpu alone is a valid alias for cpu-none-none.
vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
| alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
| romp | rs6000 | i960 | h8300)
cpu=$1
vendor=none
os=none
;;
altos | altos3068)
cpu=m68k
vendor=altos
os=sysv # maybe?
;;
altosgas)
cpu=m68k
vendor=altos
os=gas
;;
am29k)
cpu=a29k
vendor=none
os=bsd
;;
amdahl)
cpu=580
vendor=amdahl
os=uts
;;
amigados)
cpu=m68k
vendor=cbm
os=amigados # Native AmigaDOS
;;
amigaunix | amix)
cpu=m68k
vendor=cbm
os=svr4 # System V Release 4 (svr4 is an industry recognized acronym)
;;
apollo68)
cpu=m68k
vendor=apollo
os=sysv # maybe?
;;
balance)
cpu=ns32k
vendor=sequent
os=dynix
;;
convex-c1)
cpu=c1
vendor=convex
os=sysv # maybe?
;;
convex-c2)
cpu=c2
vendor=convex
os=sysv # maybe?
;;
cray | ymp)
cpu=ymp
vendor=cray
os=unicos
;;
cray2)
cpu=cray2
vendor=cray
os=unicos
;;
dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin)
cpu=mips
vendor=dec
os=ultrix
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
cpu=m68k
vendor=motorola
os=sysv # maybe?
;;
delta88)
cpu=m88k
vendor=motorola
os=m88kbcs
;;
gmicro)
cpu=tron
vendor=gmicro
os=sysv # maybe?
;;
h8300hds)
cpu=h8300
vendor=hitachi
os=hds
;;
# start-sanitize-v9
hal-32 | hal32)
cpu=sparc64
vendor=hal
os=hal32
;;
hal-64 | hal64)
cpu=sparc64
vendor=hal
os=hal64
;;
sparc64)
cpu=sparc64
vendor=sun
os=v9
;;
sparc64-v7 | sparc64v7)
cpu=sparc64
vendor=sun
os=v7
;;
# end-sanitize-v9
hp300bsd)
cpu=m68k
vendor=hp
os=bsd
;;
hp300hpux | hpux | hp9k3[2-9][0-9])
cpu=m68k
vendor=hp
os=hpux
;;
hp9k31[0-9] | hp9k2[0-9][0-9])
cpu=m68000
vendor=hp
os=hpux
;;
i386sco)
cpu=i386
vendor=sco
os=sysv # maybe?
;;
i386v)
cpu=i386
vendor=none
os=sysv
;;
i386v32)
cpu=i386
vendor=none
os=sysv32
;;
iris | iris4d)
cpu=mips
vendor=sgi
os=irix # maybe?
;;
dpx2)
vendor=bull
cpu=m68k
os=sysv
;;
isi | isi68)
cpu=m68k
vendor=isi
os=sysv # maybe?
;;
littlemips)
cpu=mips
vendor=little
os=bsd
;;
magnum | m3230)
cpu=mips
vendor=mips
os=sysv # maybe?
;;
merlin)
cpu=ns32k
vendor=utek
os=sysv # maybe?
;;
miniframe)
cpu=m68000
vendor=convergent
os=sysv # maybe?
;;
mmax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
news | news700 | news800 | news900)
cpu=m68k
vendor=sony
os=newsos3 # Based on bsd-4.3
;;
news1000)
cpu=m68030
vendor=sony
os=newsos3 # ?
;;
news-3600 | bigmips | risc-news)
cpu=mips
vendor=sony
os=newsos4 # Presumably?
;;
next)
cpu=m68k
vendor=next
os=sysv # maybe?
;;
nindy960)
cpu=i960
vendor=intel
os=nindy
;;
none)
cpu=none
vendor=none
os=none
;;
np1)
cpu=np1
vendor=gould
os=sysv # maybe?
;;
rtpc)
cpu=romp
vendor=ibm
os=aix # maybe?
;;
pbd)
cpu=sparc
vendor=unicom
os=sysv
;;
pn)
cpu=pn
vendor=gould
os=sysv # maybe?
;;
ps2)
cpu=i386
vendor=ibm
os=sysv # maybe?
;;
sun2)
cpu=m68000
vendor=sun
os=sunos4
;;
sun2os3)
cpu=m68000
vendor=sun
os=sunos3
;;
sun2os4)
cpu=m68000
vendor=sun
os=sunos4
;;
sun3)
cpu=m68k
vendor=sun
os=sunos4
;;
sun3os3)
cpu=m68k
vendor=sun
os=sunos3
;;
sun3os4)
cpu=m68k
vendor=sun
os=sunos4
;;
sun386 | roadrunner | sun386i)
cpu=i386
vendor=sun
os=sunos
;;
sun4)
cpu=sparc
vendor=sun
os=sunos4
;;
sun4os3)
cpu=sparc
vendor=sun
os=sunos3
;;
sun4os4)
cpu=sparc
vendor=sun
os=sunos4
;;
symmetry)
cpu=i386
vendor=sequent
os=dynix
;;
tower | tower-32)
cpu=m68k
vendor=ncr
os=sysv # maybe?
;;
ultra3)
cpu=a29k
vendor=nyu
os=sym1
;;
umax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
cpu=m68k
vendor=att
os=sysv # maybe?
;;
vax-dec)
cpu=vax
vendor=dec
os=ultrix # maybe?
;;
vxworks68)
cpu=m68k
vendor=wrs
os=vxworks
;;
vxworks960)
cpu=i960
vendor=wrs
os=vxworks
;;
xmp)
cpu=xmp
vendor=cray
os=unicos
;;
# not an alias. parse what we expect to be a canonical name.
*)
cpu=`echo $1 | sed 's/-.*$//'`
if [ "${cpu}" = "$1" ] ; then
# no vendor so this is an invalid name.
echo '***' No vendor: configuration \`$1\' not recognized 1>&2
exit 1
else
# parse out vendor
rest=`echo $1 | sed "s/${cpu}-//"`
vendor=`echo ${rest} | sed 's/-.*$//'`
if [ "${vendor}" = "${rest}" ] ; then
# a missing os is acceptable
os=none
else
os=`echo ${rest} | sed "s/${vendor}-//"`
fi
fi
;;
esac
# At this point we should have three parts of a canonical name in cpu,
# vendor, and os.
# verify that the cpu is known.
case "${cpu}" in
none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \
| ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \
| a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300)
;;
# start-sanitize-v9
sparc64) ;;
# end-sanitize-v9
*)
echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the vendor is known.
case "${vendor}" in
altos | amdahl | aout | apollo | att | bcs | bout |\
cbm | convergent | convex | coff | cray | dec | encore |\
gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\
ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\
unicom | utek | wrs | bull ) ;;
# start-sanitize-v9
hal) ;;
# end-sanitize-v9
*)
echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the os is known, if it exists.
case "${os}" in
aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \
| hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \
| osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \
| vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \
| amigados)
;;
# start-sanitize-v9
hal32 | hal64 | v7 | v9) ;;
# end-sanitize-v9
*)
echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
echo ${cpu}-${vendor}-${os}

View File

@ -1,6 +0,0 @@
@echo off
echo Configuring BFD for H8/300
copy hosts\h-go32.h sysdep.h
copy makefile.dos makefile

774
bfd/configure vendored
View File

@ -1,774 +0,0 @@
#!/bin/sh
# Configuration script
# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
#This file is part of GNU.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# $Id$
#
# Shell script to create proper links to machine-dependent files in
# preparation for compilation.
#
# If configure succeeds, it leaves its status in config.status.
# If configure fails after disturbing the status quo,
# config.status is removed.
#
remove=rm
hard_link=ln
symbolic_link='ln -s'
#for Test
#remove="echo rm"
#hard_link="echo ln"
#symbolic_link="echo ln -s"
progname=$0
# clear some things potentially inherited from environment.
ansi=
arguments=$*
defaulttargets=
destdir=
fatal=
hostsubdir=
Makefile=Makefile
Makefile_in=Makefile.in
norecursion=
recurring=
removing=
srcdir=
srctrigger=
target=
targets=
commontargets=
configdirs=
targetsubdir=
template=
verbose=
for arg in $*;
do
case ${arg} in
-ansi | +a*)
ansi=true
clib=clib
;;
-destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
;;
-languages=* | +languages=* | +language=* | +languag=* \
| +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
| +l=*)
languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
;;
-gas | +g*)
gas=yes
;;
-help | +h*)
fatal=true
;;
-nfp | +nf*)
nfp=yes
;;
-norecursion | +no*)
norecursion=true
;;
-recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
recurring=true
;;
-rm | +rm)
removing=${arg}
;;
# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
# ;;
-subdirs | +f* | +su*)
subdirs=${arg}
;;
-target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
if [ -n "${targets}" ] ; then
subdirs="+subdirs"
fi
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
targets="${newtargets}"
;;
-template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
template=`echo ${arg} | sed 's/[+-]template=//'`
;;
-v | -verbose | +v*)
verbose=${arg}
;;
-* | +*)
(echo ;
echo "Unrecognized option: \"${arg}\"". ;
echo) 1>&2
fatal=true
;;
*)
if [ -n "${hosts}" ] ; then
subdirs="+subdirs"
fi
newhosts="${hosts} ${arg}"
hosts=${newhosts}
;;
esac
done
if [ -n "${verbose}" ] ; then
echo `pwd`/configure $*
fi
# process host and target only if not rebuilding configure itself or removing.
if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
# Complain if an arg is missing
if [ -z "${hosts}" ] ; then
(echo ;
echo "configure: No HOST specified." ;
echo) 1>&2
fatal=true
fi
fi
if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
(echo "Usage: configure HOST" ;
echo ;
echo "Options: [defaults in brackets]" ;
echo " +ansi configure w/ANSI library. [no ansi lib]" ;
echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
echo " +subdirs configure in subdirectories. [in source directories]" ;
echo " +lang=LANG configure to build LANG. [gcc]" ;
echo " +help print this message. [normal config]" ;
echo " +gas configure the compilers for use with gas. [native as]" ;
echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
echo " +norecursion configure this directory only. [recurse]" ;
echo " +rm remove this configuration. [build a configuration]" ;
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
echo " +template=TEM rebuild configure using TEM. [normal config]" ;
echo ;
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
echo "options given will apply to all targets.") 1>&2
if [ -r config.status ] ; then
cat config.status
fi
exit 1
fi
#### configure.in common parts come in here.
# This file is a shell script that supplies the information necessary
# to tailor a template configure script into the configure script
# appropriate for this directory. For more information, check any
# existing configure script.
srctrigger=libbfd.c
srcname="bfd"
## end of common part.
# are we rebuilding config itself?
if [ -n "${template}" ] ; then
if [ ! -r ${template} ] ; then
echo '***' "Can't find template ${template}." 1>&2
exit 1
fi
# prep the template
sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
#### configure.in common parts come in here.\
## end of common part.' \
-e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
#### configure.in per-host parts come in here.\
## end of per-host part.' \
-e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
#### configure.in per-target parts come in here.\
## end of per-target part.' \
-e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
#### configure.in post-target parts come in here.\
## end of post-target part.' \
< ${template} > template.new
if [ -r configure.in ] ; then
if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
exit 1
fi
if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
exit 1
fi
# split configure.in into common, per-host, per-target,
# and post-target parts. Post-target is optional.
sed -e '/^# per\-host:/,$d' configure.in > configure.com
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
if grep -s '^# post-target:' configure.in ; then
sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
sed -e '1,/^# post\-target:/d' configure.in > configure.pos
else
sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
echo >configure.pos
fi
# and insert them
sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
-e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
-e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
-e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
template.new > configure.new
rm -f configure.com configure.tgt configure.hst configure.pos
else
echo Warning: no configure.in in `pwd`
cat ${template} >> configure
fi
chmod a+x configure.new
rm template.new
# mv configure configure.old
mv configure.new configure
if [ -n "${verbose}" ] ; then
echo Rebuilt configure in `pwd`
fi
# Now update config.sub from the template directory.
if echo "$template" | grep -s 'configure$' ; then
cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
# mv config.sub config.sub.old
mv config.sub.new config.sub
if [ -n "${verbose}" ] ; then
echo Rebuilt config.sub in `pwd`
fi
fi
if [ -z "${norecursion}" ] ; then
# If template is relative path, make it absolute for recurring.
if echo "${template}" | grep -s '^/' ; then
true
else
template=`pwd`/${template}
fi
while [ -n "${configdirs}" ] ; do
# set configdir to car of configdirs, configdirs to cdr of configdirs
set ${configdirs}; configdir=$1; shift; configdirs=$*
if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
targetspecificdirs=${configdir}.*
else
targetspecificdirs=
fi
for i in ${configdir} ${targetspecificdirs} ; do
if [ -d $i ] ; then
if [ -r $i/configure ] ; then
(cd $i ;
./configure +template=${template} ${verbose})
else
echo Warning: No configure script in `pwd`/$i
fi
else
if [ -n "${verbose}" ] ; then
echo Warning: directory $i is missing.
fi
fi
done
done
fi
exit 0
fi
# some sanity checks on configure.in
if [ -z "${srctrigger}" ] ; then
echo Warning: srctrigger not set in configure.in. `pwd` not configured.
exit 1
fi
for host in ${hosts} ; do
# Default other arg
if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
targets=${host}
defaulttargets=true
fi
host_alias=${host}
result=`/bin/sh ./config.sub ${host}`
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
host=${host_cpu}-${host_vendor}-${host_os}
host_makefile_frag=config/hmake-${host}
#### configure.in per-host parts come in here.
if [ "${host_os}" = "posix" ] ; then
bfd_host=posix
else
case "${host_cpu}" in
rs6000) bfd_host=aix ;;
mips)
case "${host_vendor}" in
dec) bfd_host=dec3100 ;;
sgi) bfd_host=irix3 ;;
esac
;;
m88k)
case "${host_vendor}" in
*)
case "${host_os}" in
dgux) bfd_host=dgux ;;
esac
;;
esac
;;
m68k)
case "${host_vendor}" in
cbm)
case ${host_os} in
amigados) bfd_host=amigados ;;
svr4) bfd_host=amix ;;
esac
;;
hp)
case "${host_os}" in
hpux) bfd_host=hp9000 ;;
bsd) bfd_host=hp300bsd ;;
esac
;;
sony) bfd_host=news ;;
sun) bfd_host=sun3 ;;
esac
;;
i386)
case "${host_vendor}" in
*)
case "${host_os}" in
sysv) bfd_host=i386v ;;
esac
;;
esac
;;
sparc)
case "${host_vendor}" in
sun) bfd_host=sun4 ;;
esac
;;
rtpc) bfd_host=rtbsd
;;
a29k) bfd_host=ultra3
;;
tahoe)
bfd_host=${host_cpu}
;;
vax)
case "${host_os}" in
ultrix) bfd_host=vaxult ;;
*) bfd_host=vax ;;
esac
;;
esac
fi
if [ ! -f config/h-${bfd_host} ] ; then
echo '***' BFD does not support host ${host}: no file config/h-${bfd_host}
exit 1
fi
host_makefile_frag=config/h-${bfd_host}
## end of per-host part.
for target in ${targets} ; do
target_alias=${target}
result=`/bin/sh ./config.sub ${target}`
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
target=${target_cpu}-${target_vendor}-${target_os}
target_makefile_frag=config/tmake-${target}
#### configure.in per-target parts come in here.
case "${target_vendor}" in
aout | coff | bout | elf) bfd_target=${target_cpu}-${target_vendor} ;;
sony) bfd_target=news ;;
intel) bfd_target=${target_cpu}-coff ;;
cbm) bfd_target=${target_cpu}-elf ;;
hitachi)
case "${target_cpu}" in
h8300) bfd_target=h8300-ieee ;;
*) echo "bad hitachi cpu" ;;
esac
;;
wrs)
case "${target_cpu}" in
i960) bfd_target=i960-bout ;;
m68k) bfd_target=m68k-aout ;;
esac
;;
sun)
case "${target_cpu}" in
m68k) bfd_target=m68k-aout ;;
sparc) bfd_target=sparc-aout ;;
esac
;;
dec)
case "${target_cpu}" in
mips) bfd_target=dec3100 ;;
vax) bfd_target=vax ;;
esac
;;
hp)
case "${target_cpu}" in
m68k)
case "${target_os}" in
hpux) bfd_target=hp9000 ;;
bsd) bfd_target=hp300bsd ;;
esac
;;
esac
;;
sgi)
case "${target_cpu}" in
mips)
bfd_target=irix3 ;;
esac
;;
none|nyu)
case "${target_cpu}" in
i386) bfd_target=i386-coff ;;
a29k) case "${target_os}" in
aout) bfd_target=a29k-aout ;;
coff) bfd_target=a29k-coff ;;
sym1) bfd_target=a29k-coff ;;
esac
;;
tahoe | vax) bfd_target=${target_cpu} ;;
esac
;;
*)
case "${target_cpu}" in
tahoe | vax) bfd_target=${target_cpu} ;;
esac
;;
esac
if [ ! -f config/t-${bfd_target} ] ; then
echo '***' BFD does not support target ${target}: no file config/t-${bfd_target}
exit 1
fi
target_makefile_frag=config/t-${bfd_target}
files=
links=
## end of per-target part.
# Temporarily, we support only direct subdir builds.
hostsubdir=H-${host_alias}
targetsubdir=T-${target_alias}
if [ -n "${removing}" ] ; then
if [ -n "${subdirs}" ] ; then
if [ -d "${hostsubdir}" ] ; then
rm -rf ${hostsubdir}/${targetsubdir}
if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
rm -rf ${hostsubdir}
fi
else
echo Warning: no `pwd`/${hostsubdir} to remove.
fi
else
rm -f ${Makefile} config.status ${links}
fi
else
if [ -n "${subdirs}" ] ; then
# check for existing status before allowing forced subdirs.
if [ -f ${Makefile} ] ; then
echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
exit 1
fi
if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
cd ${hostsubdir}
if [ ! -d ${targetsubdir} ] ; then
if [ -z "${commontargets}" ] ; then
mkdir ${targetsubdir}
else
if [ ! -d Target-independent ] ; then
mkdir Target-independent
fi
${symbolic_link} Target-independent ${targetsubdir}
fi # if target independent
fi # if no target dir yet
cd ${targetsubdir}
srcdir=../..
else
# if not subdir builds, then make sure none exist.
if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
exit 1
fi
fi
# Find the source files, if location was not specified.
if [ -z "${srcdir}" ] ; then
srcdirdefaulted=1
srcdir=.
if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
srcdir=..
fi
fi
if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
if [ -z "${srcdirdefaulted}" ] ; then
echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
else
echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
fi
echo '***' \(At least ${srctrigger} is missing.\) 1>&2
exit 1
fi
# Set up the list of links to be made.
# ${links} is the list of link names, and ${files} is the list of names to link to.
# Make the links.
while [ -n "${files}" ] ; do
# set file to car of files, files to cdr of files
set ${files}; file=$1; shift; files=$*
set ${links}; link=$1; shift; links=$*
if [ ! -r ${srcdir}/${file} ] ; then
echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
echo '***' "since the file \"${file}\" does not exist." 1>&2
exit 1
fi
${remove} -f ${link}
rm -f config.status
# Make a symlink if possible, otherwise try a hard link
${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
if [ ! -r ${link} ] ; then
echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
exit 1
fi
if [ -n "${verbose}" ] ; then
echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
fi
done
# Create a .gdbinit file which runs the one in srcdir
# and tells GDB to look there for source files.
case ${srcdir} in
.)
;;
*)
echo "dir ." > .gdbinit
echo "dir ${srcdir}" >> .gdbinit
echo "source ${srcdir}/.gdbinit" >> .gdbinit
;;
esac
# Install a makefile, and make it set VPATH
# if necessary so that the sources are found.
# Also change its value of srcdir.
# FIXME-someday: This business of always writing to .tem and mv back
# is so that I don't screw things up while developing. Once this
# template is stable, these should be optimized. xoxorich.
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
if [ "${host}" != "${target}" ] ; then
echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
echo "ALL=start.encap" >> ${Makefile}
else
echo "ALL=all.internal" > ${Makefile}
fi
# set target, host, VPATH
echo "host_alias = ${host_alias}" >> ${Makefile}
echo "host_cpu = ${host_cpu}" >> ${Makefile}
echo "host_vendor = ${host_vendor}" >> ${Makefile}
echo "host_os = ${host_os}" >> ${Makefile}
echo "target_alias = ${target_alias}" >> ${Makefile}
echo "target_cpu = ${target_cpu}" >> ${Makefile}
echo "target_vendor = ${target_vendor}" >> ${Makefile}
echo "target_os = ${target_os}" >> ${Makefile}
if [ -n "${subdirs}" ] ; then
echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
else
echo "subdir =" >> ${Makefile}
fi
# echo "workdir = `pwd`" >> ${Makefile}
echo "VPATH = ${srcdir}" >> ${Makefile}
# add "Makefile.in" (or whatever it's called)
cat ${srcdir}/${Makefile_in} >> ${Makefile}
# Conditionalize the makefile for this host.
if [ -f ${srcdir}/${host_makefile_frag} ] ; then
(echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
mv Makefile.tem ${Makefile}
fi
# Conditionalize the makefile for this target.
if [ -f ${srcdir}/${target_makefile_frag} ] ; then
(echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
mv Makefile.tem ${Makefile}
fi
# set srcdir
sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
mv Makefile.tem ${Makefile}
# set destdir
if [ -n "${destdir}" ] ; then
sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
mv Makefile.tem ${Makefile}
fi
# reset SUBDIRS
sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
mv Makefile.tem ${Makefile}
# reset NONSUBDIRS
sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
mv Makefile.tem ${Makefile}
using=
if [ -f ${srcdir}/${host_makefile_frag} ] ; then
using=" using \"${host_makefile_frag}\""
fi
# remove any form feeds.
sed -e "s/ //" ${Makefile} > Makefile.tem
mv Makefile.tem ${Makefile}
if [ -f ${srcdir}/${target_makefile_frag} ] ; then
if [ -z "${using}" ] ; then
andusing=" using \"${target_makefile_frag}\""
else
andusing="${using} and \"${target_makefile_frag}\""
fi
else
andusing=${using}
fi
if [ -n "${verbose}" -o -z "${recurring}" ] ; then
echo "Created \"${Makefile}\"" in `pwd`${andusing}.
fi
#### configure.in post-target parts come in here.
## end of post-target part.
# describe the chosen configuration in config.status.
# Make that file a shellscript which will reestablish
# the same configuration. Used in Makefiles to rebuild
# Makefiles.
echo "#!/bin/sh
# ${srcname} was configured as follows:
${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
chmod a+x config.status
originaldir=`pwd`
cd ${srcdir}
fi
# If there are subdirectories, then recurse.
if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
for configdir in ${configdirs} ; do
if [ -n "${verbose}" ] ; then
echo Configuring ${configdir}...
fi
if [ -d ${configdir} ] ; then
(cd ${configdir} ;
./configure +recurring ${host_alias} +target=${target_alias} \
${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
| sed 's/^/ /'
else
if [ -n "${verbose}" ] ; then
echo Warning: directory \"${configdir}\" is missing.
fi
fi
done
fi
done # for each target
# Now build a Makefile for this host.
if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
cd ${hostsubdir}
cat > GNUmakefile << E!O!F
# Makefile generated by configure for host ${host_alias}.
ALL := $(shell ls -d Target-*)
%:
$(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
all:
E!O!F
cd ..
fi
done # for each host
exit 0
#
# Local Variables:
# fill-column: 131
# End:
#
# end of configure

View File

@ -1,942 +0,0 @@
/* Demangler for GNU C++
Copyright (C) 1989 Free Software Foundation, Inc.
written by James Clark (jjc@jclark.uucp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This is for g++ 1.36.1 (November 6 version). It will probably
require changes for any other version.
Modified for g++ 1.36.2 (November 18 version). */
/* This file exports one function
char *cplus_demangle (const char *name)
If `name' is a mangled function name produced by g++, then
a pointer to a malloced string giving a C++ representation
of the name will be returned; otherwise NULL will be returned.
It is the caller's responsibility to free the string which
is returned.
For example,
cplus_demangle ("_foo__1Ai")
returns
"A::foo(int)"
This file imports xmalloc and xrealloc, which are like malloc and
realloc except that they generate a fatal error if there is no
available memory. */
/* #define nounderscore 1 /* define this is names don't start with _ */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
/* #include "misc.h" */
#ifdef USG
#include <memory.h>
#else
#define memcpy(s1, s2, n) strncpy(s1, s2, n)
#define memcmp(s1, s2, n) strncmp(s1, s2, n)
#define strchr(s, c) index(s, c)
#endif
#ifndef __STDC__
#define const
#endif
#ifdef __STDC__
extern char *cplus_demangle (const char *type);
#else
extern char *cplus_demangle ();
#endif
static char **typevec = 0;
static int ntypes = 0;
static int typevec_size = 0;
static struct {
const char *in;
const char *out;
} optable[] = {
"new", " new",
"delete", " delete",
"ne", "!=",
"eq", "==",
"ge", ">=",
"gt", ">",
"le", "<=",
"lt", "<",
"plus", "+",
"minus", "-",
"mult", "*",
"convert", "+", /* unary + */
"negate", "-", /* unary - */
"trunc_mod", "%",
"trunc_div", "/",
"truth_andif", "&&",
"truth_orif", "||",
"truth_not", "!",
"postincrement", "++",
"postdecrement", "--",
"bit_ior", "|",
"bit_xor", "^",
"bit_and", "&",
"bit_not", "~",
"call", "()",
"cond", "?:",
"alshift", "<<",
"arshift", ">>",
"component", "->",
"indirect", "*",
"method_call", "->()",
"addr", "&", /* unary & */
"array", "[]",
"nop", "", /* for operator= */
};
/* Beware: these aren't '\0' terminated. */
typedef struct {
char *b; /* pointer to start of string */
char *p; /* pointer after last character */
char *e; /* pointer after end of allocated space */
} string;
#ifdef __STDC__
static void string_need (string *s, int n);
static void string_delete (string *s);
static void string_init (string *s);
static void string_clear (string *s);
static int string_empty (string *s);
static void string_append (string *p, const char *s);
static void string_appends (string *p, string *s);
static void string_appendn (string *p, const char *s, int n);
static void string_prepend (string *p, const char *s);
#if 0
static void string_prepends (string *p, string *s);
#endif
static void string_prependn (string *p, const char *s, int n);
static int get_count (const char **type, int *count);
static int do_args (const char **type, string *decl);
static int do_type (const char **type, string *result);
static int do_arg (const char **type, string *result);
static int do_args (const char **type, string *decl);
static void munge_function_name (string *name);
#else
static void string_need ();
static void string_delete ();
static void string_init ();
static void string_clear ();
static int string_empty ();
static void string_append ();
static void string_appends ();
static void string_appendn ();
static void string_prepend ();
static void string_prepends ();
static void string_prependn ();
static int get_count ();
static int do_args ();
static int do_type ();
static int do_arg ();
static int do_args ();
static void munge_function_name ();
#endif
char *
cplus_demangle (type)
const char *type;
{
string decl;
int n;
int success = 0;
int constructor = 0;
int const_flag = 0;
int i;
const char *p, *premangle;
if (type == NULL || *type == '\0')
return NULL;
#ifndef nounderscore
if (*type++ != '_')
return NULL;
#endif
p = type;
while (*p != '\0' && !(*p == '_' && p[1] == '_'))
p++;
if (*p == '\0')
{
/* destructor */
if (type[0] == '_' && type[1] == '$' && type[2] == '_')
{
unsigned int l = (strlen (type) - 3)*2 + 3 + 2 + 1;
char *tem = (char *) zalloc (l);
strcpy (tem, type + 3);
strcat (tem, "::~");
strcat (tem, type + 3);
strcat (tem, "()");
return tem;
}
/* static data member */
if (*type != '_' && (p = (char *) strchr (type, '$')) != NULL)
{
int n = strlen (type) + 2;
char *tem = (char *) xmalloc (n);
memcpy (tem, type, p - type);
strcpy (tem + (p - type), "::");
strcpy (tem + (p - type) + 2, p + 1);
return tem;
}
/* virtual table */
if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == '$')
{
int n = strlen (type + 4) + 14 + 1;
char *tem = (char *) xmalloc (n);
strcpy (tem, type + 4);
strcat (tem, " virtual table");
return tem;
}
return NULL;
}
string_init (&decl);
if (p == type)
{
if (!isdigit (p[2]))
{
string_delete (&decl);
return NULL;
}
constructor = 1;
}
else
{
string_appendn (&decl, type, p - type);
munge_function_name (&decl);
}
p += 2;
premangle = p;
switch (*p)
{
case 'C':
/* a const member function */
if (!isdigit (p[1]))
{
string_delete (&decl);
return NULL;
}
p += 1;
const_flag = 1;
/* fall through */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = 0;
do
{
n *= 10;
n += *p - '0';
p += 1;
}
while (isdigit (*p));
if (strlen (p) < n)
{
string_delete (&decl);
return NULL;
}
if (constructor)
{
string_appendn (&decl, p, n);
string_append (&decl, "::");
string_appendn (&decl, p, n);
}
else
{
string_prepend (&decl, "::");
string_prependn (&decl, p, n);
}
#ifndef LONGERNAMES
p = premangle;
#else
p += n;
#endif
success = do_args (&p, &decl);
if (const_flag)
string_append (&decl, " const");
break;
case 'F':
p += 1;
success = do_args (&p, &decl);
break;
}
for (i = 0; i < ntypes; i++)
if (typevec[i] != NULL)
free (typevec[i]);
ntypes = 0;
if (typevec != NULL)
{
free ((char *)typevec);
typevec = NULL;
typevec_size = 0;
}
if (success)
{
string_appendn (&decl, "", 1);
return decl.b;
}
else
{
string_delete (&decl);
return NULL;
}
}
static int
get_count (type, count)
const char **type;
int *count;
{
if (!isdigit (**type))
return 0;
*count = **type - '0';
*type += 1;
/* see flush_repeats in cplus-method.c */
if (isdigit (**type))
{
const char *p = *type;
int n = *count;
do
{
n *= 10;
n += *p - '0';
p += 1;
}
while (isdigit (*p));
if (*p == '_')
{
*type = p + 1;
*count = n;
}
}
return 1;
}
/* result will be initialised here; it will be freed on failure */
static int
do_type (type, result)
const char **type;
string *result;
{
int n;
int done;
int non_empty = 0;
int success;
string decl;
const char *remembered_type;
string_init (&decl);
string_init (result);
done = 0;
success = 1;
while (success && !done)
{
int member;
switch (**type)
{
case 'P':
*type += 1;
string_prepend (&decl, "*");
break;
case 'R':
*type += 1;
string_prepend (&decl, "&");
break;
case 'T':
*type += 1;
if (!get_count (type, &n) || n >= ntypes)
success = 0;
else
{
remembered_type = typevec[n];
type = &remembered_type;
}
break;
case 'F':
*type += 1;
if (!string_empty (&decl) && decl.b[0] == '*')
{
string_prepend (&decl, "(");
string_append (&decl, ")");
}
if (!do_args (type, &decl) || **type != '_')
success = 0;
else
*type += 1;
break;
case 'M':
case 'O':
{
int constp = 0;
int volatilep = 0;
member = **type == 'M';
*type += 1;
if (!isdigit (**type))
{
success = 0;
break;
}
n = 0;
do
{
n *= 10;
n += **type - '0';
*type += 1;
}
while (isdigit (**type));
if (strlen (*type) < n)
{
success = 0;
break;
}
string_append (&decl, ")");
string_prepend (&decl, "::");
string_prependn (&decl, *type, n);
string_prepend (&decl, "(");
*type += n;
if (member)
{
if (**type == 'C')
{
*type += 1;
constp = 1;
}
if (**type == 'V')
{
*type += 1;
volatilep = 1;
}
if (*(*type)++ != 'F')
{
success = 0;
break;
}
}
if ((member && !do_args (type, &decl)) || **type != '_')
{
success = 0;
break;
}
*type += 1;
if (constp)
{
if (non_empty)
string_append (&decl, " ");
else
non_empty = 1;
string_append (&decl, "const");
}
if (volatilep)
{
if (non_empty)
string_append (&decl, " ");
else
non_empty = 1;
string_append (&decl, "volatilep");
}
break;
}
case 'C':
if ((*type)[1] == 'P')
{
*type += 1;
if (!string_empty (&decl))
string_prepend (&decl, " ");
string_prepend (&decl, "const");
break;
}
/* fall through */
default:
done = 1;
break;
}
}
done = 0;
non_empty = 0;
while (success && !done)
{
switch (**type)
{
case 'C':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "const");
break;
case 'U':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "unsigned");
break;
case 'V':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "volatile");
break;
default:
done = 1;
break;
}
}
if (success)
switch (**type)
{
case '\0':
case '_':
break;
case 'v':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "void");
break;
case 'l':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "long");
break;
case 'i':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "int");
break;
case 's':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "short");
break;
case 'c':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "char");
break;
case 'r':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "long double");
break;
case 'd':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "double");
break;
case 'f':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "float");
break;
case 'G':
*type += 1;
if (!isdigit (**type))
{
success = 0;
break;
}
/* fall through */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = 0;
do
{
n *= 10;
n += **type - '0';
*type += 1;
}
while (isdigit (**type));
if (strlen (*type) < n)
{
success = 0;
break;
}
if (non_empty)
string_append (result, " ");
string_appendn (result, *type, n);
*type += n;
break;
default:
success = 0;
break;
}
if (success)
{
if (!string_empty (&decl))
{
string_append (result, " ");
string_appends (result, &decl);
}
string_delete (&decl);
return 1;
}
else
{
string_delete (&decl);
string_delete (result);
return 0;
}
}
/* `result' will be initialised in do_type; it will be freed on failure */
static int
do_arg (type, result)
const char **type;
string *result;
{
char *tem;
int len;
const char *start;
const char *end;
start = *type;
if (!do_type (type, result))
return 0;
end = *type;
if (ntypes >= typevec_size)
{
if (typevec_size == 0)
{
typevec_size = 3;
typevec = (char **) xmalloc (sizeof (char*)*typevec_size);
}
else
{
typevec_size *= 2;
typevec = (char **) realloc ((char *)typevec, sizeof (char*)*typevec_size);
}
}
len = end - start;
tem = (char *) xmalloc (len + 1);
memcpy (tem, start, len);
tem[len] = '\0';
typevec[ntypes++] = tem;
return 1;
}
/* `decl' must be already initialised, usually non-empty;
it won't be freed on failure */
static int
do_args (type, decl)
const char **type;
string *decl;
{
string arg;
int need_comma = 0;
int dont_want_first;
#ifndef LONGERNAMES
dont_want_first = 1;
#else
dont_want_first = 0;
#endif
string_append (decl, "(");
while (**type != '_' && **type != '\0' && **type != 'e' && **type != 'v')
{
if (**type == 'N')
{
int r;
int t;
*type += 1;
if (!get_count (type, &r) || !get_count (type, &t) || t >= ntypes)
return 0;
while (--r >= 0)
{
const char *tem = typevec[t];
if (need_comma)
string_append (decl, ", ");
if (!do_arg (&tem, &arg))
return 0;
string_appends (decl, &arg);
string_delete (&arg);
need_comma = 1;
}
}
else
{
if (need_comma)
string_append (decl, ", ");
if (!do_arg (type, &arg))
return 0;
if (dont_want_first)
dont_want_first = 0;
else
{
string_appends (decl, &arg);
need_comma = 1;
}
string_delete (&arg);
}
}
if (**type == 'v')
*type += 1;
else if (**type == 'e')
{
*type += 1;
if (need_comma)
string_append (decl, ",");
string_append (decl, "...");
}
string_append (decl, ")");
return 1;
}
static void
munge_function_name (name)
string *name;
{
if (!string_empty (name) && name->p - name->b >= 3
&& name->b[0] == 'o' && name->b[1] == 'p' && name->b[2] == '$')
{
int i;
/* see if it's an assignment expression */
if (name->p - name->b >= 10 /* op$assign_ */
&& memcmp (name->b + 3, "assign_", 7) == 0)
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
{
int len = name->p - name->b - 10;
if (strlen (optable[i].in) == len
&& memcmp (optable[i].in, name->b + 10, len) == 0)
{
string_clear (name);
string_append (name, "operator");
string_append (name, optable[i].out);
string_append (name, "=");
return;
}
}
}
else
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
{
int len = name->p - name->b - 3;
if (strlen (optable[i].in) == len
&& memcmp (optable[i].in, name->b + 3, len) == 0)
{
string_clear (name);
string_append (name, "operator");
string_append (name, optable[i].out);
return;
}
}
}
return;
}
else if (!string_empty (name) && name->p - name->b >= 5
&& memcmp (name->b, "type$", 5) == 0)
{
/* type conversion operator */
string type;
const char *tem = name->b + 5;
if (do_type (&tem, &type))
{
string_clear (name);
string_append (name, "operator ");
string_appends (name, &type);
string_delete (&type);
return;
}
}
}
/* a mini string-handling package */
static void
string_need (s, n)
string *s;
int n;
{
if (s->b == NULL)
{
if (n < 32)
n = 32;
s->p = s->b = (char *) xmalloc (n);
s->e = s->b + n;
}
else if (s->e - s->p < n)
{
int tem = s->p - s->b;
n += tem;
n *= 2;
s->b = (char *) realloc (s->b, n);
s->p = s->b + tem;
s->e = s->b + n;
}
}
static void
string_delete (s)
string *s;
{
if (s->b != NULL)
{
free (s->b);
s->b = s->e = s->p = NULL;
}
}
static void
string_init (s)
string *s;
{
s->b = s->p = s->e = NULL;
}
static void
string_clear (s)
string *s;
{
s->p = s->b;
}
static int
string_empty (s)
string *s;
{
return s->b == s->p;
}
static void
string_append (p, s)
string *p;
const char *s;
{
int n;
if (s == NULL || *s == '\0')
return;
n = strlen (s);
string_need (p, n);
memcpy (p->p, s, n);
p->p += n;
}
static void
string_appends (p, s)
string *p, *s;
{
int n;
if (s->b == s->p)
return;
n = s->p - s->b;
string_need (p, n);
memcpy (p->p, s->b, n);
p->p += n;
}
static void
string_appendn (p, s, n)
string *p;
const char *s;
int n;
{
if (n == 0)
return;
string_need (p, n);
memcpy (p->p, s, n);
p->p += n;
}
static void
string_prepend (p, s)
string *p;
const char *s;
{
if (s == NULL || *s == '\0')
return;
string_prependn (p, s, strlen (s));
}
static void
string_prependn (p, s, n)
string *p;
const char *s;
int n;
{
char *q;
if (n == 0)
return;
string_need (p, n);
for (q = p->p - 1; q >= p->b; q--)
q[n] = q[0];
memcpy (p->b, s, n);
p->p += n;
}

View File

@ -1,82 +0,0 @@
.SUFFIXES: .texi .o .c .h .p .ip
VPATH=..
.c.texi:
./scanit $< $@
.h.texi:
./scanit $< $@
.c.p:
./scanph $< $@
.h.p:
./scanph $< $@
.c.ip:
./scanph -i $< $@
# main GDB source directory
srcdir = ..
TEXIDIR=${srcdir}/../texinfo/fsf
DOCFILES = aoutx.texi archive.texi archures.texi \
bfd.texi cache.texi coffcode.texi \
core.texi format.texi libbfd.texi \
opncls.texi reloc.texi section.texi \
syms.texi targets.texi init.texi ctor.texi
PROTOS = archive.p archures.p bfd.p \
coffcode.p core.p format.p \
libbfd.p opncls.p reloc.p \
section.p syms.p targets.p \
format.p coffcode.p core.p machines.p init.p
IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip ctor.ip
# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction
# between VPATH and suffix rules. If you use GNU Make, perhaps other Makes,
# you don't need these three:
SRCDOC = aoutx.h archive.c archures.c \
bfd.c cache.c coffcode.h \
core.c format.c libbfd.c \
opncls.c reloc.c section.c \
syms.c targets.c init.c
SRCPROT = archive.c archures.c bfd.c \
coffcode.h core.c format.c \
libbfd.c opncls.c reloc.c \
section.c syms.c targets.c init.c
SRCIPROT = cache.c libbfd.c reloc.c cpu-h8300.c cpu-i960.c archures.c init.c ctor.c
docs: protos bfd.info bfd.dvi bfd.ps
protos: $(PROTOS) $(IPROTOS)
sed -f intobfd bfd-in.h > bfd.h
sed -f tolibbfd libbfd-in.h > libbfd.h
sed -f tolibcoff libcoff-in.h > libcoff.h
# Following three rules only for the benefit of Sun Make; see comment above
$(DOCFILES) : $(SRCDOC)
$(PROTOS) : $(SRCPROT)
$(IPROTOS) : $(SRCIPROT)
clean:
rm -f $(PROTOS) *.p *.ip *.h bfd.?? $(DOCFILES) bfd.dvi bfd.ps *~* *# bfd.???
bfd.info: $(DOCFILES) bfd.texinfo
makeinfo bfd.texinfo
bfd.dvi: $(DOCFILES) bfd.texinfo
TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex bfd.texinfo
texindex bfd.??
TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex bfd.texinfo
bfd.ps: bfd.dvi
dvips bfd -o
quickdoc: $(DOCFILES) bfd.texinfo
TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex bfd.texinfo

View File

@ -1,12 +0,0 @@
# NOTE: BEGIN pattern gives errors if other than 1st line;
# END ditto if other than last.
BEGIN { print "@c ------------------------------START TEXT FROM " FILENAME }
#
# Keep /*doc* blocks (terminated by either */ or *-*/)
/^\/\*doc\*/,/^\*\/|^\*-\*\//
#
# Also keep two kinds of /*proto blocks
/^\/\*proto\*/,/^\*\/|^\*-\*\//
/^\/\*proto-internal\*/,/^\*\/|^\*-\*\//
#
END { print "@c ------------------------------END TEXT FROM " FILENAME }

View File

@ -1,8 +0,0 @@
# Awk filter, 1st filter for BFD internal prototype file extraction
#
# keep /*proto-internal blocks
/^\/\*proto-internal\*/,/^\*\/|^\*-\*\//
#
# Apparent bug in sed can discard last line in some situations; therefore
# make last line harmless.
END { print "\n" }

View File

@ -1,8 +0,0 @@
# Awk filter, 1st filter for BFD prototype file extraction
#
# keep /*proto blocks
/^\/\*proto\*/,/^\*\/|^\*-\*\//
#
# Apparent bug in sed can discard last line in some situations; therefore
# make last line harmless.
END { print "\n" }

View File

@ -1,67 +0,0 @@
Info file bfd.info, produced by Makeinfo, -*- Text -*- from input file
bfd.texinfo.
This file documents the BFD library.
Copyright (C) 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, subject to the
terms of the GNU General Public License, which includes the provision
that the entire resulting derived work is distributed under the terms
of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.

Indirect:
bfd.info-1: 821
bfd.info-2: 44533
bfd.info-3: 89652

Tag Table:
(Indirect)
Node: Top823
Node: Overview1086
Node: History1985
Node: How It Works2937
Node: What BFD Version 1 Can Do4363
Node: BFD information loss5388
Node: Mechanism8002
Node: BFD front end12332
Node: Memory Usage17576
Node: Initialization18818
Node: Sections19432
Node: Section Input19910
Node: Section Output21190
Node: typedef asection22559
Node: section prototypes27347
Node: Symbols30865
Node: Reading Symbols32454
Node: Writing Symbols33410
Node: typedef asymbol34939
Node: symbol handling functions38386
Node: Archives40232
Node: Formats41678
Node: Relocations43795
Node: typedef arelent44535
Node: howto manager56584
Node: Core Files57569
Node: Targets58466
Node: bfd_target60218
Node: Architectures68923
Node: Opening and Closing76770
Node: Internal78654
Node: File Caching81129
Node: BFD back end83617
Node: What to Put Where83810
Node: aout83946
Node: coff89654
Node: Index100603

End Tag Table

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
# sed script for BFD header files
# Merge adjacent blank lines. Loop til no change.
:blin
/^$/,/^ *[^ ]*.*$/{
/^$/N
s/^ *\n *$//
}
t blin

View File

@ -1,5 +0,0 @@
#
# Locate and coalesce adjacent comments
/\*\/$/N
s/\*\/\n\/\*/\
/

View File

@ -1,16 +0,0 @@
# blank-line activity:
# Merge adjacent blank lines. Loop til no change.
:blin
/^$/,/^ *[^ ]*.*$/{
/^$/N
s/^ *\n *$//
}
t blin
#
/^$/,/^ *[^ ]*.*$/{
/^$/N
# Transpose <blank line> <end comment>
/^ *\n\*\/$/c\
*\/\
}

View File

@ -1,14 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# Final pass; cleanup work is done here.
#
# Within examples, make '{' and '}' printable:
/^@lisp$/,/^@end lisp$/s/{/@{/
/^@lisp$/,/^@end lisp$/s/}/@}/
/^@example$/,/^@end example$/s/{/@{/
/^@example$/,/^@end example$/s/}/@}/
#
# Delete empty @findex and @subsubsection entries (resulting from *proto*
# with no further text on same line, in middle pass)
/^@findex $/d
/^@subsubsection @code{}/d
#

View File

@ -1,12 +0,0 @@
# SED script for preprocessing embedded headers from C source comments
# (S. Chamberlain markup)
# beginning of many passes of cleanup work
#
# Delete empty comment blocks
/^\/\*$/N
/^\/\*\n\*\/ *$/d
#
# Locate and coalesce adjacent comments
/\*\/$/N
s/\*\/\n\/\*/\
/

View File

@ -1,8 +0,0 @@
# Merge adjacent blank lines. Loop til no change.
:blin
/^$/,/^ *[^ ]*.*$/{
/^$/N
s/^ *\n *$//
}
t blin

View File

@ -1,4 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# Locate and coalesce adjacent @example blocks
/^@end example/N
/^@end example\n@example$/d

View File

@ -1,13 +0,0 @@
/\/\*:init.c\*\//r init.p
/\/\*:archive.c\*\//r archive.p
/\/\*:archures.c\*\//r archures.p
/\/\*:bfd.c\*\//r bfd.p
/\/\*:core.c\*\//r core.p
/\/\*:format.c\*\//r format.p
/\/\*:libbfd.c\*\//r libbfd.p
/\/\*:opncls.c\*\//r opncls.p
/\/\*:reloc.c\*\//r reloc.p
/\/\*:section.c\*\//r section.p
/\/\*:syms.c\*\//r syms.p
/\/\*:targets.c\*\//r targets.p

View File

@ -1,5 +0,0 @@
# SED script for preprocessing embedded headers from C source comments
# Locate and coalesce adjacent comments
/\*\/$/N
s/\*\/\n\/\*/\
/

View File

@ -1,8 +0,0 @@
# sed script for BFD header files:
# Transpose <blank line> <end comment>
/^$/,/^ *[^ ]*.*$/{
/^$/N
/^ *\n\*\/$/c\
*\/\
}

View File

@ -1,25 +0,0 @@
#!/bin/sh
# Script to coordinate parsing of S. Chamberlain source-embedded
# documentation markup language.
# Four passes:
# 1) awk discards lines not intended for docn, and marks blocks of
# text with comments identifying source file;
# 2) first sed pass interprets Chamberlain markup;
# 3) second sed pass does cleanup that involves merging lines
# 4) third sed pass does remaining cleans up---making {}
# printable within examples, and eliminating empty index entries and
# headings.
#Third and second sed passes are separate because order of execution is hard
#to control otherwise, making one or another of the things involving @example
#inoperative.
base=`echo $1 | cut -d '.' -f 1`
out=`echo $2 | cut -d '.' -f 1`
awk -f $3/awkscan $1 | \
sed -f $3/sedscript | \
sed -f $3/unPROTO | \
sed -f $3/exmerge | \
sed -f $3/exfilter >$out.texi

View File

@ -1,25 +0,0 @@
#!/bin/sh
# Script to coordinate parsing of S. Chamberlain source-embedded
# header-file markup language.
# '-i' option means use *proto-internal* segments, else just *proto*
SFX=p
if [ $1 = "-i" ]; then
SFX=ip
shift
fi
out=`echo $2 | cut -d '.' -f 1`
# passes:
# 1) awk discards lines not intended for header, and marks blocks of
# text with comments identifying source file;
# 2) first sed pass interprets Chamberlain markup;
# 3) further sed passes clean up---merging adjacent comments etc.
awk -f $3/awkscan-$SFX $1 |\
sed -f $3/sedscript-p |\
sed -f $3/mergecom-p |\
sed -f $3/startcom-p |\
sed -f $3/blins-p |\
sed -f $3/movecom-p >$out.$SFX

View File

@ -1,85 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# middle pass; most of the work is done here.
#
# First, get rid of /*doc* markers; they've done their job in the first pass.
/^\/\*doc\*/d
#
# /*proto* markers may be optionally followed by a *i-style subsubsec, findex
# entry. This will generate empty @findex and @subsubsection entries if
# the *proto* is on a line by itself; third pass removes them.
/^\/\*proto\*/s/^\/\*proto\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# /*proto-internal* is just like /*proto* from doc point of view.
/^\/\*proto-internal\*/s/^\/\*proto-internal\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# *i at beginning of line: rest of line is both a subsubsection heading
# and an entry in function index.
/^\*i/s/^\*i *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# Two alternative docn block ends, '*/' and '*-*/' on lines by themselves;
# replace by blank lines (for texinfo source readability).
/^\*\/$/c\
/^\*-\*\/$/c\
# {* and *} are standins for comment markers (originally embedded in .c
# comments)---turn into real comment markers:
s/{\*/\/\*/
s/\*}/\*\//
#
# '*+++' and '*---' span a block of text that includes both example lines
# (marked by leading '$') and explanatory text (to be italicized).
# Italicize lines lacking '$':
/\*\+\+\+/,/\*---/s/^\([^$].*\)$/@i{\1}/
#
# We don't need *+++ and *--- markers any more; kill them (trailing marker
# becomes blank line for readability)
/\*\+\+\+/d
/\*---/c\
# Any line beginning with '$' is made an example line; third pass later
# coalesces adjacent example blocks. *DO NOT* introduce extra space after
# @end example, so we can spot adjacent ones in third pass.
/^\$/i\
@example
/^\$/a\
@end example
#
# In any example line, turn '{' and '}' into '@{' and '@}'
###/^\$/s/{/@{/g
###/^\$/s/}/@}/g
#
# Now delete the '$' markers themselves:
/^\$/s/\$//
#
# *+ and *- delimit large examples to be enclosed in cartouches.
/^\*\+$/c\
@lisp\
@c @cartouche
/^\*-$/c\
@c @end cartouche\
@end lisp\
# '*;' introduces an example which may have a single line or multiple lines;
# it extends until the next semicolon (which is also printed).
# One-line case: (do this first; else second line address for multi-line case
# will include random text til we happen to end a line in a doc comment with
# a semicolon)
/^\*;.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}
# Multi-line case:
/^\*;/,/.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}

View File

@ -1,63 +0,0 @@
# SED script for preprocessing embedded headers from source
# (S. Chamberlain markup)
# middle pass; most of the work is done here.
#
# First, get rid of /*proto* markers; they've done their job in the first pass.
# (They remain comment-introducers)
/^\/\*proto\*/s/^\/\*proto\*/\/*/
/^\/\*proto-internal\*/s/^\/\*proto-internal\*/\/*/
#
# *-*/ is an alternative (older) comment-block end. Remap for uniformity:
s/^\*-\*\//\*\//
#
# {* and *} are standins for comment markers (originally embedded in .c
# comments)---turn into real comment markers:
s/{\*/\/\*/
s/\*}/\*\//
#
# '*+++' and '*---' span a block of text that includes both header lines
# (marked by leading '$') and explanatory text (to be comments).
# No need to start comment at "*+++", or end it at "*---", since we're
# already in a *proto* comment block. Just delete.
/\*\+\+\+/d
/\*---/d
#
# Any line beginning with '$' is made a line of code in the header;
# stuff in between is comments, so *precede* each '$' line with
# END-comment, *follow* each '$' line with START-comment; third pass later
# eliminates empty comment blocks.
/^\$/i\
*/
/^\$/a\
/*
#
# Now delete the '$' markers themselves:
/^\$/s/\$//
#
# *+ and *- delimit larger blocks of code, treated the same as '$' lines
/^\*\+$/c\
*/
/^\*-$/c\
/*
#
# '*;' introduces code which may have a single line or multiple lines;
# it extends until the next semicolon (which is also printed).
#
# One-line case: (do this first; else second line address for multi-line case
# will include random text til we happen to end a line in a proto comment with
# a semicolon)
/^\*;.*;$/{
s/^\*;/*\/\
/
s/;$/;\
\/*\
/
}
# Multi-line case:
/^\*;/,/.*;$/{
s/^\*;/*\/\
/
s/;$/;\
\/*\
/
}

View File

@ -1,12 +0,0 @@
# sed script for preprocessing BFD header files
# <start comment> activity:
/^\/\*$/{
N
# Delete empty comment blocks
/^\/\*\n\*\/ *$/d
# Transpose <start comment><blank line>
s/^\/\*\n *$/\
\/*/
# merge <start comment> on line by itself with following line
s/^\/\*\n\(.*\)/\/* \1/
}

View File

@ -1,10 +0,0 @@
/---------------START FROM/,/---------------END FROM/d
/\/\*:init.c\*\//r init.ip
/\/\*:libbfd.c\*\//r libbfd.ip
/\/\*:cache.c\*\//r cache.ip
/\/\*:cpu-h8300.c\*\//r cpu-h8300.ip
/\/\*:cpu-i960.c\*\//r cpu-i960.ip
/\/\*:cpu-empty.c\*\//r cpu-empty.ip
/\/\*:archures.c\*\//r archures.ip
/\/\*:reloc.c\*\//r reloc.ip
/\/\*:ctor.c\*\//r ctor.ip

View File

@ -1 +0,0 @@
/\/\*:coffcode.h\*\//r coffcode.p

View File

@ -1,18 +0,0 @@
#
# The PROTO macro is a subterfuge to be compatible with both ANSI and K&R
# declaration syntax. It's not widely known, so for the docn just map the
# thing to ANSI declaration syntax.
#
# First, join up defns broken across multiple lines in source---but leave
# any linebreaks, to prettify our examples
:pbegn
/PROTO(.*, *$/N
s/\n/?/
t pbegn
s/?/\
/g
# Now actually do the PROTO interpretation.
# A PROTO invocation looks like
# PROTO( resulttype, function, (arglist));
s/[ ]*PROTO(\(.*\),[\n ]*\(.*\),[\n ]*\((.*)\));/\1 \2\3;/

View File

@ -1,14 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# Final pass; cleanup work is done here.
#
# Within examples, make '{' and '}' printable:
/^@lisp$/,/^@end lisp$/s/{/@{/
/^@lisp$/,/^@end lisp$/s/}/@}/
/^@example$/,/^@end example$/s/{/@{/
/^@example$/,/^@end example$/s/}/@}/
#
# Delete empty @findex and @subsubsection entries (resulting from *proto*
# with no further text on same line, in middle pass)
/^@findex $/d
/^@subsubsection @code{}/d
#

View File

@ -1,4 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# Locate and coalesce adjacent @example blocks
/^@end example/N
/^@end example\n@example$/d

View File

@ -1,51 +0,0 @@
/* $Id$ */
#include <sys/types.h>
#include <sys/file.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <malloc.h>
#define USG
#ifdef __GNUC__
#define alloca __builtin_alloca
#endif
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#include <memory.h>
#define bcmp(b1,b2,len) memcmp(b1,b2,len)
#define bcopy(src,dst,len) memcpy(dst,src,len)
#define bzero(s,n) memset(s,0,n)
#include <string.h>
#define index(s,c) strchr(s,c)
#define rindex(s,c) strrchr(s,c)
/* EXACT TYPES */
typedef char int8e_type;
typedef unsigned char uint8e_type;
typedef short int16e_type;
typedef unsigned short uint16e_type;
typedef int int32e_type;
typedef unsigned int uint32e_type;
/* CORRECT SIZE OR GREATER */
typedef char int8_type;
typedef unsigned char uint8_type;
typedef short int16_type;
typedef unsigned short uint16_type;
typedef int int32_type;
typedef unsigned int uint32_type;

View File

@ -1,70 +0,0 @@
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <sys/file.h>
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
void free();
/* Some things that need to be defined in order to make code written for
BSD Unix compile under System V Unix. */
#include <memory.h>
#define bcmp(b1,b2,len) memcmp(b1,b2,len)
#define bcopy(src,dst,len) memcpy(dst,src,len)
#define bzero(s,n) memset(s,0,n)
#if 0
static int
rename(from, to)
{
unlink(to);
return(link(from, to));
}
#endif
/*
* Might not need these. Leave them out for now.
*
#include <string.h>
#define index(s,c) strchr(s,c)
#define rindex(s,c) strrchr(s,c)
#ifdef SEEK_SET
# ifndef L_SET
# define L_SET SEEK_SET
# endif
# endif
#ifdef SEEK_CUR
# ifndef L_INCR
# define L_INCR SEEK_CUR
# endif
# endif
*/
/* EXACT TYPES */
typedef char int8e_type;
typedef unsigned char uint8e_type;
typedef short int16e_type;
typedef unsigned short uint16e_type;
typedef int int32e_type;
typedef unsigned int uint32e_type;
/* CORRECT SIZE OR GREATER */
typedef char int8_type;
typedef unsigned char uint8_type;
typedef short int16_type;
typedef unsigned short uint16_type;
typedef int int32_type;
typedef unsigned int uint32_type;
#include "fopen-same.h"

View File

@ -1,85 +0,0 @@
/* bfd howto manager.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* The howto manager
When an application wants to create a relocation, but doesn't know
what the target machine might call it, it can find out by using this
bit of code.
*/
#include <sysdep.h>
#include <bfd.h>
#include "libbfd.h"
/*proto* bfd_reloc_code_enum_type
*+++
$typedef enum
${
16 bits wide, simple reloc
$ BFD_RELOC_16,
8 bits wide, but used to form an address like 0xffnn
$ BFD_RELOC_8_FFnn,
8 bits wide, simple
$ BFD_RELOC_8,
8 bits wide, pc relative
$ BFD_RELOC_8_PCREL
$ } bfd_reloc_code_enum_real_type;
*---
*/
/*proto* bfd_reloc_type_lookup
This routine returns a pointer to a howto struct which when invoked,
will perform the supplied relocation on data from the architecture
noted.
[Note] This function will go away.
*; PROTO(struct reloc_howto_struct *,
bfd_reloc_type_lookup,
(enum bfd_architecture arch, bfd_reloc_code_enum_type code));
*/
struct reloc_howto_struct *
DEFUN(bfd_reloc_type_lookup,(arch, code),
enum bfd_architecture arch AND
bfd_reloc_code_enum_type code)
{
return arch_functions(arch,0)->reloc_type_lookup(code);
}

View File

@ -1,11 +0,0 @@
/\/\*:archive.c\*\//r archive.p
/\/\*:archures.c\*\//r archures.p
/\/\*:bfd.c\*\//r bfd.p
/\/\*:core.c\*\//r core.p
/\/\*:format.c\*\//r format.p
/\/\*:libbfd.c\*\//r libbfd.p
/\/\*:opncls.c\*\//r opncls.p
/\/\*:reloc.c\*\//r reloc.p
/\/\*:section.c\*\//r section.p
/\/\*:syms.c\*\//r syms.p
/\/\*:targets.c\*\//r targets.p

View File

@ -1,334 +0,0 @@
# Makefile template for Configure for the BFD library.
# Copyright (C) 1990, 1991 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# This file is part of BFD, the Binary File Descriptor library.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id$
HDEPFILES=
TDEPFILES=
HDEFINES=-D__MSDOS__
TDEFINES=
CSWITCHES=
srcdir = .
ddestdir = /usr/local
libdir = $(ddestdir)/lib
docdir = $(srcdir)$(subdir)/doc
includedir= $(ddestdir)/include
RANLIB = ar rvs
AR = ar
AR_FLAGS = clq
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
DEP = mkdep
MINUS_G=-O
SUBDIRS = doc
#### host and target dependent Makefile fragments come in here.
# Target: Hitachi H8/300 using IEEE-695 object file format
# Avoid dragging in a lot of other architectures and formats.
TDEFAULTS=-DSELECT_ARCHITECTURES=bfd_h8300_arch -DSELECT_VECS=&ieee_vec\,&srec_vec\,&h8300coff_vec
# Change this (to MINIMIZE=1) to save space in executables.
# Currently, all this does is control the target_vector in targets.c.
MINIMIZE=0
TARGETLIB = libbfd.a
CFLAGS = $(MINUS_G) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) # -DINTEL960VERSION
BFD_LIBS = libbfd.o opncls.o bfd.o archive.o targets.o cache.o \
archures.o core.o section.o format.o syms.o reloc.o init.o ctor.o
BFD_MACHINES = cpu-h8300.o cpu-i960.o cpu-sparc.o cpu-m68k.o cpu-m88k.o \
cpu-vax.o cpu-mips.o cpu-a29k.o cpu-i386.o cpu-rs6000.o
BFD_BACKENDS = oasys.o ieee.o srec.o elf.o stab-syms.o\
aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o \
coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
coff-mips.o coff-rs6000.o coff-h8300.o
OPTIONAL_BACKENDS = trad-core.o
BFD_H=$(INCDIR)/bfd.h
# C source files that correspond to .o's.
CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
coff-i386.c aout64.c aout32.c sunos.c demo64.c coff-i960.c srec.c \
oasys.c ieee.c coff-m68k.c coff-a29k.c coff-rs6000.c \
format.c section.c core.c syms.c stabs-syms.c reloc.c init.c ctor.c \
coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c bout.c elf.c \
cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c cpu-m88k.c \
cpu-vax.c cpu-mips.c cpu-a29k.c cpu-i386.c cpu-rs6000.c coff-h8300.c
STAGESTUFF = $(TARGETLIB) $(OFILES)
all: $(TARGETLIB)
# $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)"
all-info: force
$(MAKE) subdir_do DO=all-info "DODIRS=$(SUBDIRS)"
install-info: force
$(MAKE) subdir_do DO=install-info "DODIRS=$(SUBDIRS)"
# HDEPFILES comes from the host config; TDEPFILES from the target config.
OFILES = $(BFD_LIBS) $(BFD_BACKENDS) $(BFD_MACHINES) $(HDEPFILES) $(TDEPFILES)
$(TARGETLIB): $(OFILES)
-rm -f $(TARGETLIB)
>target.rf $(AR_FLAGS) $(TARGETLIB) $(OFILES)
$(AR) @target.rf
$(RANLIB) $(TARGETLIB)
# When compiling targets.c, supply the default target info from configure.
targets.o: targets.c
>targets.rf $(CFLAGS) -c -DMINIMIZE=$(MINIMIZE) $(TDEFAULTS) targets.c
$(CC) @targets.rf
subdir_do: force
for i in $(DODIRS); do \
if [ -d $(unsubdir)/$$i ] ; then \
if (cd $(unsubdir)/$$i$(subdir); \
$(MAKE) \
"against=$(against)" \
"AR=$(AR)" \
"CC=$(CC)" \
"AR_FLAGS=$(AR_FLAGS)" \
"RANLIB=$(RANLIB)" \
"BISON=$(BISON)" $(DO)) ; then true ; \
else exit 1 ; fi ; \
else true ; fi ; \
done
stage1: force
- mkdir stage1
- mv -f $(STAGESTUFF) stage1
$(MAKE) subdir_do DO=stage1 "DODIRS=$(SUBDIRS)"
stage2: force
- mkdir stage2
- mv -f $(STAGESTUFF) stage2
$(MAKE) subdir_do DO=stage2 "DODIRS=$(SUBDIRS)"
stage3: force
- mkdir stage3
- mv -f $(STAGESTUFF) stage3
$(MAKE) subdir_do DO=stage3 "DODIRS=$(SUBDIRS)"
against=stage2
comparison: force
for i in *.o ; do cmp $$i $(against)/$$i || exit 1 ; done
$(MAKE) subdir_do DO=comparison "DODIRS=$(SUBDIRS)"
de-stage1: force
- (cd stage1 ; mv -f $(STAGESTUFF) ..)
- rmdir stage1
$(MAKE) subdir_do DO=de-stage1 "DODIRS=$(SUBDIRS)"
de-stage2: force
- (cd stage2 ; mv -f $(STAGESTUFF) ..)
- rmdir stage2
$(MAKE) subdir_do DO=de-stage2 "DODIRS=$(SUBDIRS)"
de-stage3: force
- (cd stage3 ; mv -f $(STAGESTUFF) ..)
- rmdir stage3
$(MAKE) subdir_do DO=de-stage3 "DODIRS=$(SUBDIRS)"
tags etags: TAGS
TAGS: force
etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c
clean:
rm -f *.[oa] *~ core *.E *.p *.ip
$(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS)"
clobber realclean: clean
rm -f libbfd.a TAGS
$(MAKE) subdir_do DO=clobber "DODIRS=$(SUBDIRS)"
# Mark everything as depending on config.status, since the timestamp on
# sysdep.h might actually move backwards if we reconfig and relink it
# to a different hosts/h-xxx.h file. This will force a recompile anyway.
RECONFIG = # config.status
$(BFD_LIBS): libbfd.h $(BFD_H) $(RECONFIG)
$(BFD_MACHINES): libbfd.h $(BFD_H) $(RECONFIG)
$(BFD_BACKENDS): libbfd.h $(BFD_H) $(RECONFIG)
$(OPTIONAL_BACKENDS): libbfd.h $(BFD_H) $(RECONFIG)
# Get around a Sun Make bug in SunOS 4.1.1 with VPATH
cpu-i386.o: cpu-i386.c
saber:
#suppress 65 on bfd_map_over_sections
#suppress 66 on bfd_map_over_sections
#suppress 67 on bfd_map_over_sections
#suppress 68 on bfd_map_over_sections
#suppress 69 on bfd_map_over_sections
#suppress 70 on bfd_map_over_sections
#suppress 110 in bfd_map_over_sections
#suppress 112 in bfd_map_over_sections
#suppress 530
#suppress 590 in swap_exec_header
#suppress 590 in _bfd_dummy_core_file_matches_executable_p
#suppress 590 in bfd_dont_truncate_arname
#suppress 590 on ignore
#suppress 590 on abfd
#setopt load_flags $(CFLAGS)
#load $(CFILES)
#-----------------------------------------------------------------------------
# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
#
# 'VERSION' file must be present and contain a string of the form "x.y"
#-----------------------------------------------------------------------------
ver960.c: FORCE
rm -f ver960.c
echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
# This target should be invoked before building a new release.
# 'VERSION' file must be present and contain a string of the form "x.y"
#
roll:
@V=`cat VERSION` ; \
MAJ=`sed 's/\..*//' VERSION` ; \
MIN=`sed 's/.*\.//' VERSION` ; \
V=$$MAJ.`expr $$MIN 1` ; \
rm -f VERSION ; \
echo $$V >VERSION ; \
echo Version $$V
# Dummy target to force execution of dependent targets.
#
force:
install:
cp libbfd.a $(libdir)/libbfd.a.new
$(RANLIB) $(libdir)/libbfd.a.new
mv -f $(libdir)/libbfd.a.new $(libdir)/libbfd.a
cp $(INCDIR)/bfd.h $(includedir)/bfd.h
$(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS)"
# Target to uncomment host-specific lines in this makefile. Such lines must
# have the following string beginning in column 1: #__<hostname>__#
# Original Makefile is backed up as 'Makefile.old'.
#
# Invoke with: make make HOST=xxx
#
make:
-@if test $(HOST)x = x ; then \
echo 'Specify "make make HOST=???"'; \
exit 1; \
fi ; \
grep -s "^#The next line was generated by 'make make'" Makefile; \
if test $$? = 0 ; then \
echo "Makefile has already been processed with 'make make'";\
exit 1; \
fi ; \
mv -f Makefile Makefile.old; \
echo "#The next line was generated by 'make make'" >Makefile ; \
echo "HOST=$(HOST)" >>Makefile ; \
echo >>Makefile ; \
sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) ./config.status
dep: $(CFILES)
mkdep $(CFLAGS) $?
headers:
(cd $(docdir); $(MAKE) protos)
# Rebuild prototypes in bfd.h
cp $(docdir)/bfd.h $(BFD_H)
cp $(docdir)/libbfd.h $(srcdir)/libbfd.h
cp $(docdir)/libcoff.h $(srcdir)/libcoff.h
bfd.info:
( cd $(docdir); $(MAKE) bfd.info)
bfd.dvi:
(cd $(docdir); $(MAKE) bfd.dvi)
bfd.ps:
(cd $(docdir); $(MAKE) bfd.ps)
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
libbfd.o : libbfd.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
opncls.o : opncls.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
bfd.o : bfd.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
archive.o : archive.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/ar.h $(INCDIR)/ranlib.h
targets.o : targets.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
cache.o : cache.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
archures.o : archures.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h
aout64.o : aout64.c
aout32.o : aout32.c aoutx.h $(INCDIR)/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/obstack.h libaout.h libbfd.h $(INCDIR)/aout64.h \
$(INCDIR)/stabgnu.h $(INCDIR)/stab.def $(INCDIR)/ar.h
sunos.o : sunos.c aoutf1.h $(INCDIR)/bfd.h $(INCDIR)/obstack.h \
libaout.h libbfd.h $(INCDIR)/aout64.h $(INCDIR)/stabgnu.h \
$(INCDIR)/stab.def $(INCDIR)/ar.h
demo64.o : demo64.c
srec.o : srec.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h
oasys.o : oasys.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/oasys.h liboasys.h
ieee.o : ieee.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/ieee.h libieee.h
coff-h8300.o: coff-h8300.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/coff-h8300.h $(INCDIR)/internalcoff.h libcoff.h coffcode.h
format.o : format.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h
section.o : section.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h
core.o : core.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h
syms.o : syms.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h
syms.o : stab-syms.c
reloc.o : reloc.c $(INCDIR)/bfd.h \
$(INCDIR)/obstack.h libbfd.h
trad-core.o : trad-core.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h \
libbfd.h libaout.h
newsos3.o : newsos3.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/aout64.h $(INCDIR)/stabgnu.h $(INCDIR)/stab.def \
$(INCDIR)/ar.h libaout.h
i386aout.o : i386aout.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/aout64.h $(INCDIR)/stabgnu.h $(INCDIR)/stab.def \
$(INCDIR)/ar.h libaout.h
bout.o : bout.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/bout.h $(INCDIR)/stabgnu.h $(INCDIR)/stab.def libaout.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY

View File

@ -1,5 +0,0 @@
# SED script for preprocessing embedded headers from C source comments
# Locate and coalesce adjacent comments
/\*\/$/N
s/\*\/\n\/\*/\
/

View File

@ -1,98 +0,0 @@
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
BFD 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 1, or (at your option)
any later version.
BFD 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 BFD; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
#if 0
/* xoxorich. coelesced from other binutils. */
/* This crap should all be bundled with the binutils, or else be in its
own library, but for expediency we are doing it this way right now. */
/*
* Last Mod Mon Feb 18 14:49:39 PST 1991, by rich@cygint.cygnus.com
*/
#include <stdio.h>
#include "misc.h"
#if __STDC__
extern char *realloc (char * ptr, int size);
extern char *malloc (int size);
#else
extern char *realloc ();
extern char *malloc ();
#endif
/* Print the filename of the current file on 'outfile' (a stdio stream). */
/* Current file's name */
char *input_name;
/* Current member's name, or 0 if processing a non-library file. */
char *input_member;
void print_file_name (outfile)
FILE *outfile;
{
fprintf (outfile, "%s", input_name);
if (input_member)
fprintf (outfile, "(%s)", input_member);
}
/* process one input file */
void scan_library ();
char *program_name;
/* Report a nonfatal error.
STRING is a format for printf, and ARG1 ... ARG3 are args for it. */
/*VARARGS*/
void
error (string, arg1, arg2, arg3)
char *string, *arg1, *arg2, *arg3;
{
fprintf (stderr, "%s: ", program_name);
fprintf (stderr, string, arg1, arg2, arg3);
fprintf (stderr, "\n");
}
/* Report a nonfatal error.
STRING is printed, followed by the current file name. */
void
error_with_file (string)
char *string;
{
fprintf (stderr, "%s: ", program_name);
print_file_name (stderr);
fprintf (stderr, ": ");
fprintf (stderr, string);
fprintf (stderr, "\n");
}
/* Like malloc but get fatal error if memory is exhausted. */
/* Like realloc but get fatal error if memory is exhausted. */
/* end of misc.c */
#endif

View File

@ -1,93 +0,0 @@
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
BFD 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 1, or (at your option)
any later version.
BFD 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 BFD; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
/* xoxorich. coelesced from binutils.
*
* Last Mod Mon Feb 18 14:49:51 PST 1991, by rich@cygint.cygnus.com
*/
#ifndef MISC_H
#define MISC_H 1
#include "ranlib.h"
#ifdef USG
#include <string.h>
#else
#include <strings.h>
#endif /* USG */
#ifdef never
#ifdef LOCKS
#undef LOCKS
#endif /* LOCKS */
#endif /* never */
/* used for masking system io calls into stdio. */
/* the name, ie, argv[0], of this program. */
extern char *program_name;
/* Current file's name */
extern char *input_name;
/* Current member's name, or 0 if processing a non-library file. */
extern char *input_member;
/* Report an error using the message for the last failed system call,
followed by the string NAME. */
#define perror_name(name) perror(concat(program_name, ": error on ", name))
#define pfatal_with_name(name) {perror_name(name);exit(-1);}
#ifdef __STDC__
extern char *concat(char *a, char *b, char *c);
extern void *xmalloc(unsigned int size);
extern void * xrealloc(char *ptr, int size);
extern void error(char *string, char *arg1, char *arg2, char *arg3);
extern void error_with_file(char *string);
extern void fatal(char *string, char*a1, char*a2, char*a3);
extern void print_file_name(FILE *outfile);
extern void swap_symdef_table(struct symdef *sym, int count);
#else
extern char *alloca();
extern char *concat();
extern void * xmalloc();
extern void *xrealloc();
extern void error();
extern void error_with_file();
extern void fatal();
extern void print_file_name();
extern void swap_symdef_table();
#endif /* __STDC__ */
#endif /* MISC_H */
/*
* Local Variables:
* comment-column: 0
* End:
*/
/* end of misc.h */

View File

@ -1,8 +0,0 @@
# sed script for BFD header files:
# Transpose <blank line> <end comment>
/^$/,/^ *[^ ]*.*$/{
/^$/N
/^ *\n\*\/$/c\
*\/\
}

View File

@ -1,330 +0,0 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 1, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <sysdep.h>
#include "obstack.h"
/* Determine default alignment. */
struct fooalign {char x; double d;};
#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0)
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */
union fooround {long x; double d;};
#define DEFAULT_ROUNDING (sizeof (union fooround))
/* When we copy a long block of data, this is the unit to do it with.
On some machines, copying successive ints does not work;
in such a case, redefine COPYING_UNIT to `long' (if that works)
or `char' as a last resort. */
#ifndef COPYING_UNIT
#define COPYING_UNIT int
#endif
/* The non-GNU-C macros copy the obstack into this global variable
to avoid multiple evaluation. */
struct obstack *_obstack;
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
Objects start on multiples of ALIGNMENT (0 means use default).
CHUNKFUN is the function to use to allocate chunks,
and FREEFUN the function to free them. */
void DEFUN(_obstack_begin,(h, size, alignment, chunkfun, freefun),
struct obstack *h AND
int size AND
int alignment AND
PTR (*chunkfun) () AND
void (*freefun) ())
{
register struct _obstack_chunk* chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
if (size == 0)
/* Default size is what GNU malloc can fit in a 4096-byte block. */
{
/* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
Use the values for range checking, because if range checking is off,
the extra bytes won't be missed terribly, but if range checking is on
and we used a larger request, a whole extra 4096 bytes would be
allocated.
These number are irrelevant to the new GNU malloc. I suspect it is
less sensitive to the size of the request. */
int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
+ 4 + DEFAULT_ROUNDING - 1)
& ~(DEFAULT_ROUNDING - 1));
size = 4096 - extra;
}
h->chunkfun = chunkfun;
h->freefun = freefun;
h->chunk_size = size;
h->alignment_mask = alignment - 1;
chunk = h->chunk = (struct _obstack_chunk *)(*h->chunkfun) (h->chunk_size);
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
}
/* Allocate a new current chunk for the obstack *H
on the assumption that LENGTH bytes need to be added
to the current object, or a new object of length LENGTH allocated.
Copies any partial object from the end of the old chunk
to the beginning of the new one.
The function must be "int" so it can be used in non-ANSI C
compilers in a : expression. */
int
DEFUN(_obstack_newchunk,(h, length),
struct obstack *h AND
int length)
{
register struct _obstack_chunk* old_chunk = h->chunk;
register struct _obstack_chunk* new_chunk;
register long new_size;
register int obj_size = h->next_free - h->object_base;
register int i;
int already;
/* Compute size for new chunk. */
new_size = (obj_size + length) + (obj_size >> 3) + 100;
if (new_size < h->chunk_size)
new_size = h->chunk_size;
/* Allocate and initialize the new chunk. */
new_chunk = h->chunk = (struct _obstack_chunk *)(*h->chunkfun) (new_size);
new_chunk->prev = old_chunk;
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
/* Move the existing object to the new chunk.
Word at a time is fast and is safe if the object
is sufficiently aligned. */
if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
{
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
i >= 0; i--)
((COPYING_UNIT *)new_chunk->contents)[i]
= ((COPYING_UNIT *)h->object_base)[i];
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
but that can cross a page boundary on a machine
which does not do strict alignment for COPYING_UNITS. */
already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
}
else
already = 0;
/* Copy remaining bytes one by one. */
for (i = already; i < obj_size; i++)
new_chunk->contents[i] = h->object_base[i];
h->object_base = new_chunk->contents;
h->next_free = h->object_base + obj_size;
return 0;
}
/* Return nonzero if object OBJ has been allocated from obstack H.
This is here for debugging.
If you use it in a program, you are probably losing. */
int
DEFUN(_obstack_allocated_p, (h, obj),
struct obstack *h AND
PTR obj)
{
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk* plp; /* point to previous chunk if any */
lp = (h)->chunk;
while (lp != 0 && ((PTR)lp > obj || (PTR)(lp)->limit < obj))
{
plp = lp -> prev;
lp = plp;
}
return lp != 0;
}
/* Free objects in obstack H, including OBJ and everything allocate
more recently than OBJ. If OBJ is zero, free everything in H. */
#ifdef __STDC__
#undef obstack_free
void
obstack_free (struct obstack *h, PTR obj)
#else
int
_obstack_free (h, obj)
struct obstack *h;
PTR obj;
#endif
{
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk* plp; /* point to previous chunk if any */
lp = (h)->chunk;
/* We use >= because there cannot be an object at the beginning of a chunk.
But there can be an empty object at that address
at the end of another chunk. */
while (lp != 0 && ((PTR)lp >= obj || (PTR)(lp)->limit < obj))
{
plp = lp -> prev;
(*h->freefun) ((PTR) lp);
lp = plp;
}
if (lp)
{
(h)->object_base = (h)->next_free = (char *)(obj);
(h)->chunk_limit = lp->limit;
(h)->chunk = lp;
}
else if (obj != 0)
/* obj is not in any of the chunks! */
abort ();
}
/* Let same .o link with output of gcc and other compilers. */
#ifdef __STDC__
int
_obstack_free (h, obj)
struct obstack *h;
PTR obj;
{
obstack_free (h, obj);
return 0;
}
#endif
/* #if 0 */
/* These are now turned off because the applications do not use it
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
/* Now define the functional versions of the obstack macros.
Define them to simply use the corresponding macros to do the job. */
#ifdef __STDC__
/* These function definitions do not work with non-ANSI preprocessors;
they won't pass through the macro names in parentheses. */
/* The function names appear in parentheses in order to prevent
the macro-definitions of the names from being expanded there. */
PTR (obstack_base) (obstack)
struct obstack *obstack;
{
return obstack_base (obstack);
}
PTR (obstack_next_free) (obstack)
struct obstack *obstack;
{
return obstack_next_free (obstack);
}
int (obstack_object_size) (obstack)
struct obstack *obstack;
{
return obstack_object_size (obstack);
}
int (obstack_room) (obstack)
struct obstack *obstack;
{
return obstack_room (obstack);
}
void (obstack_grow) (obstack, ptr, length)
struct obstack *obstack;
PTR ptr;
int length;
{
(void) obstack_grow (obstack, ptr, length);
}
void (obstack_grow0) (obstack, ptr, length)
struct obstack *obstack;
PTR ptr;
int length;
{
(void) obstack_grow0 (obstack, ptr, length);
}
void (obstack_1grow) (obstack, character)
struct obstack *obstack;
int character;
{
(void) obstack_1grow (obstack, character);
}
void (obstack_blank) (obstack, length)
struct obstack *obstack;
int length;
{
(void) obstack_blank (obstack, length);
}
void (obstack_1grow_fast) (obstack, character)
struct obstack *obstack;
int character;
{
obstack_1grow_fast (obstack, character);
}
void (obstack_blank_fast) (obstack, length)
struct obstack *obstack;
int length;
{
obstack_blank_fast (obstack, length);
}
PTR (obstack_finish) (obstack)
struct obstack *obstack;
{
return obstack_finish (obstack);
}
PTR (obstack_alloc) (obstack, length)
struct obstack *obstack;
int length;
{
return obstack_alloc (obstack, length);
}
PTR (obstack_copy) (obstack, ptr, length)
struct obstack *obstack;
PTR ptr;
int length;
{
return obstack_copy (obstack, ptr, length);
}
PTR (obstack_copy0) (obstack, ptr, length)
struct obstack *obstack;
PTR ptr;
int length;
{
return obstack_copy0 (obstack, ptr, length);
}
#endif /* __STDC__ */

View File

@ -1,413 +0,0 @@
/* obstack.h - object stack macros
Copyright (C) 1988 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 1, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Summary:
All the apparent functions defined here are macros. The idea
is that you would use these pre-tested macros to solve a
very specific set of problems, and they would run fast.
Caution: no side-effects in arguments please!! They may be
evaluated MANY times!!
These macros operate a stack of objects. Each object starts life
small, and may grow to maturity. (Consider building a word syllable
by syllable.) An object can move while it is growing. Once it has
been "finished" it never changes address again. So the "top of the
stack" is typically an immature growing object, while the rest of the
stack is of mature, fixed size and fixed address objects.
These routines grab large chunks of memory, using a function you
supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
by calling `obstack_chunk_free'. You must define them and declare
them before using any obstack macros.
Each independent stack is represented by a `struct obstack'.
Each of the obstack macros expects a pointer to such a structure
as the first argument.
One motivation for this package is the problem of growing char strings
in symbol tables. Unless you are "fascist pig with a read-only mind"
[Gosper's immortal quote from HAKMEM item 154, out of context] you
would not like to put any arbitrary upper limit on the length of your
symbols.
In practice this often means you will build many short symbols and a
few long symbols. At the time you are reading a symbol you don't know
how long it is. One traditional method is to read a symbol into a
buffer, realloc()ating the buffer every time you try to read a symbol
that is longer than the buffer. This is beaut, but you still will
want to copy the symbol from the buffer to a more permanent
symbol-table entry say about half the time.
With obstacks, you can work differently. Use one obstack for all symbol
names. As you read a symbol, grow the name in the obstack gradually.
When the name is complete, finalize it. Then, if the symbol exists already,
free the newly read name.
The way we do this is to take a large chunk, allocating memory from
low addresses. When you want to build a symbol in the chunk you just
add chars above the current "high water mark" in the chunk. When you
have finished adding chars, because you got to the end of the symbol,
you know how long the chars are, and you can create a new object.
Mostly the chars will not burst over the highest address of the chunk,
because you would typically expect a chunk to be (say) 100 times as
long as an average object.
In case that isn't clear, when we have enough chars to make up
the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
so we just point to it where it lies. No moving of chars is
needed and this is the second win: potentially long strings need
never be explicitly shuffled. Once an object is formed, it does not
change its address during its lifetime.
When the chars burst over a chunk boundary, we allocate a larger
chunk, and then copy the partly formed object from the end of the old
chunk to the beginning of the new larger chunk. We then carry on
accreting characters to the end of the object as we normally would.
A special macro is provided to add a single char at a time to a
growing object. This allows the use of register variables, which
break the ordinary 'growth' macro.
Summary:
We allocate large chunks.
We carve out one object at a time from the current chunk.
Once carved, an object never moves.
We are free to append data of any size to the currently
growing object.
Exactly one object is growing in an obstack at any one time.
You can run one obstack per control block.
You may have as many control blocks as you dare.
Because of the way we do it, you can `unwind' a obstack
back to a previous state. (You may remove objects much
as you would with a stack.)
*/
/* Don't do the contents of this file more than once. */
#ifndef __OBSTACKS__
#define __OBSTACKS__
/* We use subtraction of (char *)0 instead of casting to int
because on word-addressable machines a simple cast to int
may ignore the byte-within-word field of the pointer. */
#ifndef __PTR_TO_INT
#define __PTR_TO_INT(P) ((P) - (char*)0)
#endif
#ifndef __INT_TO_PTR
#define __INT_TO_PTR(P) ((P) + (char*)0)
#endif
struct _obstack_chunk /* Lives at front of each chunk. */
{
char *limit; /* 1 past end of this chunk */
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
char contents[4]; /* objects begin here */
};
struct obstack /* control current object in current chunk */
{
long chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
int temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
PTR(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
};
#ifdef __STDC__
/* Do the function-declarations after the structs
but before defining the macros. */
void obstack_init (struct obstack *obstack);
void * obstack_alloc (struct obstack *obstack, int size);
void * obstack_copy (struct obstack *obstack, void *address, int size);
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
void obstack_free (struct obstack *obstack, void *block);
void obstack_blank (struct obstack *obstack, int size);
void obstack_grow (struct obstack *obstack, void *data, int size);
void obstack_grow0 (struct obstack *obstack, void *data, int size);
void obstack_1grow (struct obstack *obstack, int data_char);
void obstack_ptr_grow (struct obstack *obstack, void *data);
void obstack_int_grow (struct obstack *obstack, int data);
void * obstack_finish (struct obstack *obstack);
int obstack_object_size (struct obstack *obstack);
int obstack_room (struct obstack *obstack);
void obstack_1grow_fast (struct obstack *obstack, int data_char);
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
void obstack_int_grow_fast (struct obstack *obstack, int data);
void obstack_blank_fast (struct obstack *obstack, int size);
void * obstack_base (struct obstack *obstack);
void * obstack_next_free (struct obstack *obstack);
int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
#endif /* __STDC__ */
/* Non-ANSI C cannot really support alternative functions for these macros,
so we do not declare them. */
/* Pointer to beginning of object being allocated or to be allocated next.
Note that this might not be the final address of the object
because a new chunk might be needed to hold the final size. */
#define obstack_base(h) ((h)->object_base)
/* Size for allocating ordinary chunks. */
#define obstack_chunk_size(h) ((h)->chunk_size)
/* Pointer to next byte not yet allocated in current chunk. */
#define obstack_next_free(h) ((h)->next_free)
/* Mask specifying low bits that should be clear in address of an object. */
#define obstack_alignment_mask(h) ((h)->alignment_mask)
#define obstack_init(h) \
_obstack_begin ((h), 0, 0, obstack_chunk_alloc, obstack_chunk_free)
#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, obstack_chunk_alloc, obstack_chunk_free)
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
#if defined (__GNUC__) && defined (__STDC__)
/* For GNU C, if not -traditional,
we can define these macros to compute all args only once
without using a global variable.
Also, we can avoid using the `temp' slot, to make faster code. */
#define obstack_object_size(OBSTACK) \
({ struct obstack *__o = (OBSTACK); \
(unsigned) (__o->next_free - __o->object_base); })
#define obstack_room(OBSTACK) \
({ struct obstack *__o = (OBSTACK); \
(unsigned) (__o->chunk_limit - __o->next_free); })
#define obstack_grow(OBSTACK,where,length) \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
((__o->next_free + __len > __o->chunk_limit) \
? _obstack_newchunk (__o, __len) : 0); \
bcopy (where, __o->next_free, __len); \
__o->next_free += __len; \
(void) 0; })
#define obstack_grow0(OBSTACK,where,length) \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
((__o->next_free + __len + 1 > __o->chunk_limit) \
? _obstack_newchunk (__o, __len + 1) : 0), \
bcopy (where, __o->next_free, __len), \
__o->next_free += __len, \
*(__o->next_free)++ = 0; \
(void) 0; })
#define obstack_1grow(OBSTACK,datum) \
({ struct obstack *__o = (OBSTACK); \
((__o->next_free + 1 > __o->chunk_limit) \
? _obstack_newchunk (__o, 1) : 0), \
*(__o->next_free)++ = (datum); \
(void) 0; })
/* These assume that the obstack alignment is good enough for pointers or ints,
and that the data added so far to the current object
shares that much alignment. */
#define obstack_ptr_grow(OBSTACK,datum) \
({ struct obstack *__o = (OBSTACK); \
((__o->next_free + sizeof (void *) > __o->chunk_limit) \
? _obstack_newchunk (__o, sizeof (void *)) : 0), \
*((void **)__o->next_free)++ = ((void *)datum); \
(void) 0; })
#define obstack_int_grow(OBSTACK,datum) \
({ struct obstack *__o = (OBSTACK); \
((__o->next_free + sizeof (int) > __o->chunk_limit) \
? _obstack_newchunk (__o, sizeof (int)) : 0), \
*((int *)__o->next_free)++ = ((int)datum); \
(void) 0; })
#define obstack_ptr_grow_fast(h,aptr) (*((void **)(h)->next_free)++ = (void *)aptr)
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
#define obstack_blank(OBSTACK,length) \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
((__o->chunk_limit - __o->next_free < __len) \
? _obstack_newchunk (__o, __len) : 0); \
__o->next_free += __len; \
(void) 0; })
#define obstack_alloc(OBSTACK,length) \
({ struct obstack *__h = (OBSTACK); \
obstack_blank (__h, (length)); \
obstack_finish (__h); })
#define obstack_copy(OBSTACK,where,length) \
({ struct obstack *__h = (OBSTACK); \
obstack_grow (__h, (where), (length)); \
obstack_finish (__h); })
#define obstack_copy0(OBSTACK,where,length) \
({ struct obstack *__h = (OBSTACK); \
obstack_grow0 (__h, (where), (length)); \
obstack_finish (__h); })
#define obstack_finish(OBSTACK) \
({ struct obstack *__o = (OBSTACK); \
void *value = (void *) __o->object_base; \
__o->next_free \
= __INT_TO_PTR ((__PTR_TO_INT (__o->next_free)+__o->alignment_mask)\
& ~ (__o->alignment_mask)); \
((__o->next_free - (char *)__o->chunk \
> __o->chunk_limit - (char *)__o->chunk) \
? (__o->next_free = __o->chunk_limit) : 0); \
__o->object_base = __o->next_free; \
value; })
#define obstack_free(OBSTACK, OBJ) \
({ struct obstack *__o = (OBSTACK); \
void *__obj = (OBJ); \
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
__o->next_free = __o->object_base = __obj; \
else (obstack_free) (__o, __obj); })
#else /* not __GNUC__ or not __STDC__ */
#define obstack_object_size(h) \
(unsigned) ((h)->next_free - (h)->object_base)
#define obstack_room(h) \
(unsigned) ((h)->chunk_limit - (h)->next_free)
#define obstack_grow(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
? _obstack_newchunk ((h), (h)->temp) : 0), \
bcopy (where, (h)->next_free, (h)->temp), \
(h)->next_free += (h)->temp)
#define obstack_grow0(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
? _obstack_newchunk ((h), (h)->temp + 1) : 0), \
bcopy (where, (h)->next_free, (h)->temp), \
(h)->next_free += (h)->temp, \
*((h)->next_free)++ = 0)
#define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? _obstack_newchunk ((h), 1) : 0), \
*((h)->next_free)++ = (datum))
#define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? _obstack_newchunk ((h), sizeof (char *)) : 0), \
*((char **)(h)->next_free)++ = ((char *)datum))
#define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? _obstack_newchunk ((h), sizeof (int)) : 0), \
*((int *)(h)->next_free)++ = ((int)datum))
#define obstack_ptr_grow_fast(h,aptr) (*((char **)(h)->next_free)++ = (char *)aptr)
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
#define obstack_blank(h,length) \
( (h)->temp = (length), \
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
? _obstack_newchunk ((h), (h)->temp) : 0), \
(h)->next_free += (h)->temp)
#define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
#define obstack_copy(h,where,length) \
(obstack_grow ((h), (where), (length)), obstack_finish ((h)))
#define obstack_copy0(h,where,length) \
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
#define obstack_finish(h) \
( (h)->temp = __PTR_TO_INT ((h)->object_base), \
(h)->next_free \
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
& ~ ((h)->alignment_mask)), \
(((h)->next_free - (char *)(h)->chunk \
> (h)->chunk_limit - (char *)(h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp))
#ifdef __STDC__
#define obstack_free(h,obj) \
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
(((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0)))
#else
#define obstack_free(h,obj) \
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
(((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (int) _obstack_free ((h), (h)->temp + (char *) (h)->chunk)))
#endif
#endif /* not __GNUC__ or not __STDC__ */
/* Declare the external functions we use; they are in obstack.c. */
#ifdef __STDC__
extern int _obstack_newchunk (struct obstack *h, int length);
extern int _obstack_free (struct obstack *h, void *obj);
extern void _obstack_begin (struct obstack *h, int size, int alignment,
void *(*chunkfun) (), void (*freefun) ());
#else
extern int _obstack_newchunk ();
extern int _obstack_free ();
extern void _obstack_begin ();
#endif
#endif /* not __OBSTACKS__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
#!/bin/sh
# Script to coordinate parsing of S. Chamberlain source-embedded
# documentation markup language.
# Four passes:
# 1) awk discards lines not intended for docn, and marks blocks of
# text with comments identifying source file;
# 2) first sed pass interprets Chamberlain markup;
# 3) second sed pass does cleanup that involves merging lines
# 4) third sed pass does remaining cleans up---making {}
# printable within examples, and eliminating empty index entries and
# headings.
#Third and second sed passes are separate because order of execution is hard
#to control otherwise, making one or another of the things involving @example
#inoperative.
base=`echo $1 | cut -d '.' -f 1`
awk -f awkscan $1 | \
sed -f sedscript | \
sed -f unPROTO | \
sed -f exmerge | \
sed -f exfilter >$base.texi

View File

@ -1,25 +0,0 @@
#!/bin/sh
# Script to coordinate parsing of S. Chamberlain source-embedded
# header-file markup language.
# '-i' option means use *proto-internal* segments, else just *proto*
SFX=p
if [ $1 = "-i" ]; then
SFX=ip
shift
fi
base=`echo $1 | cut -d '.' -f 1`
# passes:
# 1) awk discards lines not intended for header, and marks blocks of
# text with comments identifying source file;
# 2) first sed pass interprets Chamberlain markup;
# 3) further sed passes clean up---merging adjacent comments etc.
awk -f awkscan-$SFX $1 |\
sed -f sedscript-p |\
sed -f mergecom-p |\
sed -f startcom-p |\
sed -f blins-p |\
sed -f movecom-p >$base.$SFX

View File

@ -1,85 +0,0 @@
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# middle pass; most of the work is done here.
#
# First, get rid of /*doc* markers; they've done their job in the first pass.
/^\/\*doc\*/d
#
# /*proto* markers may be optionally followed by a *i-style subsubsec, findex
# entry. This will generate empty @findex and @subsubsection entries if
# the *proto* is on a line by itself; third pass removes them.
/^\/\*proto\*/s/^\/\*proto\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# /*proto-internal* is just like /*proto* from doc point of view.
/^\/\*proto-internal\*/s/^\/\*proto-internal\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# *i at beginning of line: rest of line is both a subsubsection heading
# and an entry in function index.
/^\*i/s/^\*i *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# Two alternative docn block ends, '*/' and '*-*/' on lines by themselves;
# replace by blank lines (for texinfo source readability).
/^\*\/$/c\
/^\*-\*\/$/c\
# {* and *} are standins for comment markers (originally embedded in .c
# comments)---turn into real comment markers:
s/{\*/\/\*/
s/\*}/\*\//
#
# '*+++' and '*---' span a block of text that includes both example lines
# (marked by leading '$') and explanatory text (to be italicized).
# Italicize lines lacking '$':
/\*\+\+\+/,/\*---/s/^\([^$].*\)$/@i{\1}/
#
# We don't need *+++ and *--- markers any more; kill them (trailing marker
# becomes blank line for readability)
/\*\+\+\+/d
/\*---/c\
# Any line beginning with '$' is made an example line; third pass later
# coalesces adjacent example blocks. *DO NOT* introduce extra space after
# @end example, so we can spot adjacent ones in third pass.
/^\$/i\
@example
/^\$/a\
@end example
#
# In any example line, turn '{' and '}' into '@{' and '@}'
###/^\$/s/{/@{/g
###/^\$/s/}/@}/g
#
# Now delete the '$' markers themselves:
/^\$/s/\$//
#
# *+ and *- delimit large examples to be enclosed in cartouches.
/^\*\+$/c\
@lisp\
@cartouche
/^\*-$/c\
@end cartouche\
@end lisp\
# '*;' introduces an example which may have a single line or multiple lines;
# it extends until the next semicolon (which is also printed).
# One-line case: (do this first; else second line address for multi-line case
# will include random text til we happen to end a line in a doc comment with
# a semicolon)
/^\*;.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}
# Multi-line case:
/^\*;/,/.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}

View File

@ -1,63 +0,0 @@
# SED script for preprocessing embedded headers from source
# (S. Chamberlain markup)
# middle pass; most of the work is done here.
#
# First, get rid of /*proto* markers; they've done their job in the first pass.
# (They remain comment-introducers)
/^\/\*proto\*/s/^\/\*proto\*/\/*/
/^\/\*proto-internal\*/s/^\/\*proto-internal\*/\/*/
#
# *-*/ is an alternative (older) comment-block end. Remap for uniformity:
s/^\*-\*\//\*\//
#
# {* and *} are standins for comment markers (originally embedded in .c
# comments)---turn into real comment markers:
s/{\*/\/\*/
s/\*}/\*\//
#
# '*+++' and '*---' span a block of text that includes both header lines
# (marked by leading '$') and explanatory text (to be comments).
# No need to start comment at "*+++", or end it at "*---", since we're
# already in a *proto* comment block. Just delete.
/\*\+\+\+/d
/\*---/d
#
# Any line beginning with '$' is made a line of code in the header;
# stuff in between is comments, so *precede* each '$' line with
# END-comment, *follow* each '$' line with START-comment; third pass later
# eliminates empty comment blocks.
/^\$/i\
*/
/^\$/a\
/*
#
# Now delete the '$' markers themselves:
/^\$/s/\$//
#
# *+ and *- delimit larger blocks of code, treated the same as '$' lines
/^\*\+$/c\
*/
/^\*-$/c\
/*
#
# '*;' introduces code which may have a single line or multiple lines;
# it extends until the next semicolon (which is also printed).
#
# One-line case: (do this first; else second line address for multi-line case
# will include random text til we happen to end a line in a proto comment with
# a semicolon)
/^\*;.*;$/{
s/^\*;/*\/\
/
s/;$/;\
\/*\
/
}
# Multi-line case:
/^\*;/,/.*;$/{
s/^\*;/*\/\
/
s/;$/;\
\/*\
/
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
# sed script for preprocessing BFD header files
# <start comment> activity:
/^\/\*$/{
N
# Delete empty comment blocks
/^\/\*\n\*\/ *$/d
# Transpose <start comment><blank line>
s/^\/\*\n *$/\
\/*/
# merge <start comment> on line by itself with following line
s/^\/\*\n\(.*\)/\/* \1/
}

View File

@ -1,4 +0,0 @@
/---------------START FROM/,/---------------END FROM/d
/\/\*:libbfd.c\*\//r libbfd.ip
/\/\*:cache.c\*\//r cache.ip
/\/\*:reloc.c\*\//r reloc.ip

View File

@ -1 +0,0 @@
/\/\*:coffcode.h\*\//r coffcode.p

View File

@ -1,28 +0,0 @@
/* Declarations of BFD back end for traditional Unix core files
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support. Mostly John Gilmore's fault.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ansidecl.h"
/* forward declaration */
PROTO (bfd_target *, trad_unix_core_file_p, (bfd *abfd));
PROTO (char *, trad_unix_core_file_failing_command, (bfd *abfd));
PROTO (int, trad_unix_core_file_failing_signal, (bfd *abfd));
PROTO (boolean, trad_unix_core_file_matches_executable_p,
(bfd *core_bfd, bfd *exec_bfd));

View File

@ -1,18 +0,0 @@
#
# The PROTO macro is a subterfuge to be compatible with both ANSI and K&R
# declaration syntax. It's not widely known, so for the docn just map the
# thing to ANSI declaration syntax.
#
# First, join up defns broken across multiple lines in source---but leave
# any linebreaks, to prettify our examples
:pbegn
/PROTO(.*, *$/N
s/\n/?/
t pbegn
s/?/\
/g
# Now actually do the PROTO interpretation.
# A PROTO invocation looks like
# PROTO( resulttype, function, (arglist));
s/[ ]*PROTO(\(.*\),[\n ]*\(.*\),[\n ]*\((.*)\));/\1 \2\3;/

View File

@ -1,730 +0,0 @@
\input texinfo
@setfilename binutils.info
@synindex ky cp
@c
@c This file documents the GNU binary utilities "ar", "ld", "objdump", "nm",
@c "size", "strip", and "ranlib".
@c
@c Copyright (C) 1991 Free Software Foundation, Inc.
@c
@c This text may be freely distributed under the terms of the GNU
@c General Public License.
@c
@c $Id$
@iftex
@finalout
@c @smallbook
@end iftex
@c @cropmarks
@setchapternewpage odd
@settitle GNU Binary Utilities
@titlepage
@title The GNU Binary Utilities
@subtitle Version 1.90
@sp 1
@subtitle October 1991
@author Roland H. Pesch
@author Cygnus Support
@page
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
\xdef\manvers{\$Revision$} % For use in headers, footers too
{\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par \hfill
\TeX{}info \texinfoversion\par }
@end tex
@vskip 0pt plus 1filll
Copyright @copyright{} 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end titlepage
@node Top, ar, (dir), (dir)
@chapter Introduction
@cindex version
This brief manual contains preliminary documentation for the GNU binary
utilities (collectively version 1.90):
@table @code
@item ar
Create, modify, and extract from archives
@item nm
List symbols from object files
@item objdump
Display information from object files
@item ranlib
Generate index to archive contents
@item size
List section sizes and total size
@item strip
Discard symbols
@end table
@ifinfo
Copyright @copyright{} 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
@ignore
Permission is granted to process this file through TeX and print the
results, provided the printed document carries a copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end ifinfo
@menu
* ar:: Create, modify, and extract from archives
* ld:: See ld.info
* nm:: List symbols from object files
* objdump:: Display information from object files
* ranlib:: Generate index to archive contents
* size:: List section sizes and total size
* strip:: Discard symbols
* Index::
@end menu
@node ar, ld, Top, Top
@chapter ar
@kindex ar
@cindex archives
@cindex collections of files
@smallexample
ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{files}@dots{}
@end smallexample
The GNU @code{ar} program creates, modifies, and extracts from
archives. An @dfn{archive} is a single file holding a collection of
other files in a structure that makes it possible to retrieve
the original individual files (called @dfn{members} of the archive).
The original files' contents, mode (permissions), timestamp, owner, and
group are preserved in the archive, and may be reconstituted on
extraction.
@cindex name length
GNU @code{ar} can maintain archives whose members have names of any
length; however, depending on how @code{ar} is configured on your
system, a limit on member-name length may be imposed (for compatibility
with archive formats maintained with other tools). If it exists, the
limit is often 15 characters (typical of formats related to a.out) or 16
characters (typical of formats related to coff).
@cindex libraries
@code{ar} is considered a binary utility because archives of this sort
are most often used as @dfn{libraries} holding commonly needed
subroutines.
@cindex symbol index
@code{ar} will create an index to the symbols defined in relocatable
object modules in the archive when you specify the modifier @samp{s}.
Once created, this index is updated in the archive whenever @code{ar}
makes a change to its contents (save for the @samp{q} update operation).
An archive with such an index speeds up linking to the library, and
allows routines in the library to call each other without regard to
their placement in the archive.
You may use @samp{nm -s} or @samp{nm +print-armap} to list this index
table. If an archive lacks the table, another form of @code{ar} called
@code{ranlib} can be used to add just the table.
@code{ar} insists on at least two arguments to execute: one
keyletter specifying the @emph{operation} (optionally accompanied by other
keyletters specifying @emph{modifiers}), and the archive name to act on.
Most operations can also accept further @var{files} arguments,
specifying particular files to operate on.
GNU @code{ar} allows you to mix the operation code @var{p} and modifier
flags @var{mod} in any order, within the first command-line argument.
If you wish, you may begin the first command-line argument with a
dash.
@cindex operations on archive
The @var{p} keyletter specifies what operation to execute; it may be
any of the following, but you must specify only one of them:
@table @code
@item d
@cindex deleting from archive
@emph{Delete} modules from the archive. Specify the names of modules to
be deleted as @var{files}; the archive is untouched if you
specify no files to delete.
If you specify the @samp{v} modifier, @code{ar} will list each module
as it is deleted.
@item m
@cindex moving in archive
Use this operation to @emph{move} members in an archive.
The ordering of members in an archive can make a difference in how
programs are linked using the library, if a symbol is defined in more
than one member.
If no modifiers are used with @code{m}, any members you name in the
@var{files} arguments are moved to the @emph{end} of the archive;
you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
specified place instead.
@item p
@cindex printing from archive
@emph{Print} the specified members of the archive, to the standard
output file. If the @samp{v} modifier is specified, show the member
name before copying its contents to standard output.
If you specify no @var{files}, all the files in the archive are printed.
@item q
@cindex quick append to archive
@emph{Quick append}; add @var{files} to the end of @var{archive},
without checking for replacement.
The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
operation; new members are always placed at the end of the archive.
The modifier @samp{v} makes @code{ar} list each file as it is appended.
Since the point of this operation is speed, the archive's symbol table
index is not updated, even if it already existed; you can use @samp{ar s} or
@code{ranlib} explicitly to update the symbol table index.
@item r
@cindex replacement in archive
Insert @var{files} into @var{archive} (with @emph{replacement}). This
operation differs from @samp{q} in that any previously existing members
are deleted if their names match those being added.
If one of the files named in @var{files} doesn't exist, @code{ar}
displays an error message, and leaves undisturbed any existing members
of the archive matching that name.
By default, new members are added at the end of the file; but you may
use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
placement relative to some existing member.
The modifier @samp{v} used with this operation elicits a line of
output for each file inserted, along with one of the letters @samp{a} or
@samp{r} to indicate whether the file was appended (no old member
deleted) or replaced.
@item t
@cindex contents of archive
Display a @emph{table} listing the contents of @var{archive}, or those
of the files listed in @var{files} that are present in the
archive. Normally only the member name is shown; if you also want to
see the modes (permissions), timestamp, owner, group, and size, you can
request that by also specifying the @samp{v} modifier.
If you do not specify any @var{files}, all files in the archive
are listed.
@cindex repeated names in archive
@cindex name duplication in archive
If there is more than one file with the same name (say, @samp{fie}) in
an archive (say @samp{b.a}), @samp{ar t b.a fie} will list only the
first instance; to see them all, you must ask for a complete
listing---in our example, @samp{ar t b.a}.
@c WRS only; per Gumby, this is implementation-dependent, and in a more
@c recent case in fact works the other way.
@item x
@cindex extract from archive
@emph{Extract} members (named @var{files}) from the archive. You can
use the @samp{v} modifier with this operation, to request that
@code{ar} list each name as it extracts it.
If you do not specify any @var{files}, all files in the archive
are extracted.
@end table
A number of modifiers (@var{mod}) may immediately follow the @var{p}
keyletter, to specify variations on an operation's behavior:
@table @code
@item a
@cindex relative placement in archive
Add new files @emph{after} an existing member of the
archive. If you use the modifier @code{a}, the name of an existing archive
member must be present as the @var{membername} argument, before the
@var{archive} specification.
@item b
Add new files @emph{before} an existing member of the
archive. If you use the modifier @code{b}, the name of an existing archive
member must be present as the @var{membername} argument, before the
@var{archive} specification. (same as @samp{i}).
@item c
@cindex creating archives
@emph{Create} the archive. The specified @var{archive} is always
created if it didn't exist, when you request an update. But a warning is
issued unless you specify in advance that you expect to create it, by
using this modifier.
@item i
Insert new files @emph{before} an existing member of the
archive. If you use the modifier @code{i}, the name of an existing archive
member must be present as the @var{membername} argument, before the
@var{archive} specification. (same as @samp{b}).
@item l
This modifier is accepted but not used.
@c whaffor ar l modifier??? presumably compat; with
@c what???---pesch@@cygnus.com, 25jan91
@item o
@cindex dates in archive
Preserve the @emph{original} dates of members when extracting them. If
you do not specify this modifier, files extracted from the archive
will be stamped with the time of extraction.
@item s
@cindex writing archive index
Write an object-file index into the archive, or update an existing one,
even if no other change is made to the archive. You may use this modifier
flag either with any operation, or alone. Running @samp{ar s} on an
archive is equivalent to running @samp{ranlib} on it.
@item u
@cindex updating an archive
Normally, @code{ar r}@dots{} inserts all files
listed into the archive. If you would like to insert @emph{only} those
of the files you list that are newer than existing members of the same
names, use this modifier. The @samp{u} modifier is allowed only for the
operation @samp{r} (replace). In particular, the combination @samp{qu} is
not allowed, since checking the timestamps would lose any speed
advantage from the operation @samp{q}.
@item v
This modifier requests the @emph{verbose} version of an operation. Many
operations display additional information, such as filenames processed,
when the modifier @samp{v} is appended.
@end table
@node ld, nm, ar, Top
@chapter ld
@cindex linker
@kindex ld
The GNU linker @code{ld} is now described in a separate manual.
@xref{Top,, Overview,, GLD: the GNU linker}.
@node nm, objdump, ld, Top
@chapter nm
@cindex symbols
@kindex nm
@smallexample
nm [ -a | +debug-syms ] [ -g | +extern-only ]
[ -s | +print-armap ] [ -o | +print-file-name ]
[ -n | +numeric-sort ] [ -p | +no-sort ]
[ -r | +reverse-sort ] [ -u | +undefined-only ]
[ +target @var{bfdname} ]
[ @var{objfiles}@dots{} ]
@end smallexample
GNU @code{nm} will list the symbols from object files @var{objfiles}.
The long and short forms of options, shown here as alternatives, are
equivalent.
@table @code
@item @var{objfiles}@dots{}
@kindex a.out
Object files whose symbols are to be listed. If no object files are
listed as arguments, @code{nm} assumes @samp{a.out}.
@item -a
@itemx +debug-syms
@cindex debugging symbols
Display debugger-only symbols; normally these are not listed.
@item -g
@itemx +extern-only
@cindex external symbols
Display only external symbols.
@item -p
@itemx +no-sort
@cindex sorting symbols
Don't bother to sort the symbols in any order; just print them in the
order encountered.
@item -n
@itemx +numeric-sort
Sort symbols numerically by their addresses, not alphabetically by their
names.
@item -s
@itemx +print-armap
@cindex symbol index, listing
When listing symbols from archive members, include the index: a mapping
(stored in the archive by @code{ar} or @code{ranlib}) of what modules
contain definitions for what names.
@item -o
@itemx +print-file-name
@cindex input file name
@cindex file name
@cindex source file name
Precede each symbol by the name of the input file where it was found,
rather than identifying the input file once only before all of its
symbols.
@item -r
@itemx +reverse-sort
Reverse the sense of the sort (whether numeric or alphabetic); let the
last come first.
@item +target @var{bfdname}
@c @item +target
@cindex object code format
Specify an object code format other than your system's default format.
@xref{objdump}, for information on listing available formats.
@c FIXME what *does* +target/no arg do?
@item -u
@itemx +undefined-only
@cindex external symbols
@cindex undefined symbols
Display only undefined symbols (those external to each object file).
@end table
@node objdump, ranlib, nm, Top
@chapter objdump
@cindex object file information
@kindex objdump
@smallexample
objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
[ -h | +header ] [ -i ] [ -j @var{section} ] [ -l ]
[ -m @var{machine} ] [ -r | +reloc ] [ -s ]
[ -t | +syms ] [ -x ]
@var{objfiles}@dots{}
@end smallexample
@code{objdump} displays information about one or more object files.
The options control what particular information to display. This
information is mostly useful to programmers who are working on the
compilation tools, as opposed to programmers who just want their
program to compile and work.
The long and short forms of options, shown here as alternatives, are
equivalent.
@table @code
@item @var{objfiles}@dots{}
The object files to be examined. When you specify archives,
@code{objdump} shows information on each of the member object files.
@item -a
@c print_arelt_descr
@cindex archive headers
If any files from @var{objfiles} are archives, display the archive
header information (in a format similar to @samp{ls -l}). Besides the
information you could list with @samp{ar tv}, @samp{objdump -a} shows
the object file format of each archive member.
@c suggest longname +target or +format or +bfd
@item -b @var{bfdname}
@cindex object code format
You can specify a particular object-code format for your object files as
@var{bfdname}. This may not be necessary; @var{objdump} can
automatically recognize many formats. For example,
@example
objdump -b oasys -m vax -h fu.o
@end example
@noindent
Displays summary information from the section headers (@samp{-h}) of
@file{fu.o}, which is explicitly identified (@samp{-m}) as a Vax object
file in the format produced by Oasys compilers. You can list the
formats available with the @samp{-i} option.
@item -d
@cindex disassembling object code
@cindex machine instructions
Disassemble. Display the assembler mnemonics for the machine
instructions from @var{objfiles}.
@item -f
@cindex object file header
File header. Display summary information from the overall header of
each file in @var{objfiles}.
@item -h
@itemx +header
@cindex section headers
Header. Display summary information from the section headers of the
object file.
@item -i
@cindex architectures available
@cindex object formats available
Display a list showing all architectures and object formats available
for specification with @code{-b} or @code{-m}.
@c suggest longname +section
@item -j @var{name}
@cindex section information
Display information only for section @var{name}
@c suggest longname +label or +linespec
@item -l
@cindex source filenames for object files
Label the display (using debugging information) with the source filename
and line numbers corresponding to the object code shown.
@c suggest longname +architecture
@item -m @var{machine}
@cindex architecture
Specify the object files @var{objfiles} are for architecture
@var{machine}. You can list available architectures using the @samp{-i}
option.
@item -r
@itemx +reloc
@cindex relocation entries, in object file
Relocation. Print the relocation entries of the file.
@item -s
@cindex sections, full contents
@cindex object file sections
Display the full contents of any sections requested.
@item -t
@itemx +syms
@cindex symbol table entries, printing
Symbol Table. Print the symbol table entries of the file.
This is similar to the information provided by the @samp{nm} program.
@item -x
@cindex all header information, object file
@cindex header information, all
Display all available header information, including the symbol table and
relocation entries. Using @samp{-x} is equivalent to specifying all of
@samp{-a -f -h -r -t}.
@end table
@node ranlib, size, objdump, Top
@chapter ranlib
@kindex ranlib
@cindex archive contents
@cindex symbol index
@smallexample
ranlib @var{archive}
@end smallexample
@code{ranlib} generates an index to the contents of an archive, and
stores it in the archive. The index lists each symbol defined by a
member of an archive that is a relocatable object file.
You may use @samp{nm -s} or @samp{nm +print-armap} to list this index.
An archive with such an index speeds up linking to the library, and
allows routines in the library to call each other without regard to
their placement in the archive.
The GNU @code{ranlib} program is another form of GNU @code{ar}; running
@code{ranlib} is completely equivalent to executing @samp{ar -s}.
@xref{ar}.
@node size, strip, ranlib, Top
@chapter size
@kindex size
@cindex section sizes
@smallexample
size [ -A | -B | +format @var{compatibility} ]
[ +help ] [ -d | -o | -x | +radix @var{number} ]
[ +target @var{bfdname} ] [ -V | +version ]
@var{objfiles}@dots{}
@end smallexample
The GNU @code{size} utility lists the section sizes---and the total
size---for each of the object files @var{objfiles} in its argument list.
By default, one line of output is generated for each object file or each
module in an archive.
The command line options have the following meanings:
@table @code
@item @var{objfiles}@dots{}
The object files to be examined.
@item -A
@itemx -B
@itemx +format @var{compatibility}
@cindex size display format
Using one of these options, you can choose whether the output from GNU
@code{size} resembles output from System V @code{size} (using @samp{-A},
or @samp{+format sysv}), or Berkeley @code{size} (using @samp{-B}, or
@samp{+format berkeley}). The default is the one-line format similar to
Berkeley's.
@c Bonus for doc-source readers: you can also say +format=strange (or
@c anything else that starts with 's') for sysv, and +format=boring (or
@c anything else that starts with 'b') for Berkeley.
Here is an example of the Berkeley (default) format of output from
@code{size}:
@smallexample
eg$ size +format Berkeley ranlib size
text data bss dec hex filename
294880 81920 11592 388392 5ed28 ranlib
294880 81920 11888 388688 5ee50 size
@end smallexample
@noindent
This is the same data, but displayed closer to System V conventions:
@smallexample
eg$ size +format SysV ranlib size
ranlib :
section size addr
.text 294880 8192
.data 81920 303104
.bss 11592 385024
Total 388392
size :
section size addr
.text 294880 8192
.data 81920 303104
.bss 11888 385024
Total 388688
@end smallexample
@item +help
Show a summary of acceptable arguments and options.
@item -d
@itemx -o
@itemx -x
@itemx +radix @var{number}
@cindex size number format
@cindex radix for section sizes
Using one of these options, you can control whether the size of each
section is given in decimal (@samp{-d}, or @samp{+radix 10}); octal
(@samp{-o}, or @samp{+radix 8}); or hexadecimal (@samp{-x}, or
@samp{+radix 16}). In @samp{+radix @var{number}}, only the three
values (8, 10, 16) are supported. The total size is always given in two
radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
octal and hexadecimal if you're using @samp{-o}.
@item +target @var{bfdname}
@cindex object code format
You can specify a particular object-code format for @var{objfiles} as
@var{bfdname}. This may not be necessary; @var{size} can
automatically recognize many formats. @xref{objdump}, for information
on listing available formats.
@item -V
@itemx +version
Display version number information on @code{size} itself.
@end table
@node strip, Index, size, Top
@chapter strip
@kindex strip
@cindex removing symbols
@cindex discarding symbols
@smallexample
strip [ -s | +strip-all ] [ -g | -S | +strip-debug ]
[ -x | +discard-all ] [ -X | +discard-locals ]
[ -T @var{bfdname} ]
@var{objfiles}@dots{}
@end smallexample
GNU @code{strip} will discard all symbols from object files
@var{objfiles}, if no options are specified; or only certain symbols,
depending on its command-line options.
@code{strip} will not execute unless at least one object file is listed.
@quotation
@emph{WARNING:} @code{strip} modifies the files named in its argument,
rather than writing modified copies under different names.
@end quotation
The long and short forms of options, shown here as alternatives, are
equivalent.
@table @code
@item -s
@itemx +strip-all
@cindex all symbols, discarding
This is the default case: strip all symbol entries from @var{objfiles}.
@item -g
@itemx -S
@itemx +strip-debug
@cindex debugging symbols, discarding
Discard only debugging symbol information from @var{objfiles}.
@item -x
@itemx +discard-all
@cindex local symbols, discarding
Discard all symbols local to each file in @var{objfiles}.
@emph{WARNING:} Note that @code{+discard-all} discards only @emph{local}
symbols, in spite of its name.
@item -X
@itemx +discard-locals
Discard local symbols starting with @samp{L} from each file in
@var{objfiles}. (Some compilers produce internally-used symbols that
begin with @samp{L}.)
@item -T @var{bfdname}
@cindex object code format
You can specify a particular object-code format @var{bfdname} for
@var{objfiles}. This may not be necessary; @var{strip} can automatically
recognize many formats. @xref{objdump}, for information on listing
available formats.
@end table
@node Index, , strip, Top
@unnumbered Index
@printindex cp
@contents
@bye

446
binutils/config.sub vendored
View File

@ -1,446 +0,0 @@
#!/bin/sh
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration (e.g. a typo).
# Please email any bugs, comments, and/or additions to this file to:
# configure@cygnus.com
# decode aliases into canonical names
case "$1" in
# cpu alone is a valid alias for cpu-none-none.
vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
| alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
| romp | rs6000 | i960 | h8300)
cpu=$1
vendor=none
os=none
;;
altos | altos3068)
cpu=m68k
vendor=altos
os=sysv # maybe?
;;
altosgas)
cpu=m68k
vendor=altos
os=gas
;;
am29k)
cpu=a29k
vendor=none
os=bsd
;;
amdahl)
cpu=580
vendor=amdahl
os=uts
;;
amigados)
cpu=m68k
vendor=cbm
os=amigados # Native AmigaDOS
;;
amigaunix | amix)
cpu=m68k
vendor=cbm
os=svr4 # System V Release 4 (svr4 is an industry recognized acronym)
;;
apollo68)
cpu=m68k
vendor=apollo
os=sysv # maybe?
;;
balance)
cpu=ns32k
vendor=sequent
os=dynix
;;
convex-c1)
cpu=c1
vendor=convex
os=sysv # maybe?
;;
convex-c2)
cpu=c2
vendor=convex
os=sysv # maybe?
;;
cray | ymp)
cpu=ymp
vendor=cray
os=unicos
;;
cray2)
cpu=cray2
vendor=cray
os=unicos
;;
dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin)
cpu=mips
vendor=dec
os=ultrix
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
cpu=m68k
vendor=motorola
os=sysv # maybe?
;;
delta88)
cpu=m88k
vendor=motorola
os=m88kbcs
;;
gmicro)
cpu=tron
vendor=gmicro
os=sysv # maybe?
;;
h8300hds)
cpu=h8300
vendor=hitachi
os=hds
;;
# start-sanitize-v9
hal-32 | hal32)
cpu=sparc64
vendor=hal
os=hal32
;;
hal-64 | hal64)
cpu=sparc64
vendor=hal
os=hal64
;;
sparc64)
cpu=sparc64
vendor=sun
os=v9
;;
sparc64-v7 | sparc64v7)
cpu=sparc64
vendor=sun
os=v7
;;
# end-sanitize-v9
hp300bsd)
cpu=m68k
vendor=hp
os=bsd
;;
hp300hpux | hpux | hp9k3[2-9][0-9])
cpu=m68k
vendor=hp
os=hpux
;;
hp9k31[0-9] | hp9k2[0-9][0-9])
cpu=m68000
vendor=hp
os=hpux
;;
i386sco)
cpu=i386
vendor=sco
os=sysv # maybe?
;;
i386v)
cpu=i386
vendor=none
os=sysv
;;
i386v32)
cpu=i386
vendor=none
os=sysv32
;;
iris | iris4d)
cpu=mips
vendor=sgi
os=irix # maybe?
;;
dpx2)
vendor=bull
cpu=m68k
os=sysv
;;
isi | isi68)
cpu=m68k
vendor=isi
os=sysv # maybe?
;;
littlemips)
cpu=mips
vendor=little
os=bsd
;;
magnum | m3230)
cpu=mips
vendor=mips
os=sysv # maybe?
;;
merlin)
cpu=ns32k
vendor=utek
os=sysv # maybe?
;;
miniframe)
cpu=m68000
vendor=convergent
os=sysv # maybe?
;;
mmax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
news | news700 | news800 | news900)
cpu=m68k
vendor=sony
os=newsos3 # Based on bsd-4.3
;;
news1000)
cpu=m68030
vendor=sony
os=newsos3 # ?
;;
news-3600 | bigmips | risc-news)
cpu=mips
vendor=sony
os=newsos4 # Presumably?
;;
next)
cpu=m68k
vendor=next
os=sysv # maybe?
;;
nindy960)
cpu=i960
vendor=intel
os=nindy
;;
none)
cpu=none
vendor=none
os=none
;;
np1)
cpu=np1
vendor=gould
os=sysv # maybe?
;;
rtpc)
cpu=romp
vendor=ibm
os=aix # maybe?
;;
pbd)
cpu=sparc
vendor=unicom
os=sysv
;;
pn)
cpu=pn
vendor=gould
os=sysv # maybe?
;;
ps2)
cpu=i386
vendor=ibm
os=sysv # maybe?
;;
sun2)
cpu=m68000
vendor=sun
os=sunos4
;;
sun2os3)
cpu=m68000
vendor=sun
os=sunos3
;;
sun2os4)
cpu=m68000
vendor=sun
os=sunos4
;;
sun3)
cpu=m68k
vendor=sun
os=sunos4
;;
sun3os3)
cpu=m68k
vendor=sun
os=sunos3
;;
sun3os4)
cpu=m68k
vendor=sun
os=sunos4
;;
sun386 | roadrunner | sun386i)
cpu=i386
vendor=sun
os=sunos
;;
sun4)
cpu=sparc
vendor=sun
os=sunos4
;;
sun4os3)
cpu=sparc
vendor=sun
os=sunos3
;;
sun4os4)
cpu=sparc
vendor=sun
os=sunos4
;;
symmetry)
cpu=i386
vendor=sequent
os=dynix
;;
tower | tower-32)
cpu=m68k
vendor=ncr
os=sysv # maybe?
;;
ultra3)
cpu=a29k
vendor=nyu
os=sym1
;;
umax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
cpu=m68k
vendor=att
os=sysv # maybe?
;;
vax-dec)
cpu=vax
vendor=dec
os=ultrix # maybe?
;;
vxworks68)
cpu=m68k
vendor=wrs
os=vxworks
;;
vxworks960)
cpu=i960
vendor=wrs
os=vxworks
;;
xmp)
cpu=xmp
vendor=cray
os=unicos
;;
# not an alias. parse what we expect to be a canonical name.
*)
cpu=`echo $1 | sed 's/-.*$//'`
if [ "${cpu}" = "$1" ] ; then
# no vendor so this is an invalid name.
echo '***' No vendor: configuration \`$1\' not recognized 1>&2
exit 1
else
# parse out vendor
rest=`echo $1 | sed "s/${cpu}-//"`
vendor=`echo ${rest} | sed 's/-.*$//'`
if [ "${vendor}" = "${rest}" ] ; then
# a missing os is acceptable
os=none
else
os=`echo ${rest} | sed "s/${vendor}-//"`
fi
fi
;;
esac
# At this point we should have three parts of a canonical name in cpu,
# vendor, and os.
# verify that the cpu is known.
case "${cpu}" in
none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \
| ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \
| a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300)
;;
# start-sanitize-v9
sparc64) ;;
# end-sanitize-v9
*)
echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the vendor is known.
case "${vendor}" in
altos | amdahl | aout | apollo | att | bcs | bout |\
cbm | convergent | convex | coff | cray | dec | encore |\
gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\
ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\
unicom | utek | wrs | bull ) ;;
# start-sanitize-v9
hal) ;;
# end-sanitize-v9
*)
echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the os is known, if it exists.
case "${os}" in
aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \
| hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \
| osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \
| vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \
| amigados)
;;
# start-sanitize-v9
hal32 | hal64 | v7 | v9) ;;
# end-sanitize-v9
*)
echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
echo ${cpu}-${vendor}-${os}

View File

@ -1,6 +0,0 @@
@echo off
@echo Configuring binutils for H8/300, hosted on MS-DOS
copy ..\bfd\hosts\h-go32.h sysdep.h
copy makefile.dos makefile

View File

@ -1,934 +0,0 @@
/* Demangler for GNU C++
Copyright (C) 1989 Free Software Foundation, Inc.
written by James Clark (jjc@jclark.uucp)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This is for g++ 1.36.1 (November 6 version). It will probably
require changes for any other version.
Modified for g++ 1.36.2 (November 18 version). */
/* This file exports one function
char *cplus_demangle (const char *name)
If `name' is a mangled function name produced by g++, then
a pointer to a malloced string giving a C++ representation
of the name will be returned; otherwise NULL will be returned.
It is the caller's responsibility to free the string which
is returned.
For example,
cplus_demangle ("_foo__1Ai")
returns
"A::foo(int)"
This file imports xmalloc and xrealloc, which are like malloc and
realloc except that they generate a fatal error if there is no
available memory. */
#if 0 /* Should really be part of BFD */
#define nounderscore 1 /* define this is names don't start with _ */
#endif
#include "bfd.h"
#include "sysdep.h"
#include <ctype.h>
#ifndef __STDC__
#define const
#endif
#ifdef __STDC__
extern char *cplus_demangle (const char *type);
#else
extern char *cplus_demangle ();
#endif
static char **typevec = 0;
static int ntypes = 0;
static int typevec_size = 0;
static struct {
const char *in;
const char *out;
} optable[] = {
"new", " new",
"delete", " delete",
"ne", "!=",
"eq", "==",
"ge", ">=",
"gt", ">",
"le", "<=",
"lt", "<",
"plus", "+",
"minus", "-",
"mult", "*",
"convert", "+", /* unary + */
"negate", "-", /* unary - */
"trunc_mod", "%",
"trunc_div", "/",
"truth_andif", "&&",
"truth_orif", "||",
"truth_not", "!",
"postincrement", "++",
"postdecrement", "--",
"bit_ior", "|",
"bit_xor", "^",
"bit_and", "&",
"bit_not", "~",
"call", "()",
"cond", "?:",
"alshift", "<<",
"arshift", ">>",
"component", "->",
"indirect", "*",
"method_call", "->()",
"addr", "&", /* unary & */
"array", "[]",
"nop", "", /* for operator= */
};
/* Beware: these aren't '\0' terminated. */
typedef struct {
char *b; /* pointer to start of string */
char *p; /* pointer after last character */
char *e; /* pointer after end of allocated space */
} string;
#ifdef __STDC__
static void string_need (string *s, int n);
static void string_delete (string *s);
static void string_init (string *s);
static void string_clear (string *s);
static int string_empty (string *s);
static void string_append (string *p, const char *s);
static void string_appends (string *p, string *s);
static void string_appendn (string *p, const char *s, int n);
static void string_prepend (string *p, const char *s);
#if 0
static void string_prepends (string *p, string *s);
#endif
static void string_prependn (string *p, const char *s, int n);
static int get_count (const char **type, int *count);
static int do_args (const char **type, string *decl);
static int do_type (const char **type, string *result);
static int do_arg (const char **type, string *result);
static int do_args (const char **type, string *decl);
static void munge_function_name (string *name);
#else
static void string_need ();
static void string_delete ();
static void string_init ();
static void string_clear ();
static int string_empty ();
static void string_append ();
static void string_appends ();
static void string_appendn ();
static void string_prepend ();
static void string_prepends ();
static void string_prependn ();
static int get_count ();
static int do_args ();
static int do_type ();
static int do_arg ();
static int do_args ();
static void munge_function_name ();
#endif
char *
cplus_demangle (type)
const char *type;
{
string decl;
int n;
int success = 0;
int constructor = 0;
int const_flag = 0;
int i;
const char *p, *premangle;
if (type == NULL || *type == '\0')
return NULL;
#ifndef nounderscore
if (*type++ != '_')
return NULL;
#endif
p = type;
while (*p != '\0' && !(*p == '_' && p[1] == '_'))
p++;
if (*p == '\0')
{
/* destructor */
if (type[0] == '_' && type[1] == '$' && type[2] == '_')
{
unsigned int l = (strlen (type) - 3)*2 + 3 + 2 + 1;
char *tem = (char *) xmalloc (l);
strcpy (tem, type + 3);
strcat (tem, "::~");
strcat (tem, type + 3);
strcat (tem, "()");
return tem;
}
/* static data member */
if (*type != '_' && (p = (char *) strchr (type, '$')) != NULL)
{
int n = strlen (type) + 2;
char *tem = (char *) xmalloc (n);
memcpy (tem, type, p - type);
strcpy (tem + (p - type), "::");
strcpy (tem + (p - type) + 2, p + 1);
return tem;
}
/* virtual table */
if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == '$')
{
int n = strlen (type + 4) + 14 + 1;
char *tem = (char *) xmalloc (n);
strcpy (tem, type + 4);
strcat (tem, " virtual table");
return tem;
}
return NULL;
}
string_init (&decl);
if (p == type)
{
if (!isdigit (p[2]))
{
string_delete (&decl);
return NULL;
}
constructor = 1;
}
else
{
string_appendn (&decl, type, p - type);
munge_function_name (&decl);
}
p += 2;
premangle = p;
switch (*p)
{
case 'C':
/* a const member function */
if (!isdigit (p[1]))
{
string_delete (&decl);
return NULL;
}
p += 1;
const_flag = 1;
/* fall through */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = 0;
do
{
n *= 10;
n += *p - '0';
p += 1;
}
while (isdigit (*p));
if (strlen (p) < n)
{
string_delete (&decl);
return NULL;
}
if (constructor)
{
string_appendn (&decl, p, n);
string_append (&decl, "::");
string_appendn (&decl, p, n);
}
else
{
string_prepend (&decl, "::");
string_prependn (&decl, p, n);
}
#ifndef LONGERNAMES
p = premangle;
#else
p += n;
#endif
success = do_args (&p, &decl);
if (const_flag)
string_append (&decl, " const");
break;
case 'F':
p += 1;
success = do_args (&p, &decl);
break;
}
for (i = 0; i < ntypes; i++)
if (typevec[i] != NULL)
free (typevec[i]);
ntypes = 0;
if (typevec != NULL)
{
free ((char *)typevec);
typevec = NULL;
typevec_size = 0;
}
if (success)
{
string_appendn (&decl, "", 1);
return decl.b;
}
else
{
string_delete (&decl);
return NULL;
}
}
static int
get_count (type, count)
const char **type;
int *count;
{
if (!isdigit (**type))
return 0;
*count = **type - '0';
*type += 1;
/* see flush_repeats in cplus-method.c */
if (isdigit (**type))
{
const char *p = *type;
int n = *count;
do
{
n *= 10;
n += *p - '0';
p += 1;
}
while (isdigit (*p));
if (*p == '_')
{
*type = p + 1;
*count = n;
}
}
return 1;
}
/* result will be initialised here; it will be freed on failure */
static int
do_type (type, result)
const char **type;
string *result;
{
int n;
int done;
int non_empty = 0;
int success;
string decl;
const char *remembered_type;
string_init (&decl);
string_init (result);
done = 0;
success = 1;
while (success && !done)
{
int member;
switch (**type)
{
case 'P':
*type += 1;
string_prepend (&decl, "*");
break;
case 'R':
*type += 1;
string_prepend (&decl, "&");
break;
case 'T':
*type += 1;
if (!get_count (type, &n) || n >= ntypes)
success = 0;
else
{
remembered_type = typevec[n];
type = &remembered_type;
}
break;
case 'F':
*type += 1;
if (!string_empty (&decl) && decl.b[0] == '*')
{
string_prepend (&decl, "(");
string_append (&decl, ")");
}
if (!do_args (type, &decl) || **type != '_')
success = 0;
else
*type += 1;
break;
case 'M':
case 'O':
{
int constp = 0;
int volatilep = 0;
member = **type == 'M';
*type += 1;
if (!isdigit (**type))
{
success = 0;
break;
}
n = 0;
do
{
n *= 10;
n += **type - '0';
*type += 1;
}
while (isdigit (**type));
if (strlen (*type) < n)
{
success = 0;
break;
}
string_append (&decl, ")");
string_prepend (&decl, "::");
string_prependn (&decl, *type, n);
string_prepend (&decl, "(");
*type += n;
if (member)
{
if (**type == 'C')
{
*type += 1;
constp = 1;
}
if (**type == 'V')
{
*type += 1;
volatilep = 1;
}
if (*(*type)++ != 'F')
{
success = 0;
break;
}
}
if ((member && !do_args (type, &decl)) || **type != '_')
{
success = 0;
break;
}
*type += 1;
if (constp)
{
if (non_empty)
string_append (&decl, " ");
else
non_empty = 1;
string_append (&decl, "const");
}
if (volatilep)
{
if (non_empty)
string_append (&decl, " ");
else
non_empty = 1;
string_append (&decl, "volatilep");
}
break;
}
case 'C':
if ((*type)[1] == 'P')
{
*type += 1;
if (!string_empty (&decl))
string_prepend (&decl, " ");
string_prepend (&decl, "const");
break;
}
/* fall through */
default:
done = 1;
break;
}
}
done = 0;
non_empty = 0;
while (success && !done)
{
switch (**type)
{
case 'C':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "const");
break;
case 'U':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "unsigned");
break;
case 'V':
*type += 1;
if (non_empty)
string_append (result, " ");
else
non_empty = 1;
string_append (result, "volatile");
break;
default:
done = 1;
break;
}
}
if (success)
switch (**type)
{
case '\0':
case '_':
break;
case 'v':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "void");
break;
case 'l':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "long");
break;
case 'i':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "int");
break;
case 's':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "short");
break;
case 'c':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "char");
break;
case 'r':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "long double");
break;
case 'd':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "double");
break;
case 'f':
*type += 1;
if (non_empty)
string_append (result, " ");
string_append (result, "float");
break;
case 'G':
*type += 1;
if (!isdigit (**type))
{
success = 0;
break;
}
/* fall through */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = 0;
do
{
n *= 10;
n += **type - '0';
*type += 1;
}
while (isdigit (**type));
if (strlen (*type) < n)
{
success = 0;
break;
}
if (non_empty)
string_append (result, " ");
string_appendn (result, *type, n);
*type += n;
break;
default:
success = 0;
break;
}
if (success)
{
if (!string_empty (&decl))
{
string_append (result, " ");
string_appends (result, &decl);
}
string_delete (&decl);
return 1;
}
else
{
string_delete (&decl);
string_delete (result);
return 0;
}
}
/* `result' will be initialised in do_type; it will be freed on failure */
static int
do_arg (type, result)
const char **type;
string *result;
{
char *tem;
int len;
const char *start;
const char *end;
start = *type;
if (!do_type (type, result))
return 0;
end = *type;
if (ntypes >= typevec_size)
{
if (typevec_size == 0)
{
typevec_size = 3;
typevec = (char **) xmalloc (sizeof (char*)*typevec_size);
}
else
{
typevec_size *= 2;
typevec = (char **) xrealloc ((char *)typevec, sizeof (char*)*typevec_size);
}
}
len = end - start;
tem = (char *) xmalloc (len + 1);
memcpy (tem, start, len);
tem[len] = '\0';
typevec[ntypes++] = tem;
return 1;
}
/* `decl' must be already initialised, usually non-empty;
it won't be freed on failure */
static int
do_args (type, decl)
const char **type;
string *decl;
{
string arg;
int need_comma = 0;
int dont_want_first;
#ifndef LONGERNAMES
dont_want_first = 1;
#else
dont_want_first = 0;
#endif
string_append (decl, "(");
while (**type != '_' && **type != '\0' && **type != 'e' && **type != 'v')
{
if (**type == 'N')
{
int r;
int t;
*type += 1;
if (!get_count (type, &r) || !get_count (type, &t) || t >= ntypes)
return 0;
while (--r >= 0)
{
const char *tem = typevec[t];
if (need_comma)
string_append (decl, ", ");
if (!do_arg (&tem, &arg))
return 0;
string_appends (decl, &arg);
string_delete (&arg);
need_comma = 1;
}
}
else
{
if (need_comma)
string_append (decl, ", ");
if (!do_arg (type, &arg))
return 0;
if (dont_want_first)
dont_want_first = 0;
else
{
string_appends (decl, &arg);
need_comma = 1;
}
string_delete (&arg);
}
}
if (**type == 'v')
*type += 1;
else if (**type == 'e')
{
*type += 1;
if (need_comma)
string_append (decl, ",");
string_append (decl, "...");
}
string_append (decl, ")");
return 1;
}
static void
munge_function_name (name)
string *name;
{
if (!string_empty (name) && name->p - name->b >= 3
&& name->b[0] == 'o' && name->b[1] == 'p' && name->b[2] == '$')
{
unsigned int i;
/* see if it's an assignment expression */
if (name->p - name->b >= 10 /* op$assign_ */
&& memcmp (name->b + 3, "assign_", 7) == 0)
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
{
int len = name->p - name->b - 10;
if (strlen (optable[i].in) == len
&& memcmp (optable[i].in, name->b + 10, len) == 0)
{
string_clear (name);
string_append (name, "operator");
string_append (name, optable[i].out);
string_append (name, "=");
return;
}
}
}
else
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
{
int len = name->p - name->b - 3;
if (strlen (optable[i].in) == len
&& memcmp (optable[i].in, name->b + 3, len) == 0)
{
string_clear (name);
string_append (name, "operator");
string_append (name, optable[i].out);
return;
}
}
}
return;
}
else if (!string_empty (name) && name->p - name->b >= 5
&& memcmp (name->b, "type$", 5) == 0)
{
/* type conversion operator */
string type;
const char *tem = name->b + 5;
if (do_type (&tem, &type))
{
string_clear (name);
string_append (name, "operator ");
string_appends (name, &type);
string_delete (&type);
return;
}
}
}
/* a mini string-handling package */
static void
string_need (s, n)
string *s;
int n;
{
if (s->b == NULL)
{
if (n < 32)
n = 32;
s->p = s->b = (char *) xmalloc (n);
s->e = s->b + n;
}
else if (s->e - s->p < n)
{
int tem = s->p - s->b;
n += tem;
n *= 2;
s->b = (char *) xrealloc (s->b, n);
s->p = s->b + tem;
s->e = s->b + n;
}
}
static void
string_delete (s)
string *s;
{
if (s->b != NULL)
{
free (s->b);
s->b = s->e = s->p = NULL;
}
}
static void
string_init (s)
string *s;
{
s->b = s->p = s->e = NULL;
}
static void
string_clear (s)
string *s;
{
s->p = s->b;
}
static int
string_empty (s)
string *s;
{
return s->b == s->p;
}
static void
string_append (p, s)
string *p;
const char *s;
{
int n;
if (s == NULL || *s == '\0')
return;
n = strlen (s);
string_need (p, n);
memcpy (p->p, s, n);
p->p += n;
}
static void
string_appends (p, s)
string *p, *s;
{
int n;
if (s->b == s->p)
return;
n = s->p - s->b;
string_need (p, n);
memcpy (p->p, s->b, n);
p->p += n;
}
static void
string_appendn (p, s, n)
string *p;
const char *s;
int n;
{
if (n == 0)
return;
string_need (p, n);
memcpy (p->p, s, n);
p->p += n;
}
static void
string_prepend (p, s)
string *p;
const char *s;
{
if (s == NULL || *s == '\0')
return;
string_prependn (p, s, strlen (s));
}
static void
string_prependn (p, s, n)
string *p;
const char *s;
int n;
{
char *q;
if (n == 0)
return;
string_need (p, n);
for (q = p->p - 1; q >= p->b; q--)
q[n] = q[0];
memcpy (p->b, s, n);
p->p += n;
}

Binary file not shown.

View File

@ -1,417 +0,0 @@
/* strip certain symbols from a rel file.
Copyright (C) 1986, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "getopt.h"
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
enum strip_action {
strip_undef,
strip_all, /* strip all symbols */
strip_debug, /* strip all debugger symbols */
};
/* Which symbols to remove. */
enum strip_action strip_symbols;
enum locals_action {
locals_undef,
locals_start_L, /* discard locals starting with L */
locals_all, /* discard all locals */
};
/* Which local symbols to remove. */
enum locals_action discard_locals;
/* The name this program was run with. */
char *program_name;
struct option long_options[] = {
{"strip-all", 0, 0, 's'},
{"strip-debug", 0, 0, 'S'},
{"discard-all", 0, 0, 'x'},
{"discard-locals", 0, 0, 'X'},
{0, 0, 0, 0},
};
static char *target = NULL;
static int fatal_error;
extern char *malloc();
extern char *mktemp();
extern char *realloc();
extern char *strcpy();
extern int exit();
extern int fprintf();
extern int free();
extern int getpid();
extern int kill();
extern int perror();
extern int sprintf();
extern int unlink();
#ifdef __STDC__
static int strip_bfd(bfd *ibfd, bfd *obfd);
static int strip_file(char *filetostrip);
static void usage(void);
#else
static int strip_bfd();
static int strip_file();
static void usage();
#endif /* __STDC__ */
static void copy_sections ();
static void setup_sections ();
int main(argc, argv)
char **argv;
int argc;
{
int ind;
int c;
program_name = argv[0];
strip_symbols = strip_undef; /* default is to strip everything. */
discard_locals = locals_undef;
while ((c = getopt_long (argc, argv, "gsST:xX", long_options, &ind)) != EOF) {
switch (c) {
case 0:
break;
case 's':
strip_symbols = strip_all;
break;
case 'g':
case 'S':
strip_symbols = strip_debug;
break;
case 'T':
target = optarg;
break;
case 'x':
discard_locals = locals_all;
break;
case 'X':
discard_locals = locals_start_L;
break;
default:
usage ();
} /* switch on option */
} /* for each option */
if (strip_symbols == strip_undef && discard_locals == locals_undef) {
strip_symbols = strip_all;
} /* Default is to strip all symbols. */
if (argc == optind) {
return(strip_file("a.out"));
} else {
int retval = 0;
for ( ; optind < argc; ++optind) {
retval &= strip_file(argv[optind]);
} /* for each file to strip */
return(retval);
} /* if no arguments given */
} /* main() */
static int delayed_signal;
void delay_signal(signo)
int signo;
{
delayed_signal = signo;
signal(signo, delay_signal);
} /* delay_signal() */
static int sigint_handled = 0;
static int sighup_handled = 0;
static int sigterm_handled = 0;
void handle_sigs() {
/* Effectively defer handling of asynchronous kill signals. */
delayed_signal = 0;
if (signal (SIGINT, SIG_IGN) != SIG_IGN) {
sigint_handled = 1;
signal(SIGINT, delay_signal);
} /* if not ignored */
if (signal (SIGHUP, SIG_IGN) != SIG_IGN) {
sighup_handled = 1;
signal(SIGHUP, delay_signal);
} /* if not ignored */
if (signal (SIGTERM, SIG_IGN) != SIG_IGN) {
sigterm_handled = 1;
signal(SIGTERM, delay_signal);
} /* if not ignored */
return;
} /* handle_sigs() */
void unhandle_sigs() {
/* Effectively undefer handling. */
if (sigint_handled)
signal (SIGINT, SIG_DFL);
if (sighup_handled)
signal (SIGHUP, SIG_DFL);
if (sigterm_handled)
signal (SIGTERM, SIG_DFL);
/* Handle any signal that came in while they were deferred. */
if (delayed_signal)
kill (getpid (), delayed_signal);
return;
} /* unhandle_sigs() */
static int strip_file(filetostrip)
char *filetostrip;
{
bfd *ibfd;
bfd *obfd;
char tmpfilename[] = "stXXXXXX";
if ((ibfd = bfd_openr(filetostrip, (char *)NULL)) == NULL) {
bfd_perror(filetostrip);
return(1);
} /* on error opening input */
obfd = bfd_openw(mktemp(tmpfilename),
target? target: bfd_get_target (ibfd));
if (obfd == NULL) {
bfd_perror(tmpfilename);
if (bfd_close(ibfd) == false) {
bfd_perror(bfd_get_filename(ibfd));
} /* on close error */
return(1);
} /* on error opening output */
handle_sigs();
if (bfd_check_format(ibfd, bfd_object) != false) {
if (bfd_set_format(obfd, bfd_get_format(ibfd)) != false) {
if (!strip_bfd(ibfd, obfd)) {
/* success */
if (bfd_close(ibfd) == false) {
bfd_perror(bfd_get_filename(ibfd));
} /* on close error */
if (bfd_close(obfd) == false) {
bfd_perror(bfd_get_filename(obfd));
} /* on close error */
rename(tmpfilename, filetostrip);
unhandle_sigs();
return(0);
} /* strip_bfd prints it's own failing messages */
} else {
bfd_perror(filetostrip);
} /* can't set format */
} else {
/* not an object file */
(void) fprintf(stderr, "File %s has format 0x%x that will not be stripped.\n",
filetostrip, (unsigned) bfd_get_format(ibfd));
} /* if anything fails along the way */
if (bfd_close(ibfd) == false) {
bfd_perror(bfd_get_filename(ibfd));
} /* on close error */
if (bfd_close(obfd) == false) {
bfd_perror(bfd_get_filename(obfd));
} /* on close error */
if (unlink(tmpfilename)) {
perror(tmpfilename);
} /* on error */
unhandle_sigs();
return(1);
} /* strip_file() */
boolean
bfd_set_start_address (abfd, new_address)
bfd *abfd;
bfd_vma new_address;
{
bfd_get_start_address (abfd) = new_address;
return true;
}
static int
strip_bfd(ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
if (bfd_set_start_address(obfd, bfd_get_start_address(ibfd)) == false
|| bfd_set_file_flags(obfd, bfd_get_file_flags(ibfd) & ~(HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS)) == false
|| bfd_set_start_address(obfd, bfd_get_start_address(ibfd)) == false) {
bfd_perror(bfd_get_filename(ibfd));
return(1);
} /* on error setting file attributes */
/* bfd mandates that all output sections be created and sizes set before
any output is done. Thus, we traverse all sections twice. */
fatal_error = 0;
bfd_map_over_sections (ibfd, setup_sections, (void *)obfd);
if (!fatal_error)
bfd_map_over_sections (ibfd, copy_sections, (void *)obfd);
return fatal_error;
}
static void
setup_sections(ibfd, isection, obfd)
bfd *ibfd;
sec_ptr isection;
bfd *obfd;
{
sec_ptr osection;
char *err;
do {
err = "making";
osection = bfd_make_section(obfd, bfd_section_name(ibfd, isection));
if (osection == NULL)
break;
err = "size";
if (!bfd_set_section_size(obfd, osection,
bfd_section_size(ibfd, isection)))
break;
err = "vma";
if (!bfd_set_section_vma(obfd, osection,
bfd_section_vma(ibfd, isection)))
break;
err = "alignment";
if (!bfd_set_section_alignment(obfd, osection,
bfd_section_alignment(ibfd, isection)))
break;
err = "flags";
if (!bfd_set_section_flags(obfd, osection,
bfd_get_section_flags(ibfd, isection)))
break;
return;
} while (0);
(void) fprintf(stderr, "file \"%s\", section \"%s\": error in %s: ",
bfd_get_filename(ibfd),
bfd_section_name(ibfd, isection),
err);
bfd_perror("");
fatal_error = 1;
}
static void
copy_sections(ibfd, isection, obfd)
bfd *ibfd;
sec_ptr isection;
bfd *obfd;
{
static char *memhunk = NULL;
static unsigned memhunksize = 0;
sec_ptr osection;
unsigned long size;
flagword iflg;
char *temp;
osection = bfd_get_section_by_name (obfd,
bfd_section_name(ibfd, isection));
size = bfd_section_size(ibfd, isection);
iflg = bfd_get_section_flags(ibfd, isection);
/* either:
we don't need any memory because there's nothing in this section,
we had no memory so we got some,
we had some memory but not enough so we got more,
or we fail to allocat. */
if (size == 0)
return;
if (memhunk == NULL) {
memhunk = malloc (size);
memhunksize = size;
}
if (size > memhunksize) {
temp = realloc (memhunk, size);
memhunksize = size;
if (!temp) /* If realloc failed, blow away our mem */
free (memhunk);
memhunk = temp;
}
if (memhunk == NULL) {
/* failed to allocate or reallocate */
/* FIXME, we should just copy in pieces. */
(void) fprintf(stderr,
"Could not allocate %lu bytes in which to copy section.\n", size);
return;
}
/* now we have enough memory */
if (!bfd_get_section_contents(ibfd, isection, memhunk, 0, size)) {
bfd_perror(bfd_get_filename(ibfd));
fatal_error = 1;
return;
}
if (!bfd_set_section_contents(obfd, osection, memhunk, 0, size)) {
bfd_perror(bfd_get_filename(obfd));
fatal_error = 1;
return;
}
}
void
usage ()
{
fprintf (stderr, "\
Usage: %s [-gsxSX] [+strip-all] [+strip-debug] [+discard-all]\n\
[+discard-locals] file...\n", program_name);
exit (1);
}
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of strip.c */

View File

@ -1,362 +0,0 @@
/* strip.c -- strip certain symbols from a rel file.
Copyright (C) 1986, 1990, 1991 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* BUGS: When there's not enough memory, this should do the copy
in pieces rather than just fail as it does now */
#include "bfd.h"
#include "sysdep.h"
#include "getopt.h"
#include <signal.h>
/* Various program options */
int show_version = 0;
/* Which symbols to remove. */
enum strip_action {
strip_undef,
strip_all, /* strip all symbols */
strip_debug, /* strip all debugger symbols */
} strip_symbols;
/* Which local symbols to remove. */
enum {
locals_undef,
locals_start_L, /* discard locals starting with L */
locals_all, /* discard all locals */
} discard_locals;
extern char *mktemp();
/* IMPORTS */
extern char *program_version;
extern char *program_name;
extern char *target;
extern char *xmalloc();
PROTO(static boolean, strip_file, (char *filetostrip));
PROTO(static void, copy_sections, (bfd *ibfd, sec_ptr isection, bfd *obfd));
PROTO(static void, setup_sections, (bfd *ibfd, sec_ptr isection, bfd *obfd));
/** main, etc */
static void
usage ()
{
fprintf (stderr, "strip %s\nUsage: %s [-gsxSX] files ...\n",
program_version, program_name);
exit (1);
}
struct option long_options[] = {{"strip-all", 0, 0, 's'},
{"strip-debug", 0, 0, 'S'},
{"discard-all", 0, 0, 'x'},
{"discard-locals", 0, 0, 'X'},
{0, 0, 0, 0}
};
int
main (argc, argv)
char **argv;
int argc;
{
int ind;
int c;
program_name = argv[0];
bfd_init();
strip_symbols = strip_undef; /* default is to strip everything. */
discard_locals = locals_undef;
while ((c = getopt_long (argc, argv, "gsST:xX", long_options, &ind)) != EOF) {
switch (c) {
case 0:
break;
case 's':
strip_symbols = strip_all;
break;
case 'g':
case 'S':
strip_symbols = strip_debug;
break;
case 'T':
target = optarg;
break;
case 'x':
discard_locals = locals_all;
break;
case 'X':
discard_locals = locals_start_L;
break;
default:
usage ();
}
}
/* Default is to strip all symbols: */
if (strip_symbols == strip_undef && discard_locals == locals_undef) {
strip_symbols = strip_all;
}
/* OK, all options now parsed. If no filename specified, do a.out. */
if (optind == argc) return !strip_file ("a.out");
/* We were given several filenames to do: */
while (optind < argc)
if (!strip_file (argv[optind++])) return 1;
return 0;
}
/** Hack signals */
/* Why does strip need to do this, and anyway, if it does shouldn't this be
handled by bfd? */
static int delayed_signal;
static int sigint_handled = 0;
static int sighup_handled = 0;
static int sigterm_handled = 0;
void
delay_signal (signo)
int signo;
{
delayed_signal = signo;
signal (signo, delay_signal);
}
/* Effectively defer handling of asynchronous kill signals. */
void
handle_sigs () /* puff puff */
{
delayed_signal = 0;
if (signal (SIGINT, SIG_IGN) != SIG_IGN) {
sigint_handled = 1;
signal (SIGINT, delay_signal);
}
if (signal (SIGHUP, SIG_IGN) != SIG_IGN) {
sighup_handled = 1;
signal (SIGHUP, delay_signal);
}
if (signal (SIGTERM, SIG_IGN) != SIG_IGN) {
sigterm_handled = 1;
signal (SIGTERM, delay_signal);
}
return;
}
/* Effectively undefer handling. */
void
unhandle_sigs () /* put them down */
{
if (sigint_handled) signal (SIGINT, SIG_DFL);
if (sighup_handled) signal (SIGHUP, SIG_DFL);
if (sigterm_handled) signal (SIGTERM, SIG_DFL);
/* Handle any signal that came in while they were deferred. */
if (delayed_signal)
kill (getpid (), delayed_signal);
return;
}
static boolean
strip_file (filetostrip)
char *filetostrip;
{
static char template[] = "stXXXXXX";
char *slash;
char *tmpname;
bfd *ibfd;
bfd *obfd;
ibfd = bfd_openr (filetostrip, target);
if (ibfd == NULL) bfd_fatal (filetostrip);
handle_sigs (); /* light up */
if (!bfd_check_format (ibfd, bfd_object)) {
fprintf (stderr, "Can't strip %s file %s.\n",
bfd_format_string (bfd_get_format (ibfd)), filetostrip);
exit (1);
}
slash = strrchr( filetostrip, '/' );
if ( slash ){
*slash = 0;
tmpname = xmalloc( strlen(filetostrip) + sizeof(template) + 1 );
strcpy( tmpname, filetostrip );
strcat( tmpname, "/" );
strcat( tmpname, template );
mktemp( tmpname );
*slash = '/';
} else {
tmpname = xmalloc( sizeof(template) );
strcpy( tmpname, template );
mktemp( tmpname );
}
obfd = bfd_openw (mktemp(tmpname), (target ? target : bfd_get_target (ibfd)));
if (obfd == NULL) bfd_fatal (tmpname);
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
bfd_fatal (tmpname);
if ((bfd_set_start_address (obfd, bfd_get_start_address (ibfd)) == false) ||
(bfd_set_file_flags (obfd, (bfd_get_file_flags (ibfd) &
~(HAS_LINENO | HAS_DEBUG | HAS_SYMS |
HAS_LOCALS))) == false) ||
bfd_set_start_address (obfd, bfd_get_start_address (ibfd)) == false)
bfd_fatal (bfd_get_filename (ibfd));
/* Copy architecture of input file to output file */
if (!bfd_set_arch_mach (obfd, bfd_get_architecture (ibfd),
bfd_get_machine (ibfd))) {
fprintf(stderr, "Output file cannot represent architecture %s",
bfd_printable_arch_mach (bfd_get_architecture(ibfd),
bfd_get_machine (ibfd)));
}
/* bfd mandates that all output sections be created and sizes set before
any output is done. Thus, we traverse all sections twice. */
bfd_map_over_sections (ibfd, setup_sections, (void *)obfd);
bfd_map_over_sections (ibfd, copy_sections, (void *)obfd);
if (!bfd_close (obfd)) bfd_fatal (filetostrip);
if (!bfd_close (ibfd)) bfd_fatal (filetostrip);
rename(tmpname, filetostrip);
free(tmpname);
unhandle_sigs();
return true;
}
/** Actually do the work */
static void
setup_sections (ibfd, isection, obfd)
bfd *ibfd;
sec_ptr isection;
bfd *obfd;
{
sec_ptr osection;
char *err;
osection = bfd_make_section (obfd, bfd_section_name (ibfd, isection));
if (osection == NULL) {
err = "making";
goto loser;
}
if (!bfd_set_section_size(obfd, osection, bfd_section_size(ibfd, isection))) {
err = "size";
goto loser;
}
if (!bfd_set_section_vma (obfd, osection, bfd_section_vma (ibfd, isection))) {
err = "vma";
goto loser;
}
if (bfd_set_section_alignment (obfd, osection,
bfd_section_alignment (ibfd, isection))
!= true) {
err = "alignment";
goto loser;
} /* on error, I presume. */
if (!bfd_set_section_flags (obfd, osection,
bfd_get_section_flags (ibfd, isection))) {
err = "flags";
goto loser;
}
/* All went well */
return;
loser:
fprintf (stderr, "%s: file \"%s\", section \"%s\": error in %s: %s\n",
program_name,
bfd_get_filename (ibfd), bfd_section_name (ibfd, isection),
err, bfd_errmsg (bfd_error));
exit (1);
}
static void
copy_sections (ibfd, isection, obfd)
bfd *ibfd;
sec_ptr isection;
bfd *obfd;
{
static unsigned char *memhunk = NULL;
static unsigned memhunksize = 0;
sec_ptr osection;
unsigned long size;
flagword iflg;
unsigned char *temp;
osection = bfd_get_section_by_name (obfd, bfd_section_name (ibfd, isection));
size = bfd_section_size (ibfd, isection);
iflg = bfd_get_section_flags (ibfd, isection);
/* either:
we don't need any memory because there's nothing in this section,
we had no memory so we got some,
we had some memory but not enough so we got more,
or we fail to allocat. */
if (size == 0)
return;
if ((iflg & SEC_HAS_CONTENTS) == 0)
return;
if (memhunk == NULL) {
memhunk = (unsigned char *) xmalloc (size);
memhunksize = size;
}
if (size > memhunksize) {
temp = (unsigned char *) xrealloc ((char *) memhunk, size);
memhunksize = size;
memhunk = temp;
}
/* now we have enough memory, just do it: */
if (!bfd_get_section_contents (ibfd, isection, memhunk, 0, size))
bfd_fatal (bfd_get_filename (ibfd));
if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
bfd_fatal (bfd_get_filename (obfd));
}

View File

@ -1,5 +0,0 @@
# Makefile changes for Suns running Solaris 2
SYSV = -DSYSV
RANLIB = echo >/dev/null
INSTALL = cp

View File

@ -1,6 +0,0 @@
# Define SYSV as -DSYSV if you are using a System V operating system.
SYSV = -DSYSV -DSVR4
RANLIB = echo >/dev/null
# The l flag generates a warning from the SVR4 archiver, remove it.
AR_FLAGS = cq

View File

@ -1,2 +0,0 @@
ALL= all.cross
INSTALL_TARGET= install.cross

View File

@ -1,2 +0,0 @@
ALL= all.cross
INSTALL_TARGET= install.cross

View File

@ -1,6 +0,0 @@
ALL := $(shell ls -d =*)
%:
$(foreach subdir,$(ALL),$(MAKE) -C $(subdir) $@ &&) true
gas:

View File

@ -1,146 +0,0 @@
#-----------------------------------------------------------------------------
# Makefile for gas960
#
# $Id$
#-----------------------------------------------------------------------------
# The following two lines should be uncommented for system V (i386v).
#__i386v__#USG = -DUSG
#__i386v__#LIBS = -lmalloc -lPW
# The following two lines should be uncommented for HP-UX
#__hp9000__#USG = -DUSG
# The following line should be uncommented for Macintosh A/UX.
#__mac-aux__#USG = -DUSG
#Always build with static libraries on Sun systems
#__sun3__#LDFLAGS = -Bstatic
#__sun386i__#LDFLAGS = -Bstatic
#__sun4__#LDFLAGS = -Bstatic
# Essential under System V, harmless elsewhere
SHELL = /bin/sh
TARG = gas960
OPT = -g
IPATH = ../../include
CFLAGS = ${OPT} ${USG} -DI80960 -I${IPATH}
OBJS = app.o append.o as.o atof-generic.o bignum-copy.o expr.o \
flonum-const.o flonum-copy.o flonum-mult.o frags.o gdb-blocks.o \
gdb-file.o gdb-lines.o gdb-symbols.o gdb.o hash.o hex-value.o \
input-file.o input-scrub.o messages.o obstack.o output-file.o read.o \
strstr.o subsegs.o symbols.o version.o write.o xmalloc.o xrealloc.o
# Note that we use the 386 floating-point support for the i80960
I960OBJ = i960.o i960-opcode.o atof-i386.o
gas960: ${OBJS} ${I960OBJ} VERSION
make ver960.o
${CC} -o gas960 ${LDFLAGS} ${OBJS} ${I960OBJ} ver960.o ${LIBS}
hash.o: hash.c
${CC} -c ${CFLAGS} -Derror=as_fatal hash.c
xmalloc.o: xmalloc.c
${CC} -c ${CFLAGS} -Derror=as_fatal xmalloc.c
xrealloc.o: xrealloc.c
${CC} -c ${CFLAGS} -Derror=as_fatal xrealloc.c
app.o: as.h
as.o: ${IPATH}/b.out.h as.h read.h struc-symbol.h write.h
atof-generic.o: flonum.h
bignum-copy.o: bignum.h
expr.o: ${IPATH}/b.out.h as.h expr.h flonum.h obstack.h read.h
expr.o: struc-symbol.h symbols.h
flonum-const.o: flonum.h
flonum-copy.o: flonum.h
flonum-mult.o: flonum.h
flonum-normal.o:flonum.h
flonum-print.o: flonum.h
frags.o: ${IPATH}/b.out.h as.h frags.h obstack.h struc-symbol.h subsegs.h
gdb.o: as.h
gdb-blocks.o: as.h
gdb-lines.o: as.h frags.h obstack.h
gdb-symbols.o: ${IPATH}/b.out.h as.h struc-symbol.h
hash.o: hash.h
i960.o: as.h ${IPATH}/b.out.h expr.h flonum.h frags.h hash.h
i960.o: i960-opcode.h md.h obstack.h struc-symbol.h write.h
i960-opcode.o: i960-opcode.h
input-file.o: input-file.h
input-scrub.o: as.h input-file.h read.h
messages.o: as.h
obstack.o: obstack.h
read.o: ${IPATH}/b.out.h as.h expr.h flonum.h frags.h hash.h md.h
read.o: obstack.h read.h struc-symbol.h symbols.h
subsegs.o: ${IPATH}/b.out.h as.h frags.h obstack.h struc-symbol.h subsegs.h
subsegs.o: write.h
symbols.o: ${IPATH}/b.out.h as.h frags.h hash.h obstack.h struc-symbol.h
symbols.o: symbols.h
write.o: ${IPATH}/b.out.h as.h md.h obstack.h struc-symbol.h subsegs.h
write.o: symbols.h write.h
flonum.h: bignum.h
#-----------------------------------------------------------------------------
# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
#
# 'VERSION' file must be present and contain a string of the form "x.y"
#-----------------------------------------------------------------------------
ver960.c: FORCE
rm -f ver960.c
echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
# This target should be invoked before building a new release.
# 'VERSION' file must be present and contain a string of the form "x.y"
#
roll:
@V=`cat VERSION` ; \
MAJ=`sed 's/\..*//' VERSION` ; \
MIN=`sed 's/.*\.//' VERSION` ; \
V=$$MAJ.`expr $$MIN + 1` ; \
rm -f VERSION ; \
echo $$V >VERSION ; \
echo Version $$V
# Dummy target to force execution of dependent targets.
#
FORCE:
# 'G960BASE' will be defined at invocation
install:
make ${TARG} OPT=-O
strip ${TARG}
rm -f ${G960BASE}/bin/${TARG}
mv ${TARG} ${G960BASE}/bin/${TARG}
clean:
rm -f ${TARG} *.o core
# Target to uncomment host-specific lines in this makefile. Such lines must
# have the following string beginning in column 1: #__<hostname>__#
# Original Makefile is backed up as 'Makefile.old'.
#
# Invoke with: make make HOST=xxx
#
make:
-@if test $(HOST)x = x ; then \
echo 'Specify "make make HOST=???"'; \
exit 1; \
fi ; \
grep -s "^#The next line was generated by 'make make'" Makefile; \
if test $$? = 0 ; then \
echo "Makefile has already been processed with 'make make'";\
exit 1; \
fi ; \
mv -f Makefile Makefile.old; \
echo "#The next line was generated by 'make make'" >Makefile ; \
echo "HOST=$(HOST)" >>Makefile ; \
echo >>Makefile ; \
sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile

View File

@ -1,586 +0,0 @@
host = generic
target = generic
# Makefile for GNU Assembler
# Copyright (C) 1987, 1988, 1990, 1991 Free Software Foundation, Inc.
#This file is part of GNU GAS.
#GNU GAS 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 1, or (at your option)
#any later version.
#GNU GAS 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 GNU GAS; see the file COPYING. If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id$
# The targets for external use include:
# all, doc, proto, install, uninstall, includes, TAGS,
# clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.
# Variables that exist for you to override.
# See below for how to change them for certain systems.
ALLOCA =
CFLAGS = -g $(XCFLAGS) # -I$(srcdir)/../include
INTERNAL_CFLAGS = $(CROSS)
OLDCC = cc
BISON = bison
BISONFLAGS = -v
AR = ar
OLDAR_FLAGS = qc
AR_FLAGS = rc
SHELL = /bin/sh
# on sysV, define this as cp.
INSTALL = install -c
# These permit overriding just for certain files.
INSTALL_PROGRAM = $(INSTALL)
INSTALL_FILE = $(INSTALL)
# Define this as & to perform parallel make on a Sequent.
# Note that this has some bugs, and it seems currently necessary
# to compile all the gen* files first by hand to avoid erroneous results.
P =
# How to invoke ranlib.
RANLIB = ranlib
# Test to use to see whether ranlib exists on the system.
RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
# CFLAGS for use with OLDCC, for compiling gnulib.
# NOTE: -O does not work on some Unix systems!
CCLIBFLAGS = -O
# Version of ar to use when compiling gnulib.
OLDAR = ar
version=`./gcc -dumpversion`
# Directory where sources are, from where we are.
srcdir = .
# Common prefix for installation directories.
# NOTE: This directory must exist when you start installation.
prefix = /usr/local
# Directory in which to put the executable for the command `gcc'
bindir = $(prefix)/bin
# Directory in which to put the directories used by the compiler.
libdir = $(prefix)/lib
# Directory in which the compiler finds executables, libraries, etc.
libsubdir = $(libdir)/gcc/$(target)/$(version)
# Number to put in man-page filename.
manext = 1
# Directory in which to put man pages.
mandir = $(prefix)/man/man$(manext)
# Additional system libraries to link with.
CLIB=
# Change this to a null string if obstacks are installed in the
# system library.
OBSTACK=obstack.o
# Specify the rule for actually making gnulib.
GNULIB = gnulib.portable
# Specify the rule for actually making gnulib2.
GNULIB2 = gnulib2.portable
# List of extra C and assembler files to add to gnulib.
# Assembler files should have names ending in `.asm'.
LIBFUNCS_EXTRA =
# Program to convert libraries.
LIBCONVERT =
# Control whether header files are installed.
INSTALL_HEADERS=install-headers
# Change this to empty to prevent installing limits.h
LIMITS_H = limits.h
# Directory to link to, when using the target `maketest'.
DIR = ../gcc
# For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h
# and define the following variable as `aux-output2.c' in make-...
AUX_OUTPUT2 =
# Flags to use when cross-building GCC.
# Prefix to apply to names of object files when using them
# to run on the machine we are compiling on.
HOST_PREFIX=
# Prefix to apply to names of object files when compiling them
# to run on the machine we are compiling on.
# The default for this variable is chosen to keep these rules
# out of the way of the other rules for compiling the same source files.
HOST_PREFIX_1=loser-
HOST_CC=$(CC)
HOST_CFLAGS=$(ALL_CFLAGS)
HOST_LDFLAGS=$(LDFLAGS)
HOST_CPPFLAGS=$(CPPFLAGS)
# Choose the real default target.
ALL=bootstrap
# End of variables for you to override.
# Lists of files for various purposes.
REAL_SOURCES = \
$(srcdir)/app.c \
$(srcdir)/as.c \
$(srcdir)/atof-generic.c \
$(srcdir)/bignum-copy.c \
$(srcdir)/cond.c \
$(srcdir)/expr.c \
$(srcdir)/flonum-const.c \
$(srcdir)/flonum-copy.c \
$(srcdir)/flonum-mult.c \
$(srcdir)/frags.c \
$(srcdir)/hash.c \
$(srcdir)/hex-value.c \
$(srcdir)/input-file.c \
$(srcdir)/input-scrub.c \
$(srcdir)/messages.c \
$(srcdir)/output-file.c \
$(srcdir)/read.c \
$(srcdir)/strstr.c \
$(srcdir)/subsegs.c \
$(srcdir)/symbols.c \
$(srcdir)/version.c \
$(srcdir)/write.c \
$(srcdir)/xmalloc.c \
$(srcdir)/xrealloc.c
# in an expedient order
LINKED_SOURCES = \
targ-cpu.c \
obj-format.c \
atof-targ.c
SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
REAL_HEADERS = \
$(srcdir)/as.h \
$(srcdir)/bignum.h \
$(srcdir)/expr.h \
$(srcdir)/flonum.h \
$(srcdir)/frags.h \
$(srcdir)/hash.h \
$(srcdir)/input-file.h \
$(srcdir)/tc.h \
$(srcdir)/obj.h \
$(srcdir)/read.h \
$(srcdir)/reloc.h \
$(srcdir)/struc-symbol.h \
$(srcdir)/subsegs.h \
$(srcdir)/symbols.h \
$(srcdir)/syscalls.h \
$(srcdir)/write.h
LINKED_HEADERS = \
a.out.gnu.h \
a.out.h \
host.h \
targ-env.h \
targ-cpu.h \
obj-format.h \
atof-targ.h
HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
OBJS = \
targ-cpu.o \
obj-format.o \
atof-targ.o \
app.o \
as.o \
atof-generic.o \
bignum-copy.o \
cond.o \
expr.o \
flonum-const.o \
flonum-copy.o \
flonum-mult.o \
frags.o \
hash.o \
hex-value.o \
input-file.o \
input-scrub.o \
messages.o \
output-file.o \
read.o \
strstr.o \
subsegs.o \
symbols.o \
version.o \
write.o \
xmalloc.o \
xrealloc.o
# Definition of `all' is here so that new rules inserted by sed
# do not specify the default target.
# The real definition is under `all.internal'.
all: $(ALL)
# sed inserts variable overrides after the following line.
####
# Now figure out from those variables how to compile and link.
# This is the variable actually used when we compile.
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS)
# Even if ALLOCA is set, don't use it if compiling with GCC.
USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi`
USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi`
# Dependency on obstack, alloca, malloc or whatever library facilities
# are not installed in the system libraries.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC)
# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB)
# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config
# Always use -I$(srcdir)/config when compiling.
.c.o:
$(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.
.NOEXPORT:
# Files to be copied away after each stage in building.
STAGE_GCC=gcc
STAGESTUFF = *.o gas
# The files that "belong" in CONFIG_H are deliberately omitted
# because having them there would not be useful in actual practice.
# All they would do is cause complete recompilation every time
# one of the machine description files is edited.
# That may or may not be what one wants to do.
# If it is, rm *.o is an easy way to do it.
# CONFIG_H = config.h tm.h
CONFIG_H =
gas: $(OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gas $(OBJS) $(LIBS)
all.internal: native
# This is what is made with the host's compiler if making a cross assembler.
native: config.status gas
config.status:
@echo You must configure gas. Look at the INSTALL file for details.
@false
compilations: ${OBJS}
# Compiling object files from source files.
# Note that dependencies on obstack.h are not written
# because that file is not part of GAS.
app.o : app.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
as.o : as.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
bignum-copy.o : bignum-copy.c as.h host.h \
targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
cond.o : cond.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
obstack.h
debug.o : debug.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h
expr.o : expr.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
obstack.h
flonum-const.o : flonum-const.c flonum.h bignum.h
flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
flonum-mult.o : flonum-mult.c flonum.h bignum.h
frags.o : frags.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h obstack.h
hash.o : hash.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
hex-value.o : hex-value.c
input-file.o : input-file.c as.h host.h \
targ-env.h obj-format.h targ-cpu.h \
struc-symbol.h reloc.h write.h flonum.h bignum.h expr.h \
frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
input-file.h
messages.o : messages.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
obstack.o : obstack.c obstack.h
output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
output-file.h
read.o : read.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
obstack.h
strstr.o : strstr.c
subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h obstack.h
symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
obstack.h subsegs.h
version.o : version.c
write.o : write.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h obstack.h output-file.h
xmalloc.o : xmalloc.c
xrealloc.o : xrealloc.c
atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
symbols.h tc.h obj.h
obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
symbols.h tc.h obj.h obstack.h
targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h reloc.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
symbols.h tc.h obj.h obstack.h
# Normally this target is not used; but it is used if you
# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
# from the GNU Emacs distribution.
# Note some machines won't allow $(CC) without -S on this source file.
alloca.o: alloca.c
$(CC) $(ALL_CFLAGS) $(CPPFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
as alloca.s -o alloca.o
# Compile the libraries to be used by gen*.
# If we are not cross-building, gen* use the same .o's that cc1 will use,
# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
# with the rules for rtl.o, alloca.o, etc.
$(HOST_PREFIX_1)alloca.o: alloca.c
rm -f $(HOST_PREFIX)alloca.c
cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
$(HOST_PREFIX_1)obstack.o: obstack.c
rm -f $(HOST_PREFIX)obstack.c
cp $(srcdir)/obstack.c $(HOST_PREFIX)obstack.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
$(HOST_PREFIX_1)malloc.o: malloc.c
rm -f $(HOST_PREFIX)malloc.c
cp $(srcdir)/malloc.c $(HOST_PREFIX)malloc.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
# Remake the info files.
doc: $(srcdir)/gas.info
$(srcdir)/gas.info: $(srcdir)/gas.texinfo
makeinfo `echo $(srcdir)/gas.texinfo | sed 's,^\./,,'`
# Deletion of files made during compilation.
# There are three levels of this: `clean', `cleanconfig' and `realclean'.
# `clean' deletes what you want to delete ordinarily to save space.
# This is most, but not all, of the files made by compilation.
# `cleanconfig' also deletes everything depending
# on the choice of config files.
# `realclean' also deletes everything that could be regenerated automatically.
clean:
-rm -f $(STAGESTUFF)
# Delete the temporary source copies for cross compilation.
-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
-rm -f $(HOST_PREFIX_1)obstack.c
# Delete the stamp files except stamp-gnulib2.
-rm -f core
# Like clean but also delete the links made to configure gas.
cleanconfig: clean
-rm -f config.status Makefile host.h targ-env.h
-rm -f targ-cpu.h targ-cpu.c
-rm -f obj-format.h obj-format.c
-rm -f atof-targ.c
# Get rid of every file that's generated from some other file (except INSTALL).
realclean: cleanconfig
-rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs
-rm -f TAGS
-rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux
-rm -f *.dvi
# Entry points `install', `includes' and `uninstall'.
# Copy the files into directories where they will be run.
install:
$(INSTALL_PROGRAM) gas $(bindir)/as
# Create the installation directory.
install-dir:
-mkdir $(libdir)
-mkdir $(libdir)/gcc
-mkdir $(libdir)/gcc/$(target)
-mkdir $(libdir)/gcc/$(target)/$(version)
# Install the compiler executables built during cross compilation.
install-cross: native install-dir
-if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi
-if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi
$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
./gcc -dumpspecs > $(libsubdir)/specs
$(INSTALL_PROGRAM) gcc $(bindir)/gcc
# Install the man pages.
install-man: install-dir $(srcdir)/gcc.1 protoize.1 unprotoize.1
$(INSTALL_FILE) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
chmod a-x $(mandir)/gcc.$(manext)
$(INSTALL_FILE) $(srcdir)/protoize.1 $(mandir)/protoize.$(manext)
chmod a-x $(mandir)/protoize.$(manext)
$(INSTALL_FILE) $(srcdir)/unprotoize.1 $(mandir)/unprotoize.$(manext)
chmod a-x $(mandir)/unprotoize.$(manext)
# Cancel installation by deleting the installed files.
uninstall:
-rm -rf $(libsubdir)
-rm -rf $(bindir)/gas
-rm -rf $(mandir)/gas.$(manext)
# These exist for maintenance purposes.
tags TAGS: force
etags $(REAL_SOURCES) $(REAL_HEADERS) README Makefile config/*.[hc]
bootstrap: gas force
$(MAKE) stage1
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
$(MAKE) stage2
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
for i in *.o; do cmp $$i stage2/$$i; done
bootstrap2: force
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
$(MAKE) stage2
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
for i in *.o; do cmp $$i stage2/$$i; done
bootstrap3: force
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
for i in *.o; do cmp $$i stage2/$$i; done
# Copy the object files from a particular stage into a subdirectory.
stage1: force
-mkdir stage1
-mv $(STAGESTUFF) stage1
-(cd stage1 ; ln -s gas as)
stage2: force
-mkdir stage2
-mv $(STAGESTUFF) stage2
-(cd stage2 ; ln -s gas as)
stage3: force
-mkdir stage3
-mv $(STAGESTUFF) $(STAGE_GCC) stage3
-rm -f stage3/gnulib
-cp gnulib stage3
-if $(RANLIB_TEST) ; then $(RANLIB) stage3/gnulib; else true; fi
stage4: force
-mkdir stage4
-mv $(STAGESTUFF) $(STAGE_GCC) stage4
-rm -f stage4/gnulib
-cp gnulib stage4
-if $(RANLIB_TEST) ; then $(RANLIB) stage4/gnulib; else true; fi
# Copy just the executable files from a particular stage into a subdirectory,
# and delete the object files. Use this if you're just verifying a version
# that is pretty sure to work, and you are short of disk space.
risky-stage1: force
-mkdir stage1
-mv cc1 cpp cccp gcc stage1
-rm -f stage1/gnulib
-cp gnulib stage1 && $(RANLIB) stage1/gnulib
-make clean
risky-stage2: force
-mkdir stage2
-mv cc1 cpp cccp gcc stage2
-rm -f stage2/gnulib
-cp gnulib stage2 && $(RANLIB) stage2/gnulib
-make clean
risky-stage3: force
-mkdir stage3
-mv cc1 cpp cccp gcc stage3
-rm -f stage3/gnulib
-cp gnulib stage3 && $(RANLIB) stage3/gnulib
-make clean
risky-stage4: force
-mkdir stage4
-mv cc1 cpp cccp gcc stage4
-rm -f stage4/gnulib
-cp gnulib stage4 && $(RANLIB) stage4/gnulib
-make clean
#In GNU Make, ignore whether `stage*' exists.
.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
force:
Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
$(srcdir)/configure.was -srcdir=$(srcdir) -host=$(host) $(target)

View File

@ -1,203 +0,0 @@
# Makefile for GAS.
# Copyright (C) 1989, Free Software Foundation
#
# This file is part of GAS, the GNU Assembler.
#
# GAS 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 1, or (at your option)
# any later version.
#
# GAS 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 GAS; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
BINDIR = /usr/local/bin
BINARY = gas
#
# Add these flags to XCFLAGS below for specific use.
#
# If you machine does not have vfprintf, but does have _doprnt(),
# -DNO_VARARGS
#
# If the return-type of a signal-hander is void (instead of int),
# -DSIGTY
#
# To include the mc68851 mmu coprocessor instructions in the 68020 assembler,
# -Dm68851
#
# If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr
# opcodes (unlike most 80386 assemblers)
# -DNON_BROKEN_WORDS
#
XCFLAGS =
# Your favorite compiler
CC = gcc
# Uncomment the following lines if you use USG
INCLUDE_DIRS = -I.
COFF_OBJECTS = stack.o
CPPFLAGS = -DUSG
CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
LDFLAGS =
#LOADLIBES = -lPW
# Uncomment the following lines if you use BSD
#INCLUDE_DIRS = -I.
#CPPFLAGS =
#CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
#LDFLAGS =
#LOADLIBES =
CONFIG_FILES = \
machine.c machine.h atof.c obj-format.c obj-format.h opcode.h
OBJECTS = \
as.o xrealloc.o xmalloc.o hash.o hex-value.o \
atof-generic.o append.o messages.o expr.o app.o \
frags.o input-file.o input-scrub.o output-file.o \
subsegs.o symbols.o version.o flonum-const.o flonum-copy.o \
flonum-mult.o strstr.o bignum-copy.o obstack.o write.o read.o \
obj-format.o machine.o atof.o $(COFF_OBJECTS)
SOURCES = $(OBJECTS:.o=.c)
all : $(BINARY)
install : all
cp $(BINARY) $(BINDIR)
clean :
rm -f $(OBJECTS)
clobber : clean
rm -f $(BINARY) $(CONFIG_FILES) dependencies TAGS m68k.h
$(BINARY) : $(OBJECTS)
$(CC) -o $(BINARY) $(LDFLAGS) $(OBJECTS) $(LOADLIBES)
TAGS : $(SOURCES)
etags $(SOURCES) *.h
CXREF : $(SOURCES)
cxref -c $(INCLUDE_DIRS) $(SOURCES)
stack.o: stack.c
$(CC) $(CFLAGS) -c stack.c
atof.o: \
flonum.h \
bignum.h
obj-format.o: \
as.h \
md.h \
aout.h \
a.out.gnu.h \
struc-symbol.h \
write.h \
append.h
read.o: \
obj-format.h \
a.out.gnu.h \
as.h \
read.h \
md.h \
hash.h \
obstack.h \
frags.h \
flonum.h \
bignum.h \
struc-symbol.h \
expr.h \
symbols.h \
sparc.h
write.o: \
obj-format.h \
a.out.gnu.h \
as.h \
md.h \
subsegs.h \
obstack.h \
struc-symbol.h \
write.h \
symbols.h \
append.h \
sparc.h
obstack.o: \
obstack.h
bignum-copy.o: \
bignum.h
flonum-mult.o: \
flonum.h \
bignum.h
flonum-copy.o: \
flonum.h \
bignum.h
flonum-const.o: \
flonum.h \
bignum.h
symbols.o: \
obj-format.h \
a.out.gnu.h \
as.h \
hash.h \
obstack.h \
struc-symbol.h \
symbols.h \
frags.h
subsegs.o: \
obj-format.h \
a.out.gnu.h \
as.h \
subsegs.h \
obstack.h \
frags.h \
struc-symbol.h \
write.h
input-scrub.o: \
as.h \
read.h \
input-file.h
input-file.o: \
input-file.h
frags.o: \
obj-format.h \
a.out.gnu.h \
as.h \
subsegs.h \
obstack.h \
frags.h \
struc-symbol.h
expr.o: \
obj-format.h \
a.out.gnu.h \
as.h \
flonum.h \
bignum.h \
read.h \
struc-symbol.h \
expr.h \
obstack.h \
symbols.h
messages.o: \
as.h
atof-generic.o: \
flonum.h \
bignum.h
hash.o: \
hash.h
as.o: \
obj-format.h \
a.out.gnu.h \
as.h \
struc-symbol.h \
write.h

View File

@ -1 +0,0 @@
1.2

View File

@ -1,351 +0,0 @@
/* This file is a.out.gnu.h
Copyright (C) 1987-1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__
#include "aout/reloc.h"
#define __GNU_EXEC_MACROS__
#ifndef __STRUCT_EXEC_OVERRIDE__
/* This is the layout on disk of a Unix V7, Berkeley, SunOS, Vax Ultrix
"struct exec". Don't assume that on this machine, the "struct exec"
will lay out the same sizes or alignments. */
struct exec_bytes {
unsigned char a_info[4];
unsigned char a_text[4];
unsigned char a_data[4];
unsigned char a_bss[4];
unsigned char a_syms[4];
unsigned char a_entry[4];
unsigned char a_trsize[4];
unsigned char a_drsize[4];
};
/* How big the "struct exec" is on disk */
#define EXEC_BYTES_SIZE (8 * 4)
/* This is the layout in memory of a "struct exec" while we process it. */
struct exec
{
unsigned long a_info; /* Use macros N_MAGIC, etc for access */
unsigned a_text; /* length of text, in bytes */
unsigned a_data; /* length of data, in bytes */
unsigned a_bss; /* length of uninitialized data area for file, in bytes */
unsigned a_syms; /* length of symbol table data in file, in bytes */
unsigned a_entry; /* start address */
unsigned a_trsize; /* length of relocation info for text, in bytes */
unsigned a_drsize; /* length of relocation info for data, in bytes */
};
#endif /* __STRUCT_EXEC_OVERRIDE__ */
/* these go in the N_MACHTYPE field */
/* These symbols could be defined by code from Suns...punt 'em */
#undef M_UNKNOWN
#undef M_68010
#undef M_68020
#undef M_SPARC
enum machine_type {
M_UNKNOWN = 0,
M_68010 = 1,
M_68020 = 2,
M_SPARC = 3,
/* skip a bunch so we don't run into any of sun's numbers */
M_386 = 100,
M_29K = 101,
M_RS6000 = 102, /* IBM RS/6000 */
/* HP/BSD formats */
M_HP200 = 200, /* hp200 (68010) BSD binary */
M_HP300 = 300, /* hp300 (68020+68881) BSD binary */
M_HPUX23 = 0x020C, /* hp200/300 HPUX binary */
};
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
#define N_SET_INFO(exec, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24))
#define N_SET_MAGIC(exec, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
#define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
#define N_SET_FLAGS(exec, flags) \
((exec).a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
/* Code indicating object file or impure executable. */
#define OMAGIC 0407
/* Code indicating pure executable. */
#define NMAGIC 0410
/* Code indicating demand-paged executable. */
#define ZMAGIC 0413
/* Virtual Address of text segment from the a.out file. For OMAGIC,
(almost always "unlinked .o's" these days), should be zero.
For linked files, should reflect reality if we know it. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) (N_MAGIC(x)==OMAGIC? 0 : TEXT_START_ADDR)
#endif
#ifndef N_BADMAG
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
#endif
/* By default, segment size is constant. But on some machines, it can
be a function of the a.out header (e.g. machine type). */
#ifndef N_SEGSIZE
#define N_SEGSIZE(x) SEGMENT_SIZE
#endif
/* This complexity is for encapsulated COFF support */
#ifndef _N_HDROFF
#define _N_HDROFF(x) (N_SEGSIZE(x) - sizeof (struct exec))
#endif
#ifndef N_TXTOFF
#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? \
_N_HDROFF((x)) + sizeof (struct exec) : \
sizeof (struct exec))
#endif
#ifndef N_DATOFF
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#endif
#ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#endif
#ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#endif
#ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#endif
#ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
#endif
/* Address of text segment in memory after it is loaded. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) 0
#endif
#ifndef N_DATADDR
#define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1))))
#endif
/* Address of bss segment in memory after it is loaded. */
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx;
} n_un;
unsigned char n_type;
char n_other;
short n_desc;
unsigned long n_value;
};
#define N_UNDF 0
#define N_ABS 2
#define N_TEXT 4
#define N_DATA 6
#define N_BSS 8
#define N_COMM 0x12 /* common (visible in shared lib commons) */
#define N_FN 0x1F /* File name of a .o file */
/* Note: N_EXT can only usefully be OR-ed with N_UNDF, N_ABS, N_TEXT,
N_DATA, or N_BSS. When the low-order bit of other types is set,
(e.g. N_WARNING versus N_FN), they are two different types. */
#define N_EXT 1
#define N_TYPE 036
#define N_STAB 0340
/* The following type indicates the definition of a symbol as being
an indirect reference to another symbol. The other symbol
appears as an undefined reference, immediately following this symbol.
Indirection is asymmetrical. The other symbol's value will be used
to satisfy requests for the indirect symbol, but not vice versa.
If the other symbol does not have a definition, libraries will
be searched to find a definition. */
#define N_INDR 0xa
/* The following symbols refer to set elements.
All the N_SET[ATDB] symbols with the same name form one set.
Space is allocated for the set in the text section, and each set
element's value is stored into one word of the space.
The first word of the space is the length of the set (number of elements).
The address of the set is made into an N_SETV symbol
whose name is the same as the name of the set.
This symbol acts like a N_DATA global symbol
in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
/* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
/* Warning symbol. The text gives a warning message, the next symbol
in the table will be undefined. When the symbol is referenced, the
message is printed. */
#define N_WARNING 0x1e
/* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures,
all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */
/* The following enum and struct were borrowed from SunOS's
/usr/include/sun4/a.out.h and extended to handle
other machines. It is currently used on SPARC and AMD 29000.
reloc_ext_bytes is how it looks on disk. reloc_info_extended is
how we might process it on a native host. */
struct reloc_ext_bytes {
unsigned char r_address[4];
unsigned char r_index[3];
unsigned char r_bits[1];
unsigned char r_addend[4];
};
#define RELOC_EXT_BITS_EXTERN_BIG 0x80
#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01
#define RELOC_EXT_BITS_TYPE_BIG 0x1F
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
#define RELOC_EXT_SIZE 12 /* Bytes per relocation entry */
struct reloc_info_extended
{
unsigned long r_address;
unsigned int r_index:24;
# define r_symbolnum r_index
unsigned r_extern:1;
unsigned :2;
/* RS/6000 compiler does not support enum bitfield
enum reloc_type r_type:5; */
enum reloc_type r_type;
long int r_addend;
};
/* The standard, old-fashioned, Berkeley compatible relocation struct */
struct reloc_std_bytes {
unsigned char r_address[4];
unsigned char r_index[3];
unsigned char r_bits[1];
};
#define RELOC_STD_BITS_PCREL_BIG 0x80
#define RELOC_STD_BITS_PCREL_LITTLE 0x01
#define RELOC_STD_BITS_LENGTH_BIG 0x60
#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */
#define RELOC_STD_BITS_LENGTH_LITTLE 0x06
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
#define RELOC_STD_BITS_EXTERN_BIG 0x10
#define RELOC_STD_BITS_EXTERN_LITTLE 0x08
#define RELOC_STD_BITS_BASEREL_BIG 0x08
#define RELOC_STD_BITS_BASEREL_LITTLE 0x08
#define RELOC_STD_BITS_JMPTABLE_BIG 0x04
#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04
#define RELOC_STD_BITS_RELATIVE_BIG 0x02
#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02
#define RELOC_STD_SIZE 8 /* Bytes per relocation entry */
#ifndef CUSTOM_RELOC_FORMAT
struct relocation_info
{
/* Address (within segment) to be relocated. */
int r_address;
/* The meaning of r_symbolnum depends on r_extern. */
unsigned int r_symbolnum:24;
/* Nonzero means value is a pc-relative offset
and it should be relocated for changes in its own address
as well as for changes in the symbol or section specified. */
unsigned int r_pcrel:1;
/* Length (as exponent of 2) of the field to be relocated.
Thus, a value of 2 indicates 1<<2 bytes. */
unsigned int r_length:2;
/* 1 => relocate with value of symbol.
r_symbolnum is the index of the symbol
in file's the symbol table.
0 => relocate with the address of a segment.
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
(the N_EXT bit may be set also, but signifies nothing). */
unsigned int r_extern:1;
/* The next three bits are for SunOS shared libraries, and seem to
be undocumented. */
unsigned int r_baserel:1; /* Linkage table relative */
unsigned int r_jmptable:1; /* pc-relative to jump table */
#ifdef TC_NS32K
#define r_bsr r_baserel
#define r_disp r_jmptable
#endif /* TC_NS32K */
unsigned int r_relative:1; /* "relative relocation" */
/* unused */
unsigned int r_pad:1; /* Padding -- set to zero */
};
#endif /* CUSTOM_RELOC_FORMAT */
#endif /* __A_OUT_GNU_H__ */
/* end of a.out.gnu.h */

446
gas/config.sub vendored
View File

@ -1,446 +0,0 @@
#!/bin/sh
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration (e.g. a typo).
# Please email any bugs, comments, and/or additions to this file to:
# configure@cygnus.com
# decode aliases into canonical names
case "$1" in
# cpu alone is a valid alias for cpu-none-none.
vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
| alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
| romp | rs6000 | i960 | h8300)
cpu=$1
vendor=none
os=none
;;
altos | altos3068)
cpu=m68k
vendor=altos
os=sysv # maybe?
;;
altosgas)
cpu=m68k
vendor=altos
os=gas
;;
am29k)
cpu=a29k
vendor=none
os=bsd
;;
amdahl)
cpu=580
vendor=amdahl
os=uts
;;
amigados)
cpu=m68k
vendor=cbm
os=amigados # Native AmigaDOS
;;
amigaunix | amix)
cpu=m68k
vendor=cbm
os=svr4 # System V Release 4 (svr4 is an industry recognized acronym)
;;
apollo68)
cpu=m68k
vendor=apollo
os=sysv # maybe?
;;
balance)
cpu=ns32k
vendor=sequent
os=dynix
;;
convex-c1)
cpu=c1
vendor=convex
os=sysv # maybe?
;;
convex-c2)
cpu=c2
vendor=convex
os=sysv # maybe?
;;
cray | ymp)
cpu=ymp
vendor=cray
os=unicos
;;
cray2)
cpu=cray2
vendor=cray
os=unicos
;;
dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin)
cpu=mips
vendor=dec
os=ultrix
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
cpu=m68k
vendor=motorola
os=sysv # maybe?
;;
delta88)
cpu=m88k
vendor=motorola
os=m88kbcs
;;
gmicro)
cpu=tron
vendor=gmicro
os=sysv # maybe?
;;
h8300hds)
cpu=h8300
vendor=hitachi
os=hds
;;
# start-sanitize-v9
hal-32 | hal32)
cpu=sparc64
vendor=hal
os=hal32
;;
hal-64 | hal64)
cpu=sparc64
vendor=hal
os=hal64
;;
sparc64)
cpu=sparc64
vendor=sun
os=v9
;;
sparc64-v7 | sparc64v7)
cpu=sparc64
vendor=sun
os=v7
;;
# end-sanitize-v9
hp300bsd)
cpu=m68k
vendor=hp
os=bsd
;;
hp300hpux | hpux | hp9k3[2-9][0-9])
cpu=m68k
vendor=hp
os=hpux
;;
hp9k31[0-9] | hp9k2[0-9][0-9])
cpu=m68000
vendor=hp
os=hpux
;;
i386sco)
cpu=i386
vendor=sco
os=sysv # maybe?
;;
i386v)
cpu=i386
vendor=none
os=sysv
;;
i386v32)
cpu=i386
vendor=none
os=sysv32
;;
iris | iris4d)
cpu=mips
vendor=sgi
os=irix # maybe?
;;
dpx2)
vendor=bull
cpu=m68k
os=sysv
;;
isi | isi68)
cpu=m68k
vendor=isi
os=sysv # maybe?
;;
littlemips)
cpu=mips
vendor=little
os=bsd
;;
magnum | m3230)
cpu=mips
vendor=mips
os=sysv # maybe?
;;
merlin)
cpu=ns32k
vendor=utek
os=sysv # maybe?
;;
miniframe)
cpu=m68000
vendor=convergent
os=sysv # maybe?
;;
mmax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
news | news700 | news800 | news900)
cpu=m68k
vendor=sony
os=newsos3 # Based on bsd-4.3
;;
news1000)
cpu=m68030
vendor=sony
os=newsos3 # ?
;;
news-3600 | bigmips | risc-news)
cpu=mips
vendor=sony
os=newsos4 # Presumably?
;;
next)
cpu=m68k
vendor=next
os=sysv # maybe?
;;
nindy960)
cpu=i960
vendor=intel
os=nindy
;;
none)
cpu=none
vendor=none
os=none
;;
np1)
cpu=np1
vendor=gould
os=sysv # maybe?
;;
rtpc)
cpu=romp
vendor=ibm
os=aix # maybe?
;;
pbd)
cpu=sparc
vendor=unicom
os=sysv
;;
pn)
cpu=pn
vendor=gould
os=sysv # maybe?
;;
ps2)
cpu=i386
vendor=ibm
os=sysv # maybe?
;;
sun2)
cpu=m68000
vendor=sun
os=sunos4
;;
sun2os3)
cpu=m68000
vendor=sun
os=sunos3
;;
sun2os4)
cpu=m68000
vendor=sun
os=sunos4
;;
sun3)
cpu=m68k
vendor=sun
os=sunos4
;;
sun3os3)
cpu=m68k
vendor=sun
os=sunos3
;;
sun3os4)
cpu=m68k
vendor=sun
os=sunos4
;;
sun386 | roadrunner | sun386i)
cpu=i386
vendor=sun
os=sunos
;;
sun4)
cpu=sparc
vendor=sun
os=sunos4
;;
sun4os3)
cpu=sparc
vendor=sun
os=sunos3
;;
sun4os4)
cpu=sparc
vendor=sun
os=sunos4
;;
symmetry)
cpu=i386
vendor=sequent
os=dynix
;;
tower | tower-32)
cpu=m68k
vendor=ncr
os=sysv # maybe?
;;
ultra3)
cpu=a29k
vendor=nyu
os=sym1
;;
umax)
cpu=ns32k
vendor=encore
os=sysv # maybe?
;;
unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
cpu=m68k
vendor=att
os=sysv # maybe?
;;
vax-dec)
cpu=vax
vendor=dec
os=ultrix # maybe?
;;
vxworks68)
cpu=m68k
vendor=wrs
os=vxworks
;;
vxworks960)
cpu=i960
vendor=wrs
os=vxworks
;;
xmp)
cpu=xmp
vendor=cray
os=unicos
;;
# not an alias. parse what we expect to be a canonical name.
*)
cpu=`echo $1 | sed 's/-.*$//'`
if [ "${cpu}" = "$1" ] ; then
# no vendor so this is an invalid name.
echo '***' No vendor: configuration \`$1\' not recognized 1>&2
exit 1
else
# parse out vendor
rest=`echo $1 | sed "s/${cpu}-//"`
vendor=`echo ${rest} | sed 's/-.*$//'`
if [ "${vendor}" = "${rest}" ] ; then
# a missing os is acceptable
os=none
else
os=`echo ${rest} | sed "s/${vendor}-//"`
fi
fi
;;
esac
# At this point we should have three parts of a canonical name in cpu,
# vendor, and os.
# verify that the cpu is known.
case "${cpu}" in
none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \
| ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \
| a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300)
;;
# start-sanitize-v9
sparc64) ;;
# end-sanitize-v9
*)
echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the vendor is known.
case "${vendor}" in
altos | amdahl | aout | apollo | att | bcs | bout |\
cbm | convergent | convex | coff | cray | dec | encore |\
gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\
ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\
unicom | utek | wrs | bull ) ;;
# start-sanitize-v9
hal) ;;
# end-sanitize-v9
*)
echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
# verify that the os is known, if it exists.
case "${os}" in
aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \
| hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \
| osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \
| vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \
| amigados)
;;
# start-sanitize-v9
hal32 | hal64 | v7 | v9) ;;
# end-sanitize-v9
*)
echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2
exit 1
;;
esac
echo ${cpu}-${vendor}-${os}

View File

@ -1,289 +0,0 @@
Mon Nov 23 11:50:00 1992 Ken Raeburn (raeburn@cygnus.com)
* obj-coff.c (obj_coff_endef): Use as_warn, not fprintf.
* tc-m68k.c (md_assemble): Don't complain about 68000 with 68881;
could be doing emulation.
Tue Nov 10 09:50:25 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.c (m68k_reg_parse): If REGISTER_PREFIX isn't defined,
still accept (but don't require) OPTIONAL_REGISTER_PREFIX before
the register name.
(insert_reg): put REGISTER_PREFIX before register names before
putting them in the symbol table.
* tc-m68k.h (OPTIONAL_REGISTER_PREFIX): Define to be "%", if not
M68KCOFF.
* obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss
section.
* atof-ieee.c, atof-ns32k.c, tc-*.c: made EXP_CHARS, FLT_CHARS,
comment_chars, line_comment_chars and line_seperator_chars
consistently const, and always initialized them. Included read.h.
Thu Nov 5 17:55:41 1992 Jim Wilson (wilson@sphagnum.cygnus.com)
* tc-sparc.c (sparc_ip): Add code to flag error if an absolute
constant will not fit in an immediate field.
(md_apply_fix, RELOC_BASE13 case): Check for relocation overflow.
Wed Nov 4 07:50:46 1992 Ken Raeburn (raeburn@cygnus.com)
* obj-coff.c (callj_table): Delete global variable.
(obj_emit_relocations): Define it locally here, and only if
TC_I960 is defined.
* tc-m68k.c (m68k_reg_parse): Underscore is part of a symbol name.
(m68k_ip): Don't warn about bignum used as float bit-pattern.
* obj-coff.c: Replaced ANSI and non-ANSI function declarations
with a single set using PARAMS macro.
* tc-i960.c (tc_bout_fix_to_chars): Bit-field fixups want a length
of 2.
* tc-i960.c: Missed a couple of 0->NO_RELOC conversions.
* tc-i960.h (N_BALNAME, N_CALLNAME): Define as char-type values,
so widening works consistently.
Fri Oct 23 14:40:38 1992 Ian Lance Taylor (ian@cygnus.com)
* obj-coffbfd.c (write_object_file): check return value of
bfd_close_all_done.
Tue Oct 20 13:02:25 1992 Ian Lance Taylor (ian@cygnus.com)
* Support for i386-sysv.
obj-coffbfd.c (do_relocs_for, write_object_file): set segment
addresses to reasonable sizes. New define ZERO_BASED_SEGMENTS can
be used to set them all to zero as was done before.
(fill_section): segment addresses now set in write_object_file.
(fill_section): Don't set STYP_NOLOAD for .bss section.
(fixup_segment): 386 uses strange common symbol format.
tc-i386.c (tc_coff_fix2rtype): use R_DIR32, not R_RELLONG, for
compatibility with SVR3.2 linker.
Mon Oct 5 09:28:57 1992 Steve Chamberlain (sac@thepub.cygnus.com)
fix i960+non-bfd coff bit rot.
* obj-coff.c (c_dot_file_symbol, obj_coff_ln, obj_coff_line):
support for C source listings. (obj_coff_endef): look in the right
part of the symbol for the symbol name
* tc-m68k.c (get_num): make it work for all segments, not just the
first three.
Tue Sep 29 12:22:52 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* obj-coffbfd.c (write_object_file): don't fixup for the z8k
* tc-z8k.c: lots of bug fixes
Tue Sep 29 10:51:55 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-i960.h, tc-i960.c: avoid the ANSI preprocessor addition
#elif, since it is not supported by old compilers.
ho-rs6000.h, tc-m68k.c: the native RS/6000 compiler miscompiles a
couple of expressions in tc-m68k.c.
Mon Sep 28 21:16:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
* tc-i960.c (get_cdisp): Use NO_RELOC, not 0, in call to fix_new.
Fri Sep 25 18:18:52 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.h: if M68KCOFF, define DOT_LABEL_PREFIX (to require
local labels to start with a .) and set REGISTER_PREFIX to %.
tc-m68k.c (m68k_reg_parse): accept REGISTER_PREFIX if defined.
Tue Sep 22 13:02:07 1992 Sean Eric Fagan (sef@cygnus.com)
* obj-coffbfd.c (do_relocs_for,fill_section): now allocate all
sections starting from zero, rather than making them consecutive.
This makes subsequent reloc calculations easier, esp if the object
format doesn't understand addends. (obj_coff_lcomm): (maybe temporarily)
allocate lcomm in .data rather than in .bss. It seems that some
tools can't cope with a non-zero sized bss before linkage.
Tue Sep 22 15:10:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
* tc-m68k.c: Replace "enum m68k_architecture" with "int"
throughout. That enum no longer means what we thought it meant.
* tc-m68k.c (md_assemble, md_parse_option): Handle new
"-mno-688[58]1" options.
* tc-m68k.c: Added CPU32 support.
Fri Sep 18 08:02:18 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* tc-m68k.c (m68k_ip): An(disp) is not pc relative.
Sun Sep 13 20:29:39 1992 Ian Lance Taylor (ian@cygnus.com)
* obj-coffbfd.h: define WARN_SIGNED_OVERFLOW_WORD.
obj-coffbfd.c (fixup_segment): check for signed .word overflow if
WARN_SIGNED_OVERFLOW_WORD.
* obj-coffbfd.c (fixup_segment): fixed missing parens in
expression checking for byte or word overflow.
Fri Sep 11 10:21:04 1992 Steve Chamberlain (sac@thepub.cygnus.com)
Support for i386 coff
* obj-coffbfd.h : added stuff
* tc-i386.c (tc_coff_fix2rtype): new function
* tc-i386.h : new coff defines
Wed Sep 9 11:10:24 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.c (m68k_ip, m68k_ip_op, get_num, try_moto_index): merge
Motorola and MIT syntax; gas can now assemble either type of
file.
tc-m68kmote.c, tc-m68kmote.h: removed now superfluous files.
From Steve Chamberlain:
m68kcoff.mt: for m68k COFF.
obj-coffbfd.c: (fixup_mdeps) added
(size_section) removed bad sanity check
(fill_section) added rs_machine_dependent case
(write_object_file) call fixup_mdeps
(fixup_segment) set fx_subsy to 0.
obj-coffbfd.h: define WORKING_DOT_WORD (too hard to support) and
handle m68k.
tc-m68k.c, config/tc-m68k.h: added m68k COFF support and Motorala
pseudo ops.
Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com)
* obj-bout.h, obj-bout.c (obj_header_append, obj_symbol_to_chars),
tc-i960.c (md_ri_to_chars): Always output bout object file in
little endian byte order (used to use endianness of host).
Tue Aug 25 15:11:08 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* z8k.c, z8k.h, z8k.mt: z8000 support stuff
Mon Aug 24 12:45:12 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.c: use TARGET_CPU to choose default cpu type.
* te-generic.h: default to LOCAL_LABELS_DOLLAR and LOCAL_LABELS_FB
so that we can assemble hand-written libgcc code.
Wed Aug 19 11:20:59 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.c, tc-m68kmote.c: the cas2 instruction is supposed to be
written with indirection on the last two operands, which can be
either data or address registers. Added a new operand type 'r'
which accepts either register type. Added '(' to notend stuff in
tc-m68kmote.c to accept (a0):(a2) in cas2 instruction.
Tue Aug 11 12:58:14 1992 Ken Raeburn (raeburn@cygnus.com)
* sparc.mt: New file.
Mon Aug 10 14:37:08 1992 Per Bothner (bothner@cygnus.com)
* tc-m68k.c: ".align N" means align to N-byte boundary *only*
if TN_SUN3; otherwise align to 2**N-byte bounary.
Thu Aug 6 12:08:42 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* config/tc-h8300.c: if a :8 is seen after an operand, fill top
two bytes of any constant with 0xff:
Wed Aug 5 01:54:34 1992 John Gilmore (gnu at cygnus.com)
* tc-m68k.c (try_index): Error if index scaling specified and
assembling for an older CPU than a 68020.
Mon Jul 6 17:09:32 1992 Steve Chamberlain (sac@cygnus.com)
* obj-coffbfd.c (fill_section): mark .lit sections as STYP_LIT
Tue Jun 9 07:50:46 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* tc-m68k.c (m68kip): Fix typo so that only arch's >=68020 do
pcrel data stuff. (md_estimate_size_before_relax): when relaxing a
68010 bxx into a bra+6 jmpxx, put the bytes of the jmp opcode into
the right place. (s_bss): Don't put .bss stuff into SEG_DATA, put
it into SEG_BSS
Thu May 28 11:20:27 1992 Jim Wilson (wilson@sphagnum.cygnus.com)
* tc-sparc.c: Use new ARCHITECTURES_CONFLICT_P macro. Mention new
-Asparclite flag.
Mon May 4 18:56:19 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* obj-coffbfd.c: use is a synonym for section, (do_relocs_for):
calc the base of relocs correctly.
* tc-a29k.c (parse_operand): allow expressions to be in any section.
Thu Mar 12 04:42:38 1992 K. Richard Pixley (rich@cygnus.com)
* tc-m68k.h, te-sun3.h: moved LOCAL_LABELS_FB definition from
tc-m68k.h to te-sun3.h.
Wed Mar 11 23:34:46 1992 K. Richard Pixley (rich@cygnus.com)
* te-sun3.h: add LOCAL_LABELS_DOLLAR.
Fri Feb 21 06:22:15 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* obj-aout.c: do not include stab.gnu.h if NO_LISTING.
* tc-i860.c, a.out.gnu.h: move i860 relocs to a proper place.
* a.out.h: removed.
Fri Feb 21 02:17:22 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)
* tc-i386.c: tc-i386.c: added handling of the following opcodes:
i/o opcodes - inb, inw, outb and outw. string manipulation with
att syntax - scmp, slod, smov, ssca, ssto.
Fri Feb 21 01:53:50 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)
* obj-coff.c: (for aix386) Moved the symbols .text, .data and .bss
to just after .file .
In obj_crawl_symbol_chain() where it tries to put the external
symbols apart, with the condition:
(!S_IS_DEFINED(symbolP) &&
!S_IS_DEBUG(symbolP) &&
!SF_GET_STATICS(symbolP))
it was moving too many symbols out. So I switch it back to the
condition:
(S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP))
In obj_emit_relocations() added the conditional on KEEP_RELOC_INFO
so that we don't use the F_RELFLG which make the linker complain
that somebody has stripped the relocation info.
Also, the AIX ld program require that the relocation table
is sorted by r_vaddr like the standard ATT assembler does.
[he also changed the sizeof(struct ...)'s into the coff
style FOOSZ macros. I'm not sure this is right, but I can't
remember why. xoxorich.]
Tue Feb 18 02:11:10 1992 K. Richard Pixley (rich at cygnus.com)
* tc-m88k.[hc]: pulled in from hack's unfinished work. These
aren't yet integrated.
* tc-i860.[hc]: blew off the dust. Something must still be done
about conflicting relocation types.
* tc-ns32k.c: Replaced previous tc_aout_fix_to_chars stub with the
real thing.
* tc-i960.c, tc-sparc.c: white space and comments only.
* tc-a29k.h: delete duplicate macro definition.
* new file atof-ns32k.c copied from hack's last unreleased gas.

View File

@ -1,431 +0,0 @@
/* This file is a.out.gnu.h
Copyright (C) 1987-1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__
/* There are two main flavours of a.out, one which uses the standard
relocations, and one which uses extended relocations.
Today, the extended reloc uses are
TC_SPARC, TC_A29K
each must define the enum reloc_type
*/
#define USE_EXTENDED_RELOC (defined(TC_SPARC) || defined(TC_A29K))
#if defined(TC_SPARC) || defined(TC_A29K)
enum reloc_type {
RELOC_8, RELOC_16, RELOC_32, /* simple relocations */
RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* pc-rel displacement */
RELOC_WDISP30, RELOC_WDISP22,
RELOC_HI22, RELOC_22,
RELOC_13, RELOC_LO10,
RELOC_SFA_BASE, RELOC_SFA_OFF13,
RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* P.I.C. (base-relative) */
RELOC_PC10, RELOC_PC22, /* for some sort of pc-rel P.I.C. (?) */
RELOC_JMP_TBL, /* P.I.C. jump table */
RELOC_SEGOFF16, /* reputedly for shared libraries somehow */
RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE,
RELOC_11,
RELOC_WDISP2_14,
RELOC_WDISP19,
RELOC_HHI22,
RELOC_HLO10,
/* 29K relocation types */
RELOC_JUMPTARG, RELOC_CONST, RELOC_CONSTH,
RELOC_WDISP14, RELOC_WDISP21,
NO_RELOC,
};
#endif /* TC_SPARC or TC_A29K */
#define __GNU_EXEC_MACROS__
#ifndef __STRUCT_EXEC_OVERRIDE__
/* This is the layout on disk of a Unix V7, Berkeley, SunOS, Vax Ultrix
"struct exec". Don't assume that on this machine, the "struct exec"
will lay out the same sizes or alignments. */
struct exec_bytes {
unsigned char a_info[4];
unsigned char a_text[4];
unsigned char a_data[4];
unsigned char a_bss[4];
unsigned char a_syms[4];
unsigned char a_entry[4];
unsigned char a_trsize[4];
unsigned char a_drsize[4];
};
/* How big the "struct exec" is on disk */
#define EXEC_BYTES_SIZE (8 * 4)
/* This is the layout in memory of a "struct exec" while we process it. */
struct exec
{
unsigned long a_info; /* Use macros N_MAGIC, etc for access */
unsigned a_text; /* length of text, in bytes */
unsigned a_data; /* length of data, in bytes */
unsigned a_bss; /* length of uninitialized data area for file, in bytes */
unsigned a_syms; /* length of symbol table data in file, in bytes */
unsigned a_entry; /* start address */
unsigned a_trsize; /* length of relocation info for text, in bytes */
unsigned a_drsize; /* length of relocation info for data, in bytes */
};
#endif /* __STRUCT_EXEC_OVERRIDE__ */
/* these go in the N_MACHTYPE field */
/* These symbols could be defined by code from Suns...punt 'em */
#undef M_UNKNOWN
#undef M_68010
#undef M_68020
#undef M_SPARC
enum machine_type {
M_UNKNOWN = 0,
M_68010 = 1,
M_68020 = 2,
M_SPARC = 3,
/* skip a bunch so we don't run into any of sun's numbers */
M_386 = 100,
M_29K = 101,
M_RS6000 = 102, /* IBM RS/6000 */
/* HP/BSD formats */
M_HP200 = 200, /* hp200 (68010) BSD binary */
M_HP300 = 300, /* hp300 (68020+68881) BSD binary */
M_HPUX23 = 0x020C, /* hp200/300 HPUX binary */
};
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
#define N_SET_INFO(exec, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24))
#define N_SET_MAGIC(exec, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
#define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
#define N_SET_FLAGS(exec, flags) \
((exec).a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
/* Code indicating object file or impure executable. */
#define OMAGIC 0407
/* Code indicating pure executable. */
#define NMAGIC 0410
/* Code indicating demand-paged executable. */
#define ZMAGIC 0413
/* Virtual Address of text segment from the a.out file. For OMAGIC,
(almost always "unlinked .o's" these days), should be zero.
For linked files, should reflect reality if we know it. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) (N_MAGIC(x)==OMAGIC? 0 : TEXT_START_ADDR)
#endif
#ifndef N_BADMAG
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
#endif
/* By default, segment size is constant. But on some machines, it can
be a function of the a.out header (e.g. machine type). */
#ifndef N_SEGSIZE
#define N_SEGSIZE(x) SEGMENT_SIZE
#endif
/* This complexity is for encapsulated COFF support */
#ifndef _N_HDROFF
#define _N_HDROFF(x) (N_SEGSIZE(x) - sizeof (struct exec))
#endif
#ifndef N_TXTOFF
#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? \
_N_HDROFF((x)) + sizeof (struct exec) : \
sizeof (struct exec))
#endif
#ifndef N_DATOFF
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#endif
#ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#endif
#ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#endif
#ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#endif
#ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
#endif
/* Address of text segment in memory after it is loaded. */
#ifndef N_TXTADDR
#define N_TXTADDR(x) 0
#endif
#ifndef N_DATADDR
#define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1))))
#endif
/* Address of bss segment in memory after it is loaded. */
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx;
} n_un;
unsigned char n_type;
char n_other;
short n_desc;
unsigned long n_value;
};
#define N_UNDF 0
#define N_ABS 2
#define N_TEXT 4
#define N_DATA 6
#define N_BSS 8
#define N_COMM 0x12 /* common (visible in shared lib commons) */
#define N_FN 0x1F /* File name of a .o file */
/* Note: N_EXT can only usefully be OR-ed with N_UNDF, N_ABS, N_TEXT,
N_DATA, or N_BSS. When the low-order bit of other types is set,
(e.g. N_WARNING versus N_FN), they are two different types. */
#define N_EXT 1
#define N_TYPE 036
#define N_STAB 0340
/* The following type indicates the definition of a symbol as being
an indirect reference to another symbol. The other symbol
appears as an undefined reference, immediately following this symbol.
Indirection is asymmetrical. The other symbol's value will be used
to satisfy requests for the indirect symbol, but not vice versa.
If the other symbol does not have a definition, libraries will
be searched to find a definition. */
#define N_INDR 0xa
/* The following symbols refer to set elements.
All the N_SET[ATDB] symbols with the same name form one set.
Space is allocated for the set in the text section, and each set
element's value is stored into one word of the space.
The first word of the space is the length of the set (number of elements).
The address of the set is made into an N_SETV symbol
whose name is the same as the name of the set.
This symbol acts like a N_DATA global symbol
in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
/* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
/* Warning symbol. The text gives a warning message, the next symbol
in the table will be undefined. When the symbol is referenced, the
message is printed. */
#define N_WARNING 0x1e
/* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures,
all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */
/* The following enum and struct were borrowed from SunOS's
/usr/include/sun4/a.out.h and extended to handle
other machines. It is currently used on SPARC and AMD 29000.
reloc_ext_bytes is how it looks on disk. reloc_info_extended is
how we might process it on a native host. */
#if USE_EXTENDED_RELOC
struct reloc_ext_bytes {
unsigned char r_address[4];
unsigned char r_index[3];
unsigned char r_bits[1];
unsigned char r_addend[4];
};
#define RELOC_EXT_BITS_EXTERN_BIG 0x80
#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01
#define RELOC_EXT_BITS_TYPE_BIG 0x1F
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
#define RELOC_EXT_SIZE 12 /* Bytes per relocation entry */
struct reloc_info_extended
{
unsigned long r_address;
unsigned int r_index:24;
# define r_symbolnum r_index
unsigned r_extern:1;
unsigned :2;
/* RS/6000 compiler does not support enum bitfield
enum reloc_type r_type:5; */
enum reloc_type r_type;
long int r_addend;
};
#else
/* The standard, old-fashioned, Berkeley compatible relocation struct */
#ifdef TC_I860
/* NOTE: three bits max, see struct reloc_info_i860.r_type */
enum i860_reloc_type {
NO_RELOC = 0, BRADDR, LOW0, LOW1, LOW2, LOW3, LOW4, SPLIT0, SPLIT1, SPLIT2, RELOC_32,
};
typedef enum i860_reloc_type reloc_type;
/* NOTE: two bits max, see reloc_info_i860.r_type */
enum highlow_type {
NO_SPEC = 0, PAIR, HIGH, HIGHADJ,
};
struct reloc_info_i860
{
unsigned long r_address;
/*
* Using bit fields here is a bad idea because the order is not portable. :-(
*/
unsigned int r_symbolnum: 24;
unsigned int r_pcrel : 1;
unsigned int r_extern : 1;
/* combining the two field simplifies the argument passing in "new_fix()" */
/* and is compatible with the existing Sparc #ifdef's */
/* r_type: highlow_type - bits 5,4; reloc_type - bits 3-0 */
unsigned int r_type : 6;
long r_addend;
};
#endif /* TC_I860 */
struct reloc_std_bytes {
unsigned char r_address[4];
unsigned char r_index[3];
unsigned char r_bits[1];
};
#define RELOC_STD_BITS_PCREL_BIG 0x80
#define RELOC_STD_BITS_PCREL_LITTLE 0x01
#define RELOC_STD_BITS_LENGTH_BIG 0x60
#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */
#define RELOC_STD_BITS_LENGTH_LITTLE 0x06
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
#define RELOC_STD_BITS_EXTERN_BIG 0x10
#define RELOC_STD_BITS_EXTERN_LITTLE 0x08
#define RELOC_STD_BITS_BASEREL_BIG 0x08
#define RELOC_STD_BITS_BASEREL_LITTLE 0x08
#define RELOC_STD_BITS_JMPTABLE_BIG 0x04
#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04
#define RELOC_STD_BITS_RELATIVE_BIG 0x02
#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02
#define RELOC_STD_SIZE 8 /* Bytes per relocation entry */
#endif /* USE_EXTENDED_RELOC */
#ifndef CUSTOM_RELOC_FORMAT
struct relocation_info
{
/* Address (within segment) to be relocated. */
int r_address;
/* The meaning of r_symbolnum depends on r_extern. */
unsigned int r_symbolnum:24;
/* Nonzero means value is a pc-relative offset
and it should be relocated for changes in its own address
as well as for changes in the symbol or section specified. */
unsigned int r_pcrel:1;
/* Length (as exponent of 2) of the field to be relocated.
Thus, a value of 2 indicates 1<<2 bytes. */
unsigned int r_length:2;
/* 1 => relocate with value of symbol.
r_symbolnum is the index of the symbol
in file's the symbol table.
0 => relocate with the address of a segment.
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
(the N_EXT bit may be set also, but signifies nothing). */
unsigned int r_extern:1;
/* The next three bits are for SunOS shared libraries, and seem to
be undocumented. */
unsigned int r_baserel:1; /* Linkage table relative */
unsigned int r_jmptable:1; /* pc-relative to jump table */
#ifdef TC_NS32K
#define r_bsr r_baserel
#define r_disp r_jmptable
#endif /* TC_NS32K */
unsigned int r_relative:1; /* "relative relocation" */
/* unused */
unsigned int r_pad:1; /* Padding -- set to zero */
};
#endif /* CUSTOM_RELOC_FORMAT */
#endif /* __A_OUT_GNU_H__ */
/* end of a.out.gnu.h */

View File

@ -1,150 +0,0 @@
/* This file describes the a.out file format
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef USE_HP_INC_HDR
#include "../binutils/hp-include/a.out.h"
#else
#ifdef USE_SYSTEM_HDR
#include "/usr/include/a.out.h"
#else
#ifdef USE_HP_HDR
/* The `exec' structure and overall layout must be close to HP's when
we are running on an HP system, otherwise we will not be able to
execute the resulting file. */
struct exec
{
unsigned short a_machtype; /* machine type */
unsigned short a_magic; /* magic number */
unsigned long a_spare1;
unsigned long a_spare2;
unsigned long a_text; /* length of text, in bytes */
unsigned long a_data; /* length of data, in bytes */
unsigned long a_bss; /* length of uninitialized data area for file, in bytes */
unsigned long a_trsize; /* length of relocation info for text, in bytes */
unsigned long a_drsize; /* length of relocation info for data, in bytes */
unsigned long a_spare3; /* HP = pascal interface size */
unsigned long a_spare4; /* HP = symbol table size */
unsigned long a_spare5; /* HP = debug name table size */
unsigned long a_entry; /* start address */
unsigned long a_spare6; /* HP = source line table size */
unsigned long a_spare7; /* HP = value table size */
unsigned long a_syms; /* length of symbol table data in file, in bytes */
unsigned long a_spare8;
};
#define N_MAGIC(exec) ((exec) . a_magic)
#define N_MACHTYPE(exec) ((exec) . a_machtype)
#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic))
#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype))
#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x)))
#define _N_BADMACH(x) \
(((N_MACHTYPE (x)) != HP9000S200_ID) \
&& ((N_MACHTYPE (x)) != HP98x6_ID))
#define _N_BADMAG(x) \
(((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC)
#define HP98x6_ID 0x20A
#define HP9000S200_ID 0x20C
#else
/* A Generic machine. . . */
/* JF I'm not sure where this file came from. I put the permit.text message in
it anyway. This file came to me as part of the original VAX assembler, but had
no copyright notices in it. */
struct exec {
long a_magic; /* number identifies as .o file and gives type of such. */
unsigned a_text; /* length of text, in bytes */
unsigned a_data; /* length of data, in bytes */
unsigned a_bss; /* length of uninitialized data area for file, in bytes */
unsigned a_syms; /* length of symbol table data in file, in bytes */
unsigned a_entry; /* start address */
unsigned a_trsize; /* length of relocation info for text, in bytes */
unsigned a_drsize; /* length of relocation info for data, in bytes */
};
#define N_BADMAG(x) \
(((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC)
#endif
/* From here down is common to both the HP and the generic machine */
#define OMAGIC 0407
#define NMAGIC 0410
#define ZMAGIC 0413
#define N_TXTOFF(x) \
((x).a_magic == ZMAGIC ? 1024 : sizeof(struct exec))
#define N_SYMOFF(x) \
(N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize)
#define N_STROFF(x) \
(N_SYMOFF(x) + (x).a_syms)
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx;
} n_un;
char n_type;
char n_other;
short n_desc;
unsigned n_value;
};
#define N_UNDF 0
#define N_ABS 2
#define N_TEXT 4
#define N_DATA 6
#define N_BSS 8
#define N_FN 31 /* JF: Someone claims this should be 31 instead of
15. I just inherited this file; I didn't write
it. Who is right? */
#define N_EXT 1
#define N_TYPE 036
#define N_STAB 0340
struct relocation_info {
int r_address;
unsigned r_symbolnum:24;
unsigned r_pcrel:1;
unsigned r_length:2;
unsigned r_extern:1;
unsigned r_bsr:1; /* OVE: used on ns32k based systems, if you want */
unsigned r_disp:1; /* OVE: used on ns32k based systems, if you want */
unsigned nuthin:2;
};
#endif
#endif
/* end of a.out.h */

View File

@ -1,783 +0,0 @@
/* coff.gnu.h
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* At this point I'm sure this file is right for i960 and I'm pretty sure it's
* right for a29k, although it hasn't been tested rigorously. Please feel free
* to add your own machine's description here. Without that info, it isn't
* possible to build cross development tools from elsewhere nor is it easy to
* continue to support your machines format.
*
* The TC_foo ifdef's are mine. They are what gas uses. The other ifdef's
* remain for documentation from other scavenged files. xoxorich.
*/
/********************** FILE HEADER **********************/
struct filehdr {
unsigned short f_magic; /* magic number */
unsigned short f_nscns; /* number of sections */
long f_timdat; /* time & date stamp */
long f_symptr; /* file pointer to symtab */
long f_nsyms; /* number of symtab entries */
unsigned short f_opthdr; /* sizeof(optional hdr) */
unsigned short f_flags; /* flags */
};
/* Bits for f_flags:
* F_RELFLG relocation info stripped from file
* F_EXEC file is executable (no unresolved externel references)
* F_LNNO line nunbers stripped from file
* F_LSYMS local symbols stripped from file
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
*/
#define F_RELFLG (0x0001)
#define F_EXEC (0x0002)
#define F_LNNO (0x0004)
#define F_LSYMS (0x0008)
#ifdef TC_I960
#define F_AR32WR (0x0010) /* File has 32 bits per word, least
significant byte first. */
#else /* TC_I960 */
#define F_AR32WR (0x0100)
#endif /* TC_I960 */
#define F_MINMAL (0x0010) /* ??? */
#define F_UPDATE (0x0020) /* ??? */
#define F_SWABD (0x0040) /* ??? */
#define F_AR16WR (0x0080) /* File has the byte ordering used by
the PDP*-11/70 processor. */
#define F_AR32W (0x0200) /* File has 32 bits per word, most
significant byte first. */
/*
* Intel 80960 (I960) processor flags.
* F_I960TYPE == mask for processor type field.
*/
#define F_I960TYPE (0xf000)
#define F_I960CORE (0x1000)
#define F_I960KB (0x2000)
#define F_I960SB (0x2000)
#define F_I960MC (0x3000)
#define F_I960XA (0x4000)
#define F_I960CA (0x5000)
#define F_I960KA (0x6000)
#define F_I960SA (0x6000)
/*
* i80960 Magic Numbers
*/
#define I960ROMAGIC (0x160) /* read-only text segments */
#define I960RWMAGIC (0x161) /* read-write text segments */
#define I960BADMAG(x) (((x).f_magic != I960ROMAGIC) && ((x).f_magic != I960RWMAGIC))
#define SIPFBOMAGIC (0x17a) /* Am29000 (Byte 0 is MSB - Big Endian) */
#define SIPRBOMAGIC (0x17b) /* Am29000 (Byte 0 is LSB - Little Endian) */
#define A29KBADMAG(x) (((x).f_magic != SIPFBOMAGIC) && ((x).f_magic != SIPRBOMAGIC))
#ifdef TE_I386AIX
# define I386MAGIC (0x175) /* Danbury AIX C compiler */
# define I386SVMAGIC (0x14c) /* System V C Compiler */
# define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && \
((x).f_magic!=I386SVMAGIC))
#else /* not TE_I386AIX */
# define I386MAGIC 0x14c
# define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
#endif /* not TE_I386AIX */
#define FILHDR struct filehdr
#define FILHSZ sizeof(FILHDR)
/********************** AOUT "OPTIONAL HEADER" **********************/
typedef struct {
unsigned long phys_addr;
unsigned long bitarray;
} TAGBITS;
/* These appear to be used only by exec(2). I don't know who cares
about them in a cross development environment. In any case, this
is my collection after researching the issue for a few hours.
Apparently, most have these have remained essentially unchanged
since v7 days, although a few new ones have been added. xoxorich. */
#define BAD0MAGIC (0401) /* (?) "lpd (UNIX/RT)" */
#define BAD1MAGIC (0405) /* (?) overlay */
#define OMAGIC (0407) /* old impure format. data immediately
follows text. both sections are rw. */
#define NMAGIC (0410) /* split i&d, read-only text */
#define A_MAGIC3 (0411) /* (?) "separated I&D" */
#define ZMAGIC (0413) /* like NMAGIC, but demand loaded */
#define PAGEMAGIC2 (0414) /* (?) like ZMAGIC, but address zero
explicitly unmapped. */
#define REGMAGIC (0414) /* (?) a PAGEMAGIC2 alias? */
#define PAGEMAGIC3 (0415) /* (?) like ZMAGIC, but address zero mapped. */
#define A_MAGIC5 (0437) /* (?) "system overlay, separated I&D" */
/* intended for non-unix cross development */
#define SASMAGIC (010000) /* Single Address Space */
#define MASMAGIC (020000) /* (?) "Multiple (separate I & D) Address Spaces" */
typedef struct aouthdr {
short magic; /* type of file */
short vstamp; /* version stamp */
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
unsigned long dsize; /* initialized data " " */
unsigned long bsize; /* uninitialized data " " */
#if U3B
unsigned long dum1;
unsigned long dum2; /* pad to entry point */
#endif
unsigned long entry; /* entry pt. */
unsigned long text_start; /* base of text used for this file */
unsigned long data_start; /* base of data used for this file */
/* CAREFUL: some formats omit the tagentries member. */
unsigned long tagentries; /* number of tag entries to
follow (always zero for i960) */
} AOUTHDR;
/* return a pointer to the tag bits array */
#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
/* compute size of a header */
/*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
#define AOUTSZ (sizeof(AOUTHDR))
/********************** STORAGE CLASSES **********************/
#define C_EFCN -1 /* physical end of function */
#define C_NULL 0
#define C_AUTO 1 /* automatic variable */
#define C_EXT 2 /* external symbol */
#define C_STAT 3 /* static */
#define C_REG 4 /* register variable */
#define C_EXTDEF 5 /* external definition */
#define C_LABEL 6 /* label */
#define C_ULABEL 7 /* undefined label */
#define C_MOS 8 /* member of structure */
#define C_ARG 9 /* function argument */
#define C_STRTAG 10 /* structure tag */
#define C_MOU 11 /* member of union */
#define C_UNTAG 12 /* union tag */
#define C_TPDEF 13 /* type definition */
#define C_USTATIC 14 /* undefined static */
#define C_ENTAG 15 /* enumeration tag */
#define C_MOE 16 /* member of enumeration */
#define C_REGPARM 17 /* register parameter */
#define C_FIELD 18 /* bit field */
#ifdef TC_I960
#define C_AUTOARG 19 /* auto argument */
#define C_LASTENT 20 /* dummy entry (end of block) */
#endif /* TC_I960 */
#ifdef TC_A29K
#define C_GLBLREG 19 /* global register */
#define C_EXTREG 20 /* external global register */
#define C_DEFREG 21 /* ext. def. of global register */
#define C_STARTOF 22 /* as29 $SIZEOF and $STARTOF symbols */
#endif /* TC_A29K */
#define C_BLOCK 100 /* ".bb" or ".eb" */
#define C_FCN 101 /* ".bf" or ".ef" */
#define C_EOS 102 /* end of structure */
#define C_FILE 103 /* file name */
#define C_LINE 104 /* line # reformatted as symbol table entry */
#define C_ALIAS 105 /* duplicate tag */
#define C_HIDDEN 106 /* ext symbol in dmert public lib. like static,
used to avoid name conflicts. */
#ifdef TC_I960
/* New storage classes for 80960 */
#define C_SCALL 107 /* Procedure reachable via system call */
/* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */
#define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */
#define C_LEAFEXT 108
#define C_OPTVAR 109 /* Optimized variable */
#define C_DEFINE 110 /* Preprocessor #define */
#define C_PRAGMA 111 /* Advice to compiler or linker */
#define C_SEGMENT 112 /* 80960 segment name */
#define C_LEAFSTAT 113 /* Static leaf */
#endif /* TC_I960 */
#ifdef TC_A29K
#define C_SHADOW 107 /* shadow symbol */
#endif /* TC_A29K */
/********************** SECTION HEADER **********************/
struct scnhdr {
char s_name[8]; /* section name */
long s_paddr; /* physical address, aliased s_nlib */
long s_vaddr; /* virtual address */
long s_size; /* section size */
long s_scnptr; /* file ptr to raw data for section */
long s_relptr; /* file ptr to relocation */
long s_lnnoptr; /* file ptr to line numbers */
unsigned short s_nreloc; /* number of relocation entries */
unsigned short s_nlnno; /* number of line number entries */
long s_flags; /* flags */
#ifdef TC_I960
unsigned long s_align; /* section alignment */
#endif /* TC_I960 */
};
#define SCNHDR struct scnhdr
#define SCNHSZ sizeof(SCNHDR)
/*
* names of "special" sections
*/
#define _TEXT ".text" /* executable code section */
#define _DATA ".data" /* initialized data */
#define _BSS ".bss" /* un-initialized data */
#define _DEBUG ".debug" /* special section used by dbx */
#define _COMMENT ".comment" /* version info */
#define _LIB ".lib" /* shared lib info section */
#define _TV ".tv"
/*
* s_flags "type"
*/
/*
* In instances where it is necessary for a linker to
* produce an output file which contains text or data not
* based at virtual address 0, e.g. for a ROM, then the
* linker should accept address base information as command
* input and use PAD sections to skip over unused addresses.
* (at least for a29k. Maybe others.)
*/
#define STYP_REG (0x0000) /* "regular" section: allocated, relocated, loaded */
#define STYP_DSECT (0x0001) /* "dummy" section: not allocated, relocated, not loaded */
#define STYP_NOLOAD (0x0002) /* "noload" section: allocated, relocated, not loaded */
#define STYP_GROUP (0x0004) /* "grouped" section: formed of input sections */
#define STYP_PAD (0x0008) /* "padding" section: not allocated, not relocated, loaded */
#define STYP_COPY (0x0010) /* "copy" section: for decision function used by field update; not allocated, not relocated,
loaded; reloc & lineno entries processed normally */
#define STYP_TEXT (0x0020) /* section contains text only */
#define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
update all process invocations. */
#define STYP_DATA (0x0040) /* section contains data only */
#define STYP_BSS (0x0080) /* section contains bss only */
#define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
#define STYP_INFO (0x0200) /* comment section : not allocated not relocated, not loaded */
#define STYP_OVER (0x0400) /* overlay section : relocated not allocated or loaded */
#define STYP_LIB (0x0800) /* for .lib section : same as INFO */
#define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
word of contiguous bytes beginning on a word boundary. */
#ifdef TC_A29K
/* NOTE: The use of STYP_BSSREG for relocation is not yet defined. */
#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
#define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */
#endif /* TC_A29K */
/********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section.
* Line numbers are grouped on a per function basis; first entry in a function
* grouping will have l_lnno = 0 and in place of physical address will be the
* symbol table index of the function name.
*/
struct lineno {
union {
long l_symndx; /* symbol index of function name, iff l_lnno == 0*/
long l_paddr; /* (physical) address of line number */
} l_addr;
unsigned short l_lnno; /* line number */
#ifdef TC_I960
/* not used on a29k */
char padding[2]; /* force alignment */
#endif /* TC_I960 */
};
#define LINENO struct lineno
#define LINESZ sizeof(LINENO)
/********************** SYMBOLS **********************/
#define SYMNMLEN 8 /* # characters in a symbol name */
#define FILNMLEN 14 /* # characters in a file name */
#define DIMNUM 4 /* # array dimensions in auxiliary entry */
struct syment {
union {
char _n_name[SYMNMLEN]; /* old COFF version */
struct {
long _n_zeroes; /* new == 0 */
long _n_offset; /* offset into string table */
} _n_n;
char *_n_nptr[2]; /* allows for overlaying */
} _n;
long n_value; /* value of symbol */
short n_scnum; /* section number */
#ifdef TC_I960
/* This isn't yet used on the i960. In some formats this
is two bytes of padding. In others, it is missing entirely. */
unsigned short n_flags; /* copy of flags from filhdr */
#endif /* TC_I960 */
#ifdef TC_A29K
unsigned short n_type; /* type and derived type */
#else /* TC_A29K */
/* at least i960 uses long */
unsigned long n_type; /* type and derived type */
#endif /* TC_A29K */
char n_sclass; /* storage class */
char n_numaux; /* number of aux. entries */
#ifndef TC_A29K
char pad2[2]; /* force alignment */
#endif /* TC_A29K */
};
#define SYMENT struct syment
#define SYMESZ sizeof(SYMENT) /* This had better also be sizeof(AUXENT) */
#define n_name _n._n_name
#define n_ptr _n._n_nptr[1]
#define n_zeroes _n._n_n._n_zeroes
#define n_offset _n._n_n._n_offset
/*
* Relocatable symbols have number of the section in which they are defined,
* or one of the following:
*/
#define N_SCNUM ((short) 1-65535) /* section num where symbol defined */
#define N_UNDEF ((short)0) /* undefined symbol */
#define N_ABS ((short)-1) /* value of symbol is absolute */
#define N_DEBUG ((short)-2) /* debugging symbol -- symbol value is meaningless */
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
#define P_TV ((short)-4) /* indicates symbol needs transfer vector (postload) */
/*
* Type of a symbol, in low 4 bits of the word
*/
#define T_NULL 0 /* type not assigned */
#define T_VOID 1 /* function argument (only used by compiler) (but now real void). */
#define T_CHAR 2 /* character */
#define T_SHORT 3 /* short integer */
#define T_INT 4 /* integer */
#define T_LONG 5 /* long integer */
#define T_FLOAT 6 /* floating point */
#define T_DOUBLE 7 /* double word */
#define T_STRUCT 8 /* structure */
#define T_UNION 9 /* union */
#define T_ENUM 10 /* enumeration */
#define T_MOE 11 /* member of enumeration */
#define T_UCHAR 12 /* unsigned character */
#define T_USHORT 13 /* unsigned short */
#define T_UINT 14 /* unsigned integer */
#define T_ULONG 15 /* unsigned long */
#ifdef TC_I960
#define T_LNGDBL 16 /* long double */
#endif /* TC_I960 */
/*
* derived types, in n_type
*/
#define DT_NON (0) /* no derived type */
#define DT_PTR (1) /* pointer */
#define DT_FCN (2) /* function */
#define DT_ARY (3) /* array */
#ifndef TC_I960
#define N_BTMASK (0x0f)
#define N_TMASK (0x30)
#define N_BTSHFT (4)
#define N_TSHIFT (2)
#else /* TC_I960 */
#define N_BTMASK (0x1f)
#define N_TMASK (0x60)
#define N_BTSHFT (5)
#define N_TSHIFT (2)
#endif /* TC_I960 */
#define BTYPE(x) ((x) & N_BTMASK)
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
union auxent {
struct {
long x_tagndx; /* str, un, or enum tag indx */
union {
struct {
unsigned short x_lnno; /* declaration line number */
unsigned short x_size; /* str/union/array size */
} x_lnsz;
long x_fsize; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
long x_lnnoptr; /* ptr to fcn line # */
long x_endndx; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
unsigned short x_dimen[DIMNUM];
} x_ary;
} x_fcnary;
unsigned short x_tvndx; /* tv index */
} x_sym;
/* This was just a struct x_file with x_fname only in a29k. xoxorich. */
union {
char x_fname[FILNMLEN];
struct {
long x_zeroes;
long x_offset;
} x_n;
} x_file;
struct {
long x_scnlen; /* section length */
unsigned short x_nreloc; /* # relocation entries */
unsigned short x_nlinno; /* # line numbers */
} x_scn;
struct {
long x_tvfill; /* tv fill value */
unsigned short x_tvlen; /* length of .tv */
/* This field was typo'd x_tvrna on a29k. xoxorich. */
unsigned short x_tvran[2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
#ifdef TC_I960
/******************************************
* I960-specific *2nd* aux. entry formats
******************************************/
struct {
/* This is a very old typo that keeps getting propogated. */
#define x_stdindx x_stindx
long x_stindx; /* sys. table entry */
} x_sc; /* system call entry */
struct {
unsigned long x_balntry; /* BAL entry point */
} x_bal; /* BAL-callable function */
struct {
unsigned long x_timestamp; /* time stamp */
char x_idstring[20]; /* producer identity string */
} x_ident; /* Producer ident info */
char a[sizeof(struct syment)]; /* force auxent/syment sizes to match */
#endif /* TC_I960 */
};
#define AUXENT union auxent
#define AUXESZ sizeof(AUXENT) /* This had better also be sizeof(SYMENT) */
#if VAX || I960
# define _ETEXT "_etext"
#else
# define _ETEXT "etext"
#endif
/********************** RELOCATION DIRECTIVES **********************/
struct reloc {
long r_vaddr; /* Virtual address of reference */
long r_symndx; /* Index into symbol table */
unsigned short r_type; /* Relocation type */
#ifdef TC_I960
/* not used for a29k */
char pad[2]; /* Unused */
#endif /* TC_I960 */
};
#define RELOC struct reloc
#define RELSZ sizeof(RELOC)
#define R_ABS (0x00) /* reference is absolute */
#ifdef TC_I960
#define R_RELLONG (0x11) /* Direct 32-bit relocation */
#define R_IPRSHORT (0x18)
#define R_IPRMED (0x19) /* 24-bit ip-relative relocation */
#define R_IPRLONG (0x1a)
#define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
#define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
#define R_GETSEG (0x1d)
#define R_GETPA (0x1e)
#define R_TAGWORD (0x1f)
#endif /* TC_I960 */
#ifdef TC_A29K
/*
* NOTE: All the "I" forms refer to Am29000 instruction
* formats. The linker is expected to know how the numeric
* information is split and/or aligned within the
* instruction word(s). R_BYTE works for instructions, too.
*
* If the parameter to a CONSTH instruction is a relocatable
* type, two relocation records are written. The first has
* an r_type of R_IHIHALF (33 octal) and a normal r_vaddr
* and r_symndx. The second relocation record has an r_type
* of R_IHCONST (34 octal), a normal r_vaddr (which is
* redundant), and an r_symndx containing the 32-bit
* constant offset to the relocation instead of the actual
* symbol table index. This second record is always
* written, even if the constant offset is zero. The
* constant fields of the instruction are set to zero.
*/
#define R_IREL (0x18) /* instruction relative (jmp/call) */
#define R_IABS (0x19) /* instruction absolute (jmp/call) */
#define R_ILOHALF (0x1a) /* instruction low half (const) */
#define R_IHIHALF (0x1b) /* instruction high half (consth) part 1 */
#define R_IHCONST (0x1c) /* instruction high half (consth) part 2
constant offset of R_IHIHALF relocation */
#define R_BYTE (0x1d) /* relocatable byte value */
#define R_HWORD (0x1e) /* relocatable halfword value */
#define R_WORD (0x1f) /* relocatable word value */
#define R_IGLBLRC (0x20) /* instruction global register RC */
#define R_IGLBLRA (0x21) /* instruction global register RA */
#define R_IGLBLRB (0x22) /* instruction global register RB */
#endif /* TC_A29K */
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
#define DEFAULT_TEXT_SECTION_ALIGNMENT 16
/* For new sections we haven't heard of before */
#define DEFAULT_SECTION_ALIGNMENT 4
#if defined(TC_I386)
/*
* X86 generic
* 8-bit offset reference in 8-bits
* 8-bit offset reference in 16-bits
* 12-bit segment reference
* auxiliary relocation entry
*/
#define R_OFF8 07
#define R_OFF16 010
#define R_SEG12 011
#define R_AUX 013
/*
* B16 and X86 generics
* 16-bit direct reference
* 16-bit "relative" reference
* 16-bit "indirect" (TV) reference
*/
#define R_DIR16 01
#define R_REL16 02
#define R_IND16 03
/*
* 3B generic
* 24-bit direct reference
* 24-bit "relative" reference
* 16-bit optimized "indirect" TV reference
* 24-bit "indirect" TV reference
* 32-bit "indirect" TV reference
*/
#define R_DIR24 04
#define R_REL24 05
#define R_OPT16 014
#define R_IND24 015
#define R_IND32 016
/*
* XL generics
* 10-bit direct reference
* 10-bit "relative" reference
* 32-bit "relative" reference
*/
#define R_DIR10 025
#define R_REL10 026
#define R_REL32 027
/*
* 3B and M32 generics
* 32-bit direct reference
*/
#define R_DIR32 06
/*
* M32 generic
* 32-bit direct reference with bytes swapped
*/
#define R_DIR32S 012
#endif /* TC_I386 */
#if defined(TE_I386AIX)
#define UINFOSIZ 64 /* size of user info buffer */
typedef char uinfo_t[UINFOSIZ];
struct env387 {
unsigned short control;
unsigned short r0;
unsigned short status;
unsigned short r1;
unsigned short tag;
unsigned short r2;
unsigned long eip;
unsigned short code_seg;
unsigned short opcode;
unsigned long operand;
unsigned short operand_seg;
unsigned short r3;
unsigned char regs[8][10];
};
#define CD_NAMELEN 16 /* length of most names in this header */
#define CORHDRSIZ 2048 /* size to which header is padded out */
#define MAX_CORE_SEGS 32 /* maximum segments in a core dump */
#define NUM_FREGS 1 /* # of saved FP regs */
/*
* These are defined such that 286 and 386 kernels can produce
* compatible dumps.
*/
#define CD_AX 0
#define CD_BX 1
#define CD_CX 2
#define CD_DX 3
#define CD_SI 4
#define CD_DI 5
#define CD_BP 6
#define CD_SP 7
#define CD_FL 8
#define CD_IP 9
#define CD_CS 10
#define CD_DS 11
#define CD_ES 12
#define CD_FS 13
#define CD_GS 14
#define CD_SS 15
#define NUM_REGS 16
#ifndef SPATHLEN
# define SPATHLEN 16 /* sys/param.h */
#endif
#ifndef NSIG
# define NSIG 63 /* sys/signal.h */
# define SIGSETSZ ((NSIG+31)/32)
typedef struct ksigmask {
unsigned long sigs[SIGSETSZ];
} ksigmask_t;
#endif
struct corehdr {
char cd_magic[4]; /* COR_MAGIC = "core" */
/* general information about the dump itself */
struct dumpseg { /* table of contents for dump */
long cs_type; /* seg. type; see below */
long cs_len; /* length (in bytes) of segment */
long cs_offset; /* offset (in dump) of segment */
long cs_address; /* address segment had in mem */
} cd_segs[MAX_CORE_SEGS];
/* general information about the process */
char cd_comm[CD_NAMELEN]; /* command being run */
char cd_mach[CD_NAMELEN]; /* type of machine it ran on */
char cd_site[CD_NAMELEN]; /* name of site it ran on */
long cd_ldtype; /* type of load module running */
char cd_intsize; /* sizeof(int) */
char cd_dptrsize; /* sizeof(char *) */
char cd_tptrsize; /* sizeof(int (*)()) */
char cd_unused;
/* user-mode program state */
long cd_regs[NUM_REGS]; /* user-mode general registers */
struct env387 cd_fpregs; /* user-mode floating-point state */
/* kernel-mode program state */
int (*cd_sig[NSIG])(); /* disposition of signals */
ksigmask_t cd_sigmask; /* signals to be blocked */
ksigmask_t cd_sigpend; /* signals currently pending */
long cd_cursig; /* signal that caused the dump */
long cd_pid; /* process ID of the corpse */
long cd_ppid; /* parent process ID of corpse */
short cd_uid; /* process effective user ID */
short cd_ruid; /* process real user ID */
short cd_gid; /* process effective group ID */
short cd_rgid; /* process real group ID */
uinfo_t cd_uinfo; /* buffer of user information */
char cd_locname[32]; /* name of /local */
char cd_uvers[CD_NAMELEN]; /* user version string */
unsigned short cd_spath[SPATHLEN]; /* sitepath */
};
#ifndef NOCHECKS
/* this will generate an error if sizeof(struct corehdr) > CORHDRSIZ */
struct { char xxcdxx[CORHDRSIZ+1-sizeof(struct corehdr)]; };
#endif /* ! NOCHECKS */
/*
* segment types (in cs_type)
* each segment in the address space appears here, whether or not it
* is actually dumped. Read/only segments will not actually be dumped.
* A segment that is not in the dump will have a cs_offset of zero.
*/
#define COR_TYPE_CODE 'x' /* process code - NOT IN DUMP */
#define COR_TYPE_DATA 'd' /* process data segment */
#define COR_TYPE_STACK 's' /* process stack segment */
#define COR_TYPE_LIBCODE 'X' /* shared lib code - NOT IN DUMP*/
#define COR_TYPE_LIBDATA 'D' /* shared lib data */
#define COR_TYPE_READ 'r' /* other read/only - NOT IN DUMP*/
#define COR_TYPE_WRITE 'w' /* other writeable */
#define COR_TYPE_MSC '?' /* other, mapped in segment */
#endif /* TE_I386AIX */
/*
* Local Variables:
* comment-column: 0
* End:
*/
/* end of coff.gnu.h */

View File

@ -1,26 +0,0 @@
/* ho-a29k.h Host-specific header file intended for "eb" board with
HIF.
Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HO_A29K 1
#include <stdlib.h>
/* end of ho-a29k.h */

View File

@ -1,31 +0,0 @@
/* ho-ansi.h Host-specific header file for generic ansi environments.
Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define M_ANSI 1
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#define sys_nerr _sys_nerr
#define sys_errlist _sys_errlist
#define bzero(s,l) (memset((s),0,(l)))
/* end of ho-cygnus.h */

View File

@ -1 +0,0 @@
CC = gcc -ba29k

View File

@ -1,8 +0,0 @@
CC = gcc -b$(target) -Wall -nostdinc -nostdlib \
-I$(srcdir)/../clib/ansi/include -I$(srcdir)/../os-layer/include
CLIB = $(srcdir)/../clib/Host-$(host)/Target-$(target)/libc.a \
$(srcdir)/../gcc/Host-sun4/Target-$(target)/gnulib
LDFLAGS = /lib/crt0.o

File diff suppressed because it is too large Load Diff

View File

@ -1,512 +0,0 @@
/* coff object file format
Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
This file is part of GAS.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
#define OBJ_COFF 1
#include "targ-cpu.h"
#include "bfd.h"
/*extern bfd *stdoutput;*/
/* This internal_lineno crap is to stop namespace pollution from the
bfd internal coff headerfile. */
#define internal_lineno bfd_internal_lineno
#include "coff/internal.h"
#undef internal_lineno
#if defined(TC_H8300)
#include "coff/h8300.h"
#define TARGET_FORMAT "coff-h8300"
#elif defined(TC_A29K)
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
#else
help me
#endif
#if 0
/* Define some processor dependent values according to the processor we are
on. */
#if defined(TC_H8300)
#define BYTE_ORDERING 0
#define FILE_HEADER_MAGIC H8300MAGIC
#elif defined(TC_M68K)
#define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
#define FILE_HEADER_MAGIC MC68MAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_I386)
#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
#define FILE_HEADER_MAGIC I386MAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_I960)
#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
#define FILE_HEADER_MAGIC I960ROMAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_A29K)
#define BYTE_ORDERING F_AR32W /* big endian. */
#ifndef FILE_HEADER_MAGIC
#define FILE_HEADER_MAGIC SIPFBOMAGIC
#endif /* FILE_HEADER_MAGIC */
#else
you lose
#endif
#endif
#ifndef OBJ_COFF_MAX_AUXENTRIES
#define OBJ_COFF_MAX_AUXENTRIES 1
#endif /* OBJ_COFF_MAX_AUXENTRIES */
extern const segT N_TYPE_seg[];
/* Magic number of paged executable. */
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300
/* SYMBOL TABLE */
/* targets may also set this */
#ifndef SYMBOLS_NEED_BACKPOINTERS
#define SYMBOLS_NEED_BACKPOINTERS 1
#endif /* SYMBOLS_NEED_BACKPOINTERS */
/* Symbol table entry data type */
typedef struct
{
struct internal_syment ost_entry; /* Basic symbol */
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
unsigned int ost_flags; /* obj_coff internal use only flags */
} obj_symbol_type;
#define DO_NOT_STRIP 0
#define DO_STRIP 1
/* Symbol table macros and constants */
/* Possible and usefull section number in symbol table
* The values of TEXT, DATA and BSS may not be portable.
*/
#define C_ABS_SECTION N_ABS
#define C_UNDEF_SECTION N_UNDEF
#define C_DEBUG_SECTION N_DEBUG
#define C_NTV_SECTION N_TV
#define C_PTV_SECTION P_TV
#define C_REGISTER_SECTION 20
/*
* Macros to extract information from a symbol table entry.
* This syntaxic indirection allows independence regarding a.out or coff.
* The argument (s) of all these macros is a pointer to a symbol table entry.
*/
/* Predicates */
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
/* True if symbol has been defined, ie :
section > 0 (DATA, TEXT or BSS)
section == 0 and value > 0 (external bss symbol) */
#define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \
((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \
(s)->sy_symbol.ost_entry.n_value > 0))
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
#define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \
(s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION || \
(S_LOCAL_NAME(s) && !flagseen['L']))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value == 0)
/*
* True if a symbol can be multiply defined (bss symbols have this def
* though it is bad practice)
*/
#define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value != 0)
/* True if a symbol name is in the string table, i.e. its length is > 8. */
#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
/* Accessors */
/* The name of the symbol */
#define S_GET_NAME(s) ((char*)(s)->sy_symbol.ost_entry.n_offset)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset)
/* The zeroes if symbol name is longer than 8 chars */
#define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes)
/* The value of the symbol */
#define S_GET_VALUE(s) ((unsigned) ((s)->sy_symbol.ost_entry.n_value))
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) s_get_segment(s)
/* The data type */
#define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type)
/* The storage class */
#define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
/* The number of auxiliary entries */
#define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux)
/* Modifiers */
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long)(v))
/* Set the offset of the symbol */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v))
/* The zeroes if symbol name is longer than 8 chars */
#define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v))
/* Set the value of the symbol */
#define S_SET_VALUE(s,v) ((s)->sy_symbol.ost_entry.n_value = (v))
/* The numeric value of the segment */
#define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
/* The data type */
#define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v))
/* The storage class */
#define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v))
/* The number of auxiliary entries */
#define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v))
/* Additional modifiers */
/* The symbol is external (does not mean undefined) */
#define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
/* Omit the tv related fields */
/* Accessors */
#ifdef BFD_HEADERS
#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l)
#else
#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx)
#endif
#define SA_GET_SYM_LNNO(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno)
#define SA_GET_SYM_SIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size)
#define SA_GET_SYM_FSIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize)
#define SA_GET_SYM_LNNOPTR(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr)
#ifdef BFD_HEADERS
#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l)
#else
#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#define SA_GET_SYM_DIMEN(s,i) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)])
#define SA_GET_FILE_FNAME(s) ((s)->sy_symbol.ost_auxent[0].x_file.x_fname)
#define SA_GET_SCN_SCNLEN(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen)
#define SA_GET_SCN_NRELOC(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc)
#define SA_GET_SCN_NLINNO(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno)
/* Modifiers */
#ifdef BFD_HEADERS
#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l=(v))
#else
#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx=(v))
#endif
#define SA_SET_SYM_LNNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno=(v))
#define SA_SET_SYM_SIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size=(v))
#define SA_SET_SYM_FSIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize=(v))
#define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
#ifdef BFD_HEADERS
#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
#else
#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx=(v))
#endif
#define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
#define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_symbol.ost_auxent[0].x_file.x_fname,(v),FILNMLEN)
#define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen=(v))
#define SA_SET_SCN_NRELOC(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc=(v))
#define SA_SET_SCN_NLINNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno=(v))
/*
* Internal use only definitions. SF_ stands for symbol flags.
*
* These values can be assigned to sy_symbol.ost_flags field of a symbolS.
*
* You'll break i960 if you shift the SYSPROC bits anywhere else. for
* more on the balname/callname hack, see tc-i960.h. b.out is done
* differently.
*/
#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
#define SF_STRING (0x00004000) /* Symbol name length > 8 */
#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
#define SF_FUNCTION (0x00010000) /* The symbol is a function */
#define SF_PROCESS (0x00020000) /* Process symbol before write */
#define SF_TAGGED (0x00040000) /* Is associated with a tag */
#define SF_TAG (0x00080000) /* Is a tag */
#define SF_DEBUG (0x00100000) /* Is in debug or abs section */
#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
/* All other bits are unused. */
/* Accessors */
#define SF_GET(s) ((s)->sy_symbol.ost_flags)
#define SF_GET_NORMAL_FIELD(s) ((s)->sy_symbol.ost_flags & SF_NORMAL_MASK)
#define SF_GET_DEBUG_FIELD(s) ((s)->sy_symbol.ost_flags & SF_DEBUG_MASK)
#define SF_GET_FILE(s) ((s)->sy_symbol.ost_flags & SF_FILE)
#define SF_GET_STATICS(s) ((s)->sy_symbol.ost_flags & SF_STATICS)
#define SF_GET_DEFINED(s) ((s)->sy_symbol.ost_flags & SF_DEFINED)
#define SF_GET_STRING(s) ((s)->sy_symbol.ost_flags & SF_STRING)
#define SF_GET_LOCAL(s) ((s)->sy_symbol.ost_flags & SF_LOCAL)
#define SF_GET_FUNCTION(s) ((s)->sy_symbol.ost_flags & SF_FUNCTION)
#define SF_GET_PROCESS(s) ((s)->sy_symbol.ost_flags & SF_PROCESS)
#define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG)
#define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED)
#define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG)
#define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT)
#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
/* Modifiers */
#define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v))
#define SF_SET_NORMAL_FIELD(s,v)((s)->sy_symbol.ost_flags |= ((v) & SF_NORMAL_MASK))
#define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_DEBUG_MASK))
#define SF_SET_FILE(s) ((s)->sy_symbol.ost_flags |= SF_FILE)
#define SF_SET_STATICS(s) ((s)->sy_symbol.ost_flags |= SF_STATICS)
#define SF_SET_DEFINED(s) ((s)->sy_symbol.ost_flags |= SF_DEFINED)
#define SF_SET_STRING(s) ((s)->sy_symbol.ost_flags |= SF_STRING)
#define SF_SET_LOCAL(s) ((s)->sy_symbol.ost_flags |= SF_LOCAL)
#define SF_CLEAR_LOCAL(s) ((s)->sy_symbol.ost_flags &= ~SF_LOCAL)
#define SF_SET_FUNCTION(s) ((s)->sy_symbol.ost_flags |= SF_FUNCTION)
#define SF_SET_PROCESS(s) ((s)->sy_symbol.ost_flags |= SF_PROCESS)
#define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG)
#define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED)
#define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG)
#define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT)
#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
/* File header macro and type definition */
/*
* File position calculators. Beware to use them when all the
* appropriate fields are set in the header.
*/
#ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
#define OBJ_COFF_AOUTHDRSZ (0)
#else
#define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ)
#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
#define H_GET_FILE_SIZE(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
H_GET_SYMBOL_TABLE_SIZE(h) + \
(h)->string_table_size)
#define H_GET_TEXT_FILE_OFFSET(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
#define H_GET_DATA_FILE_OFFSET(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
H_GET_TEXT_SIZE(h))
#define H_GET_BSS_FILE_OFFSET(h) 0
#define H_GET_RELOCATION_FILE_OFFSET(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
#define H_GET_LINENO_FILE_OFFSET(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_RELOCATION_SIZE(h))
#define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
(long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
/* Accessors */
/* aouthdr */
#define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
#define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
#define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
#define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize)
#define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize)
#define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
#define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
#define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
/* filehdr */
#define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
#define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
#define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
#define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr)
#define H_GET_SYMBOL_COUNT(h) ((h)->filehdr.f_nsyms)
#define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ)
#define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
#define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
/* Extra fields to achieve bsd a.out compatibility and for convenience */
#define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
#define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
+ sizeof(AOUTHDR)\
+ (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
#else /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
#define H_GET_HEADER_SIZE(h) (sizeof(FILHDR) \
+ (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ))
#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
#define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ)
#define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ)
/* Modifiers */
/* aouthdr */
#define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
#define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
#define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
#define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v))
#define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v))
#define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
#define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
#define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
/* filehdr */
#define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
#define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
#define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
#define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
#define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
#define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
/* Extra fields to achieve bsd a.out compatibility and for convinience */
#define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
/* Segment flipping */
#define segment_name(v) (seg_name[(int) (v)])
typedef struct {
#ifdef BFD_HEADERS
struct internal_aouthdr aouthdr; /* a.out header */
struct internal_filehdr filehdr; /* File header, not machine dep. */
#else
AOUTHDR aouthdr; /* a.out header */
FILHDR filehdr; /* File header, not machine dep. */
#endif
long string_table_size; /* names + '\0' + sizeof(int) */
long relocation_size; /* Cumulated size of relocation
information for all sections in
bytes. */
long lineno_size; /* Size of the line number information
table in bytes */
} object_headers;
struct lineno_list
{
struct bfd_internal_lineno line;
char* frag; /* Frag to which the line number is related */
struct lineno_list* next; /* Forward chain pointer */
} ;
/* stack stuff */
typedef struct {
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char* data;
unsigned long pointer;
} stack;
char *EXFUN(stack_pop,(stack *st));
char *EXFUN(stack_push,(stack *st, char *element));
char *EXFUN(stack_top,(stack *st));
stack *EXFUN(stack_init,(unsigned long chunk_size, unsigned long element_size));
void EXFUN(c_dot_file_symbol,(char *filename));
void EXFUN(obj_extra_stuff,(object_headers *headers));
void EXFUN(stack_delete,(stack *st));
void EXFUN(c_section_header,(
struct internal_scnhdr *header,
char *name,
long core_address,
long size,
long data_ptr,
long reloc_ptr,
long lineno_ptr,
long reloc_number,
long lineno_number,
long alignment));
/* sanity check */
#ifdef TC_I960
#ifndef C_LEAFSTAT
hey! Where is the C_LEAFSTAT definition? i960-coff support is depending on it.
#endif /* no C_LEAFSTAT */
#endif /* TC_I960 */
#ifdef BFD_HEADERS
extern struct internal_scnhdr data_section_header;
extern struct internal_scnhdr text_section_header;
#else
extern SCNHDR data_section_header;
extern SCNHDR text_section_header;
#endif
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-coff.h */

View File

@ -1,36 +0,0 @@
/* This file is ranlib.h
Copyright (C) 1987-1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* Structure of the __.SYMDEF table of contents for an archive.
* __.SYMDEF begins with a word giving the number of ranlib structures
* which immediately follow, and then continues with a string
* table consisting of a word giving the number of bytes of strings
* which follow and then the strings themselves.
* The ran_strx fields index the string table whose first byte is numbered 0.
*/
struct ranlib {
union {
off_t ran_strx; /* string table index of */
char *ran_name; /* symbol defined by */
} ran_un;
off_t ran_off; /* library member at this offset */
};
/* end of ranlib.h */

View File

@ -1,43 +0,0 @@
/* Convert between signal names and numbers.
Copyright (C) 1990, 1992 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Names for signals from 0 to NSIG-1. */
extern char *sys_siglist[];
#if __STDC__ == 1
/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER.
Do not return this as a const char *. The caller might want to
assign it to a char *. */
char *sig_abbrev (int number);
/* Return the signal number for an ABBREV, or -1 if there is no
signal by that name. */
int sig_number (const char *abbrev);
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
a colon, and followed by a newline. */
void psignal (int signal, const char *message);
#else /* not __STDC__ */
char *sig_abbrev ();
int sig_number ();
void psignal ();
#endif /* not __STDC__ */
/* end of signame.h */

View File

@ -1,37 +0,0 @@
/* This file is stab.h
Copyright (C) 1987-1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __GNU_STAB__
/* Indicate the GNU stab.h is in use. */
#define __GNU_STAB__
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
enum __stab_debug_code
{
#include "stab.def"
};
#undef __define_stab
#endif /* __GNU_STAB_ */
/* end of stab.h */

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
/* This file is tc-m68kmote.h
Copyright (C) 1987-1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* This file is tp-generic.h and is intended to be a template for
* target processor specific header files.
*/
#define TC_M68K 1
#ifdef TE_SUN3
/* This variable contains the value to write out at the beginning of
the a.out file. The 2<<16 means that this is a 68020 file instead
of an old-style 68000 file */
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */
#endif /* TE_SUN3 */
#define AOUT_MACHTYPE 0x2
#define REVERSE_SORT_RELOCS /* FIXME-NOW: this line can be removed. */
#define LOCAL_LABELS_FB
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define LISTING_WORD_SIZE 2 /* A word is 2 bytes */
#define LISTING_LHS_WIDTH 3 /* 3 word on the first line */
#define LISTING_LHS_WIDTH_SECOND 3 /* One word on the second line */
#define LISTING_LHS_CONT_LINES 4 /* And 4 lines max */
#define LISTING_HEADER "68K GAS "
/* Copied from write.c */
#define M68K_AIM_KLUDGE(aim, this_state,this_type) \
if (aim==0 && this_state== 4) { /* hard encoded from tc-m68k.c */ \
aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \
}
#define MRI
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of tc-m68kmote.h */

View File

@ -1,4 +0,0 @@
/* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */
/* Remove leading underscore from the gcc generated symbol names */
#define STRIP_UNDERSCORE 1

Some files were not shown because too many files have changed in this diff Show More