Brought over NetBSD's gas ready for pk's shared libs.

This commit is contained in:
Paul Richards 1993-11-03 00:56:24 +00:00
parent 81fc6236e6
commit 3bab57bf8e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=691
197 changed files with 71957 additions and 8872 deletions

View File

@ -0,0 +1,11 @@
(This file under construction).
If you've contributed to gas and your name isn't listed here, it is
not meant as a slight. I just don't know about it. Email me,
rich@cygnus.com and I'll correct the situation.
Dean Elsnor wrote the original gas for vax.
Jay Fenalson maintained gas for a while.
K. Richard Pixley currently maintains gas.

View File

@ -1,38 +1,40 @@
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Version 2, June 1991
Copyright (C) 1989 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
@ -45,120 +47,207 @@ want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
7. The Free Software Foundation may publish revised and/or new versions
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
this License, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
@ -168,7 +257,7 @@ of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
@ -178,7 +267,7 @@ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
@ -193,22 +282,21 @@ POSSIBILITY OF SUCH DAMAGES.
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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.
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
@ -224,26 +312,28 @@ Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,72 @@
# @(#)Makefile 6.1 (Berkeley) 3/3/91
PROG= as
SRCS= app.c append.c as.c atof-generic.c bignum-copy.c \
expr.c flonum-const.c flonum-copy.c flonum-mult.c \
frags.c hash.c hex-value.c input-file.c input-scrub.c \
messages.c obstack.c output-file.c read.c subsegs.c \
symbols.c version.c write.c xmalloc.c xrealloc.c
CFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/config \
-DSIGTY=void -Derror=as_fatal
.PATH: $(.CURDIR)/config
# from: @(#)Makefile 6.1 (Berkeley) 3/3/91
# $Id: Makefile,v 1.10 1993/10/16 22:04:48 pk Exp $
.include "config/Makefile.$(MACHINE)"
.if !defined (gas_hosttype)
gas_hosttype=$(MACHINE)
.endif
.if !defined (gas_target)
gas_target=$(MACHINE)
.endif
.if !defined (gas_objformat)
gas_objformat=aout
.endif
.if exists(${.CURDIR}/obj)
ADDINCLUDE=-I${.CURDIR}/obj
.endif
PROG= as
SRCS+= app.c as.c atof-generic.c bignum-copy.c \
cond.c expr.c flo-const.c flo-copy.c flonum-mult.c \
frags.c hash.c hex-value.c input-file.c input-scrub.c \
listing.c messages.c obstack.c output-file.c read.c subsegs.c \
symbols.c version.c write.c xmalloc.c xrealloc.c \
obj-$(gas_objformat).c
CFLAGS+= -I$(.CURDIR) ${ADDINCLUDE} -I$(.CURDIR)/config \
-DPIC -DOLD_GAS -DSIGTY=void -Derror=as_fatal
#LDADD+= -lgnumalloc
DPADD+= /usr/lib/libgnumalloc.a
CONF_HEADERS= targ-cpu.h obj-format.h host.h targ-env.h
.PATH: $(.CURDIR)/config
beforedepend ${PROG}: ${CONF_HEADERS}
targ-cpu.h: Makefile config/Makefile.$(MACHINE)
@cmp -s $(.CURDIR)/config/tc-$(gas_target).h targ-cpu.h || \
( echo "updating ${.TARGET}..." ; /bin/rm -f targ-cpu.h ; \
cp $(.CURDIR)/config/tc-$(gas_target).h targ-cpu.h )
obj-format.h: Makefile config/Makefile.$(MACHINE)
@cmp -s $(.CURDIR)/config/obj-$(gas_objformat).h obj-format.h || \
( echo "updating ${.TARGET}..." ; /bin/rm -f obj-format.h ; \
cp $(.CURDIR)/config/obj-$(gas_objformat).h obj-format.h )
.if exists ($(.CURDIR)/config/ho-$(gas_hosttype).h)
config_hostfile= $(.CURDIR)/config/ho-$(gas_hosttype).h
.else
config_hostfile= $(.CURDIR)/config/ho-generic.h
.endif
host.h: Makefile config/Makefile.$(MACHINE)
@cmp -s $(config_hostfile) host.h || \
( echo "updating ${.TARGET}..." ; /bin/rm -f host.h ; \
cp $(config_hostfile) host.h )
.if exists ($(.CURDIR)/config/te-$(MACHINE).h)
config_targenvfile= $(.CURDIR)/config/te-$(MACHINE).h
.else
config_targenvfile= $(.CURDIR)/config/te-generic.h
.endif
targ-env.h: Makefile config/Makefile.$(MACHINE)
@cmp -s $(config_targenvfile) targ-env.h || \
( echo "updating ${.TARGET}..." ; /bin/rm -f targ-env.h ; \
cp $(config_targenvfile) targ-env.h )
CLEANFILES+= ${CONF_HEADERS}
.include <bsd.prog.mk>

409
gnu/usr.bin/as/Makefile.in Normal file
View File

@ -0,0 +1,409 @@
# Makefile for GNU Assembler
# Copyright (C) 1987-1992 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 2, 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.
# 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.
srcdir = .
prefix = /usr/local
bindir = $(prefix)/bin
datadir = $(prefix)/lib
libdir = $(prefix)/lib
mandir = $(datadir)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
man9dir = $(mandir)/man9
infodir = $(datadir)/info
includedir = $(prefix)/include
docdir = $(datadir)/doc
SHELL = /bin/sh
INSTALL = install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)
AR = ar
AR_FLAGS = qv
BISON = bison
MAKEINFO = makeinfo
RANLIB = ranlib
MINUS_G = -g
# 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)/flo-const.c \
$(srcdir)/flo-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)/obstack.c \
$(srcdir)/output-file.c \
$(srcdir)/read.c \
$(srcdir)/strerror.c \
$(srcdir)/strstr.c \
$(srcdir)/subsegs.c \
$(srcdir)/symbols.c \
$(srcdir)/version.c \
$(srcdir)/write.c \
$(srcdir)/listing.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)/listing.h \
$(srcdir)/tc.h \
$(srcdir)/obj.h \
$(srcdir)/obstack.h \
$(srcdir)/read.h \
$(srcdir)/struc-symbol.h \
$(srcdir)/subsegs.h \
$(srcdir)/symbols.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 \
flo-const.o \
flo-copy.o \
flonum-mult.o \
frags.o \
hash.o \
hex-value.o \
input-file.o \
input-scrub.o \
messages.o \
obstack.o \
output-file.o \
read.o \
strerror.o \
strstr.o \
subsegs.o \
symbols.o \
version.o \
write.o \
listing.o \
xmalloc.o \
xrealloc.o
#### host, target, and site specific Makefile frags come in here.
all: as.new
(cd doc ; $(MAKE) all)
info:
(cd doc ; $(MAKE) info)
install-info:
(cd doc ; $(MAKE) install-info)
clean-info:
(cd doc ; $(MAKE) clean-info)
# Now figure out from those variables how to compile and link.
# This is the variable actually used when we compile.
ALL_CFLAGS = $(MINUS_G) $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES) -DPIC -DOLD_GAS
# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(HLIBS)
# 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 # -I$(srcdir)/../include
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.
STAGESTUFF = *.o as.new
as.new: $(OBJS) $(LIBDEPS)
-mv -f as.new as.old
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS)
config.status:
@echo You must configure gas. Look at the INSTALL file for details.
@false
# Compiling object files from source files.
app.o : app.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.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 \
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 \
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 \
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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
debug.o : debug.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
flo-const.o : flo-const.c flonum.h bignum.h
flo-copy.o : flo-copy.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h
hash.o : hash.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.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 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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
input-file.h
listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \
listing.h obj-format.h targ-cpu.h struc-symbol.h write.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
obstack.o : obstack.c
output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.h
symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
subsegs.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 \
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 \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
symbols.h tc.h obj.h
targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \
targ-cpu.h struc-symbol.h \
write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS)
# Remake the info files.
doc: $(srcdir)/as.info
$(srcdir)/as.info: $(srcdir)/doc/as.texinfo
(cd doc; make as.info; mv as.info $srcdir)
clean:
(cd doc ; $(MAKE) clean)
-rm -f $(STAGESTUFF) core
# Like clean but also delete the links made to configure gas.
distclean: clean
-rm -f config.status Makefile host.h targ-env.h targ-cpu.h \
targ-cpu.c obj-format.h obj-format.c atof-targ.c \
gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs \
gas.tps gas.vrs TAGS gas.info* gas.?? gas.??s gas.log \
gas.toc gas.*aux *.dvi
# Entry points `install', `includes' and `uninstall'.
# Copy the files into directories where they will be run.
install:
if [ "$(host_alias)" = "$(target_alias)" ] ; then \
$(INSTALL_PROGRAM) as.new $(bindir)/as ; \
else \
$(INSTALL_PROGRAM) as.new $(bindir)/as-$(target_alias) ; \
fi
# Create the installation directory.
install-dir:
-mkdir $(libdir)
-mkdir $(libdir)/gcc
-mkdir $(libdir)/gcc/$(target)
-mkdir $(libdir)/gcc/$(target)/$(version)
# Cancel installation by deleting the installed files.
uninstall:
-rm -rf $(libsubdir)
-rm -rf $(bindir)/as
-rm -rf $(mandir)/gas.$(manext)
# These exist for maintenance purposes.
tags TAGS: force
etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
bootstrap: as.new force
$(MAKE) stage1
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
$(MAKE) stage2
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
$(MAKE) comparison against=stage2
bootstrap2: force
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
$(MAKE) stage2
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
$(MAKE) comparison against=stage2
bootstrap3: force
$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
$(MAKE) comparison against=stage2
# Copy the object files from a particular stage into a subdirectory.
stage1: force
-mkdir stage1
-mv $(STAGESTUFF) stage1
if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
stage2: force
-mkdir stage2
-mv $(STAGESTUFF) stage2
if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
stage3: force
-mkdir stage3
-mv $(STAGESTUFF) stage3
if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
against=stage2
comparison: force
for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
de-stage1: force
- (cd stage1 ; rm as ; mv -f * ..)
- rmdir stage1
de-stage2: force
- (cd stage2 ; rm as ; mv -f * ..)
- rmdir stage2
de-stage3: force
- (cd stage3 ; rm as ; mv -f * ..)
- rmdir stage3
#In GNU Make, ignore whether `stage*' exists.
.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
force:
Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) ./config.status

View File

@ -1,35 +1,16 @@
gdb debugging of assembly sources:
write a function linestab() that generates a .stabd symbol
independently of the input
write a function filestab() to generate a .stabs symbol
we need to take especial care with #line directives
since we want to handle locore, and locore is passed thru cpp
this could be tough
outline of a solution:
cpp sends us lines of the form
# logical-line "logical-file" trash
these lines are interpreted ahead of the gas preprocess pass
in the starting state, the logical filename is the same
as the real filename (in case there're no #lines)
the initial logical line number is 1
every time we're ready to process a new instruction line,
if the source file has changed,
emit a .stabs for the logical file
emit a .stabd for the logical line
bump the logical line number
can gas eat multiple actual lines in one insn?
to do:
i386 nits:
jmp *$foo produces a short relative branch
string quotes in comments
Bill says gas eats text across newlines to find matches
works fine for me
I think it's most likely due to cpp
make / no longer be a comment char
it's now like the VAX: # is the only comment char
incorrectly assembles lcall, int3, into, bsr/f instructions
constant expressions fail if more than a few terms
gives (low+2)*3+4*5 as an example
works fine for me
cpp seems to think $ is a valid literal
use -$ in /usr/bin/cpp
remove DONTDEF
remove the ifdef's from fx_callj tests?
what are callj tests?
space tighten sparc alignment.
fix number_to_chars, & family to have no side effects.
md_ => tp_
multiple segments.
share b.out with a.out.
regress:
+-inf
stack:

View File

@ -0,0 +1,52 @@
(This file under construction).
The GAS Configuration Plan
Theory:
The goal of the new configuration scheme is to bury all object format,
target processor, and host machine dependancies in object, target, and
host specific files. That is, to move as many #ifdef's as possible
out of the gas common code.
Here's how it works. There is a .h and a .c file for each object file
format, a .h and a .c file for each target processor, and a .h for
each host. configure creates {sym}links in the current directory to
the appropriate files in the config directory.
Implementation:
host.h is a {sym}link to .../config/ho-yourhost.h. It is intended to
be used to hide host compiler, system header file, and system library
differences between host machines. If your host needs actual c source
files, then either: these are generally useful functions, in which
case you should probably build a local library outside of the gas
source tree, or someone, perhaps me, is confused about what is needed
by different hosts.
obj-format.h is a {sym}link to .../config/obj-something.h. It is
intended to hide object file format differences from the bulk of gas,
and from most of the cpu backend.
All gas .c files include as.h.
as.h #define's "gas", includes host.h, defines a number of gas
specific structures and types, and then includes tp.h, obj.h, and
target-environment.h.
te-something.h defines a target environment specific preprocessor
flag, eg, TE_SUN, and then includes obj-format.h.
obj-format.h defines an object format specific preprocessor flag, eg,
OBJ_AOUT, OBJ_BOUT, OBJ_COFF, includes "target-processor.h", and then
defines the object specific macros, functions, types, and structures.
target-processor.h
target-processor.
Porting:
There appear to be four major types of ports; new hosts, new target
processors, new object file formats, and new target environments.

212
gnu/usr.bin/as/README Normal file
View File

@ -0,0 +1,212 @@
This is a pre-alpha version of the GNU assembler, version 1.92.3.
(this is a copy of the mail announcement. Real README follows below.)
This session I merged the m88k support. It configures, builds, and
assembles things, including some gcc2 output. I have no way of
knowing if the output is right.
I've merged the tahoe support. It configures and builds. I couldn't
build the cygnus version of gcc2 for this machine, so I have no idea
whether gas is assembling anything at all for it.
I've walked through my bug and patch archives. Gas now makes a
tolerable guess at a.out headers for hpux and sequent, although I have
no way to know if these are right yet.
Ming tran-le's changes for 386aix will probably drop out soon. He
needs multiple segments and I don't plan to get that in before the
real release.
Eric youngdale's help with vms has been invaluable. According to him,
this gas is doing vms. I didn't quite get a cross to vms working and
don't plan to spend any more time on it.
The gas manual is included in the distribution, configuration, and
Makefiles. It should build, be printable, and readable through info.
I have not yet verified that this gas has all of the unreleased
changes that hack made after the last gas release. At this point I
plan to ignore these until those bugs are re-reported in an alpha or
full release I don't think it's worth my time.
I have not yet verified any hosts other than sun4, although I have
three-staged sun3 native.
I have not updated the configuration doc.
I do not plan to bring in any new backends for the upcoming release
unless someone hands them to me on a platter as eric did for vms. I
merged the m88k and tahoe ports because they were simple for me at
this point, but would have been difficult for someone else. I may yet
do this for the ncube support as well.
I've looked at the osf stuff and discarded it for this release. I'm
not sure I like what they've done for macho object format and without
macho headers, I can't even build their version.
I've looked at the utah stuff and discarded it for this release.
They, too, have made some sweeping changes to support their object
format that I'm not sure were necessary. In any case, merging this
would be too much work for me right now.
I've looked at the tron port. It's remarkably clean and it's a.out
format. I don't plan to merge this for the full release for two
reasons. First, it's so clean, they will be able to add their stuff
on top and build a seperate distribution without much trouble.
Second, I'm get responses from them, and hope that they will be able
to do the merge.
To do before alpha:
* merge patches and address bugs as they arrive.
* kill a remaining bug. The following input:
.text
a .word 3
b .word 4
c .half b-a
kills most risc ports. I believe that this represents a failing of
the internal representation of relocs (aka fixS's). The fix is
relatively straightforward and I intend to make it.
* add autoconf style configuration for hosts (not targets).
* test via three-staging (preferably with gcc2) on all a.out based
machines to which I have access.
* update/clean out README's and build a brief porting guide.
There is still a copyright issue on the coff back end, so it may need
to be pulled for the full release. If this gets resolved, I hope to
see coff run personally on at least one native machine before full
release.
Real README:
This is a pre-alpha version of the GNU assembler, version 1.92.3.
A number of things have changed and the wonderful world of gas looks
very different. There's still a lot of irrelevant garbage lying
around that will be cleaned up soon. The gas manual now builds and
installs, but internal documentation is still scarce, as are logs of
the changes made since the last gas release. My apologies, and I'll
try to get something useful
At this point I believe gas to be ansi only code for most target
cpu's. That is, there should be relatively few, if any host system
dependencies. Most of my recent effort has been spent testing and
dusting off ports for which Cygnus hasn't had recent need.
Hosting has recently been tested on only:
sun4
sun3
I believe that gas can currently be targetted for:
sun4
sun3
and "ports" for other cpu's and object file formats from the following
set are probably trivial at this point:
a.out
a29k
i386
i860
i960
m68k
m88k
ns32k
tahoe
sparc
vax
I have tested most of these in "generic" a.out configurations so I
feel pretty confident in them. If anything else works, it's an
accident.
Some ports now generate object files that are somewhat differently
shaped, but should be more correct. Specifically:
* Most a.out ports now sort the relocation table in numerically
ascending order. In previous versions of gas, the relocation table
was sorted in descending order. To get the previous functionality,
compile with -DREVERSE_SORT_RELOCS.
* ns32k: The last gas I have from hack simply looks broken for ns32k.
I think this one works, but don't have an assembler that I trust
against which to compare.
* i386: now uses ".align x" to mean x bytes rather than 2^x bytes. It
also pads with the noop instruction rather than zeroes.
In all cases, compiling with -DOLD_GAS will produce an assembler that
should produce object files that are bitwise identical to the previous
version of gas.
NEW FEATURES!
This isn't a complete catalog. I've forgotten what all has been done.
* support for i960, a29k, m88k, and tahoe.
* support for 68030 and 68040, including the ability to limit the
instructions that gas will accept. ie, you can assemble for EXACTLY
68000 and no more.
* object file formats have been broken out into separate backends.
* a new "backend" has been created to represent the target
environment. That is, gas now mimics various other assemblers
rather than creating it's own requirements. A side effect of this
is that this version of gas may not behave the same way as previous
versions.
* ansi. gas is now strictly ansi code so host ports should be
trivial.
REPORTING BUGS IN GAS
Bugs in THIS RELEASE of gas should be reported directly to
rich@cygnus.com. NOT to bug-gnu-utils@prep.ai.mit.edu.
If you report a bug in GAS, please remember to include:
A description of exactly what went wrong.
How GAS was configured,
The Operating System GAS was running under.
The options given to GAS.
The actual input file that caused the problem.
It is silly to report a bug in GAS without including an input file for
GAS. Don't ask us to generate the file just because you made it from
files you think we have access to.
1. You might be mistaken.
2. It might take us a lot of time to install things to regenerate that file.
3. We might get a different file from the one you got, and might not see any
bug.
To save us these delays and uncertainties, always send the input file
for the program that failed.
If the input file is very large, and you are on the internet, you may
want to make it avaliable for anonymous FTP instead of mailing it. If you
do, include instructions for FTP'ing it in your bug report.

248
gnu/usr.bin/as/README-vms Normal file
View File

@ -0,0 +1,248 @@
This document explains a couple of things that are specific to VMS.
There are currently two "chapters", the first deals with cross-assembly
issues, and the second deals with the VMS debugger and GNU-CC.
***********************************************************************
****************** Notes for Cross Assembly with VMS ******************
***********************************************************************
If you wish to build gas on a non-VMS system to cross-assemble,
you should use:
configure ${hosttype} -target=vms
and then follow the usual procedure. The object files generated on
Unix will be correct from a binary point of view, but the real trick is
getting them to the VMS machine. The format of the object file is
a variable-length record, but each record contains binary data. gas
writes the records in the same format that VMS would expect,
namely a two-byte count followed by that number of bytes.
If you try to copy the file to a VMS system using ftp, the ftp
protocol will screw up the file by looking for nulls (record terminator for
unix) and it will insert it's own record terminators at that point. This
will obviously corrupt the file.
If you try to transfer the file with ftp in binary mode, the
file itself will not be corrupt, but VMS will think that the file contains
fixed-length records of 512 bytes. You can use the public-domain FILE
utility to change this with a command like:
$FILE foo.o/type=variable
If you do not have this utility available, the following program can be
used to perform this task:
#include <fab.h>
#define RME$C_SETRFM 1
struct FAB * fab;
main(int argc, char * argv[]){
int i, status;
fab = (struct FAB*) malloc(sizeof(struct FAB));
*fab = cc$rms_fab; /* initialize FAB*/
fab->fab$b_fac = FAB$M_PUT;
fab->fab$l_fop |= FAB$M_ESC;
fab->fab$l_ctx = RME$C_SETRFM;
fab->fab$w_ifi = 0;
for(i=1;i<argc;i++){
printf("Setting %s to variable length records.\n",argv[i]);
fab->fab$l_fna = argv[i];
fab->fab$b_fns = strlen(argv[i]);
status = sys$open(fab,0,0);
if((status & 7) != 1) lib$signal(status);
fab->fab$b_rfm = FAB$C_VAR;
status = sys$modify(fab,0,0);
if((status & 7) != 1) lib$signal(status);
status = sys$close(fab,0,0);
if((status & 7) != 1) lib$signal(status);
};
}
If you have NFS running on the VMS system, what you need to do
depends upon which NFS software you are running on the VMS system. There
are a number of different TCP/IP packages for VMS available, and only very
limited testing has been performed. In the tests that has been done so
far, the contents of the file will always be correct when transferring the
file via NFS, but the record attributes may or may not be correct.
One proprietary TCP/IP/NFS package for VMS is known to
automatically fix the record attributes of the object file if you NFS mount
a unix disk from the VMS system, and if the file has a ".obj" extension on
the unix system. Other TCP/IP packages might do this for you as well, but
they have not been checked.
No matter what method you use to get the file to the VMS system, it is
always a good idea to check to make sure that it is the correct type by
doing a "$dir/full" on the object file. The desired record attributes will
be "None". Undesirable record attributes will be "Stream-LF" or anything
else.
Once you get the files on the VMS system, you can check their integrity
with the "$anal/obj" command. (Naturally at some point you should rename
the .o files to .obj). As far as the debugger is concerned, the records
will be correct, but the debugger will not be able to find the source files,
since it only has the file name, and not the full directory specification.
You must give the debugger some help by telling it which directories to
search for the individual files - once you have done this you should be
able to proceed normally.
It is a good idea to use names for your files which will be valid
under VMS, since otherwise you will have no way of getting the debugger to
find the source file when deugging.
The reason for this is that the object file normally contins specific
information that the debugger can use to positively identify a file, and if
you are assembling on a unix system this information simply does not exist
in a meaningful way. You must help the debugger by using the "SET FILE="
command to tell the debugger where to look for source files. The debugger
records will be correct, except that the debugger will not be initially
able to find the source files. You can use the "SET FILE" command to tell
the debugger where to look for the source files.
I have only tested this with a SVr4 i486 machine, and everything seems to
work OK, with the limited testing that I have done. Other machines may
or may not work. You should read the chapters on cross-compilers in the gcc
manual before fooling with this. Since gas does not need to do any floating
point arithmetic, the floating point constants that are generated here should
be correct - the only concern is with constant folding in the main compiler.
The range and precision of floats and doubles are similar on the 486 (with
a builtin 80387) and the VAX, although there is a factor of 2 to 4
difference in the range. The double, as implemented on the 486, is quite
similar to the G_FLOAT on the VAX.
***********************************************************************
****************** Notes for using GNU CC with the VMS debugger********
***********************************************************************
1) You should be aware that GNU-C, as with any other decent compiler,
will do things when optimization is turned on that you may not expect.
Sometimes intermediate results are not written to variables, if they are only
used in one place, and sometimes variables that are not used at all will not be
written to the symbol table. Also, parameters to inline functions are often
inaccessible. You can see the assembly code equivalent by using KP7 in the
debugger, and from this you can tell if in fact a variable should have the
value that you expect. You can find out if a variable lives withing a register
by doing a 'show symbol/addr'.
2) Overly complex data types, such as:
int (*(*(*(*(*(* sarr6)[1])[1])[2])[3])[4])[5];
will not be debugged properly, since the debugging record overflows an internal
debugger buffer. gcc-as will convert these to *void as far as the debugger
symbol table is concerned, which will avoid any problems, and the assembler
will give you a message informing you that this has happened.
3) You must, of course, compile and link with /debug. If you link
without debug, you still get traceback table in the executable, but there is no
symbol table for variables.
4) Included in the patches to VMS.C are fixes to two bugs that are
unrelated to the changes that I have made. One of these made it impossible to
debug small programs sometimes, and the other caused the debugger to become
confused about which routine it was in, and give this incorrect info in
tracebacks.
5) If you are using the GNU-C++ compiler, you should modify the
compiler driver file GNU_CC:[000000]GCC.COM (or GXX.COM). If you have a
seperate GXX.COM, then you need to change one line in GXX.COM to:
$ if f$locate("D",p2) .ne. P2_Length then Debug = " ""-G0"""
Notice zero---> ^
If you are using a GCC.COM that does both C and C++, add the following lines to
GCC.COM:
$!
$! Use old style debugging records for VMS
$!
$ if (Debug.nes."" ).and. Plus then Debug = " ""-G0"""
after the variables Plus and Debug are set. The reason for this, is that C++
compiler by default generates debugging records that are more complex,
with many new syntactical elements that allow for the new features of the
language. The -G0 switch tells the C++ compiler to use the old style debugging
records. Until the debugger understands C++ there is not any point to try and
use the expanded syntax.
6) When you have nested scopes, i.e.:
main(){
int i;
{int i;
{int i;
};};}
and you say "EXAM i" the debugger needs to figure out which variable you
actually want to reference. I have arranged things to define a block to the
debugger when you use brackets to enter a new scope, so in the example above,
the variables would be described as:
TEST\main\i
TEST\main\$0\i
TEST\main\$0\$0\i
At each level, the block name is a number with a dollar sign prefix, the
numbers start with 0 and count upward. When you say EXAM i, the debugger looks
at the current PC, and decides which block it is currently in. It works from
the innermost level outward until it finds a block that has the variable "i"
defined. You can always specify the scope explicitly.
7) With C++, there can be a lot of inline functions, and it would be
rather restrictive to force the user to debug the program by converting all of
the inline functions to normal functions. What I have done is to essentially
"add" (with the debugger) source lines from the include files that contain the
inline functions. Thus when you step into an inline function it appears as if
you have called the function, and you can examine variables and so forth.
There are several *very* important differences, however. First of all, since
there is no function call involved, you cannot step over the inline function
call - you always step into it. Secondly, since the same source lines are used
in many locations, there is a seperate copy of the source for *each* usage.
Without this, breakpoints do not work, since we must have a 1-to-1 mapping
between source lines and PC.
Since you cannot step over inline function calls, it can be a real pain
if you are not really interested in what is going on for that function call.
What I have done is to use the "-D" switch for the assembler to toggle the
following behavior. With the "-D" switch, all inline functions are included in
the object file, and you can debug everything. Without the "-D" switch
(default case with VMS implementation), inline functions are included *only* if
they did not come from system header files (i.e. from GNU_CC_INCLUDE: or
GNU_GXX_INCLUDE:). Thus, without the switch the user only debugs his/her own
inline functions, and not the system ones. (This is especially useful if you do
a lot of stream I/O in C++). This probably will not provide enough granularity
for many users, but for now this is still somewhat experimental, and I would
like to reflect upon it and get some feedback before I go any further.
Possible solutions include an interactive prompting, a logical name, or a new
command line option in gcc.c (which is then passed through somehow to the guts
of the assembler).
The inline functions from header files appear after the source code
for the source file. This has the advantage that the source file itself is
numbered with the same line numbers that you get with an editor. In addition,
the entire header file is not included, since the assembler makes a list of
the min and max source lines that are used, and only includes those lines from
the first to the last actually used. (It is easy to change it to include the
whole file).
8) When you are debugging C++ objects, the object "this" is refered to
as "$this". Actually, the compiler writes it as ".this", but the period is
not good for the debugger, so I have a routine to convert it to a $. (It
actually converts all periods to $, but only for variables, since this was
intended to allow us to access "this".
9) If you use the asm("...") keyword for global symbols, you will not
be able to see that symbol with the debugger. The reason is that there are two
records for the symbol stored in the data structures of the assembler. One
contains the info such as psect number and offset, and the other one contains
the information having to do with the data type of the variable. In order to
debug as symbol, you need to be able to coorelate these records, and the only
way to do this is by name. The record with the storage attributes will take
the name used in the asm directive, and the record that specifies the data type
has the actual variable name, and thus when you use the asm directive to change
a variable name, the symbol becomes invisible.
10) Older versions of the compiler ( GNU-C 1.37.92 and earlier) place
global constants in the text psect. This is unfortunate, since to the linker
this appears to be an entry point. I sent a patch to the compiler to RMS,
which will generate a .const section for these variables, and patched the
assembler to put these variables into a psect just like that for normal
variables, except that they are marked NOWRT. static constants are still
placed in the text psect, since there is no need for any external access.

View File

@ -0,0 +1,79 @@
The coff patches intend to do the following :
. Generate coff files very compatible with vanilla linker.
. Understands coff debug directives.
Here are the guidelines of the work I have done :
. Encapsulate format dependent code in macros where it is possible.
. Where not possible differenciate with #ifdef
. try not to change the calling conventions of the existing functions.
I made one exception : symbol_new. I would be pleased to hear about
a better solution. (symbols.c)
. Extend the use of N_TYPE_seg seg_N_TYPE tables so that segments can
be manipulated without using their format dependent name. (subsegs.c)
. Write a function to parse the .def debug directives
. Write two small peaces of code to handle the .ln directive.
. In write.c try to move all the cross compilation specifics (md_..) to
format dependent files.
. Encapsulate the data structures using generic types, macros calls.
. Added too much code to resolve the complexity of the symbol table
generated. Most of the code deals with debug stuff.
. Create another makefile, shorter, cleaner.
. Create a config.gas shell script to mimic the gcc,gdb... configuration
mechanism. This reduce the complexity of the makefile.
. Isolate the format dependent code in two files
coff.c coff.h
aout.c aout.h
elf.c elf.h [ Not yet ;-]
. added a little stack management routine for coff in file stack.c
. isolate os specific flags in m- files
If further development is planed on it is should solve the following problems :
. Encapsulate DESC & OTHER tests in a macro call. I'm not aware
of their exact semantics.
. Clean up the seg_N_TYPE N_TYPE_seg naming scheme
. Try to remove as much reference to segment dependent names as possible
. Find a cleaner solution for symbol_new.
. Report the modifications on vax, ns32k, sparc machine dependent files.
To acheive this goal, search for \<N_, sy_, symbol_new and symbolS.
. Allow an arbitrary number of segments (spare sections .ctor .dtor .bletch)
. Find a way to extend the debug information without breaking sdb
compatibility. Mainly intended for G++.
. should it do something to generate shared libraries objects ?
I have tested this code on the following processor/os. gcc-1.37.1 was
used for all the tests.
386 SCO unix ODT
gcc-1.37.1, gas, emacs-18.55
386 Esix rev C
gas-1.37/write.s
386 Ix 2.02
gas, all the X11R4 mit clients
386 CTIX 3.2
xsol (X11R4 solitary game), gas
68030 unisoft 1.3
the kernel (V.3.2) + tcp/ip extensions
bash-1.05, bison-1.11, compress-4.0, cproto, shar-3.49, diff-1.14,
dist-18.55, flex-2.3, gas-1.37, gcc-1.37.1, gdb-3.6, grep-1.5,
kermit, make-3.58, makedep, patch, printf, makeinfo, g++-1.37.1,
tar-1.08, texi2roff, uuencode, uutraf-1.2, libg++-1.37.2, groff-0.5
68020 sunos 3.5 (no, not coff, just to be sure that I didn't
introduce errors)
gcc-1.37.1, gas, emacs-18.55, gdb-3.6, bison-1.11, diff-1.14,
make-3.58, tar-1.08
68030 sunos 4.0.3 (idem)
gas
I would be glad to hear about new experiences
Loic (loic@adesign.uucp or loic@afp.uucp)

25
gnu/usr.bin/as/README.pic Normal file
View File

@ -0,0 +1,25 @@
A few short notes on PIC support.
. References to the symbol "_GLOBAL_OFFSET_TABLE_" are special. These always
PC relative to the start of the current instruction. Also, they occur
in "complex" expressions in function prologs, eg.
move _GLOBAL_OFFSET_TABLE_ + (. - L1 ), %some_register
The expression parser can't handle these generically, so the expression
above is recognised as a special case.
. Some archs have special PIC assembler syntax to reference static and global
data. This is handled in targ-cpu.c.
. Correct relocation_info must be output (eg. fields r_jmptable and r_baserel).
. Internal labels must be output in the symbol table if they are referred to
by PIC instructions. The linker must allocate a GOT slot for them.
. The former meaning of the -k switch ("WORKING_DOT" stuff), has been nuked
in favour of enabling PIC code recognition.
-pk

144
gnu/usr.bin/as/README.rich Normal file
View File

@ -0,0 +1,144 @@
(This file is under construction.)
The Code Pedigree of This Directory
This directory contains a big merge of several development lines of
gas as well as a few bug fixes and some configuration that I've added
in order to retain my own sanity.
A little history.
The only common baseline of all versions was gas-1.31.
From 1.31, Intel branched off and added:
support for the Intel 80960 (i960) processor.
support for b.out object files.
some bug fixes.
sloppy mac MPW support
Intel gnu/960 makefiles and version numbering.
Many of the bug fixes found their way into the main development line
prior to 1.36. ALL intel changes were ifdef'd I80960. This was good
as it isolated the changes, but bad in that it connected the b.out
support to the i960 support, and bad in that the bug fixes were only
active in the i960+b.out executables of gas, (although most of these
were nicely marked with comments indicating that they were probably
general bug fixes.)
To pick up the main FSF development line again, along the way to 1.36,
several new processors were added, many bugs fixed, and the world was
a somewhat better place in general.
From gas-1.36, Loic at Axis Design (france!) encapsulated object
format specific actions, added coff versions of those encapsulations,
and a config.gas style configuration and Makefile. This was a big
change and a lot of work.
Then along came the FIRST FSF release of gas-1.37. I say this because
there have been at least two releases of gas-1.37. Only two of them
do we care about for this story, so let's call them gas-1.37.1 and
gas-1.37.2.
Here starts the confusion. Firstly, gas-1.37.1 did not compile.
In the meantime, John Gilmore at Cygnus Support had been hacking
gas-1.37.1. He got it to compile. He added support for the AMD 29000
processor. AND he started encapsulating some of the a.out specific
pieces of code mostly into functions. AND he rebuilt the relocation
info to be generic. AND he restructured somewhat so that for a single
host, cross assemblers could be built for all targets in the same
directory. Useful work but a considerable nuisance because the a29k
changes were not partitioned from the encapsulation changes, the
encapsulation changes were incomplete, and the encapsulation required
functions where alternate structuring might have used macros. Let's
call this version gas-1.37.1+a29k.
By the time gas-1.37.2 was "released", (remember that it TOO was
labelled by FSF as gas-1.37), it compiled, but it also added i860
support and ansi style const declarations.
At this point, Loic rolled his changes into gas-1.37.2.
What I've done.
I collected all the stray versions of gas that sounded relevant to my
goals of cross assembly and alternate object file formats and the FSF
releases from which the stray versions had branched.
I rolled the Intel i960 changes from 1.31 into versions that I call
1.34+i960, 1.36+i960, and then 1.37.1+i960.
Then I merged 1.37.1+i960 with 1.37.1+a29k to produce what I call
1.37.1+i960+a29k or 1.37.3.
From 1.37.3, I pulled in Loic's stuff. This wasn't easy as Loic's
stuff hit all the same points as John's encapsulations. Loic's goal
was to split the a.out from coff dependancies for native assembly on
coff, while John's was to split for multiple cross assembly from a
single host.
Loic's config arranged files much like emacs into m-*, etc. I've
rearranged these somewhat.
Theory:
The goal of the new configuration scheme is to bury all object format,
target processor, and host machine dependancies in object, target, and
host specific files. That is, to move all #ifdef's out of the gas
common code.
Here's how it works. There is a .h and a .c file for each object file
format, a .h and a .c file for each target processor, and a .h for
each host. config.gas creates {sym}links in the current directory to
the appropriate files in the config directory. config.gas also serves
as a list of triplets {host, target, object-format} that have been
tested at one time or another. I also recommend that config.gas be
used to document triplet specific notes as to purpose of the triplet,
etc.
Implementation:
host.h is a {sym}link to .../config/xm-yourhost.h. It is intended to
be used to hide host compiler, system header file, and system library
differences between host machines. If your host needs actual c source
files, then either: these are generally useful functions, in which
case you should probably build a local library outside of the gas
source tree, or someone, perhaps me, is confused about what is needed
by different hosts.
obj-format.h is a {sym}link to .../config/obj-something.h. It is intended
All gas .c files include as.h.
as.h #define's "gas", includes host.h, defines a number of gas
specific structures and types, and then includes tp.h, obj.h, and
target-environment.h.
target-environment.h defines a target environment specific
preprocessor flag, eg, TE_SUN, and then includes obj-format.h.
obj-format.h defines an object format specific preprocessor flag, eg,
OBJ_AOUT, OBJ_BOUT, OBJ_COFF, includes "target-processor.h", and then
defines the object specific macros, functions, types, and structures.
target-processor.h
target-processor.
Porting:
There appear to be four major types of ports; new hosts, new target
processors, new object file formats, and new target environments.
-----
reloc now stored internally as generic. (symbols too?) (segment types
vs. names?)
I don't mean to overlook anyone here. There have also been several
other development lines here that I looked at and elected to bypass.
Specifically, xxx's stabs in coff stuff was particularly tempting.

1
gnu/usr.bin/as/VERSION Normal file
View File

@ -0,0 +1 @@
1.92.3

View File

@ -1,182 +1,273 @@
/* Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
Modified by Allen Wirfs-Brock, Instantiations Inc 2/90
*/
/* This is the Assembler Pre-Processor
Copyright (C) 1987 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 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. */
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. */
/* App, the assembler pre-processor. This pre-processor strips out excess
spaces, turns single-quoted characters into a decimal constant, and turns
# <number> <filename> <garbage> into a .line <number>;.file <filename> pair.
# <number> <filename> <garbage> into a .line <number>\n.app-file <filename> pair.
This needs better error-handling.
*/
#include <stdio.h>
#ifdef USG
#define bzero(s,n) memset(s,0,n)
*/
#ifndef lint
static char rcsid[] = "$Id: app.c,v 1.3 1993/10/02 20:57:12 pk Exp $";
#endif
#if !defined(__STDC__) && !defined(const)
#include <stdio.h>
#include "as.h" /* For BAD_CASE() only */
#if (__STDC__ != 1) && !defined(const)
#define const /* Nothing */
#endif
static char lex [256];
static const char symbol_chars[] =
"$._ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
static char lex[256];
static char symbol_chars[] =
"$._ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
/* These will go in BSS if not defined elsewhere, producing empty strings. */
extern const char comment_chars[];
extern const char line_comment_chars[];
extern const char line_separator_chars[];
#define LEX_IS_SYMBOL_COMPONENT (1)
#define LEX_IS_WHITESPACE (2)
#define LEX_IS_LINE_SEPERATOR (4)
#define LEX_IS_COMMENT_START (8) /* JF added these two */
#define LEX_IS_LINE_COMMENT_START (16)
#define IS_SYMBOL_COMPONENT(c) (lex [c] & LEX_IS_SYMBOL_COMPONENT)
#define IS_WHITESPACE(c) (lex [c] & LEX_IS_WHITESPACE)
#define IS_LINE_SEPERATOR(c) (lex [c] & LEX_IS_LINE_SEPERATOR)
#define IS_COMMENT(c) (lex [c] & LEX_IS_COMMENT_START)
#define IS_LINE_COMMENT(c) (lex [c] & LEX_IS_LINE_COMMENT_START)
#define LEX_IS_SYMBOL_COMPONENT 1
#define LEX_IS_WHITESPACE 2
#define LEX_IS_LINE_SEPARATOR 3
#define LEX_IS_COMMENT_START 4
#define LEX_IS_LINE_COMMENT_START 5
#define LEX_IS_TWOCHAR_COMMENT_1ST 6
#define LEX_IS_TWOCHAR_COMMENT_2ND 7
#define LEX_IS_STRINGQUOTE 8
#define LEX_IS_COLON 9
#define LEX_IS_NEWLINE 10
#define LEX_IS_ONECHAR_QUOTE 11
#define IS_SYMBOL_COMPONENT(c) (lex[c] == LEX_IS_SYMBOL_COMPONENT)
#define IS_WHITESPACE(c) (lex[c] == LEX_IS_WHITESPACE)
#define IS_LINE_SEPARATOR(c) (lex[c] == LEX_IS_LINE_SEPARATOR)
#define IS_COMMENT(c) (lex[c] == LEX_IS_COMMENT_START)
#define IS_LINE_COMMENT(c) (lex[c] == LEX_IS_LINE_COMMENT_START)
#define IS_NEWLINE(c) (lex[c] == LEX_IS_NEWLINE)
void
do_scrub_begin()
{
/* FIXME-soon: The entire lexer/parser thingy should be
built statically at compile time rather than dynamically
each and every time the assembler is run. xoxorich. */
void do_scrub_begin() {
const char *p;
bzero (lex, sizeof(lex)); /* Trust NOBODY! */
lex [' '] |= LEX_IS_WHITESPACE;
lex ['\t'] |= LEX_IS_WHITESPACE;
for (p =symbol_chars;*p;++p)
lex [*p] |= LEX_IS_SYMBOL_COMPONENT;
lex ['\n'] |= LEX_IS_LINE_SEPERATOR;
#ifdef DONTDEF
lex [':'] |= LEX_IS_LINE_SEPERATOR;
#endif
lex [';'] |= LEX_IS_LINE_SEPERATOR;
for (p=comment_chars;*p;p++)
lex[*p] |= LEX_IS_COMMENT_START;
for (p=line_comment_chars;*p;p++)
lex[*p] |= LEX_IS_LINE_COMMENT_START;
}
lex[' '] = LEX_IS_WHITESPACE;
lex['\t'] = LEX_IS_WHITESPACE;
lex['\n'] = LEX_IS_NEWLINE;
lex[';'] = LEX_IS_LINE_SEPARATOR;
lex['"'] = LEX_IS_STRINGQUOTE;
lex['\''] = LEX_IS_ONECHAR_QUOTE;
lex[':'] = LEX_IS_COLON;
/* Note that these override the previous defaults, e.g. if ';'
is a comment char, then it isn't a line separator. */
for (p = symbol_chars; *p; ++p) {
lex[*p] = LEX_IS_SYMBOL_COMPONENT;
} /* declare symbol characters */
for (p = line_comment_chars; *p; p++) {
lex[*p] = LEX_IS_LINE_COMMENT_START;
} /* declare line comment chars */
for (p = comment_chars; *p; p++) {
lex[*p] = LEX_IS_COMMENT_START;
} /* declare comment chars */
for (p = line_separator_chars; *p; p++) {
lex[*p] = LEX_IS_LINE_SEPARATOR;
} /* declare line separators */
/* Only allow slash-star comments if slash is not in use */
if (lex['/'] == 0) {
lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST;
}
/* FIXME-soon. This is a bad hack but otherwise, we
can't do c-style comments when '/' is a line
comment char. xoxorich. */
if (lex['*'] == 0) {
lex['*'] = LEX_IS_TWOCHAR_COMMENT_2ND;
}
} /* do_scrub_begin() */
FILE *scrub_file;
int
scrub_from_file()
{
int scrub_from_file() {
return getc(scrub_file);
}
void
scrub_to_file(ch)
void scrub_to_file(ch)
int ch;
{
ungetc(ch,scrub_file);
}
} /* scrub_to_file() */
char *scrub_string;
char *scrub_last_string;
int
scrub_from_string()
{
int scrub_from_string() {
return scrub_string == scrub_last_string ? EOF : *scrub_string++;
}
} /* scrub_from_string() */
void
scrub_to_string(ch)
void scrub_to_string(ch)
int ch;
{
*--scrub_string=ch;
} /* scrub_to_string() */
/* Saved state of the scrubber */
static int state;
static int old_state;
static char *out_string;
static char out_buf[20];
static int add_newlines = 0;
/* Data structure for saving the state of app across #include's. Note that
app is called asynchronously to the parsing of the .include's, so our
state at the time .include is interpreted is completely unrelated.
That's why we have to save it all. */
struct app_save {
int state;
int old_state;
char *out_string;
char out_buf[sizeof (out_buf)];
int add_newlines;
char *scrub_string;
char *scrub_last_string;
FILE *scrub_file;
};
char *app_push() {
register struct app_save *saved;
saved = (struct app_save *) xmalloc(sizeof (*saved));
saved->state = state;
saved->old_state = old_state;
saved->out_string = out_string;
memcpy(out_buf, saved->out_buf, sizeof(out_buf));
saved->add_newlines = add_newlines;
saved->scrub_string = scrub_string;
saved->scrub_last_string = scrub_last_string;
saved->scrub_file = scrub_file;
/* do_scrub_begin() is not useful, just wastes time. */
return (char *)saved;
}
int
do_scrub_next_char(get,unget)
void app_pop(arg)
char *arg;
{
register struct app_save *saved = (struct app_save *)arg;
/* There is no do_scrub_end (). */
state = saved->state;
old_state = saved->old_state;
out_string = saved->out_string;
memcpy(saved->out_buf, out_buf, sizeof (out_buf));
add_newlines = saved->add_newlines;
scrub_string = saved->scrub_string;
scrub_last_string = saved->scrub_last_string;
scrub_file = saved->scrub_file;
free (arg);
} /* app_pop() */
int do_scrub_next_char(get,unget)
int (*get)();
void (*unget)();
/* FILE *fp; */
{
/* State 0: beginning of normal line
1: After first whitespace on normal line (flush more white)
2: After first non-white on normal line (keep 1white)
3: after second white on normal line (flush white)
4: after putting out a .line, put out digits
5: parsing a string, then go to old-state
6: putting out \ escape in a "d string.
7: After putting out a .file, put out string.
8: After putting out a .file string, flush until newline.
-1: output string in out_string and go to the state in old_state
-2: flush text until a '*' '/' is seen, then go to state old_state
*/
static state;
static old_state;
static char *out_string;
static char out_buf[20];
static add_newlines;
int ch;
if(state==-1) {
/*State 0: beginning of normal line
1: After first whitespace on line (flush more white)
2: After first non-white (opcode) on line (keep 1white)
3: after second white on line (into operands) (flush white)
4: after putting out a .line, put out digits
5: parsing a string, then go to old-state
6: putting out \ escape in a "d string.
7: After putting out a .app-file, put out string.
8: After putting out a .app-file string, flush until newline.
-1: output string in out_string and go to the state in old_state
-2: flush text until a '*' '/' is seen, then go to state old_state
*/
register int ch, ch2 = 0;
switch (state) {
case -1:
ch= *out_string++;
if(*out_string==0) {
if (*out_string == 0) {
state=old_state;
old_state=3;
}
return ch;
}
if(state==-2) {
for(;;) {
do ch=(*get)();
while(ch!=EOF && ch!='\n' && ch!='*');
if(ch=='\n' || ch==EOF)
return ch;
ch=(*get)();
if(ch==EOF || ch=='/')
break;
case -2:
for (;;) {
do {
ch=(*get)();
} while (ch != EOF && ch != '\n' && ch != '*');
if (ch == '\n' || ch == EOF)
return ch;
/* At this point, ch must be a '*' */
while ( (ch=(*get)()) == '*' ){
;
}
if (ch == EOF || ch == '/')
break;
(*unget)(ch);
}
state=old_state;
return ' ';
}
if(state==4) {
case 4:
ch=(*get)();
if(ch==EOF || (ch>='0' && ch<='9'))
return ch;
if (ch == EOF || (ch >= '0' && ch <= '9'))
return ch;
else {
while(ch!=EOF && IS_WHITESPACE(ch))
ch=(*get)();
if(ch=='"') {
while (ch != EOF && IS_WHITESPACE(ch))
ch=(*get)();
if (ch == '"') {
(*unget)(ch);
out_string="; .file ";
out_string="\n.app-file ";
old_state=7;
state= -1;
return *out_string++;
} else {
while(ch!=EOF && ch!='\n')
ch=(*get)();
while (ch != EOF && ch != '\n')
ch=(*get)();
return ch;
}
}
}
if(state==5) {
case 5:
ch=(*get)();
if(ch=='"') {
if (ch == '"') {
state=old_state;
return '"';
} else if(ch=='\\') {
} else if (ch == '\\') {
state=6;
return ch;
} else if(ch==EOF) {
} else if (ch == EOF) {
as_warn("End of file in string: inserted '\"'");
state=old_state;
(*unget)('\n');
@ -184,19 +275,19 @@ void (*unget)();
} else {
return ch;
}
}
if(state==6) {
case 6:
state=5;
ch=(*get)();
switch(ch) {
switch (ch) {
/* This is neet. Turn "string
more string" into "string\n more string"
*/
*/
case '\n':
(*unget)('n');
add_newlines++;
return '\\';
case '"':
case '\\':
case 'b':
@ -204,6 +295,9 @@ void (*unget)();
case 'n':
case 'r':
case 't':
#ifdef BACKSLASH_V
case 'v':
#endif /* BACKSLASH_V */
case '0':
case '1':
case '2':
@ -213,158 +307,202 @@ void (*unget)();
case '6':
case '7':
break;
#ifdef ONLY_STANDARD_ESCAPES
default:
as_warn("Unknown escape '\\%c' in string: Ignored",ch);
break;
#else /* ONLY_STANDARD_ESCAPES */
default:
/* Accept \x as x for any x */
break;
#endif /* ONLY_STANDARD_ESCAPES */
case EOF:
as_warn("End of file in string: '\"' inserted");
return '"';
}
return ch;
}
if(state==7) {
case 7:
ch=(*get)();
state=5;
old_state=8;
return ch;
}
if(state==8) {
case 8:
do ch= (*get)();
while(ch!='\n');
while (ch != '\n');
state=0;
return ch;
}
flushchar:
/* OK, we are somewhere in states 0 through 4 */
/* flushchar: */
ch=(*get)();
switch(ch) {
case ' ':
case '\t':
recycle:
if (ch == EOF) {
if (state != 0)
as_warn("End of file not at end of a line: Newline inserted.");
return ch;
}
switch (lex[ch]) {
case LEX_IS_WHITESPACE:
do ch=(*get)();
while(ch!=EOF && IS_WHITESPACE(ch));
if(ch==EOF)
return ch;
if(IS_COMMENT(ch) || (state==0 && IS_LINE_COMMENT(ch)) || ch=='/' || IS_LINE_SEPERATOR(ch)) {
(*unget)(ch);
goto flushchar;
while (ch != EOF && IS_WHITESPACE(ch));
if (ch == EOF)
return ch;
if (IS_COMMENT(ch) || (state == 0 && IS_LINE_COMMENT(ch)) || ch == '/' || IS_LINE_SEPARATOR(ch)) {
goto recycle;
}
(*unget)(ch);
if(state==0 || state==2) {
state++;
return ' ';
} else goto flushchar;
case '/':
ch=(*get)();
if(ch=='*') {
for(;;) {
do {
ch=(*get)();
if(ch=='\n')
add_newlines++;
} while(ch!=EOF && ch!='*');
ch=(*get)();
if(ch==EOF || ch=='/')
break;
(*unget)(ch);
}
if(ch==EOF)
as_warn("End of file in '/' '*' string: */ inserted");
(*unget)(' ');
goto flushchar;
} else {
if(IS_COMMENT('/') || (state==0 && IS_LINE_COMMENT('/'))) {
(*unget)(ch);
ch='/';
goto deal_misc;
}
if(ch!=EOF)
(*unget)(ch);
return '/';
switch (state) {
case 0: state++; goto recycle; /* Punted leading sp */
case 1: BAD_CASE(state); /* We can't get here */
case 2: state++; (*unget)(ch); return ' '; /* Sp after opco */
case 3: goto recycle; /* Sp in operands */
default: BAD_CASE(state);
}
break;
case '"':
case LEX_IS_TWOCHAR_COMMENT_1ST:
ch2=(*get)();
if (ch2 != EOF && lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND) {
for (;;) {
do {
ch2=(*get)();
if (ch2 != EOF && IS_NEWLINE(ch2))
add_newlines++;
} while (ch2 != EOF &&
(lex[ch2] != LEX_IS_TWOCHAR_COMMENT_2ND));
while (ch2 != EOF &&
(lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND)){
ch2=(*get)();
}
if (ch2 == EOF
|| lex[ch2] == LEX_IS_TWOCHAR_COMMENT_1ST)
break;
(*unget)(ch);
}
if (ch2 == EOF)
as_warn("End of file in multiline comment");
ch = ' ';
goto recycle;
} else {
if (ch2 != EOF)
(*unget)(ch2);
return ch;
}
break;
case LEX_IS_STRINGQUOTE:
old_state=state;
state=5;
return '"';
break;
case '\'':
return ch;
#ifndef IEEE_STYLE
case LEX_IS_ONECHAR_QUOTE:
ch=(*get)();
if(ch==EOF) {
as_warn("End-of-file after a ': \000 inserted");
if (ch == EOF) {
as_warn("End-of-file after a one-character quote; \000 inserted");
ch=0;
}
sprintf(out_buf,"(%d)",ch&0xff);
sprintf(out_buf,"%d", (int)(unsigned char)ch);
/* None of these 'x constants for us. We want 'x'.
*/
if ( (ch=(*get)()) != '\'' ) {
#ifdef REQUIRE_CHAR_CLOSE_QUOTE
as_warn("Missing close quote: (assumed)");
#else
(*unget)(ch);
#endif
}
old_state=state;
state= -1;
out_string=out_buf;
return *out_string++;
case ':':
if(state!=3)
state=0;
#endif
case LEX_IS_COLON:
if (state != 3)
state=0;
return ch;
case '\n':
if(add_newlines) {
case LEX_IS_NEWLINE:
/* Roll out a bunch of newlines from inside comments, etc. */
if (add_newlines) {
--add_newlines;
(*unget)(ch);
}
case ';':
/* fall thru into... */
case LEX_IS_LINE_SEPARATOR:
state=0;
return ch;
default:
deal_misc:
if(state==0 && IS_LINE_COMMENT(ch)) {
do ch=(*get)();
while(ch!=EOF && IS_WHITESPACE(ch));
if(ch==EOF) {
as_warn("EOF in comment: Newline inserted");
return '\n';
}
if(ch<'0' || ch>'9') {
while(ch!=EOF && ch!='\n')
ch=(*get)();
if(ch==EOF)
as_warn("EOF in Comment: Newline inserted");
state=0;
return '\n';
}
(*unget)(ch);
old_state=4;
state= -1;
out_string=".line ";
return *out_string++;
} else if(IS_COMMENT(ch)) {
do ch=(*get)();
while(ch!=EOF && ch!='\n');
if(ch==EOF)
as_warn("EOF in comment: Newline inserted");
case LEX_IS_LINE_COMMENT_START:
if (state != 0) /* Not at start of line, act normal */
goto de_fault;
/* FIXME-someday: The two character comment stuff was badly
thought out. On i386, we want '/' as line comment start
AND we want C style comments. hence this hack. The
whole lexical process should be reworked. xoxorich. */
if (ch == '/' && (ch2 = (*get)()) == '*') {
state = -2;
return(do_scrub_next_char(get, unget));
} else {
(*unget)(ch2);
} /* bad hack */
do ch=(*get)();
while (ch != EOF && IS_WHITESPACE(ch));
if (ch == EOF) {
as_warn("EOF in comment: Newline inserted");
return '\n';
}
if (ch<'0' || ch>'9') {
/* Non-numerics: Eat whole comment line */
while (ch != EOF && !IS_NEWLINE(ch))
ch=(*get)();
if (ch == EOF)
as_warn("EOF in Comment: Newline inserted");
state=0;
return '\n';
} else if(state==0) {
state=2;
}
/* Numerics begin comment. Perhaps CPP `# 123 "filename"' */
(*unget)(ch);
old_state=4;
state= -1;
out_string=".line ";
return *out_string++;
case LEX_IS_COMMENT_START:
do ch=(*get)();
while (ch != EOF && !IS_NEWLINE(ch));
if (ch == EOF)
as_warn("EOF in comment: Newline inserted");
state=0;
return '\n';
default:
de_fault:
/* Some relatively `normal' character. */
if (state == 0) {
state=2; /* Now seeing opcode */
return ch;
} else if(state==1) {
state=2;
} else if (state == 1) {
state=2; /* Ditto */
return ch;
} else {
return ch;
return ch; /* Opcode or operands already */
}
case EOF:
if(state==0)
return ch;
as_warn("End-of-File not at end of a line");
}
return -1;
}
@ -377,10 +515,10 @@ char line_comment_chars[] = "#";
main()
{
int ch;
app_begin();
while((ch=do_scrub_next_char(stdin))!=EOF)
putc(ch,stdout);
while ((ch=do_scrub_next_char(stdin)) != EOF)
putc(ch,stdout);
}
as_warn(str)
@ -390,3 +528,12 @@ char *str;
putc('\n',stderr);
}
#endif
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of app.c */

View File

@ -3,7 +3,7 @@
.TH as 1 "21 January 1992" "cygnus support" "GNU Development Tools"
.SH NAME
GNU as\-\-the portable GNU assembler.
GNU as \- the portable GNU assembler.
.SH SYNOPSIS
.na
@ -15,7 +15,7 @@ GNU as\-\-the portable GNU assembler.
.RB "[\|" \-I
.I path\c
\&\|]
.RB "[\|" \-K "\|]"
.RB "[\|" \-k "\|]"
.RB "[\|" \-L "\|]"
.RB "[\|" \-o
.I objfile\c
@ -144,8 +144,8 @@ to the search list for
.B .include
directives.
.TP
.B \-K
Issue warnings when difference tables altered for long displacements.
.B \-k
Handle position independent code, generated by gcc -fpic.
.TP
.B \-L
Keep (in symbol table) local symbols, starting with `\|\c

View File

@ -3,7 +3,7 @@
.TH as 1 "21 January 1992" "cygnus support" "GNU Development Tools"
.SH NAME
GNU as\-\-the portable GNU assembler.
GNU as \- the portable GNU assembler.
.SH SYNOPSIS
.na
@ -15,7 +15,7 @@ GNU as\-\-the portable GNU assembler.
.RB "[\|" \-I
.I path\c
\&\|]
.RB "[\|" \-K "\|]"
.RB "[\|" \-k "\|]"
.RB "[\|" \-L "\|]"
.RB "[\|" \-o
.I objfile\c
@ -144,8 +144,8 @@ to the search list for
.B .include
directives.
.TP
.B \-K
Issue warnings when difference tables altered for long displacements.
.B \-k
Handle position independent code, generated by gcc -fpic.
.TP
.B \-L
Keep (in symbol table) local symbols, starting with `\|\c

View File

@ -1,32 +1,21 @@
/*-
* This code is derived from software copyrighted by the Free Software
* Foundation.
*
* Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
*/
#ifndef lint
static char sccsid[] = "@(#)as.c 6.3 (Berkeley) 5/8/91";
#endif /* not lint */
/* as.c - GAS main program.
Copyright (C) 1987 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 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. */
Copyright (C) 1987, 1990, 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. */
/*
* Main program for AS; a 32-bit assembler of GNU.
@ -42,6 +31,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
* don't support them now.
*
*/
#ifndef lint
static char rcsid[] = "$Id: as.c,v 1.3 1993/10/02 20:57:15 pk Exp $";
#endif
#include <stdio.h>
#include <string.h>
#ifdef _POSIX_SOURCE
#include <sys/types.h> /* For pid_t in signal.h */
@ -49,52 +44,66 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <signal.h>
#define COMMON
#include "as.h"
#include "struc-symbol.h"
#include "write.h"
/* Warning! This may have some slightly strange side effects
if you try to compile two or more assemblers in the same
directory!
*/
#include "subsegs.h"
#if __STDC__ == 1
/* This prototype for got_sig() is ansi. If you want
anything else, then your compiler is lying to you when
it says that it is __STDC__. If you want to change it,
#ifdef protect it from those of us with real ansi
compilers. */
#define SIGTY void
static void got_sig(int sig);
static char *stralloc(char *str);
static void perform_an_assembly_pass(int argc, char **argv);
#else /* __STDC__ */
#ifndef SIGTY
#define SIGTY int
#endif
SIGTY got_sig();
static SIGTY got_sig();
static char *stralloc(); /* Make a (safe) copy of a string. */
static void perform_an_assembly_pass();
#endif /* not __STDC__ */
#ifdef DONTDEF
static char * gdb_symbol_file_name;
long int gdb_begin();
long gdb_begin();
#endif
int listing; /* true if a listing is wanted */
char *myname; /* argv[0] */
extern char version_string[];
extern const char version_string[];
main(argc,argv)
int argc;
char **argv;
int main(argc,argv)
int argc;
char **argv;
{
int work_argc; /* variable copy of argc */
char **work_argv; /* variable copy of argv */
char *arg; /* an arg to program */
char a; /* an arg flag (after -) */
int work_argc; /* variable copy of argc */
char **work_argv; /* variable copy of argv */
char *arg; /* an arg to program */
char a; /* an arg flag (after -) */
static const int sig[] = { SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
extern int bad_error; /* Did we hit a bad error ? */
char *stralloc(); /* Make a (safe) copy of a string. */
void symbol_begin();
void read_begin();
void write_object_file();
for(a=0;sig[a]!=0;a++)
if(signal(sig[a], SIG_IGN) != SIG_IGN)
signal(sig[a], got_sig);
for (a=0;sig[a] != 0;a++)
if (signal(sig[a], SIG_IGN) != SIG_IGN)
signal(sig[a], got_sig);
myname=argv[0];
bzero (flagseen, sizeof(flagseen)); /* aint seen nothing yet */
out_file_name = "a.out"; /* default .o file */
memset(flagseen, '\0', sizeof(flagseen)); /* aint seen nothing yet */
#ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
#define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
#endif /* OBJ_DEFAULT_OUTPUT_FILE_NAME */
out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
symbol_begin(); /* symbols.c */
subsegs_begin(); /* subsegs.c */
read_begin(); /* read.c */
@ -113,107 +122,161 @@ char **argv;
* name(s) and ""(s) denoting stdin. These file names are used
* (perhaps more than once) later.
*/
/* FIXME-SOMEDAY this should use getopt. */
work_argc = argc-1; /* don't count argv[0] */
work_argv = argv+1; /* skip argv[0] */
for (;work_argc--;work_argv++) {
arg = * work_argv; /* work_argv points to this argument */
if (*arg!='-') /* Filename. We need it later. */
continue; /* Keep scanning args looking for flags. */
if (*arg != '-') /* Filename. We need it later. */
continue; /* Keep scanning args looking for flags. */
if (arg[1] == '-' && arg[2] == 0) {
/* "--" as an argument means read STDIN */
/* on this scan, we don't want to think about filenames */
* work_argv = ""; /* Code that means 'use stdin'. */
continue;
}
/* This better be a switch. */
arg ++; /* -> letter. */
while (a = * arg) {/* scan all the 1-char flags */
arg ++; /* arg -> after letter. */
/* This better be a switch. */
arg ++; /*->letter. */
while ((a = * arg) != '\0') {/* scan all the 1-char flags */
arg ++; /* arg->after letter. */
a &= 0x7F; /* ascii only please */
if (flagseen[a])
as_warn("%s: Flag option -%c has already been seen!",myname,a);
flagseen[a] = TRUE;
/* if (flagseen[a])
as_tsktsk("%s: Flag option - %c has already been seen.", myname, a); */
flagseen[a] = 1;
switch (a) {
case 'a':
{
int loop =1;
while (loop) {
switch (*arg)
{
case 'l':
listing |= LISTING_LISTING;
arg++;
break;
case 's':
listing |= LISTING_SYMBOLS;
arg++;
break;
case 'h':
listing |= LISTING_HLL;
arg++;
break;
case 'n':
listing |= LISTING_NOFORM;
arg++;
break;
case 'd':
listing |= LISTING_NODEBUG;
arg++;
break;
default:
if (!listing)
listing= LISTING_DEFAULT;
loop = 0;
break;
}
}
}
break;
case 'f':
break; /* -f means fast - no need for "app" preprocessor. */
case 'D':
/* DEBUG is implemented: it debugs different */
/* things to other people's assemblers. */
break;
#ifdef DONTDEF
case 'G': /* GNU AS switch: include gdbsyms. */
if (*arg) /* Rest of argument is file-name. */
gdb_symbol_file_name = stralloc (arg);
gdb_symbol_file_name = stralloc (arg);
else if (work_argc) { /* Next argument is file-name. */
work_argc --;
* work_argv = NULL; /* Not a source file-name. */
gdb_symbol_file_name = * ++ work_argv;
} else
as_warn( "%s: I expected a filename after -G",myname);
as_warn("%s: I expected a filename after -G", myname);
arg = ""; /* Finished with this arg. */
break;
#endif
#ifndef WORKING_DOT_WORD
case 'I': { /* Include file directory */
char *temp = NULL;
if (*arg)
temp = stralloc (arg);
else if (work_argc) {
* work_argv = NULL;
work_argc--;
temp = * ++ work_argv;
} else
as_warn("%s: I expected a filename after -I", myname);
add_include_dir (temp);
arg = ""; /* Finished with this arg. */
break;
}
#if 00000
case 'k':
break;
#endif
case 'L': /* -L means keep L* symbols */
break;
case 'o':
if (*arg) /* Rest of argument is object file-name. */
out_file_name = stralloc (arg);
out_file_name = stralloc (arg);
else if (work_argc) { /* Want next arg for a file-name. */
* work_argv = NULL; /* This is not a file-name. */
work_argc--;
out_file_name = * ++ work_argv;
} else
as_warn("%s: I expected a filename after -o. \"%s\" assumed.",myname,out_file_name);
as_warn("%s: I expected a filename after -o. \"%s\" assumed.", myname, out_file_name);
arg = ""; /* Finished with this arg. */
break;
case 'R':
/* -R means put data into text segment */
break;
case 'v':
#ifdef VMS
#ifdef OBJ_VMS
{
extern char *compiler_version_string;
compiler_version_string = arg;
extern char *compiler_version_string;
compiler_version_string = arg;
}
#else /* not VMS */
#else /* not OBJ_VMS */
fprintf(stderr,version_string);
if(*arg && strcmp(arg,"ersion"))
as_warn("Unknown -v option ignored");
#endif
while(*arg) arg++; /* Skip the rest */
if (*arg && strcmp(arg,"ersion"))
as_warn("Unknown -v option ignored");
#endif /* not OBJ_VMS */
while (*arg) arg++; /* Skip the rest */
break;
case 'W':
/* -W means don't warn about things */
case 'X':
/* -X means treat warnings as errors */
case 'Z':
/* -Z means attempt to generate object file even after errors. */
break;
case 'g':
/*
* -g asks gas to produce gdb/dbx line number
* and file name stabs so that an assembly
* file can be handled by a source debugger.
*/
break;
default:
--arg;
if(md_parse_option(&arg,&work_argc,&work_argv)==0)
as_warn("%s: I don't understand '%c' flag!",myname,a);
if(arg && *arg)
arg++;
if (md_parse_option(&arg,&work_argc,&work_argv) == 0)
as_warn("%s: I don't understand '%c' flag.", myname, a);
if (arg && *arg)
arg++;
break;
}
}
@ -229,21 +292,37 @@ char **argv;
}
#ifdef DONTDEF
if (gdb_begin(gdb_symbol_file_name) == 0)
flagseen ['G'] = 0; /* Don't do any gdbsym stuff. */
flagseen['G'] = 0; /* Don't do any gdbsym stuff. */
#endif
/* Here with flags set up in flagseen[]. */
perform_an_assembly_pass(argc,argv); /* Assemble it. */
if (seen_at_least_1_file() && !bad_error)
write_object_file();/* relax() addresses then emit object file */
#ifdef TC_I960
brtab_emit();
#endif
if (seen_at_least_1_file()
&& !((had_warnings() && flagseen['Z'])
|| had_errors() > 0)) {
write_object_file(); /* relax() addresses then emit object file */
} /* we also check in write_object_file() just before emit. */
input_scrub_end();
md_end(); /* MACHINE.c */
#ifndef VMS
exit(bad_error); /* WIN */
#else /* VMS */
exit(!bad_error); /* WIN */
#endif /* VMS */
}
#ifndef NO_LISTING
listing_print("");
#endif
#ifndef HO_VMS
return((had_warnings() && flagseen['Z'])
|| had_errors() > 0); /* WIN */
#else /* HO_VMS */
return(!((had_warnings() && flagseen['Z'])
|| had_errors() > 0)); /* WIN */
#endif /* HO_VMS */
} /* main() */
/* perform_an_assembly_pass()
*
@ -256,34 +335,50 @@ char **argv;
* Note the un*x semantics: there is only 1 logical input file, but it
* may be a catenation of many 'physical' input files.
*/
perform_an_assembly_pass (argc, argv)
int argc;
char ** argv;
static void perform_an_assembly_pass(argc, argv)
int argc;
char **argv;
{
char * buffer; /* Where each bufferful of lines will start. */
void read_a_source_file();
int saw_a_file = 0;
need_pass_2 = 0;
#ifdef MANY_SEGMENTS
unsigned int i;
for (i= SEG_E0; i < SEG_UNKNOWN; i++)
{
segment_info[i].fix_root = 0;
}
/* Create the three fixed ones */
subseg_new (SEG_E0, 0);
subseg_new (SEG_E1, 0);
subseg_new (SEG_E2, 0);
strcpy(segment_info[SEG_E0].scnhdr.s_name,".text");
strcpy(segment_info[SEG_E1].scnhdr.s_name,".data");
strcpy(segment_info[SEG_E2].scnhdr.s_name,".bss");
subseg_new (SEG_E0, 0);
#else /* not MANY_SEGMENTS */
text_fix_root = NULL;
data_fix_root = NULL;
need_pass_2 = FALSE;
bss_fix_root = NULL;
subseg_new (SEG_TEXT, 0);
#endif /* not MANY_SEGMENTS */
argv++; /* skip argv[0] */
argc--; /* skip argv[0] */
argv++; /* skip argv[0] */
argc--; /* skip argv[0] */
while (argc--) {
if (*argv) { /* Is it a file-name argument? */
/* argv -> "" if stdin desired, else -> filename */
if (buffer = input_scrub_new_file (*argv) ) {
saw_a_file++;
read_a_source_file(buffer);
}
if (*argv) { /* Is it a file-name argument? */
saw_a_file++;
/* argv->"" if stdin desired, else->filename */
read_a_source_file(*argv);
}
argv++; /* completed that argv */
argv++; /* completed that argv */
}
if(!saw_a_file)
if(buffer = input_scrub_new_file("") )
read_a_source_file(buffer);
}
if (!saw_a_file)
read_a_source_file("");
} /* perform_an_assembly_pass() */
/*
* stralloc()
@ -292,33 +387,43 @@ char ** argv;
* Return the address of the new string. Die if there is any error.
*/
char *
stralloc (str)
static char *
stralloc (str)
char * str;
{
register char * retval;
register long int len;
register long len;
len = strlen (str) + 1;
retval = xmalloc (len);
(void)strcpy (retval, str);
return (retval);
(void) strcpy(retval, str);
return(retval);
}
lose()
{
as_fatal( "%s: 2nd pass not implemented - get your code from random(3)",myname );
}
#ifdef comment
static void lose() {
as_fatal("%s: 2nd pass not implemented - get your code from random(3)", myname);
return;
} /* lose() */
#endif /* comment */
SIGTY
got_sig(sig)
static SIGTY
got_sig(sig)
int sig;
{
static here_before = 0;
as_bad("Interrupted by signal %d",sig);
if(here_before++)
exit(1);
as_bad("Interrupted by signal %d", sig);
if (here_before++)
exit(1);
return((SIGTY) 0);
}
/* end: as.c */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of as.c */

View File

@ -1,76 +1,86 @@
/* as.h - global header file
Copyright (C) 1987 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 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. */
#ifndef asH
#define asH /* Don't declare things twice. */
#if !defined(__STDC__) && !defined(const)
#define const /* ignore */
#endif
#ifdef USG
#define index strchr
#define bzero(s,n) memset((s),0,(n))
#define bcopy(from,to,n) memcpy((to),(from),(n))
#define setbuffer(a,b,c)
#endif
Copyright (C) 1987, 1990, 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. */
/*
* $Id: as.h,v 1.3 1993/10/02 20:57:16 pk Exp $
*/
#define GAS 1
/* #include <ansidecl.h> */
#include "host.h"
#include "flonum.h"
#if __STDC__ != 1
#define volatile /**/
#ifndef const
#define const /**/
#endif /* const */
#endif /* __STDC__ */
#ifdef __GNUC__
#define alloca __builtin_alloca
#define register
#endif /* __GNUC__ */
#ifndef __LINE__
#define __LINE__ "unknown"
#endif /* __LINE__ */
#ifndef __FILE__
#define __FILE__ "unknown"
#endif /* __FILE__ */
/*
* I think this stuff is largely out of date. xoxorich.
*
* CAPITALISED names are #defined.
* "lowercaseH" is #defined if "lowercase.h" has been #include-d.
* "lowercaseT" is a typedef of "lowercase" objects.
* "lowercaseP" is type "pointer to object of type 'lowercase'".
* "lowercaseS" is typedef struct ... lowercaseS.
*
* #define DEBUG to enable all the "know" assertion tests.
* #define SUSPECT when debugging.
* #define DUMP to include data-structure dumpers.
* #define COMMON as "extern" for all modules except one, where you #define
* COMMON as "".
* If TEST is #defined, then we are testing a module: #define COMMON as "".
*/
/* These #defines are for parameters of entire assembler. */
/* #define SUSPECT JF remove for speed testing */
/* #define DUMP */
#define NDEBUG /* JF disable asserts */
/* These #includes are for type definitions etc. */
/* #include "style.h" */
#include <stdio.h>
#include <assert.h>
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
#include <string.h>
/* These defines are potentially useful */
#define FALSE (0)
#define TRUE (!FALSE)
#define ASSERT assert
#define BAD_CASE(value) \
{ \
as_fatal ("Case value %d unexpected at line %d of file \"%s\"\n", \
value, __LINE__, __FILE__); \
}
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
#define xfree free
#define BAD_CASE(value) \
{ \
as_fatal("Case value %d unexpected at line %d of file \"%s\"\n", \
value, __LINE__, __FILE__); \
}
/* These are assembler-wide concepts */
@ -83,21 +93,17 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define COMMON extern /* our commons live elswhere */
#endif
#endif
/* COMMON now defined */
/* COMMON now defined */
#define DEBUG /* temporary */
#ifdef SUSPECT
#define register /* no registers: helps debugging */
#define know(p) ASSERT(p) /* know() is less ugly than #ifdef SUSPECT/ */
/* assert()/#endif. */
#ifdef DEBUG
#undef NDEBUG
#ifndef know
#define know(p) assert(p) /* Verify our assumptions! */
#endif /* not yet defined */
#else
#define know(p) /* know() checks are no-op.ed */
#endif /* #ifdef SUSPECT */
char *xmalloc(); /* keep C compilers happy */
char *xrealloc(); /* " */
void free(); /* " */
#define xfree free
#endif
/* input_scrub.c */
@ -106,18 +112,6 @@ void free(); /* " */
* Also understands printing line-number part of error messages.
*/
/* Line number things. */
int seen_at_least_1_file();
void bump_line_counters();
void new_logical_line();
void as_where();
void as_perror();
void as_howmuch();
/* Sanitising things. */
void input_scrub_begin();
void input_scrub_end();
char *input_scrub_new_file();
char *input_scrub_next_buffer();
/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/
@ -125,7 +119,7 @@ char *input_scrub_next_buffer();
* This table describes the use of segments as EXPRESSION types.
*
* X_seg X_add_symbol X_subtract_symbol X_add_number
* SEG_NONE no (legal) expression
* SEG_ABSENT no (legal) expression
* SEG_PASS1 no (defined) "
* SEG_BIG * > 32 bits const.
* SEG_ABSOLUTE 0
@ -134,6 +128,7 @@ char *input_scrub_next_buffer();
* SEG_BSS * 0
* SEG_UNKNOWN * 0
* SEG_DIFFERENCE 0 * 0
* SEG_REGISTER *
*
* The blank fields MUST be 0, and are nugatory.
* The '0' fields MAY be 0. The '*' fields MAY NOT be 0.
@ -149,69 +144,81 @@ char *input_scrub_next_buffer();
* X_add_symbol != X_sub_symbol (then we just cancel them, => SEG_ABSOLUTE).
*/
typedef enum
{
SEG_ABSOLUTE,
SEG_TEXT,
SEG_DATA,
SEG_BSS,
#ifdef MANY_SEGMENTS
#define N_SEGMENTS 10
#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E9)
#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9
#define SEG_DATA SEG_E1
#define SEG_TEXT SEG_E0
#define SEG_BSS SEG_E2
#else
#define N_SEGMENTS 3
#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS
#endif
typedef enum _segT {
SEG_ABSOLUTE = 0,
SEG_LIST,
SEG_UNKNOWN,
SEG_NONE, /* Mythical Segment: NO expression seen. */
SEG_ABSENT, /* Mythical Segment (absent): NO expression seen. */
SEG_PASS1, /* Mythical Segment: Need another pass. */
SEG_GOOF, /* Only happens if AS has a logic error. */
/* Invented so we don't crash printing */
/* error message involving weird segment. */
SEG_BIG, /* Bigger than 32 bits constant. */
SEG_DIFFERENCE /* Mythical Segment: absolute difference. */
} segT;
#define SEG_MAXIMUM_ORDINAL (SEG_DIFFERENCE)
/* Invented so we don't crash printing */
/* error message involving weird segment. */
SEG_BIG, /* Bigger than 32 bits constant. */
SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
SEG_DEBUG, /* Debug segment */
SEG_NTV, /* Transfert vector preload segment */
SEG_PTV, /* Transfert vector postload segment */
SEG_REGISTER, /* Mythical: a register-valued expression */
} segT;
typedef unsigned char subsegT;
#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
typedef int subsegT;
COMMON subsegT now_subseg;
/* What subseg we are accreting now? */
/* What subseg we are accreting now? */
COMMON segT now_seg;
/* Segment our instructions emit to. */
/* Only OK values are SEG_TEXT or SEG_DATA. */
/* Segment our instructions emit to. */
/* Only OK values are SEG_TEXT or SEG_DATA. */
extern char *const seg_name[];
extern const int seg_N_TYPE[];
extern const segT N_TYPE_seg[];
void subsegs_begin();
void subseg_change();
void subseg_new();
extern int section_alignment[];
/* relax() */
typedef enum
{
rs_fill, /* Variable chars to be repeated fr_offset */
/* times. Fr_symbol unused. */
/* Used with fr_offset == 0 for a constant */
/* length frag. */
rs_align, /* Align: Fr_offset: power of 2. */
/* 1 variable char: fill character. */
rs_org, /* Org: Fr_offset, fr_symbol: address. */
/* 1 variable char: fill character. */
typedef enum _relax_state {
rs_fill, /* Variable chars to be repeated fr_offset times. Fr_symbol
unused. Used with fr_offset == 0 for a constant length
frag. */
rs_align, /* Align: Fr_offset: power of 2. 1 variable char: fill
character. */
rs_org, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
character. */
rs_machine_dependent,
#ifndef WORKING_DOT_WORD
rs_broken_word, /* JF: gunpoint */
#endif
}
relax_stateT;
} relax_stateT;
/* typedef unsigned char relax_substateT; */
/* JF this is more likely to leave the end of a struct frag on an align
boundry. Be very careful with this. */
typedef unsigned long int relax_substateT;
typedef unsigned long relax_substateT;
typedef unsigned long int relax_addressT;/* Enough bits for address. */
/* Still an integer type. */
typedef unsigned long relax_addressT;/* Enough bits for address. */
/* Still an integer type. */
/* frags.c */
@ -227,66 +234,183 @@ typedef unsigned long int relax_addressT;/* Enough bits for address. */
* of the 1st char of a frag is generally not known until after relax().
* Many things at assembly time describe an address by {object-file-address
* of a particular frag}+offset.
BUG: it may be smarter to have a single pointer off to various different
notes for different frag kinds. See how code pans out.
notes for different frag kinds. See how code pans
*/
struct frag /* a code fragment */
{
long unsigned int fr_address; /* Object file address. */
unsigned long fr_address; /* Object file address. */
struct frag *fr_next; /* Chain forward; ascending address order. */
/* Rooted in frch_root. */
long int fr_fix; /* (Fixed) number of chars we know we have. */
/* May be 0. */
long int fr_var; /* (Variable) number of chars after above. */
/* May be 0. */
/* Rooted in frch_root. */
long fr_fix; /* (Fixed) number of chars we know we have. */
/* May be 0. */
long fr_var; /* (Variable) number of chars after above. */
/* May be 0. */
struct symbol *fr_symbol; /* For variable-length tail. */
long int fr_offset; /* For variable-length tail. */
long fr_offset; /* For variable-length tail. */
char *fr_opcode; /*->opcode low addr byte,for relax()ation*/
relax_stateT fr_type; /* What state is my tail in? */
relax_substateT fr_subtype;
/* These are needed only on the NS32K machines */
/* These are needed only on the NS32K machines */
char fr_pcrel_adjust;
char fr_bsr;
char fr_literal [1]; /* Chars begin here. */
/* One day we will compile fr_literal[0]. */
#ifndef NO_LISTING
struct list_info_struct *line;
#endif
char fr_literal[1]; /* Chars begin here. */
/* One day we will compile fr_literal[0]. */
};
#define SIZEOF_STRUCT_FRAG \
((int)zero_address_frag.fr_literal-(int)&zero_address_frag)
/* We want to say fr_literal[0] above. */
((int)zero_address_frag.fr_literal-(int)&zero_address_frag)
/* We want to say fr_literal[0] above. */
typedef struct frag fragS;
COMMON fragS * frag_now; /* -> current frag we are building. */
/* This frag is incomplete. */
/* It is, however, included in frchain_now. */
/* Frag_now->fr_fix is bogus. Use: */
/* Virtual frag_now->fr_fix==obstack_next_free(&frags)-frag_now->fr_literal.*/
COMMON fragS *frag_now; /* -> current frag we are building. */
/* This frag is incomplete. */
/* It is, however, included in frchain_now. */
/* Frag_now->fr_fix is bogus. Use: */
/* Virtual frag_now->fr_fix == obstack_next_free(&frags)-frag_now->fr_literal.*/
COMMON fragS zero_address_frag; /* For foreign-segment symbol fixups. */
COMMON fragS bss_address_frag; /* For local common (N_BSS segment) fixups. */
void frag_new();
char * frag_more();
char * frag_var();
void frag_wane();
void frag_align();
/* main program "as.c" (command arguments etc) */
COMMON char
flagseen[128]; /* ['x'] TRUE if "-x" seen. */
flagseen[128]; /* ['x'] TRUE if "-x" seen. */
COMMON char *
out_file_name; /* name of emitted object file */
out_file_name; /* name of emitted object file */
COMMON int need_pass_2; /* TRUE if we need a second pass. */
typedef struct {
char * poc_name; /* assembler mnemonic, lower case, no '.' */
void (*poc_handler)(); /* Do the work */
int poc_val; /* Value to pass to handler */
} pseudo_typeS;
#endif /* #ifdef asH */
#if (__STDC__ == 1) & !defined(NO_STDARG)
/* end: as.h */
int had_errors(void);
int had_warnings(void);
void as_bad(const char *Format, ...);
void as_fatal(const char *Format, ...);
void as_tsktsk(const char *Format, ...);
void as_warn(const char *Format, ...);
#else
int had_errors();
int had_warnings();
void as_bad();
void as_fatal();
void as_tsktsk();
void as_warn();
#endif /* __STDC__ & !NO_STDARG */
#if __STDC__ == 1
char *app_push(void);
char *atof_ieee(char *str, int what_kind, LITTLENUM_TYPE *words);
char *input_scrub_include_file(char *filename, char *position);
char *input_scrub_new_file(char *filename);
char *input_scrub_next_buffer(char **bufp);
char *strstr(const char *s, const char *wanted);
char *xmalloc(int size);
char *xrealloc(char *ptr, long n);
int do_scrub_next_char(int (*get)(), void (*unget)());
int gen_to_words(LITTLENUM_TYPE *words, int precision, long exponent_bits);
int had_err(void);
int had_errors(void);
int had_warnings(void);
int ignore_input(void);
int scrub_from_file(void);
int scrub_from_file(void);
int scrub_from_string(void);
int seen_at_least_1_file(void);
void app_pop(char *arg);
void as_howmuch(FILE *stream);
void as_perror(char *gripe, char *filename);
void as_where(void);
void bump_line_counters(void);
void do_scrub_begin(void);
void input_scrub_begin(void);
void input_scrub_close(void);
void input_scrub_end(void);
void int_to_gen(long x);
void new_logical_line(char *fname, int line_number);
void scrub_to_file(int ch);
void scrub_to_string(int ch);
void subseg_change(segT seg, int subseg);
void subseg_new(segT seg, subsegT subseg);
void subsegs_begin(void);
#else /* not __STDC__ */
char *app_push();
char *atof_ieee();
char *input_scrub_include_file();
char *input_scrub_new_file();
char *input_scrub_next_buffer();
char *strstr();
char *xmalloc();
char *xrealloc();
int do_scrub_next_char();
int gen_to_words();
int had_err();
int had_errors();
int had_warnings();
int ignore_input();
int scrub_from_file();
int scrub_from_file();
int scrub_from_string();
int seen_at_least_1_file();
void app_pop();
void as_howmuch();
void as_perror();
void as_where();
void bump_line_counters();
void do_scrub_begin();
void input_scrub_begin();
void input_scrub_close();
void input_scrub_end();
void int_to_gen();
void new_logical_line();
void scrub_to_file();
void scrub_to_string();
void subseg_change();
void subseg_new();
void subsegs_begin();
#endif /* not __STDC__ */
/* this one starts the chain of target dependant headers */
#include "targ-env.h"
/* these define types needed by the interfaces */
#include "struc-symbol.h"
#include "write.h"
#include "expr.h"
#include "frags.h"
#include "hash.h"
#include "read.h"
#include "symbols.h"
#include "tc.h"
#include "obj.h"
#include "listing.h"
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of as.h */

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,28 @@
/* bignum_copy.c - copy a bignum
Copyright (C) 1987 Free Software Foundation, Inc.
Copyright (C) 1987, 1990, 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. */
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. */
#include "bignum.h"
#ifdef USG
#define bzero(s,n) memset(s,0,n)
#define bcopy(from,to,n) memcpy(to,from,n)
#ifndef lint
static char rcsid[] = "$Id: bignum-copy.c,v 1.3 1993/10/02 20:57:18 pk Exp $";
#endif
#include "as.h"
/*
* bignum_copy ()
*
@ -31,45 +30,47 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
* If the output is shorter than the input, copy lower-order littlenums.
* Return 0 or the number of significant littlenums dropped.
* Assumes littlenum arrays are densely packed: no unused chars between
* the littlenums. Uses bcopy() to move littlenums, and wants to
* the littlenums. Uses memcpy() to move littlenums, and wants to
* know length (in chars) of the input bignum.
*/
/* void */
int
bignum_copy (in, in_length, out, out_length)
register LITTLENUM_TYPE * in;
register int in_length; /* in sizeof(littlenum)s */
register LITTLENUM_TYPE * out;
register int out_length; /* in sizeof(littlenum)s */
bignum_copy(in, in_length, out, out_length)
register LITTLENUM_TYPE *in;
register int in_length; /* in sizeof(littlenum)s */
register LITTLENUM_TYPE *out;
register int out_length; /* in sizeof(littlenum)s */
{
register int significant_littlenums_dropped;
int significant_littlenums_dropped;
if (out_length < in_length) {
LITTLENUM_TYPE *p; /* -> most significant (non-zero) input
littlenum. */
memcpy((void *) out, (void *) in,
out_length << LITTLENUM_SHIFT);
for (p = in + in_length - 1; p >= in; --p) {
if (* p) break;
}
significant_littlenums_dropped = p - in - in_length + 1;
if (significant_littlenums_dropped < 0) {
significant_littlenums_dropped = 0;
}
} else {
memcpy((char *) out, (char *) in,
in_length << LITTLENUM_SHIFT);
if (out_length < in_length)
{
register LITTLENUM_TYPE * p; /* -> most significant (non-zero) input littlenum. */
if (out_length > in_length) {
memset((char *) (out + out_length),
'\0', (out_length - in_length) << LITTLENUM_SHIFT);
}
bcopy ((char *)in, (char *)out, out_length << LITTLENUM_SHIFT);
for (p = in + in_length - 1; p >= in; -- p)
{
if (* p) break;
significant_littlenums_dropped = 0;
}
significant_littlenums_dropped = p - in - in_length + 1;
if (significant_littlenums_dropped < 0)
{
significant_littlenums_dropped = 0;
}
}
else
{
bcopy ((char *)in, (char *)out, in_length << LITTLENUM_SHIFT);
if (out_length > in_length)
{
bzero ((char *)(out + out_length), (out_length - in_length) << LITTLENUM_SHIFT);
}
significant_littlenums_dropped = 0;
}
return (significant_littlenums_dropped);
}
return(significant_littlenums_dropped);
} /* bignum_copy() */
/* end: bignum_copy.c */
/* end of bignum-copy.c */

View File

@ -1,33 +1,37 @@
/* bignum.h-arbitrary precision integers
Copyright (C) 1987 Free Software Foundation, Inc.
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 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. */
/*
* $Id: bignum.h,v 1.3 1993/10/02 20:57:19 pk Exp $
*/
/***********************************************************************\
* *
* Arbitrary-precision integer arithmetic. *
* For speed, we work in groups of bits, even though this *
* complicates algorithms. *
* Each group of bits is called a 'littlenum'. *
* A bunch of littlenums representing a (possibly large) *
* integer is called a 'bignum'. *
* Bignums are >= 0. *
* *
\***********************************************************************/
* *
* Arbitrary-precision integer arithmetic. *
* For speed, we work in groups of bits, even though this *
* complicates algorithms. *
* Each group of bits is called a 'littlenum'. *
* A bunch of littlenums representing a (possibly large) *
* integer is called a 'bignum'. *
* Bignums are >= 0. *
* *
\***********************************************************************/
#define LITTLENUM_NUMBER_OF_BITS (16)
#define LITTLENUM_RADIX (1 << LITTLENUM_NUMBER_OF_BITS)
@ -38,11 +42,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define BITS_PER_CHAR (8)
#endif
typedef unsigned short int LITTLENUM_TYPE;
typedef unsigned short LITTLENUM_TYPE;
/* JF truncated this to get around a problem with GCC */
#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651 )
/* WARNING: I haven't checked that the trailing digits are correct! */
#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651)
/* WARNING: I haven't checked that the trailing digits are correct! */
/* end: bignum.h */
/* lengths are in sizeof(littlenum)s */
#if __STDC__ == 1
int bignum_copy(LITTLENUM_TYPE *in, int in_length,
LITTLENUM_TYPE *out, int out_length);
#else
int bignum_copy();
#endif /* __STDC__ */
/* end of bignum.h */

54
gnu/usr.bin/as/bit_fix.h Normal file
View File

@ -0,0 +1,54 @@
/* write.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. */
/*
* $Id: bit_fix.h,v 1.1 1993/10/02 20:57:19 pk Exp $
*/
/* The bit_fix was implemented to support machines that need variables
to be inserted in bitfields other than 1, 2 and 4 bytes.
Furthermore it gives us a possibillity to mask in bits in the symbol
when it's fixed in the objectcode and check the symbols limits.
The or-mask is used to set the huffman bits in displacements for the
ns32k port.
The acbi, addqi, movqi, cmpqi instruction requires an assembler that
can handle bitfields. Ie handle an expression, evaluate it and insert
the result in an some bitfield. ( ex: 5 bits in a short field of a opcode)
*/
#ifndef __bit_fix_h__
#define __bit_fix_h__
struct bit_fix {
int fx_bit_size; /* Length of bitfield */
int fx_bit_offset; /* Bit offset to bitfield */
long fx_bit_base; /* Where do we apply the bitfix.
If this is zero, default is assumed. */
long fx_bit_base_adj; /* Adjustment of base */
long fx_bit_max; /* Signextended max for bitfield */
long fx_bit_min; /* Signextended min for bitfield */
long fx_bit_add; /* Or mask, used for huffman prefix */
};
typedef struct bit_fix bit_fixS;
#endif /* __bit_fix_h__ */
/* end of bit_fix.h */

239
gnu/usr.bin/as/cond.c Normal file
View File

@ -0,0 +1,239 @@
/* cond.c - conditional assembly pseudo-ops, and .include
Copyright (C) 1990, 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. */
#ifndef lint
static char rcsid[] = "$Id: cond.c,v 1.1 1993/10/02 20:57:20 pk Exp $";
#endif
#include "as.h"
#include "obstack.h"
/* This is allocated to grow and shrink as .ifdef/.endif pairs are scanned. */
struct obstack cond_obstack;
struct file_line {
char *logical_file;
int logical_line;
char *physical_file;
int physical_line;
}; /* file_line */
/* This is what we push and pop. */
struct conditional_frame {
struct file_line if_file_line; /* the source file & line number of the "if" */
struct file_line else_file_line; /* the source file & line of the "else" */
struct conditional_frame *previous_cframe;
int else_seen; /* have we seen an else yet? */
int ignoring; /* if we are currently ignoring input. */
int dead_tree; /* if a conditional at a higher level is ignoring input. */
}; /* conditional_frame */
#if __STDC__ == 1
static void get_file_line(struct file_line *into);
static void initialize_cframe(struct conditional_frame *cframe);
static void set_file_line(struct file_line *from);
#else
static void get_file_line();
static void initialize_cframe();
static void set_file_line();
#endif
static struct conditional_frame *current_cframe = NULL;
void s_ifdef(arg)
int arg;
{
register char *name; /* points to name of symbol */
register struct symbol *symbolP; /* Points to symbol */
struct conditional_frame cframe;
SKIP_WHITESPACE(); /* Leading whitespace is part of operand. */
name = input_line_pointer;
if (!is_name_beginner(*name)) {
as_bad("invalid identifier for \".ifdef\"");
obstack_1grow(&cond_obstack, 0);
} else {
get_symbol_end();
++input_line_pointer;
symbolP = symbol_find(name);
initialize_cframe(&cframe);
cframe.ignoring = cframe.dead_tree && !((symbolP != 0) ^ arg);
current_cframe = (struct conditional_frame *) obstack_copy(&cond_obstack, &cframe, sizeof(cframe));
} /* if a valid identifyer name */
return;
} /* s_ifdef() */
void s_if(arg)
int arg;
{
expressionS operand;
struct conditional_frame cframe;
SKIP_WHITESPACE(); /* Leading whitespace is part of operand. */
expr(0, &operand);
if (operand.X_add_symbol != NULL
|| operand.X_subtract_symbol != NULL) {
as_bad("non-constant expression in \".if\" statement");
} /* bad condition */
/* If the above error is signaled, this will dispatch
using an undefined result. No big deal. */
initialize_cframe(&cframe);
cframe.ignoring = cframe.dead_tree || !((operand.X_add_number != 0) ^ arg);
current_cframe = (struct conditional_frame *) obstack_copy(&cond_obstack, &cframe, sizeof(cframe));
return;
} /* s_if() */
void s_endif(arg)
int arg;
{
struct conditional_frame *hold;
if (current_cframe == NULL) {
as_bad("\".endif\" without \".if\"");
} else {
hold = current_cframe;
current_cframe = current_cframe->previous_cframe;
obstack_free(&cond_obstack, hold);
} /* if one pop too many */
return;
} /* s_endif() */
void s_else(arg)
int arg;
{
if (current_cframe == NULL) {
as_bad(".else without matching .if - ignored");
} else if (current_cframe->else_seen) {
struct file_line hold;
as_bad("duplicate \"else\" - ignored");
get_file_line(&hold);
set_file_line(&current_cframe->else_file_line);
as_bad("here is the previous \"else\".");
set_file_line(&current_cframe->if_file_line);
as_bad("here is the matching \".if\".");
set_file_line(&hold);
} else {
get_file_line(&current_cframe->else_file_line);
if (!current_cframe->dead_tree) {
current_cframe->ignoring = !current_cframe->ignoring;
} /* if not a dead tree */
current_cframe->else_seen = 1;
} /* if error else do it */
return;
} /* s_else() */
void s_ifeqs(arg)
int arg;
{
as_bad("ifeqs not implemented.");
return;
} /* s_ifeqs() */
void s_end(arg)
int arg;
{
return;
} /* s_end() */
int ignore_input() {
char *ptr = obstack_next_free (&cond_obstack);
/* We cannot ignore certain pseudo ops. */
if (input_line_pointer[-1] == '.'
&& ((input_line_pointer[0] == 'i'
&& (!strncmp (input_line_pointer, "if", 2)
|| !strncmp (input_line_pointer, "ifdef", 5)
|| !strncmp (input_line_pointer, "ifndef", 6)))
|| (input_line_pointer[0] == 'e'
&& (!strncmp (input_line_pointer, "else", 4)
|| !strncmp (input_line_pointer, "endif", 5))))) {
return 0;
}
return((current_cframe != NULL) && (current_cframe->ignoring));
} /* ignore_input() */
static void initialize_cframe(cframe)
struct conditional_frame *cframe;
{
memset(cframe, 0, sizeof(*cframe));
get_file_line(&(cframe->if_file_line));
cframe->previous_cframe = current_cframe;
cframe->dead_tree = current_cframe != NULL && current_cframe->ignoring;
return;
} /* initialize_cframe() */
static void get_file_line(into)
struct file_line *into;
{
extern char *logical_input_file;
extern char *physical_input_file;
extern int logical_input_line;
extern int physical_input_line;
into->logical_file = logical_input_file;
into->logical_line = logical_input_line;
into->physical_file = physical_input_file;
into->physical_line = physical_input_line;
return;
} /* get_file_line() */
static void set_file_line(from)
struct file_line *from;
{
extern char *logical_input_file;
extern char *physical_input_file;
extern int logical_input_line;
extern int physical_input_line;
logical_input_file = from->logical_file;
logical_input_line = from->logical_line;
physical_input_file = from->physical_file;
physical_input_line = from->physical_line;
return;
} /* set_file_line() */
/*
* Local Variables:
* fill-column: 131
* comment-column: 0
* End:
*/
/* end of cond.c */

View File

@ -0,0 +1,76 @@
$!
$! This file sets things up to build gas on a VMS system to generate object
$! files for a VMS system. We do not use the configure script, since we
$! do not have /bin/sh to execute it.
$!
$! If you are running this file, then obviously the host is vax-dec-vms.
$!
$gas_host="vms"
$!
$cpu_type="vax"
$emulation="generic"
$obj_format="vms"
$atof="vax"
$!
$! host specific information
$call link host.h [.config]ho-'gas_host'.h
$!
$! Target specific information
$call link targ-cpu.c [.config]tc-'cpu_type'.c
$call link targ-cpu.h [.config]tc-'cpu_type'.h
$call link targ-env.h [.config]te-'emulation'.h
$!
$! Code to handle the object file format.
$call link obj-format.h [.config]obj-'obj_format'.h
$call link obj-format.c [.config]obj-'obj_format'.c
$!
$! Code to handle floating point.
$call link atof-targ.c [.config]atof-'atof'.c
$!
$!
$! Create the file version.opt, which helps identify the executalbe.
$!
$search version.c version_string,"="/match=and/output=t.tmp
$open ifile$ t.tmp
$read ifile$ line
$close ifile$
$delete/nolog t.tmp;
$ijk=f$locate("""",line)+1
$line=f$extract(ijk,f$length(line)-ijk,line)
$ijk=f$locate("""",line)
$line=f$extract(0,ijk,line)
$ijk=f$locate("\n",line)
$line=f$extract(0,ijk,line)
$!
$i=0
$loop:
$elm=f$element(i," ",line)
$if elm.eqs."" then goto no_ident
$if (elm.les."9").and.(elm.ges."0") then goto write_ident
$i=i+1
$goto loop
$!
$no_ident:
$elm="?.??"
$!
$!
$write_ident:
$open ifile$ version.opt/write
$write ifile$ "ident="+""""+elm+""""
$close ifile$
$!
$ !
$ if f$search("config.status") .nes. "" then delete config.status.*
$ open/write file config.status
$ write file "Links are now set up for use with a vax running VMS."
$ close file
$ type config.status
$exit
$!
$!
$link:
$subroutine
$if f$search(p1).nes."" then delete/nolog 'p1';
$copy 'p2' 'p1'
$write sys$output "Linked ''p2' to ''p1'."
$endsubroutine

View File

@ -0,0 +1,7 @@
# from: @(#)Makefile.hp300 6.1 (Berkeley) 3/3/91
# $Id: Makefile.hp300,v 1.4 1993/10/16 03:23:04 cgd Exp $
CFLAGS+= -Dm68851
SRCS+= tc-m68k.c atof-ieee.c
gas_target= m68k

View File

@ -1,4 +1,5 @@
# @(#)Makefile.i386 6.1 (Berkeley) 3/3/91
# from: @(#)Makefile.i386 6.1 (Berkeley) 3/3/91
# $Id: Makefile.i386,v 1.3 1993/10/02 20:58:21 pk Exp $
CFLAGS+= -DNON_BROKEN_WORDS
SRCS+= i386.c atof-ieee.c
SRCS+= tc-i386.c atof-ieee.c

View File

@ -0,0 +1,7 @@
# $Id: Makefile.pc532,v 1.1 1993/10/16 03:23:37 cgd Exp $
SRCS+= tc-ns32k.c atof-ns32k.c
CFLAGS+= -DNS32532 -DNS32381
gas_target= ns32k

View File

@ -0,0 +1,5 @@
# from: @(#)Makefile.i386 6.1 (Berkeley) 3/3/91
# $Id: Makefile.sparc,v 1.1 1993/10/02 20:58:22 pk Exp $
CFLAGS+= -DNON_BROKEN_WORDS
SRCS+= tc-sparc.c atof-ieee.c

View File

@ -0,0 +1,4 @@
# from: @(#)Makefile.vax 6.1 (Berkeley) 3/3/91
# $Id: Makefile.vax,v 1.3 1993/10/02 20:58:23 pk Exp $
SRCS+= tc-vax.c atof-vax.c

View File

@ -0,0 +1,424 @@
/* This file is aout.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__
enum reloc_type {
#ifdef TC_M88K
RELOC_LO16, /* lo16(sym) */
RELOC_HI16, /* hi16(sym) */
RELOC_PC16, /* bb0, bb1, bcnd */
RELOC_PC26, /* br, bsr */
RELOC_32, /* jump tables, etc */
RELOC_IW16, /* global access through linker regs 28 */
NO_RELOC,
#else /* not TC_M88K */
#ifdef TC_I860
/* NOTE: three bits max, see struct reloc_info_i860.r_type */
NO_RELOC = 0, BRADDR, LOW0, LOW1, LOW2, LOW3, LOW4, SPLIT0, SPLIT1, SPLIT2, RELOC_32,
#else /* not TC_I860 */
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,
#ifndef TC_SPARC
RELOC_11,
RELOC_WDISP2_14,
RELOC_WDISP19,
RELOC_HHI22,
RELOC_HLO10,
/* 29K relocation types */
RELOC_JUMPTARG, RELOC_CONST, RELOC_CONSTH,
RELOC_WDISP14, RELOC_WDISP21,
#endif /* not TC_SPARC */
NO_RELOC,
#endif /* not TC_I860 */
#endif /* not TC_M88K */
};
#ifdef TC_I860
/* NOTE: two bits max, see reloc_info_i860.r_type */
enum highlow_type {
NO_SPEC = 0, PAIR, HIGH, HIGHADJ,
};
#endif /* TC_I860 */
#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 type indicates the size of the symbol it refers to */
#define N_SIZE 0xc
/* 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];
};
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;
};
#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 aout.h */

View File

@ -1,177 +1,188 @@
/* atof_ieee.c - turn a Flonum into an IEEE floating point number
Copyright (C) 1987 Free Software Foundation, Inc.
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 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. */
#include "flonum.h"
#ifdef USG
#define bzero(s,n) memset(s,0,n)
#define bcopy(from,to,n) memcpy((to),(from),(n))
#ifndef lint
static char rcsid[] = "$Id: atof-ieee.c,v 1.3 1993/10/02 20:58:25 pk Exp $";
#endif
#include "as.h"
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
#ifndef NULL
#define NULL (0)
#endif
extern char EXP_CHARS[];
/* Precision in LittleNums. */
/* Precision in LittleNums. */
#define MAX_PRECISION (6)
#define F_PRECISION (2)
#define D_PRECISION (4)
#define X_PRECISION (6)
#define P_PRECISION (6)
/* Length in LittleNums of guard bits. */
/* Length in LittleNums of guard bits. */
#define GUARD (2)
static unsigned long int mask [] = {
0x00000000,
0x00000001,
0x00000003,
0x00000007,
0x0000000f,
0x0000001f,
0x0000003f,
0x0000007f,
0x000000ff,
0x000001ff,
0x000003ff,
0x000007ff,
0x00000fff,
0x00001fff,
0x00003fff,
0x00007fff,
0x0000ffff,
0x0001ffff,
0x0003ffff,
0x0007ffff,
0x000fffff,
0x001fffff,
0x003fffff,
0x007fffff,
0x00ffffff,
0x01ffffff,
0x03ffffff,
0x07ffffff,
0x0fffffff,
0x1fffffff,
0x3fffffff,
0x7fffffff,
0xffffffff
};
static unsigned long mask[] = {
0x00000000,
0x00000001,
0x00000003,
0x00000007,
0x0000000f,
0x0000001f,
0x0000003f,
0x0000007f,
0x000000ff,
0x000001ff,
0x000003ff,
0x000007ff,
0x00000fff,
0x00001fff,
0x00003fff,
0x00007fff,
0x0000ffff,
0x0001ffff,
0x0003ffff,
0x0007ffff,
0x000fffff,
0x001fffff,
0x003fffff,
0x007fffff,
0x00ffffff,
0x01ffffff,
0x03ffffff,
0x07ffffff,
0x0fffffff,
0x1fffffff,
0x3fffffff,
0x7fffffff,
0xffffffff,
};
static int bits_left_in_littlenum;
static int littlenums_left;
static LITTLENUM_TYPE * littlenum_pointer;
static LITTLENUM_TYPE *littlenum_pointer;
static int
next_bits (number_of_bits)
int number_of_bits;
next_bits (number_of_bits)
int number_of_bits;
{
int return_value;
if(!littlenums_left)
return 0;
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask [bits_left_in_littlenum] & *littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
if(--littlenums_left) {
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
littlenum_pointer --;
return_value |= (*littlenum_pointer>>bits_left_in_littlenum) & mask[number_of_bits];
}
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask [number_of_bits] & (*littlenum_pointer>>bits_left_in_littlenum);
}
return (return_value);
int return_value;
if (!littlenums_left)
return(0);
if (number_of_bits >= bits_left_in_littlenum) {
return_value = mask[bits_left_in_littlenum] & *littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
if (--littlenums_left) {
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
--littlenum_pointer;
return_value |= (*littlenum_pointer >> bits_left_in_littlenum) & mask[number_of_bits];
}
} else {
bits_left_in_littlenum -= number_of_bits;
return_value = mask[number_of_bits] & (*littlenum_pointer >> bits_left_in_littlenum);
}
return(return_value);
}
/* Num had better be less than LITTLENUM_NUMBER_OF_BITS */
static int
unget_bits(num)
static void
unget_bits(num)
int num;
{
if(!littlenums_left) {
if (!littlenums_left) {
++littlenum_pointer;
++littlenums_left;
bits_left_in_littlenum=num;
} else if(bits_left_in_littlenum+num>LITTLENUM_NUMBER_OF_BITS) {
bits_left_in_littlenum= num-(LITTLENUM_NUMBER_OF_BITS-bits_left_in_littlenum);
bits_left_in_littlenum = num;
} else if (bits_left_in_littlenum + num > LITTLENUM_NUMBER_OF_BITS) {
bits_left_in_littlenum = num - (LITTLENUM_NUMBER_OF_BITS - bits_left_in_littlenum);
++littlenum_pointer;
++littlenums_left;
} else
bits_left_in_littlenum+=num;
bits_left_in_littlenum += num;
}
static void
make_invalid_floating_point_number (words)
LITTLENUM_TYPE * words;
make_invalid_floating_point_number(words)
LITTLENUM_TYPE *words;
{
as_warn("cannot create floating-point number");
words[0]= ((unsigned)-1)>>1; /* Zero the leftmost bit */
words[1]= -1;
words[2]= -1;
words[3]= -1;
words[4]= -1;
words[5]= -1;
as_bad("cannot create floating-point number");
words[0] = ((unsigned) -1) >> 1; /* Zero the leftmost bit */
words[1] = -1;
words[2] = -1;
words[3] = -1;
words[4] = -1;
words[5] = -1;
}
/***********************************************************************\
* Warning: this returns 16-bit LITTLENUMs. It is up to the caller *
* to figure out any alignment problems and to conspire for the *
* bytes/word to be emitted in the right order. Bigendians beware! *
* *
\***********************************************************************/
* Warning: this returns 16-bit LITTLENUMs. It is up to the caller *
* to figure out any alignment problems and to conspire for the *
* bytes/word to be emitted in the right order. Bigendians beware! *
* *
\***********************************************************************/
/* Note that atof-ieee always has X and P precisions enabled. it is up
to md_atof to filter them out if the target machine does not support
them. */
char * /* Return pointer past text consumed. */
atof_ieee (str, what_kind, words)
char * str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE * words; /* Build the binary here. */
atof_ieee(str, what_kind, words)
char *str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE *words; /* Build the binary here. */
{
static LITTLENUM_TYPE bits [MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char * return_value;
int precision; /* Number of 16-bit words in the format. */
long int exponent_bits;
static LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char *return_value;
int precision; /* Number of 16-bit words in the format. */
long exponent_bits;
FLONUM_TYPE save_gen_flonum;
/* We have to save the generic_floating_point_number because it
contains storage allocation about the array of LITTLENUMs
where the value is actually stored. We will allocate our
own array of littlenums below, but have to restore the global
one on exit. */
save_gen_flonum = generic_floating_point_number;
return_value = str;
generic_floating_point_number.low = bits + MAX_PRECISION;
generic_floating_point_number.high = NULL;
generic_floating_point_number.leader = NULL;
generic_floating_point_number.exponent = NULL;
generic_floating_point_number.sign = '\0';
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
bzero (bits, sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
switch(what_kind) {
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
memset(bits, '\0', sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
switch (what_kind) {
case 'f':
case 'F':
case 's':
@ -179,7 +190,7 @@ atof_ieee (str, what_kind, words)
precision = F_PRECISION;
exponent_bits = 8;
break;
case 'd':
case 'D':
case 'r':
@ -187,7 +198,7 @@ atof_ieee (str, what_kind, words)
precision = D_PRECISION;
exponent_bits = 11;
break;
case 'x':
case 'X':
case 'e':
@ -195,111 +206,115 @@ atof_ieee (str, what_kind, words)
precision = X_PRECISION;
exponent_bits = 15;
break;
case 'p':
case 'P':
precision = P_PRECISION;
exponent_bits= -1;
exponent_bits = -1;
break;
default:
make_invalid_floating_point_number (words);
return NULL;
make_invalid_floating_point_number(words);
return(NULL);
}
generic_floating_point_number.high = generic_floating_point_number.low + precision - 1 + GUARD;
if (atof_generic (& return_value, ".", EXP_CHARS, & generic_floating_point_number)) {
/* as_warn("Error converting floating point number (Exponent overflow?)"); */
make_invalid_floating_point_number (words);
return NULL;
if (atof_generic(&return_value, ".", EXP_CHARS, &generic_floating_point_number)) {
/* as_bad("Error converting floating point number (Exponent overflow?)"); */
make_invalid_floating_point_number(words);
return(NULL);
}
gen_to_words(words, precision, exponent_bits);
return return_value;
/* Restore the generic_floating_point_number's storage alloc
(and everything else). */
generic_floating_point_number = save_gen_flonum;
return(return_value);
}
/* Turn generic_floating_point_number into a real float/double/extended */
gen_to_words(words,precision,exponent_bits)
int gen_to_words(words, precision, exponent_bits)
LITTLENUM_TYPE *words;
long int exponent_bits;
int precision;
long exponent_bits;
{
int return_value=0;
long int exponent_1;
long int exponent_2;
long int exponent_3;
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE * lp;
int return_value = 0;
long exponent_1;
long exponent_2;
long exponent_3;
long exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE *lp;
if (generic_floating_point_number.low > generic_floating_point_number.leader) {
/* 0.0e0 seen. */
if(generic_floating_point_number.sign=='+')
words[0]=0x0000;
if (generic_floating_point_number.sign == '+')
words[0] = 0x0000;
else
words[0]=0x8000;
bzero (&words[1], sizeof(LITTLENUM_TYPE) * (precision-1));
return return_value;
words[0] = 0x8000;
memset(&words[1], '\0', sizeof(LITTLENUM_TYPE) * (precision - 1));
return(return_value);
}
/* NaN: Do the right thing */
if(generic_floating_point_number.sign==0) {
if(precision==F_PRECISION) {
words[0]=0x7fff;
words[1]=0xffff;
if (generic_floating_point_number.sign == 0) {
if (precision == F_PRECISION) {
words[0] = 0x7fff;
words[1] = 0xffff;
} else {
words[0]=0x7fff;
words[1]=0xffff;
words[2]=0xffff;
words[3]=0xffff;
words[0] = 0x7fff;
words[1] = 0xffff;
words[2] = 0xffff;
words[3] = 0xffff;
}
return return_value;
} else if(generic_floating_point_number.sign=='P') {
} else if (generic_floating_point_number.sign == 'P') {
/* +INF: Do the right thing */
if(precision==F_PRECISION) {
words[0]=0x7f80;
words[1]=0;
if (precision == F_PRECISION) {
words[0] = 0x7f80;
words[1] = 0;
} else {
words[0]=0x7ff0;
words[1]=0;
words[2]=0;
words[3]=0;
words[0] = 0x7ff0;
words[1] = 0;
words[2] = 0;
words[3] = 0;
}
return return_value;
} else if(generic_floating_point_number.sign=='N') {
return(return_value);
} else if (generic_floating_point_number.sign == 'N') {
/* Negative INF */
if(precision==F_PRECISION) {
words[0]=0xff80;
words[1]=0x0;
if (precision == F_PRECISION) {
words[0] = 0xff80;
words[1] = 0x0;
} else {
words[0]=0xfff0;
words[1]=0x0;
words[2]=0x0;
words[3]=0x0;
words[0] = 0xfff0;
words[1] = 0x0;
words[2] = 0x0;
words[3] = 0x0;
}
return return_value;
return(return_value);
}
/*
* The floating point formats we support have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word(s) are the next most significant bits.
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
/*
* The floating point formats we support have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word(s) are the next most significant bits.
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = generic_floating_point_number.leader;
littlenums_left = 1+generic_floating_point_number.leader - generic_floating_point_number.low;
littlenums_left = 1 + generic_floating_point_number.leader - generic_floating_point_number.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++)
;
exponent_1 = generic_floating_point_number.exponent + generic_floating_point_number.leader + 1 -
generic_floating_point_number.low;
for (exponent_skippage = 0; !next_bits(1); ++exponent_skippage) ;;
exponent_1 = generic_floating_point_number.exponent + generic_floating_point_number.leader
+ 1 - generic_floating_point_number.low;
/* Radix LITTLENUM_RADIX, point just higher than generic_floating_point_number.leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
/* Radix 2. */
@ -307,152 +322,151 @@ int precision;
/* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + ((1 << (exponent_bits - 1)) - 2);
/* Offset exponent. */
lp = words;
/* Word 1. Sign, exponent and perhaps high bits. */
word1 = (generic_floating_point_number.sign == '+') ? 0 : (1<<(LITTLENUM_NUMBER_OF_BITS-1));
word1 = (generic_floating_point_number.sign == '+') ? 0 : (1 << (LITTLENUM_NUMBER_OF_BITS - 1));
/* Assume 2's complement integers. */
if(exponent_4<1 && exponent_4>=-62) {
if (exponent_4 < 1 && exponent_4 >= -62) {
int prec_bits;
int num_bits;
unget_bits(1);
num_bits= -exponent_4;
prec_bits=LITTLENUM_NUMBER_OF_BITS*precision-(exponent_bits+1+num_bits);
if(precision==X_PRECISION && exponent_bits==15)
prec_bits-=LITTLENUM_NUMBER_OF_BITS+1;
if(num_bits>=LITTLENUM_NUMBER_OF_BITS-exponent_bits) {
num_bits = -exponent_4;
prec_bits = LITTLENUM_NUMBER_OF_BITS * precision - (exponent_bits + 1 + num_bits);
if (precision == X_PRECISION && exponent_bits == 15)
prec_bits -= LITTLENUM_NUMBER_OF_BITS + 1;
if (num_bits >= LITTLENUM_NUMBER_OF_BITS - exponent_bits) {
/* Bigger than one littlenum */
num_bits-=(LITTLENUM_NUMBER_OF_BITS-1)-exponent_bits;
*lp++=word1;
if(num_bits+exponent_bits+1>=precision*LITTLENUM_NUMBER_OF_BITS) {
num_bits -= (LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits;
*lp++ = word1;
if (num_bits + exponent_bits + 1 >= precision * LITTLENUM_NUMBER_OF_BITS) {
/* Exponent overflow */
make_invalid_floating_point_number(words);
return return_value;
return(return_value);
}
if(precision==X_PRECISION && exponent_bits==15) {
*lp++=0;
*lp++=0;
num_bits-=LITTLENUM_NUMBER_OF_BITS-1;
if (precision == X_PRECISION && exponent_bits == 15) {
*lp++ = 0;
*lp++ = 0;
num_bits -= LITTLENUM_NUMBER_OF_BITS - 1;
}
while(num_bits>=LITTLENUM_NUMBER_OF_BITS) {
num_bits-=LITTLENUM_NUMBER_OF_BITS;
*lp++=0;
while (num_bits >= LITTLENUM_NUMBER_OF_BITS) {
num_bits -= LITTLENUM_NUMBER_OF_BITS;
*lp++ = 0;
}
if(num_bits)
*lp++=next_bits(LITTLENUM_NUMBER_OF_BITS-(num_bits));
if (num_bits)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - (num_bits));
} else {
if(precision==X_PRECISION && exponent_bits==15) {
*lp++=word1;
*lp++=0;
if(num_bits==LITTLENUM_NUMBER_OF_BITS) {
*lp++=0;
*lp++=next_bits(LITTLENUM_NUMBER_OF_BITS-1);
} else if(num_bits==LITTLENUM_NUMBER_OF_BITS-1)
*lp++=0;
if (precision == X_PRECISION && exponent_bits == 15) {
*lp++ = word1;
*lp++ = 0;
if (num_bits == LITTLENUM_NUMBER_OF_BITS) {
*lp++ = 0;
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - 1);
} else if (num_bits == LITTLENUM_NUMBER_OF_BITS - 1)
*lp++ = 0;
else
*lp++=next_bits(LITTLENUM_NUMBER_OF_BITS-1-num_bits);
num_bits=0;
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - 1 - num_bits);
num_bits = 0;
} else {
word1|= next_bits ((LITTLENUM_NUMBER_OF_BITS-1) - (exponent_bits+num_bits));
*lp++=word1;
word1 |= next_bits((LITTLENUM_NUMBER_OF_BITS - 1) - (exponent_bits + num_bits));
*lp++ = word1;
}
}
while(lp<words+precision)
*lp++=next_bits(LITTLENUM_NUMBER_OF_BITS);
while (lp < words + precision)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS);
/* Round the mantissa up, but don't change the number */
if(next_bits(1)) {
if (next_bits(1)) {
--lp;
if(prec_bits>LITTLENUM_NUMBER_OF_BITS) {
if (prec_bits > LITTLENUM_NUMBER_OF_BITS) {
int n = 0;
int tmp_bits;
n=0;
tmp_bits=prec_bits;
while(tmp_bits>LITTLENUM_NUMBER_OF_BITS) {
if(lp[n]!=(LITTLENUM_TYPE)-1)
break;
n = 0;
tmp_bits = prec_bits;
while (tmp_bits > LITTLENUM_NUMBER_OF_BITS) {
if (lp[n] != (LITTLENUM_TYPE) - 1)
break;
--n;
tmp_bits-=LITTLENUM_NUMBER_OF_BITS;
tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
}
if(tmp_bits>LITTLENUM_NUMBER_OF_BITS || (lp[n]&mask[tmp_bits])!=mask[tmp_bits]) {
unsigned long int carry;
if (tmp_bits > LITTLENUM_NUMBER_OF_BITS || (lp[n] & mask[tmp_bits]) != mask[tmp_bits]) {
unsigned long carry;
for (carry = 1; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
}
} else if((*lp&mask[prec_bits])!=mask[prec_bits])
lp++;
} else if ((*lp & mask[prec_bits]) != mask[prec_bits])
lp++;
}
return return_value;
} else if (exponent_4 & ~ mask [exponent_bits]) {
/*
* Exponent overflow. Lose immediately.
*/
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
} else if (exponent_4 & ~ mask[exponent_bits]) {
/*
* Exponent overflow. Lose immediately.
*/
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
make_invalid_floating_point_number (words);
return return_value;
} else {
word1 |= (exponent_4 << ((LITTLENUM_NUMBER_OF_BITS-1) - exponent_bits))
| next_bits ((LITTLENUM_NUMBER_OF_BITS-1) - exponent_bits);
word1 |= (exponent_4 << ((LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits))
| next_bits ((LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits);
}
* lp ++ = word1;
*lp++ = word1;
/* X_PRECISION is special: it has 16 bits of zero in the middle,
followed by a 1 bit. */
if(exponent_bits==15 && precision==X_PRECISION) {
*lp++=0;
*lp++= 1<<(LITTLENUM_NUMBER_OF_BITS)|next_bits(LITTLENUM_NUMBER_OF_BITS-1);
if (exponent_bits == 15 && precision == X_PRECISION) {
*lp++ = 0;
*lp++ = 1 << (LITTLENUM_NUMBER_OF_BITS) | next_bits(LITTLENUM_NUMBER_OF_BITS - 1);
}
/* The rest of the words are just mantissa bits. */
while(lp < words + precision)
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits (1)) {
unsigned long int carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp --; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
while (lp < words + precision)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS);
if (next_bits(1)) {
unsigned long carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp--; carry && (lp >= words); lp--) {
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) ) {
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) {
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
*words&= ~ (1 << (LITTLENUM_NUMBER_OF_BITS - 1));
*words &= ~(1 << (LITTLENUM_NUMBER_OF_BITS - 1));
/* make_invalid_floating_point_number (words); */
/* return return_value; */
}
@ -463,23 +477,23 @@ int precision;
/* This routine is a real kludge. Someone really should do it better, but
I'm too lazy, and I don't understand this stuff all too well anyway
(JF)
*/
*/
void
int_to_gen(x)
int_to_gen(x)
long x;
{
char buf[20];
char *bufp;
sprintf(buf,"%ld",x);
bufp= &buf[0];
if(atof_generic(&bufp,".", EXP_CHARS, &generic_floating_point_number))
as_warn("Error converting number to floating point (Exponent overflow?)");
bufp = &buf[0];
if (atof_generic(&bufp, ".", EXP_CHARS, &generic_floating_point_number))
as_bad("Error converting number to floating point (Exponent overflow?)");
}
#ifdef TEST
char *
print_gen(gen)
print_gen(gen)
FLONUM_TYPE *gen;
{
FLONUM_TYPE f;
@ -487,19 +501,24 @@ FLONUM_TYPE *gen;
double dv;
float fv;
static char sbuf[40];
if(gen) {
f=generic_floating_point_number;
generic_floating_point_number= *gen;
if (gen) {
f = generic_floating_point_number;
generic_floating_point_number = *gen;
}
gen_to_words(&arr[0],4,11);
bcopy(&arr[0],&dv,sizeof(double));
sprintf(sbuf,"%x %x %x %x %.14G ",arr[0],arr[1],arr[2],arr[3],dv);
gen_to_words(&arr[0],2,8);
bcopy(&arr[0],&fv,sizeof(float));
sprintf(sbuf+strlen(sbuf),"%x %x %.12g\n",arr[0],arr[1],fv);
if(gen)
generic_floating_point_number=f;
return sbuf;
gen_to_words(&arr[0], 4, 11);
memcpy(&dv, &arr[0], sizeof(double));
sprintf(sbuf, "%x %x %x %x %.14G ", arr[0], arr[1], arr[2], arr[3], dv);
gen_to_words(&arr[0], 2, 8);
memcpy(&fv, &arr[0], sizeof(float));
sprintf(sbuf + strlen(sbuf), "%x %x %.12g\n", arr[0], arr[1], fv);
if (gen) {
generic_floating_point_number = f;
}
return(sbuf);
}
#endif
/* end of atof-ieee.c */

View File

@ -0,0 +1,436 @@
/* atof_ns32k.c - turn a Flonum into a ns32k floating point number
Copyright (C) 1987 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 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. */
/* this is atof-m68k.c hacked for ns32k */
#include "as.h"
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
extern char EXP_CHARS[];
/* Precision in LittleNums. */
#define MAX_PRECISION (4)
#define F_PRECISION (2)
#define D_PRECISION (4)
/* Length in LittleNums of guard bits. */
#define GUARD (2)
int /* Number of chars in flonum type 'letter'. */
atof_sizeof (letter)
char letter;
{
int return_value;
/*
* Permitting uppercase letters is probably a bad idea.
* Please use only lower-cased letters in case the upper-cased
* ones become unsupported!
*/
switch (letter)
{
case 'f':
return_value = F_PRECISION;
break;
case 'd':
return_value = D_PRECISION;
break;
default:
return_value = 0;
break;
}
return (return_value);
}
static unsigned long int mask[] = {
0x00000000,
0x00000001,
0x00000003,
0x00000007,
0x0000000f,
0x0000001f,
0x0000003f,
0x0000007f,
0x000000ff,
0x000001ff,
0x000003ff,
0x000007ff,
0x00000fff,
0x00001fff,
0x00003fff,
0x00007fff,
0x0000ffff,
0x0001ffff,
0x0003ffff,
0x0007ffff,
0x000fffff,
0x001fffff,
0x003fffff,
0x007fffff,
0x00ffffff,
0x01ffffff,
0x03ffffff,
0x07ffffff,
0x0fffffff,
0x1fffffff,
0x3fffffff,
0x7fffffff,
0xffffffff
};
static int bits_left_in_littlenum;
static int littlenums_left;
static LITTLENUM_TYPE * littlenum_pointer;
static int
next_bits (number_of_bits)
int number_of_bits;
{
int return_value;
if (!littlenums_left)
return 0;
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask[bits_left_in_littlenum] & *littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
if (littlenums_left) {
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
littlenum_pointer --;
--littlenums_left;
return_value |= (*littlenum_pointer>>bits_left_in_littlenum) & mask[number_of_bits];
}
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask[number_of_bits] & (*littlenum_pointer>>bits_left_in_littlenum);
}
return (return_value);
}
static void
make_invalid_floating_point_number (words)
LITTLENUM_TYPE * words;
{
words[0]= ((unsigned)-1)>>1; /* Zero the leftmost bit */
words[1]= -1;
words[2]= -1;
words[3]= -1;
}
/***********************************************************************\
* *
* Warning: this returns 16-bit LITTLENUMs, because that is *
* what the VAX thinks in. It is up to the caller to figure *
* out any alignment problems and to conspire for the bytes/word *
* to be emitted in the right order. Bigendians beware! *
* *
\***********************************************************************/
char * /* Return pointer past text consumed. */
atof_ns32k (str, what_kind, words)
char * str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE * words; /* Build the binary here. */
{
FLONUM_TYPE f;
LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char * return_value;
int precision; /* Number of 16-bit words in the format. */
long int exponent_bits;
long int exponent_1;
long int exponent_2;
long int exponent_3;
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE * lp;
return_value = str;
f.low = bits + MAX_PRECISION;
f.high = NULL;
f.leader = NULL;
f.exponent = NULL;
f.sign = '\0';
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
bzero (bits, sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
switch (what_kind) {
case 'f':
precision = F_PRECISION;
exponent_bits = 8;
break;
case 'd':
precision = D_PRECISION;
exponent_bits = 11;
break;
default:
make_invalid_floating_point_number (words);
return NULL;
}
f.high = f.low + precision - 1 + GUARD;
if (atof_generic (& return_value, ".", EXP_CHARS, & f)) {
as_warn("Error converting floating point number (Exponent overflow?)");
make_invalid_floating_point_number (words);
return NULL;
}
if (f.low > f.leader) {
/* 0.0e0 seen. */
bzero (words, sizeof(LITTLENUM_TYPE) * precision);
return return_value;
}
if (f.sign != '+' && f.sign != '-') {
make_invalid_floating_point_number(words);
return NULL;
}
/*
* All vaxen floating_point formats (so far) have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word are the next most significant bits.
* And so on for each other word.
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = f.leader;
littlenums_left = 1 + f.leader-f.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++)
;
exponent_1 = f.exponent + f.leader + 1 - f.low;
/* Radix LITTLENUM_RADIX, point just higher than f.leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
/* Radix 2. */
exponent_3 = exponent_2 - exponent_skippage;
/* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + ((1 << (exponent_bits - 1)) - 2);
/* Offset exponent. */
if (exponent_4 & ~ mask[exponent_bits]) {
/*
* Exponent overflow. Lose immediately.
*/
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
as_warn("Exponent overflow in floating-point number");
make_invalid_floating_point_number (words);
return return_value;
}
lp = words;
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = ((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) |
((f.sign == '+') ? 0 : 0x8000) | next_bits (15 - exponent_bits);
* lp ++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
* lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits (1)) {
unsigned long int carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp --; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) ) {
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
make_invalid_floating_point_number (words);
return return_value;
}
}
return (return_value);
}
/* This is really identical to atof_ns32k except for some details */
gen_to_words(words,precision,exponent_bits)
LITTLENUM_TYPE *words;
long int exponent_bits;
{
int return_value=0;
long int exponent_1;
long int exponent_2;
long int exponent_3;
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE * lp;
if (generic_floating_point_number.low > generic_floating_point_number.leader) {
/* 0.0e0 seen. */
bzero (words, sizeof(LITTLENUM_TYPE) * precision);
return return_value;
}
/*
* All vaxen floating_point formats (so far) have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word are the next most significant bits.
* And so on for each other word.
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = generic_floating_point_number.leader;
littlenums_left = 1+generic_floating_point_number.leader - generic_floating_point_number.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++)
;
exponent_1 = generic_floating_point_number.exponent + generic_floating_point_number.leader + 1 -
generic_floating_point_number.low;
/* Radix LITTLENUM_RADIX, point just higher than generic_floating_point_number.leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
/* Radix 2. */
exponent_3 = exponent_2 - exponent_skippage;
/* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + ((1 << (exponent_bits - 1)) - 2);
/* Offset exponent. */
if (exponent_4 & ~ mask[exponent_bits]) {
/*
* Exponent overflow. Lose immediately.
*/
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
make_invalid_floating_point_number (words);
return return_value;
}
lp = words;
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = ((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) |
((generic_floating_point_number.sign == '+') ? 0 : 0x8000) | next_bits (15 - exponent_bits);
* lp ++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
* lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits (1)) {
unsigned long int carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp --; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) ) {
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
make_invalid_floating_point_number (words);
return return_value;
}
}
return (return_value);
}
/* This routine is a real kludge. Someone really should do it better, but
I'm too lazy, and I don't understand this stuff all too well anyway
(JF)
*/
void int_to_gen(x)
long x;
{
char buf[20];
char *bufp;
sprintf(buf,"%ld",x);
bufp= &buf[0];
if (atof_generic(&bufp,".", EXP_CHARS, &generic_floating_point_number))
as_warn("Error converting number to floating point (Exponent overflow?)");
}

View File

@ -0,0 +1,428 @@
/* atof_tahoe.c - turn a string into a Tahoe floating point number
Copyright (C) 1987 Free Software Foundation, Inc.
*/
/* This is really a simplified version of atof_vax.c. I glommed it wholesale
and then shaved it down. I don't even know how it works. (Don't you find
my honesty refreshing? bowen@cs.Buffalo.EDU (Devon E Bowen)
I don't allow uppercase letters in the precision descrpitors. Ie 'f' and
'd' are allowed but 'F' and 'D' aren't */
#include "as.h"
/* Precision in LittleNums. */
#define MAX_PRECISION (4)
#define D_PRECISION (4)
#define F_PRECISION (2)
/* Precision in chars. */
#define D_PRECISION_CHARS (8)
#define F_PRECISION_CHARS (4)
/* Length in LittleNums of guard bits. */
#define GUARD (2)
static const long int mask [] = {
0x00000000,
0x00000001,
0x00000003,
0x00000007,
0x0000000f,
0x0000001f,
0x0000003f,
0x0000007f,
0x000000ff,
0x000001ff,
0x000003ff,
0x000007ff,
0x00000fff,
0x00001fff,
0x00003fff,
0x00007fff,
0x0000ffff,
0x0001ffff,
0x0003ffff,
0x0007ffff,
0x000fffff,
0x001fffff,
0x003fffff,
0x007fffff,
0x00ffffff,
0x01ffffff,
0x03ffffff,
0x07ffffff,
0x0fffffff,
0x1fffffff,
0x3fffffff,
0x7fffffff,
0xffffffff
};
/* Shared between flonum_gen2tahoe and next_bits */
static int bits_left_in_littlenum;
static LITTLENUM_TYPE * littlenum_pointer;
static LITTLENUM_TYPE * littlenum_end;
#if __STDC__ == 1
int flonum_gen2tahoe(int format_letter, FLONUM_TYPE *f, LITTLENUM_TYPE *words);
#else /* not __STDC__ */
int flonum_gen2tahoe();
#endif /* not __STDC__ */
static int
next_bits (number_of_bits)
int number_of_bits;
{
int return_value;
if(littlenum_pointer<littlenum_end)
return 0;
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask [bits_left_in_littlenum] & * littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
littlenum_pointer --;
if(littlenum_pointer>=littlenum_end)
return_value |= ((*littlenum_pointer) >> (bits_left_in_littlenum)) &
mask [number_of_bits];
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask [number_of_bits] &
((*littlenum_pointer) >> bits_left_in_littlenum);
}
return (return_value);
}
static void
make_invalid_floating_point_number (words)
LITTLENUM_TYPE * words;
{
*words = 0x8000; /* Floating Reserved Operand Code */
}
static int /* 0 means letter is OK. */
what_kind_of_float (letter, precisionP, exponent_bitsP)
char letter; /* In: lowercase please. What kind of float? */
int * precisionP; /* Number of 16-bit words in the float. */
long int * exponent_bitsP; /* Number of exponent bits. */
{
int retval; /* 0: OK. */
retval = 0;
switch (letter)
{
case 'f':
* precisionP = F_PRECISION;
* exponent_bitsP = 8;
break;
case 'd':
* precisionP = D_PRECISION;
* exponent_bitsP = 8;
break;
default:
retval = 69;
break;
}
return (retval);
}
/***********************************************************************\
* *
* Warning: this returns 16-bit LITTLENUMs, because that is *
* what the VAX thinks in. It is up to the caller to figure *
* out any alignment problems and to conspire for the bytes/word *
* to be emitted in the right order. Bigendians beware! *
* *
\***********************************************************************/
char * /* Return pointer past text consumed. */
atof_tahoe (str, what_kind, words)
char * str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE * words; /* Build the binary here. */
{
FLONUM_TYPE f;
LITTLENUM_TYPE bits [MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char * return_value;
int precision; /* Number of 16-bit words in the format. */
long int exponent_bits;
return_value = str;
f . low = bits + MAX_PRECISION;
f . high = NULL;
f . leader = NULL;
f . exponent = NULL;
f . sign = '\0';
if (what_kind_of_float (what_kind, & precision, & exponent_bits))
{
return_value = NULL; /* We lost. */
make_invalid_floating_point_number (words);
}
if (return_value)
{
memset(bits, '\0', sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
f . high = f . low + precision - 1 + GUARD;
if (atof_generic (& return_value, ".", "eE", & f))
{
make_invalid_floating_point_number (words);
return_value = NULL; /* we lost */
}
else
{
if (flonum_gen2tahoe (what_kind, & f, words))
{
return_value = NULL;
}
}
}
return (return_value);
}
/*
* In: a flonum, a Tahoe floating point format.
* Out: a Tahoe floating-point bit pattern.
*/
int /* 0: OK. */
flonum_gen2tahoe (format_letter, f, words)
char format_letter; /* One of 'd' 'f'. */
FLONUM_TYPE * f;
LITTLENUM_TYPE * words; /* Deliver answer here. */
{
LITTLENUM_TYPE * lp;
int precision;
long int exponent_bits;
int return_value; /* 0 == OK. */
return_value = what_kind_of_float(format_letter,&precision,&exponent_bits);
if (return_value != 0)
{
make_invalid_floating_point_number (words);
}
else
{
if (f -> low > f -> leader)
{
/* 0.0e0 seen. */
memset(words, '\0', sizeof(LITTLENUM_TYPE) * precision);
}
else
{
long int exponent_1;
long int exponent_2;
long int exponent_3;
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
/* JF: Deal with new Nan, +Inf and -Inf codes */
if(f->sign!='-' && f->sign!='+') {
make_invalid_floating_point_number(words);
return return_value;
}
/*
* All tahoe floating_point formats have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word are the next most significant bits.
* And so on for each other word.
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = f -> leader;
littlenum_end = f->low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;
! next_bits(1);
exponent_skippage ++)
{
}
exponent_1 = f -> exponent + f -> leader + 1 - f -> low;
/* Radix LITTLENUM_RADIX, point just higher than f -> leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
/* Radix 2. */
exponent_3 = exponent_2 - exponent_skippage;
/* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + (1 << (exponent_bits - 1));
/* Offset exponent. */
if (exponent_4 & ~ mask [exponent_bits])
{
/*
* Exponent overflow. Lose immediately.
*/
make_invalid_floating_point_number (words);
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
}
else
{
lp = words;
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = ((exponent_4 & mask [exponent_bits]) << (15 - exponent_bits))
| ((f -> sign == '+') ? 0 : 0x8000)
| next_bits (15 - exponent_bits);
* lp ++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
{
* lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
}
if (next_bits (1))
{
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
unsigned long int carry;
/*
#if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif
*/
for (carry = 1, lp --;
carry && (lp >= words);
lp --)
{
carry = * lp + carry;
* lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) )
{
make_invalid_floating_point_number (words);
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
}
} /* if (we needed to round up) */
} /* if (exponent overflow) */
} /* if (0.0e0) */
} /* if (float_type was OK) */
return (return_value);
}
/*
* md_atof()
*
* In: input_line_pointer -> the 1st character of a floating-point
* number.
* 1 letter denoting the type of statement that wants a
* binary floating point number returned.
* Address of where to build floating point literal.
* Assumed to be 'big enough'.
* Address of where to return size of literal (in chars).
*
* Out: Input_line_pointer -> of next char after floating number.
* Error message, or "".
* Floating point literal.
* Number of chars we used for the literal.
*/
char *
md_atof (what_statement_type, literalP, sizeP)
char what_statement_type;
char * literalP;
int * sizeP;
{
LITTLENUM_TYPE words [MAX_PRECISION];
register char kind_of_float;
register int number_of_chars;
register LITTLENUM_TYPE * littlenum_pointer;
switch (what_statement_type)
{
case 'f': /* .ffloat */
case 'd': /* .dfloat */
kind_of_float = what_statement_type;
break;
default:
kind_of_float = 0;
break;
};
if (kind_of_float)
{
register LITTLENUM_TYPE * limit;
input_line_pointer = atof_tahoe (input_line_pointer,
kind_of_float,
words);
/*
* The atof_tahoe() builds up 16-bit numbers.
* Since the assembler may not be running on
* a different-endian machine, be very careful about
* converting words to chars.
*/
number_of_chars = (kind_of_float == 'f' ? F_PRECISION_CHARS :
(kind_of_float == 'd' ? D_PRECISION_CHARS : 0));
know(number_of_chars<=MAX_PRECISION*sizeof(LITTLENUM_TYPE));
limit = words + (number_of_chars / sizeof(LITTLENUM_TYPE));
for (littlenum_pointer = words;
littlenum_pointer < limit;
littlenum_pointer ++)
{
md_number_to_chars(literalP,*littlenum_pointer,
sizeof(LITTLENUM_TYPE));
literalP += sizeof(LITTLENUM_TYPE);
};
}
else
{
number_of_chars = 0;
};
* sizeP = number_of_chars;
return (kind_of_float ? "" : "Bad call to md_atof()");
} /* md_atof() */
/* atof_tahoe.c */

View File

@ -0,0 +1,497 @@
/* atof_vax.c - turn a Flonum into a VAX floating point number
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. */
/* JF added these two for md_atof() */
#include "as.h"
/* Precision in LittleNums. */
#define MAX_PRECISION (8)
#define H_PRECISION (8)
#define G_PRECISION (4)
#define D_PRECISION (4)
#define F_PRECISION (2)
/* Length in LittleNums of guard bits. */
#define GUARD (2)
#if __STDC__ == 1
int flonum_gen2vax(int format_letter, FLONUM_TYPE *f, LITTLENUM_TYPE *words);
#else /* not __STDC__ */
int flonum_gen2vax();
#endif /* not __STDC__ */
int /* Number of chars in flonum type 'letter'. */
atof_vax_sizeof (letter)
char letter;
{
int return_value;
/*
* Permitting uppercase letters is probably a bad idea.
* Please use only lower-cased letters in case the upper-cased
* ones become unsupported!
*/
switch (letter)
{
case 'f':
case 'F':
return_value = 4;
break;
case 'd':
case 'D':
case 'g':
case 'G':
return_value = 8;
break;
case 'h':
case 'H':
return_value = 16;
break;
default:
return_value = 0;
break;
}
return (return_value);
} /* atof_vax_sizeof */
static const long mask[] = {
0x00000000,
0x00000001,
0x00000003,
0x00000007,
0x0000000f,
0x0000001f,
0x0000003f,
0x0000007f,
0x000000ff,
0x000001ff,
0x000003ff,
0x000007ff,
0x00000fff,
0x00001fff,
0x00003fff,
0x00007fff,
0x0000ffff,
0x0001ffff,
0x0003ffff,
0x0007ffff,
0x000fffff,
0x001fffff,
0x003fffff,
0x007fffff,
0x00ffffff,
0x01ffffff,
0x03ffffff,
0x07ffffff,
0x0fffffff,
0x1fffffff,
0x3fffffff,
0x7fffffff,
0xffffffff
};
/* Shared between flonum_gen2vax and next_bits */
static int bits_left_in_littlenum;
static LITTLENUM_TYPE * littlenum_pointer;
static LITTLENUM_TYPE * littlenum_end;
static int
next_bits (number_of_bits)
int number_of_bits;
{
int return_value;
if (littlenum_pointer<littlenum_end)
return 0;
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask[bits_left_in_littlenum] & * littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
littlenum_pointer --;
if (littlenum_pointer >= littlenum_end)
return_value |= ( (* littlenum_pointer) >> (bits_left_in_littlenum) ) & mask[number_of_bits];
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask[number_of_bits] & ( (* littlenum_pointer) >> bits_left_in_littlenum);
}
return (return_value);
}
static void
make_invalid_floating_point_number (words)
LITTLENUM_TYPE * words;
{
* words = 0x8000; /* Floating Reserved Operand Code */
}
static int /* 0 means letter is OK. */
what_kind_of_float (letter, precisionP, exponent_bitsP)
char letter; /* In: lowercase please. What kind of float? */
int * precisionP; /* Number of 16-bit words in the float. */
long * exponent_bitsP; /* Number of exponent bits. */
{
int retval; /* 0: OK. */
retval = 0;
switch (letter)
{
case 'f':
* precisionP = F_PRECISION;
* exponent_bitsP = 8;
break;
case 'd':
* precisionP = D_PRECISION;
* exponent_bitsP = 8;
break;
case 'g':
* precisionP = G_PRECISION;
* exponent_bitsP = 11;
break;
case 'h':
* precisionP = H_PRECISION;
* exponent_bitsP = 15;
break;
default:
retval = 69;
break;
}
return (retval);
}
/***********************************************************************\
* *
* Warning: this returns 16-bit LITTLENUMs, because that is *
* what the VAX thinks in. It is up to the caller to figure *
* out any alignment problems and to conspire for the bytes/word *
* to be emitted in the right order. Bigendians beware! *
* *
\***********************************************************************/
char * /* Return pointer past text consumed. */
atof_vax(str, what_kind, words)
char *str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE *words; /* Build the binary here. */
{
FLONUM_TYPE f;
LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char *return_value;
int precision; /* Number of 16-bit words in the format. */
long exponent_bits;
return_value = str;
f.low = bits + MAX_PRECISION;
f.high = NULL;
f.leader = NULL;
f.exponent = NULL;
f.sign = '\0';
if (what_kind_of_float (what_kind, & precision, & exponent_bits)) {
return_value = NULL; /* We lost. */
make_invalid_floating_point_number (words);
}
if (return_value) {
memset(bits, '\0', sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
f.high = f.low + precision - 1 + GUARD;
if (atof_generic (& return_value, ".", "eE", & f)) {
make_invalid_floating_point_number (words);
return_value = NULL; /* we lost */
} else {
if (flonum_gen2vax(what_kind, & f, words)) {
return_value = NULL;
}
}
}
return(return_value);
} /* atof_vax() */
/*
* In: a flonum, a vax floating point format.
* Out: a vax floating-point bit pattern.
*/
int /* 0: OK. */
flonum_gen2vax (format_letter, f, words)
char format_letter; /* One of 'd' 'f' 'g' 'h'. */
FLONUM_TYPE *f;
LITTLENUM_TYPE *words; /* Deliver answer here. */
{
LITTLENUM_TYPE *lp;
int precision;
long exponent_bits;
int return_value; /* 0 == OK. */
return_value = what_kind_of_float(format_letter, &precision, &exponent_bits);
if (return_value != 0) {
make_invalid_floating_point_number (words);
} else {
if (f->low > f->leader) {
/* 0.0e0 seen. */
memset(words, '\0', sizeof(LITTLENUM_TYPE) * precision);
} else {
long exponent_1;
long exponent_2;
long exponent_3;
long exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
/* JF: Deal with new Nan, +Inf and -Inf codes */
if (f->sign != '-' && f->sign != '+') {
make_invalid_floating_point_number(words);
return return_value;
}
/*
* All vaxen floating_point formats (so far) have:
* Bit 15 is sign bit.
* Bits 14:n are excess-whatever exponent.
* Bits n-1:0 (if any) are most significant bits of fraction.
* Bits 15:0 of the next word are the next most significant bits.
* And so on for each other word.
*
* All this to be compatible with a KF11?? (Which is still faster
* than lots of vaxen I can think of, but it also has higher
* maintenance costs ... sigh).
*
* So we need: number of bits of exponent, number of bits of
* mantissa.
*/
#ifdef NEVER /******* This zeroing seems redundant - Dean 3may86 **********/
/*
* No matter how few bits we got back from the atof()
* routine, add enough zero littlenums so the rest of the
* code won't run out of "significant" bits in the mantissa.
*/
{
LITTLENUM_TYPE *ltp;
for (ltp = f->leader + 1;
ltp <= f->low + precision;
ltp++) {
*ltp = 0;
}
}
#endif
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = f->leader;
littlenum_end = f->low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;
! next_bits(1);
exponent_skippage ++) ;;
exponent_1 = f->exponent + f->leader + 1 - f->low;
/* Radix LITTLENUM_RADIX, point just higher than f->leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
/* Radix 2. */
exponent_3 = exponent_2 - exponent_skippage;
/* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + (1 << (exponent_bits - 1));
/* Offset exponent. */
if (exponent_4 & ~mask[exponent_bits]) {
/*
* Exponent overflow. Lose immediately.
*/
make_invalid_floating_point_number (words);
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
} else {
lp = words;
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = (((exponent_4 &mask[exponent_bits]) << (15 - exponent_bits))
| ((f->sign == '+') ? 0 : 0x8000)
| next_bits(15 - exponent_bits));
*lp++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++) {
*lp = next_bits(LITTLENUM_NUMBER_OF_BITS);
}
if (next_bits (1)) {
/*
* Since the NEXT bit is a 1, round UP the mantissa.
* The cunning design of these hidden-1 floats permits
* us to let the mantissa overflow into the exponent, and
* it 'does the right thing'. However, we lose if the
* highest-order bit of the lowest-order word flips.
* Is that clear?
*/
unsigned long carry;
/*
#if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif
*/
for (carry = 1, lp--;
carry && (lp >= words);
lp--) {
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) {
make_invalid_floating_point_number(words);
/*
* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
*/
}
} /* if (we needed to round up) */
} /* if (exponent overflow) */
} /* if (0.0e0) */
} /* if (float_type was OK) */
return(return_value);
} /* flonum_gen2vax() */
/* JF this used to be in vax.c but this looks like a better place for it */
/*
* md_atof()
*
* In: input_line_pointer->the 1st character of a floating-point
* number.
* 1 letter denoting the type of statement that wants a
* binary floating point number returned.
* Address of where to build floating point literal.
* Assumed to be 'big enough'.
* Address of where to return size of literal (in chars).
*
* Out: Input_line_pointer->of next char after floating number.
* Error message, or "".
* Floating point literal.
* Number of chars we used for the literal.
*/
#define MAXIMUM_NUMBER_OF_LITTLENUMS (8) /* For .hfloats. */
char *
md_atof (what_statement_type, literalP, sizeP)
char what_statement_type;
char * literalP;
int * sizeP;
{
LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS];
register char kind_of_float;
register int number_of_chars;
register LITTLENUM_TYPE * littlenum_pointer;
switch (what_statement_type)
{
case 'F': /* .float */
case 'f': /* .ffloat */
kind_of_float = 'f';
break;
case 'D': /* .double */
case 'd': /* .dfloat */
kind_of_float = 'd';
break;
case 'g': /* .gfloat */
kind_of_float = 'g';
break;
case 'h': /* .hfloat */
kind_of_float = 'h';
break;
default:
kind_of_float = 0;
break;
};
if (kind_of_float)
{
register LITTLENUM_TYPE * limit;
input_line_pointer = atof_vax (input_line_pointer,
kind_of_float,
words);
/*
* The atof_vax() builds up 16-bit numbers.
* Since the assembler may not be running on
* a little-endian machine, be very careful about
* converting words to chars.
*/
number_of_chars = atof_vax_sizeof (kind_of_float);
know( number_of_chars <= MAXIMUM_NUMBER_OF_LITTLENUMS * sizeof(LITTLENUM_TYPE) );
limit = words + (number_of_chars / sizeof(LITTLENUM_TYPE));
for (littlenum_pointer = words;
littlenum_pointer < limit;
littlenum_pointer ++)
{
md_number_to_chars (literalP, * littlenum_pointer, sizeof(LITTLENUM_TYPE));
literalP += sizeof(LITTLENUM_TYPE);
};
}
else
{
number_of_chars = 0;
};
* sizeP = number_of_chars;
return (kind_of_float ? "" : "Bad call to md_atof()");
} /* md_atof() */
/* end of atof-vax.c */

View File

@ -0,0 +1,783 @@
/* coff.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.h */

View File

@ -0,0 +1,927 @@
/* Demangler for GNU C++
Copyright (C) 1989, 1992 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. */
/* 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>
#if !defined(sequent) && !defined(NeXT)
#include <memory.h>
#else
#define memcpy(s1, s2, n) strncpy(s1, s2, n)
#define memcmp(s1, s2, n) strncmp(s1, s2, n)
#define strchr(s, c) index(s, c)
#endif
#if __STDC__ != 1
#define const
#endif
#if __STDC__ == 1
extern char *cplus_demangle (const char *type);
#else
extern char *cplus_demangle ();
#endif
#if __STDC__ == 1
extern char *xmalloc (int);
extern char *xrealloc (char *, int);
#else
extern char *xmalloc ();
extern char *xrealloc ();
#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", "*",
"negate", "-",
"trunc_mod", "%",
"trunc_div", "/",
"truth_andif", "&&",
"truth_orif", "||",
"postincrement", "++",
"postdecrement", "--",
"bit_ior", "|",
"bit_xor", "^",
"bit_and", "&",
"bit_not", "~",
"call", "()",
"cond", "?:",
"alshift", "<<",
"arshift", ">>",
"component", "->",
"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;
#if __STDC__ == 1
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;
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] == '_')
{
int n = (strlen (type) - 3)*2 + 3 + 2 + 1;
char *tem = (char *) xmalloc (n);
strcpy (tem, type + 3);
strcat (tem, "::~");
strcat (tem, type + 3);
strcat (tem, "()");
return tem;
}
/* static data member */
if (*type != '_' && (p = strchr (type, '$')) != '\0')
{
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;
}
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;
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);
}
p += n;
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;
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;
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;
string_appends (decl, &arg);
string_delete (&arg);
need_comma = 1;
}
}
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 *) 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));
}
#if 0
static void
string_prepends (p, s)
string *p, *s;
{
if (s->b == s->p)
return;
string_prependn (p, s->b, s->p - s->b);
}
#endif
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;
}
/* end of cplus-dem.c */

View File

@ -0,0 +1,29 @@
/* 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 <memory.h>
#define sys_nerr _sys_nerr
#define sys_errlist _sys_errlist
/* end of ho-ansi.h */

View File

@ -0,0 +1,29 @@
/* ho-pmax.h Host-specific header file for decstation 3100.
Copyright (C) 1987, 1990, 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. */
#include <string.h>
extern char *malloc();
extern int free();
#if !defined(__GNUC__)
#define know(x)
#endif /* not gcc */
/* end of ho-decstation.h */

View File

@ -0,0 +1,30 @@
/* ho-generic.h Generic host-specific header file.
Copyright 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. */
/* It is my intent that this become a file capable of config'ing and
compiling for nearly any host as aid for testing and porting.
xoxorich. */
#define M_GENERIC 1
#define HAVE_STRERROR
extern int free();
/* end of ho-generic.h */

View File

@ -0,0 +1,34 @@
/* ho-hpux.h -- Header to compile the assembler under HP-UX
Copyright (C) 1988, 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. */
#include "ho-sysv.h"
/* This header file contains the #defines specific
to HPUX changes sent me by cph@zurich.ai.mit.edu */
#ifndef hpux
#define hpux
#endif
#ifdef setbuffer
#undef setbuffer
#endif /* setbuffer */
#define setbuffer(stream, buf, size)
/* end of ho-hpux.h */

View File

@ -0,0 +1,30 @@
/* ho-i386.h i386 specific header file.
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. */
/*
* $Id: ho-i386.h,v 1.1 1993/10/02 20:58:36 pk Exp $
*/
#define HO_I386 1
#define NO_STDARG
#include "ho-sysv.h"
/* end of ho-i386.h */

View File

@ -0,0 +1,24 @@
/* ho-386aix.h AIX PS/2 i386 specific header file.
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_I386 1
#include "ho-sysv.h"
/* end of ho-i386aix.h */

View File

@ -0,0 +1,22 @@
/* ho-rs6000.h Rs6000 host-specific header file.
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_RS6000 1
/* end of ho-rs6000.h */

View File

@ -0,0 +1,3 @@
#include <ho-sunos.h>
/* end of ho-sun3.h */

View File

@ -0,0 +1,5 @@
#include <ho-sunos.h>
extern int sprintf();
/* end of ho-sun386.h */

View File

@ -0,0 +1,3 @@
#include <ho-sunos.h>
/* end of ho-sun4.h */

View File

@ -0,0 +1,81 @@
/* This file is ho-sunos.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. */
#if __STDC__ != 1
#define NO_STDARG
#endif /* not __STDC__ */
#if !defined(__GNUC__) && (__STDC__ != 1)
#include <memory.h>
#else
extern int memset();
#endif
/* #include <sys/stdtypes.h> before <stddef.h> when compiling by GCC. */
#include <sys/stdtypes.h>
#include <stddef.h>
#include <ctype.h>
#include <string.h>
/* externs for system libraries. */
/*extern int abort();*/
/*extern int exit();*/
extern char *malloc();
extern char *realloc();
extern char *strchr();
extern char *strrchr();
extern int _filbuf();
extern int _flsbuf();
extern int fclose();
extern int fgetc();
extern int fprintf();
extern int fread();
extern int free();
extern int perror();
extern int printf();
extern int rewind();
extern int setvbuf();
extern int sscanf();
extern int strcmp();
extern int strlen();
extern int strncmp();
extern int time();
extern int ungetc();
extern int vfprintf();
extern int vprintf();
extern int vsprintf();
extern long atol();
#ifndef tolower
extern int tolower();
#endif /* tolower */
#ifndef toupper
extern int toupper();
#endif /* toupper */
/*
* Local Variables:
* fill-column: 80
* comment-column: 0
* End:
*/
/* end of ho-sunos.h */

View File

@ -0,0 +1,27 @@
/* ho-sysv.h System V specific header file.
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_USG
#define setbuffer(stream, buf, size) setvbuf((stream), (buf), _IOLBF, (size))
extern int free();
extern char *malloc();
/* end of ho-sysv.h */

View File

@ -0,0 +1,27 @@
/* ho-vax.h Intended for vax ultrix
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. */
#if __STDC__ != 1
#define NO_STDARG
#endif /* not ansi */
extern char *malloc();
extern int free();
/* end of ho-vax.h */

View File

@ -0,0 +1,30 @@
/* ho-vax.h Intended for vax vms
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_VAX 1
#include "ho-vax.h"
/* We get better performance if we use the macros rather than the functions.*/
#include <ctype.h>
/* We need this to make sure that sys_nerr has the right Psect hack. */
#include <perror.h>
/* end of ho-vms.h */

View File

@ -0,0 +1 @@
ALLOCA=alloca.o

View File

@ -0,0 +1,5 @@
# Define SYSV as -DSYSV if you are using a System V operating system.
SYSV = -DSYSV
RANLIB = /bin/true
CC = gcc
MINUS_G = -O

View File

@ -0,0 +1 @@
HLIBS=-lucb

View File

@ -0,0 +1,6 @@
TARG_CPU_DEPENDENTS=
LOCAL_LOADLIBES=../bfd$(subdir)/libbfd.a
TDEFINES=-DBFD_HEADERS -DMANY_SEGMENTS -DBFD

View File

@ -0,0 +1,5 @@
TARG_CPU_DEPENDENTS=$(srcdir)/../include/opcode/h8300.h
LOCAL_LOADLIBES=$(srcdir)/../bfd/$(srcdir)/libbfd.a
TDEFINES=-DBFD_HEADERS -DMANY_SEGMENTS -DBFD
CC=gcc

View File

@ -0,0 +1,4 @@
TARG_CPU_DEPENDENTS=$(srcdir)/../include/h8300-opcode.h
LOCAL_LOADLIBES=$(srcdir)/../bfd/$(srcdir)/libbfd.a
TDEFINES=-DBFD -DMANY_SEGMENTS

View File

@ -0,0 +1,3 @@
# TDEFINES = -DBFD_HEADERS
CC = gcc
MINUS_G = -O

View File

@ -0,0 +1 @@
ALL=fake-as

View File

@ -0,0 +1 @@
ALL=fake-as

View File

@ -0,0 +1,604 @@
/* a.out object file format
Copyright (C) 1989, 1990, 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. */
#include "as.h"
#include "obstack.h"
#ifndef NO_LISTING
#include "aout/stab_gnu.h"
#endif /* NO_LISTING */
/* in: segT out: N_TYPE bits */
const short seg_N_TYPE[] = {
N_ABS,
N_TEXT,
N_DATA,
N_BSS,
N_UNDF, /* unknown */
N_UNDF, /* absent */
N_UNDF, /* pass1 */
N_UNDF, /* error */
N_UNDF, /* bignum/flonum */
N_UNDF, /* difference */
N_UNDF, /* debug */
N_UNDF, /* ntv */
N_UNDF, /* ptv */
N_REGISTER, /* register */
};
const segT N_TYPE_seg[N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
SEG_GOOF,
SEG_TEXT, /* N_TEXT == 4 */
SEG_GOOF,
SEG_DATA, /* N_DATA == 6 */
SEG_GOOF,
SEG_BSS, /* N_BSS == 8 */
SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */
SEG_GOOF,
};
#if __STDC__ == 1
static void obj_aout_stab(int what);
static void obj_aout_line(void);
static void obj_aout_desc(void);
#else /* not __STDC__ */
static void obj_aout_desc();
static void obj_aout_stab();
static void obj_aout_line();
#endif /* not __STDC__ */
const pseudo_typeS obj_pseudo_table[] = {
#ifndef IGNORE_DEBUG
/* stabs debug info */
{ "line", obj_aout_line, 0 }, /* source code line number */
{ "ln", obj_aout_line, 0 }, /* coff line number that we use anyway */
{ "desc", obj_aout_desc, 0 }, /* desc */
{ "stabd", obj_aout_stab, 'd' }, /* stabs */
{ "stabn", obj_aout_stab, 'n' }, /* stabs */
{ "stabs", obj_aout_stab, 's' }, /* stabs */
#else /* IGNORE_DEBUG */
{ "line", obj_aout_line, 0 }, /* source code line number */
{ "ln", obj_aout_line, 0 }, /* coff line number that we use anyway */
{ "desc", obj_aout_desc, 0 }, /* desc */
{ "stabd", obj_aout_stab, 'd' }, /* stabs */
{ "stabn", obj_aout_stab, 'n' }, /* stabs */
{ "stabs", obj_aout_stab, 's' }, /* stabs */
#endif /* IGNORE_DEBUG */
/* coff debug pseudos (ignored) */
{ "def", s_ignore, 0 },
{ "dim", s_ignore, 0 },
{ "endef", s_ignore, 0 },
{ "ident", s_ignore, 0 },
{ "line", s_ignore, 0 },
{ "ln", s_ignore, 0 },
{ "scl", s_ignore, 0 },
{ "size", s_size, 0 },
{ "tag", s_ignore, 0 },
{ "type", s_ignore, 0 },
{ "val", s_ignore, 0 },
{ "version", s_ignore, 0 },
/* stabs-in-coff (?) debug pseudos (ignored) */
{ "optim", s_ignore, 0 }, /* For sun386i cc (?) */
/* other stuff */
{ "ABORT", s_abort, 0 },
{ NULL} /* end sentinel */
}; /* obj_pseudo_table */
/* Relocation. */
/*
* emit_relocations()
*
* Crawl along a fixS chain. Emit the segment's relocations.
*/
void obj_emit_relocations(where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
{
for (; fixP; fixP = fixP->fx_next) {
if (fixP->fx_addsy != NULL) {
tc_aout_fix_to_chars(*where, fixP, segment_address_in_file);
*where += md_reloc_size;
} /* if there is an add symbol */
} /* for each fix */
return;
} /* obj_emit_relocations() */
/* Aout file generation & utilities */
void obj_header_append(where, headers)
char **where;
object_headers *headers;
{
tc_headers_hook(headers);
#if defined(OLD_GAS) && defined(TC_I386)
/* I think that this old behaviour was wrong, but this lets me compare to the
previous gas. xoxorich. */
md_number_to_chars(*where, headers->header.a_info, 2);
*where += 2;
md_number_to_chars(*where, 0, 2);
*where += 2;
#else /* not (TC_I386 && OLD_GAS) */
md_number_to_chars(*where, headers->header.a_info, sizeof(headers->header.a_info));
*where += sizeof(headers->header.a_info);
#endif /* not (TC_I386 && OLD_GAS) */
#ifdef TE_HPUX
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare1 */
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare2 */
#endif /* TE_HPUX */
md_number_to_chars(*where, headers->header.a_text, 4); *where += 4;
md_number_to_chars(*where, headers->header.a_data, 4); *where += 4;
md_number_to_chars(*where, headers->header.a_bss, 4); *where += 4;
#ifndef TE_HPUX
md_number_to_chars(*where, headers->header.a_syms, 4); *where += 4;
md_number_to_chars(*where, headers->header.a_entry, 4); *where += 4;
#endif /* not TE_HPUX */
md_number_to_chars(*where, headers->header.a_trsize, 4); *where += 4;
md_number_to_chars(*where, headers->header.a_drsize, 4); *where += 4;
#ifdef TE_SEQUENT
memset(*where, '\0', 3 * 2 * 4); *where += 3 * 2 * 4; /* global descriptor table? */
md_number_to_chars(*where, 0, 4); *where += 4; /* shdata - length of initialized shared data */
md_number_to_chars(*where, 0, 4); *where += 4; /* shbss - length of uninitialized shared data */
md_number_to_chars(*where, 0, 4); *where += 4; /* shdrsize - length of shared data relocation */
memset(*where, '\0', 11 * 4); *where += 11 * 4; /* boostrap for standalone */
memset(*where, '\0', 3 * 4); *where += 3 * 4; /* reserved */
md_number_to_chars(*where, 0, 4); *where += 4; /* version */
#endif /* TE_SEQUENT */
#ifdef TE_HPUX
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare3 - HP = pascal interface size */
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare4 - HP = symbol table size */
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare5 - HP = debug name table size */
md_number_to_chars(*where, headers->header.a_entry, 4); *where += 4;
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare6 - HP = source line table size */
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare7 - HP = value table size */
md_number_to_chars(*where, headers->header.a_syms, 4); *where += 4;
md_number_to_chars(*where, 0, 4); *where += 4; /* a_spare8 */
#endif /* TE_HPUX */
return;
} /* obj_append_header() */
void obj_symbol_to_chars(where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars((char *)&(S_GET_OFFSET(symbolP)), S_GET_OFFSET(symbolP), sizeof(S_GET_OFFSET(symbolP)));
md_number_to_chars((char *)&(S_GET_DESC(symbolP)), S_GET_DESC(symbolP), sizeof(S_GET_DESC(symbolP)));
md_number_to_chars((char *)&(S_GET_VALUE(symbolP)), S_GET_VALUE(symbolP), sizeof(S_GET_VALUE(symbolP)));
append(where, (char *)&symbolP->sy_symbol, sizeof(obj_symbol_type));
} /* obj_symbol_to_chars() */
void obj_emit_symbols(where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
{
symbolS * symbolP;
/*
* Emit all symbols left in the symbol chain.
*/
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
/* Used to save the offset of the name. It is used to point
to the string in memory but must be a file offset. */
register char *temp;
temp = S_GET_NAME(symbolP);
S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
/* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
if (!S_IS_DEBUG(symbolP) && !S_IS_DEFINED(symbolP)) S_SET_EXTERNAL(symbolP);
obj_symbol_to_chars(where, symbolP);
S_SET_NAME(symbolP,temp);
}
} /* emit_symbols() */
#if comment
/* uneeded if symbol is born zeroed. */
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
{
S_SET_OTHER(symbolP, 0);
S_SET_DESC(symbolP, 0);
return;
} /* obj_symbol_new_hook() */
#endif /* comment */
static void obj_aout_line() {
/* Assume delimiter is part of expression. */
/* BSD4.2 as fails with delightful bug, so we */
/* are not being incompatible here. */
new_logical_line((char *)NULL, (int)(get_absolute_expression()));
demand_empty_rest_of_line();
} /* obj_aout_line() */
/*
* stab()
*
* Handle .stabX directives, which used to be open-coded.
* So much creeping featurism overloaded the semantics that we decided
* to put all .stabX thinking in one place. Here.
*
* We try to make any .stabX directive legal. Other people's AS will often
* do assembly-time consistency checks: eg assigning meaning to n_type bits
* and "protecting" you from setting them to certain values. (They also zero
* certain bits before emitting symbols. Tut tut.)
*
* If an expression is not absolute we either gripe or use the relocation
* information. Other people's assemblers silently forget information they
* don't need and invent information they need that you didn't supply.
*
* .stabX directives always make a symbol table entry. It may be junk if
* the rest of your .stabX directive is malformed.
*/
static void obj_aout_stab(what)
int what;
{
#ifndef NO_LISTING
extern int listing;
#endif /* NO_LISTING */
register symbolS *symbolP = 0;
register char *string;
int saved_type = 0;
int length;
int goof; /* TRUE if we have aborted. */
long longint;
/*
* Enter with input_line_pointer pointing past .stabX and any following
* whitespace.
*/
goof = 0; /* JF who forgot this?? */
if (what == 's') {
string = demand_copy_C_string(& length);
SKIP_WHITESPACE();
if (* input_line_pointer == ',')
input_line_pointer ++;
else {
as_bad("I need a comma after symbol's name");
goof = 1;
}
} else
string = "";
/*
* Input_line_pointer->after ','. String->symbol name.
*/
if (! goof) {
symbolP = symbol_new(string,
SEG_UNKNOWN,
0,
(struct frag *)0);
switch (what) {
case 'd':
S_SET_NAME(symbolP, NULL); /* .stabd feature. */
S_SET_VALUE(symbolP, obstack_next_free(&frags) - frag_now->fr_literal);
symbolP->sy_frag = frag_now;
break;
case 'n':
symbolP->sy_frag = &zero_address_frag;
break;
case 's':
symbolP->sy_frag = & zero_address_frag;
break;
default:
BAD_CASE(what);
break;
}
if (get_absolute_expression_and_terminator(&longint) == ',')
symbolP->sy_symbol.n_type = saved_type = longint;
else {
as_bad("I want a comma after the n_type expression");
goof = 1;
input_line_pointer --; /* Backup over a non-',' char. */
}
}
if (!goof) {
if (get_absolute_expression_and_terminator(&longint) == ',')
S_SET_OTHER(symbolP, longint);
else {
as_bad("I want a comma after the n_other expression");
goof = 1;
input_line_pointer--; /* Backup over a non-',' char. */
}
}
if (!goof) {
S_SET_DESC(symbolP, get_absolute_expression());
if (what == 's' || what == 'n') {
if (*input_line_pointer != ',') {
as_bad("I want a comma after the n_desc expression");
goof = 1;
} else {
input_line_pointer++;
}
}
}
if ((!goof) && (what == 's' || what == 'n')) {
pseudo_set(symbolP);
symbolP->sy_symbol.n_type = saved_type;
}
#ifndef NO_LISTING
if (listing && !goof)
{
if (symbolP->sy_symbol.n_type == N_SLINE)
{
listing_source_line(symbolP->sy_symbol.n_desc);
}
else if (symbolP->sy_symbol.n_type == N_SO
|| symbolP->sy_symbol.n_type == N_SOL)
{
listing_source_file(string);
}
}
#endif
if (goof)
ignore_rest_of_line();
else
demand_empty_rest_of_line ();
} /* obj_aout_stab() */
static void obj_aout_desc() {
register char *name;
register char c;
register char *p;
register symbolS *symbolP;
register int temp;
/*
* Frob invented at RMS' request. Set the n_desc of a symbol.
*/
name = input_line_pointer;
c = get_symbol_end();
p = input_line_pointer;
* p = c;
SKIP_WHITESPACE();
if (*input_line_pointer != ',') {
*p = 0;
as_bad("Expected comma after name \"%s\"", name);
*p = c;
ignore_rest_of_line();
} else {
input_line_pointer ++;
temp = get_absolute_expression();
*p = 0;
symbolP = symbol_find_or_make(name);
*p = c;
S_SET_DESC(symbolP,temp);
}
demand_empty_rest_of_line();
} /* obj_aout_desc() */
void obj_read_begin_hook() {
return;
} /* obj_read_begin_hook() */
void obj_crawl_symbol_chain(headers)
object_headers *headers;
{
symbolS *symbolP;
symbolS **symbolPP;
int symbol_number = 0;
/* JF deal with forward references first... */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if (symbolP->sy_forward) {
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP)
+ S_GET_VALUE(symbolP->sy_forward)
+ symbolP->sy_forward->sy_frag->fr_address);
symbolP->sy_forward=0;
} /* if it has a forward reference */
} /* walk the symbol chain */
tc_crawl_symbol_chain(headers);
symbolPP = &symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL) {
if (flagseen['R'] && (S_GET_SEGMENT(symbolP) == SEG_DATA)) {
S_SET_SEGMENT(symbolP, SEG_TEXT);
} /* if pusing data into text */
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP) + symbolP->sy_frag->fr_address);
/* OK, here is how we decide which symbols go out into the
brave new symtab. Symbols that do are:
* symbols with no name (stabd's?)
* symbols with debug info in their N_TYPE
Symbols that don't are:
* symbols that are registers
* symbols with \1 as their 3rd character (numeric labels)
* "local labels" as defined by S_LOCAL_NAME(name)
if the -L switch was passed to gas.
All other symbols are output. We complain if a deleted
symbol was marked external. */
if (!S_IS_REGISTER(symbolP)
&& (!S_GET_NAME(symbolP)
|| S_IS_DEBUG(symbolP)
#ifdef TC_I960
/* FIXME-SOON this ifdef seems highly dubious to me. xoxorich. */
|| !S_IS_DEFINED(symbolP)
|| S_IS_EXTERNAL(symbolP)
#endif /* TC_I960 */
|| (S_GET_NAME(symbolP)[0] != '\001' &&
(flagseen['L'] || ! S_LOCAL_NAME(symbolP)
#ifdef PIC
|| flagseen['k'] && symbolP->sy_forceout
#endif
)
)
)
#ifdef PIC
&& (!flagseen['k'] ||
symbolP != GOT_symbol || got_referenced != 0
)
#endif
) {
symbolP->sy_number = symbol_number++;
/* The + 1 after strlen account for the \0 at the
end of each string */
if (!S_IS_STABD(symbolP)) {
/* Ordinary case. */
symbolP->sy_name_offset = string_byte_count;
string_byte_count += strlen(S_GET_NAME(symbolP)) + 1;
}
else /* .Stabd case. */
symbolP->sy_name_offset = 0;
/*
* If symbol has a known size, output an extra symbol
* of type N_SIZE and with the same name.
*/
if (symbolP->sy_size && flagseen['k']) {
symbolS *addme;
#ifdef USE_NSIZE_PREFIX /*XXX*/
char buf[BUFSIZ];
/*
* Changed my mind, make name: "=symbol"
*/
buf[0] = '=';
strncpy(buf+1, S_GET_NAME(symbolP), BUFSIZ-2);
addme = symbol_make(buf);
#else
addme = symbol_make(S_GET_NAME(symbolP));
#endif
#if 0
S_SET_SEGMENT(addme, SEG_SIZE);
#endif
addme->sy_symbol.n_type = N_SIZE;
S_SET_VALUE(addme, symbolP->sy_size);
/* Set external if symbolP is ? */
#if 1
if (S_IS_EXTERN(symbolP))
S_SET_EXTERNAL(addme);
#endif
}
symbolPP = &(symbol_next(symbolP));
} else {
if ((S_IS_EXTERNAL(symbolP) || !S_IS_DEFINED(symbolP))
#ifdef PIC
&& (!flagseen['k'] ||
symbolP != GOT_symbol || got_referenced != 0
)
#endif
) {
as_bad("Local symbol %s never defined.", decode_local_label_name(S_GET_NAME(symbolP)));
} /* oops. */
/* Unhook it from the chain */
*symbolPP = symbol_next(symbolP);
} /* if this symbol should be in the output */
} /* for each symbol */
H_SET_SYMBOL_TABLE_SIZE(headers, symbol_number);
return;
} /* obj_crawl_symbol_chain() */
/*
* Find strings by crawling along symbol table chain.
*/
void obj_emit_strings(where)
char **where;
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars(*where, string_byte_count, sizeof(string_byte_count));
*where += sizeof(string_byte_count);
#else /* CROSS_COMPILE */
append (where, (char *)&string_byte_count, (unsigned long)sizeof(string_byte_count));
#endif /* CROSS_COMPILE */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if (S_GET_NAME(symbolP))
append(&next_object_file_charP, S_GET_NAME(symbolP),
(unsigned long)(strlen (S_GET_NAME(symbolP)) + 1));
} /* walk symbol chain */
return;
} /* obj_emit_strings() */
void obj_pre_write_hook(headers)
object_headers *headers;
{
H_SET_DYNAMIC(headers, 0);
H_SET_VERSION(headers, 0);
H_SET_MACHTYPE(headers, AOUT_MACHTYPE);
H_SET_MAGIC_NUMBER(headers, DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE);
H_SET_ENTRY_POINT(headers, 0);
tc_aout_pre_write_hook(headers);
return;
} /* obj_pre_write_hook() */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-aout.c */

View File

@ -0,0 +1,207 @@
/* obj-aout.h, a.out object file format for gas, the assembler.
Copyright (C) 1989, 1990, 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. */
/*
* $Id: obj-aout.h,v 1.1 1993/10/02 20:58:55 pk Exp $
*/
/* Tag to validate a.out object file format processing */
#define OBJ_AOUT 1
#include "targ-cpu.h"
#include "aout.h" /* Needed to define struct nlist. Sigh. */
#ifndef AOUT_MACHTYPE
#define AOUT_MACHTYPE 0
#endif /* AOUT_MACHTYPE */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC)
#endif /* DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE */
/* SYMBOL TABLE */
/* Symbol table entry data type */
typedef struct nlist obj_symbol_type; /* Symbol table entry */
/* Symbol table macros and constants */
/*
* 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.
*/
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_OTHER(s) != 0) || (S_GET_DESC(s) != 0))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
(S_GET_NAME(s)[0] == '\001' || \
(S_LOCAL_NAME(s) && !flagseen['L'])))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
/* Accessors */
/* The value of the symbol */
#define S_GET_VALUE(s) (((s)->sy_symbol.n_value))
/* The name of the symbol */
#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
/* The type of the symbol */
#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
/* The n_other expression value */
#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
/* The n_desc expression value */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Modifiers */
/* Set the value of the symbol */
#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v))
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is external */
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
/* Set the offset in the string table */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
/* File header macro and type definition */
#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \
+ H_GET_TEXT_SIZE(h) \
+ H_GET_DATA_SIZE(h) \
+ H_GET_SYMBOL_TABLE_SIZE(h) \
+ H_GET_TEXT_RELOCATION_SIZE(h) \
+ H_GET_DATA_RELOCATION_SIZE(h) \
+ H_GET_STRING_SIZE(h))
#ifndef H_GET_HEADER_SIZE
#define H_GET_HEADER_SIZE(h) (sizeof(struct exec))
#endif /* not H_GET_HEADER_SIZE */
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) (0)
#define H_GET_DYNAMIC(h) ((h)->header.a_info >> 31)
#define H_GET_VERSION(h) (((h)->header.a_info >> 24) & 0x7f)
#define H_GET_MACHTYPE(h) (((h)->header.a_info >> 16) & 0xff)
#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info & 0xffff)
#define H_SET_DYNAMIC(h,v) ((h)->header.a_info = (((v) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_VERSION(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| ((v) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MACHTYPE(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| ((v) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| ((v))))
#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v)))
#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v)))
#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v)))
#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
H_SET_DATA_RELOCATION_SIZE((h),(d)))
#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
sizeof(struct nlist))
#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
/*
* Current means for getting the name of a segment.
* This will change for infinite-segments support (e.g. COFF).
*/
#define segment_name(seg) (seg_name[(int)(seg)])
extern char *const seg_name[];
typedef struct {
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
} object_headers;
/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
#define obj_symbol_new_hook(s) {;}
#if __STDC__ == 1
struct fix;
void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address);
#else /* not __STDC__ */
void tc_aout_fix_to_chars();
#endif /* not __STDC__ */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-aout.h */

View File

@ -0,0 +1,71 @@
/* obj-bfd-sunos.c
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. */
#include "as.h"
static
const short seg_N_TYPE[] = {
N_ABS,
N_TEXT,
N_DATA,
N_BSS,
N_UNDF, /* unknown */
N_UNDF, /* absent */
N_UNDF, /* pass1 */
N_UNDF, /* error */
N_UNDF, /* bignum/flonum */
N_UNDF, /* difference */
N_REGISTER, /* register */
};
const segT N_TYPE_seg[N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
SEG_GOOF,
SEG_TEXT, /* N_TEXT == 4 */
SEG_GOOF,
SEG_DATA, /* N_DATA == 6 */
SEG_GOOF,
SEG_BSS, /* N_BSS == 8 */
SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */
SEG_GOOF,
};
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
{
return;
} /* obj_symbol_new_hook() */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-bfd-sunos.c */

View File

@ -0,0 +1,69 @@
/*
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 obj-bfd-sunos.h.
*/
/* define an obj specific macro off which target cpu back ends may key. */
#define OBJ_BFD
#define OBJ_BFD_SUNOS
#include "bfd.h"
/* include whatever target cpu is appropriate. */
#include "targ-cpu.h"
/*
* SYMBOLS
*/
/*
* If your object format needs to reorder symbols, define this. When
* defined, symbols are kept on a doubly linked list and functions are
* made available for push, insert, append, and delete. If not defined,
* symbols are kept on a singly linked list, only the append and clear
* facilities are available, and they are macros.
*/
/* #define SYMBOLS_NEED_PACKPOINTERS */
typedef asymbol obj_symbol_type;
typedef void *object_headers;
#define S_SET_NAME(s, v) ((s)->sy_symbol.name = (v))
#define S_GET_NAME(s) ((s)->sy_symbol.name)
#define S_SET_SEGMENT(s,v) ((s)->sy_symbol.udata = (v))
#define S_GET_SEGMENT(s) ((s)->sy_symbol.udata)
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.flags |= BSF_GLOBAL)
#define S_SET_VALUE(s,v) ((s)->sy_symbol.value = (v))
#define S_GET_VALUE(s) ((s)->sy_symbol.value)
#define S_IS_DEFINED(s) (!((s)->sy_symbol.flags & BSF_UNDEFINED))
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (0) /* your magic number */
#define OBJ_EMIT_LINENO(a,b,c) /* must be *something*. This no-op's it out. */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-bfd-sunos.h */

View File

@ -0,0 +1,476 @@
/* b.out object file format
Copyright (C) 1989, 1990, 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. */
#include "as.h"
#include "obstack.h"
#ifndef NO_LISTING
#include "aout/stab_gnu.h"
#endif /* NO_LISTING */
const short /* in: segT out: N_TYPE bits */
seg_N_TYPE[] = {
N_ABS,
N_TEXT,
N_DATA,
N_BSS,
N_UNDF, /* unknown */
N_UNDF, /* absent */
N_UNDF, /* pass1 */
N_UNDF, /* error */
N_UNDF, /* bignum/flonum */
N_UNDF, /* difference */
N_REGISTER, /* register */
};
const segT N_TYPE_seg[N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
SEG_GOOF,
SEG_TEXT, /* N_TEXT == 4 */
SEG_GOOF,
SEG_DATA, /* N_DATA == 6 */
SEG_GOOF,
SEG_BSS, /* N_BSS == 8 */
SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */
SEG_GOOF,
};
#if __STDC__ == 1
static void obj_bout_stab(int what);
static void obj_bout_line(void);
static void obj_bout_desc(void);
#else /* not __STDC__ */
static void obj_bout_desc();
static void obj_bout_stab();
static void obj_bout_line();
#endif /* not __STDC__ */
const pseudo_typeS obj_pseudo_table[] = {
/* stabs (aka a.out aka b.out directives for debug symbols) */
{ "desc", obj_bout_desc, 0 }, /* def */
{ "line", obj_bout_line, 0 }, /* source code line number */
{ "stabd", obj_bout_stab, 'd' }, /* stabs */
{ "stabn", obj_bout_stab, 'n' }, /* stabs */
{ "stabs", obj_bout_stab, 's' }, /* stabs */
/* coff debugging directives. Currently ignored silently */
{ "def", s_ignore, 0 },
{ "dim", s_ignore, 0 },
{ "endef", s_ignore, 0 },
{ "ln", s_ignore, 0 },
{ "scl", s_ignore, 0 },
{ "size", s_ignore, 0 },
{ "tag", s_ignore, 0 },
{ "type", s_ignore, 0 },
{ "val", s_ignore, 0 },
/* other stuff we don't handle */
{ "ABORT", s_ignore, 0 },
{ "ident", s_ignore, 0 },
{ NULL} /* end sentinel */
}; /* obj_pseudo_table */
/* Relocation. */
/*
* emit_relocations()
*
* Crawl along a fixS chain. Emit the segment's relocations.
*/
void obj_emit_relocations(where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
{
for (; fixP; fixP = fixP->fx_next) {
if (fixP->fx_addsy != NULL) {
tc_bout_fix_to_chars(*where, fixP, segment_address_in_file);
*where += sizeof(struct relocation_info);
} /* if there's a symbol */
} /* for each fixup */
} /* emit_relocations() */
/* Aout file generation & utilities */
/* Convert a lvalue to machine dependent data */
void obj_header_append(where, headers)
char **where;
object_headers *headers;
{
/* Always leave in host byte order */
headers->header.a_talign = section_alignment[SEG_TEXT];
if (headers->header.a_talign < 2){
headers->header.a_talign = 2;
} /* force to at least 2 */
headers->header.a_dalign = section_alignment[SEG_DATA];
headers->header.a_balign = section_alignment[SEG_BSS];
headers->header.a_tload = 0;
headers->header.a_dload = md_section_align(SEG_DATA, H_GET_TEXT_SIZE(headers));
append(where, (char *) &headers->header, sizeof(headers->header));
} /* a_header_append() */
void obj_symbol_to_chars(where, symbolP)
char **where;
symbolS *symbolP;
{
/* leave in host byte order */
append(where, (char *)&symbolP->sy_symbol, sizeof(obj_symbol_type));
} /* obj_symbol_to_chars() */
void obj_emit_symbols(where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
{
symbolS * symbolP;
/*
* Emit all symbols left in the symbol chain.
*/
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
/* Used to save the offset of the name. It is used to point
to the string in memory but must be a file offset. */
char *temp;
temp = S_GET_NAME(symbolP);
S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
/* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
if (!S_IS_DEBUG(symbolP) && !S_IS_DEFINED(symbolP)) S_SET_EXTERNAL(symbolP);
obj_symbol_to_chars(where, symbolP);
S_SET_NAME(symbolP,temp);
}
} /* emit_symbols() */
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
{
S_SET_OTHER(symbolP, 0);
S_SET_DESC(symbolP, 0);
return;
} /* obj_symbol_new_hook() */
static void obj_bout_line() {
/* Assume delimiter is part of expression. */
/* BSD4.2 as fails with delightful bug, so we */
/* are not being incompatible here. */
new_logical_line ((char *)NULL, (int)(get_absolute_expression ()));
demand_empty_rest_of_line();
} /* obj_bout_line() */
/*
* stab()
*
* Handle .stabX directives, which used to be open-coded.
* So much creeping featurism overloaded the semantics that we decided
* to put all .stabX thinking in one place. Here.
*
* We try to make any .stabX directive legal. Other people's AS will often
* do assembly-time consistency checks: eg assigning meaning to n_type bits
* and "protecting" you from setting them to certain values. (They also zero
* certain bits before emitting symbols. Tut tut.)
*
* If an expression is not absolute we either gripe or use the relocation
* information. Other people's assemblers silently forget information they
* don't need and invent information they need that you didn't supply.
*
* .stabX directives always make a symbol table entry. It may be junk if
* the rest of your .stabX directive is malformed.
*/
static void obj_bout_stab(what)
int what;
{
register symbolS * symbolP = 0;
register char * string;
int saved_type = 0;
int length;
int goof; /* TRUE if we have aborted. */
long longint;
/*
* Enter with input_line_pointer pointing past .stabX and any following
* whitespace.
*/
goof = 0; /* JF who forgot this?? */
if (what == 's') {
string = demand_copy_C_string(& length);
SKIP_WHITESPACE();
if (*input_line_pointer == ',')
input_line_pointer ++;
else {
as_bad("I need a comma after symbol's name");
goof = 1;
}
} else
string = "";
/*
* Input_line_pointer->after ','. String->symbol name.
*/
if (!goof) {
symbolP = symbol_new(string,
SEG_UNKNOWN,
0,
(struct frag *)0);
switch (what) {
case 'd':
S_SET_NAME(symbolP,NULL); /* .stabd feature. */
S_SET_VALUE(symbolP,obstack_next_free(&frags) -
frag_now->fr_literal);
symbolP->sy_frag = frag_now;
break;
case 'n':
symbolP->sy_frag = &zero_address_frag;
break;
case 's':
symbolP->sy_frag = & zero_address_frag;
break;
default:
BAD_CASE(what);
break;
}
if (get_absolute_expression_and_terminator(& longint) == ',')
symbolP->sy_symbol.n_type = saved_type = longint;
else {
as_bad("I want a comma after the n_type expression");
goof = 1;
input_line_pointer--; /* Backup over a non-',' char. */
}
}
if (! goof) {
if (get_absolute_expression_and_terminator (& longint) == ',')
S_SET_OTHER(symbolP,longint);
else {
as_bad("I want a comma after the n_other expression");
goof = 1;
input_line_pointer--; /* Backup over a non-',' char. */
}
}
if (! goof) {
S_SET_DESC(symbolP, get_absolute_expression ());
if (what == 's' || what == 'n') {
if (* input_line_pointer != ',') {
as_bad("I want a comma after the n_desc expression");
goof = 1;
} else {
input_line_pointer ++;
}
}
}
if ((!goof) && (what == 's' || what == 'n')) {
pseudo_set(symbolP);
symbolP->sy_symbol.n_type = saved_type;
}
#ifndef NO_LISTING
{
extern int listing;
if (listing && !goof) {
if (symbolP->sy_symbol.n_type == N_SLINE) {
listing_source_line(symbolP->sy_symbol.n_desc);
} else if (symbolP->sy_symbol.n_type == N_SO
|| symbolP->sy_symbol.n_type == N_SOL) {
listing_source_file(string);
}
}
}
#endif
if (goof)
ignore_rest_of_line ();
else
demand_empty_rest_of_line ();
} /* obj_bout_stab() */
static void obj_bout_desc() {
register char *name;
register char c;
register char *p;
register symbolS * symbolP;
register int temp;
/*
* Frob invented at RMS' request. Set the n_desc of a symbol.
*/
name = input_line_pointer;
c = get_symbol_end();
p = input_line_pointer;
* p = c;
SKIP_WHITESPACE();
if (*input_line_pointer != ',') {
*p = 0;
as_bad("Expected comma after name \"%s\"", name);
*p = c;
ignore_rest_of_line();
} else {
input_line_pointer ++;
temp = get_absolute_expression ();
*p = 0;
symbolP = symbol_find_or_make(name);
*p = c;
S_SET_DESC(symbolP,temp);
}
demand_empty_rest_of_line();
} /* obj_bout_desc() */
void obj_read_begin_hook() {
return;
} /* obj_read_begin_hook() */
void obj_crawl_symbol_chain(headers)
object_headers *headers;
{
symbolS **symbolPP;
symbolS *symbolP;
int symbol_number = 0;
/* JF deal with forward references first... */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if (symbolP->sy_forward) {
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP)
+ S_GET_VALUE(symbolP->sy_forward)
+ symbolP->sy_forward->sy_frag->fr_address);
symbolP->sy_forward=0;
} /* if it has a forward reference */
} /* walk the symbol chain */
tc_crawl_symbol_chain(headers);
symbolPP = & symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL) {
if (flagseen['R'] && (S_GET_SEGMENT(symbolP) == SEG_DATA)) {
S_SET_SEGMENT(symbolP, SEG_TEXT);
} /* if pusing data into text */
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP) + symbolP->sy_frag->fr_address);
/* OK, here is how we decide which symbols go out into the
brave new symtab. Symbols that do are:
* symbols with no name (stabd's?)
* symbols with debug info in their N_TYPE
Symbols that don't are:
* symbols that are registers
* symbols with \1 as their 3rd character (numeric labels)
* "local labels" as defined by S_LOCAL_NAME(name)
if the -L switch was passed to gas.
All other symbols are output. We complain if a deleted
symbol was marked external. */
if (1
&& !S_IS_REGISTER(symbolP)
&& (!S_GET_NAME(symbolP)
|| S_IS_DEBUG(symbolP)
#ifdef TC_I960
/* FIXME-SOON this ifdef seems highly dubious to me. xoxorich. */
|| !S_IS_DEFINED(symbolP)
|| S_IS_EXTERNAL(symbolP)
#endif /* TC_I960 */
|| (S_GET_NAME(symbolP)[0] != '\001' && (flagseen['L'] || ! S_LOCAL_NAME(symbolP))))) {
symbolP->sy_number = symbol_number++;
/* The + 1 after strlen account for the \0 at the
end of each string */
if (!S_IS_STABD(symbolP)) {
/* Ordinary case. */
symbolP->sy_name_offset = string_byte_count;
string_byte_count += strlen(S_GET_NAME(symbolP)) + 1;
}
else /* .Stabd case. */
symbolP->sy_name_offset = 0;
symbolPP = &(symbol_next(symbolP));
} else {
if (S_IS_EXTERNAL(symbolP) || !S_IS_DEFINED(symbolP)) {
as_bad("Local symbol %s never defined", S_GET_NAME(symbolP));
} /* oops. */
/* Unhook it from the chain */
*symbolPP = symbol_next(symbolP);
} /* if this symbol should be in the output */
} /* for each symbol */
H_SET_SYMBOL_TABLE_SIZE(headers, symbol_number);
return;
} /* obj_crawl_symbol_chain() */
/*
* Find strings by crawling along symbol table chain.
*/
void obj_emit_strings(where)
char **where;
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars(*where, string_byte_count, sizeof(string_byte_count));
*where += sizeof(string_byte_count);
#else /* CROSS_COMPILE */
append(where, (char *) &string_byte_count, (unsigned long) sizeof(string_byte_count));
#endif /* CROSS_COMPILE */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if (S_GET_NAME(symbolP))
append(where, S_GET_NAME(symbolP), (unsigned long)(strlen (S_GET_NAME(symbolP)) + 1));
} /* walk symbol chain */
return;
} /* obj_emit_strings() */
void obj_pre_write_hook(headers)
object_headers *headers;
{
H_SET_MAGIC_NUMBER(headers, BMAGIC);
H_SET_ENTRY_POINT(headers, 0);
return;
} /* obj_pre_write_hook() */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-bout.c */

View File

@ -0,0 +1,313 @@
/* b.out object file format
Copyright (C) 1989, 1990, 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. */
/*
* This file is a modified version of 'a.out.h'. It is to be used in all GNU
* tools modified to support the i80960 b.out format (or tools that operate on
* object files created by such tools).
*
* All i80960 development is done in a CROSS-DEVELOPMENT environment. I.e.,
* object code is generated on, and executed under the direction of a symbolic
* debugger running on, a host system. We do not want to be subject to the
* vagaries of which host it is or whether it supports COFF or a.out format, or
* anything else. We DO want to:
*
* o always generate the same format object files, regardless of host.
*
* o have an 'a.out' header that we can modify for our own purposes
* (the 80960 is typically an embedded processor and may require
* enhanced linker support that the normal a.out.h header can't
* accommodate).
*
* As for byte-ordering, the following rules apply:
*
* o Text and data that is actually downloaded to the target is always
* in i80960 (little-endian) order.
*
* o All other numbers (in the header, symbols, relocation directives)
* are in host byte-order: object files CANNOT be lifted from a
* little-end host and used on a big-endian (or vice versa) without
* modification.
*
* o The downloader ('comm960') takes care to generate a pseudo-header
* with correct (i80960) byte-ordering before shipping text and data
* off to the NINDY monitor in the target systems. Symbols and
* relocation info are never sent to the target.
*/
#define OBJ_BOUT 1
#include "targ-cpu.h"
/* bout uses host byte order for headers */
#ifdef CROSS_COMPILE
#undef CROSS_COMPILE
#endif /* CROSS_COMPILE */
/* We want \v. */
#define BACKSLASH_V 1
#define OBJ_DEFAULT_OUTPUT_FILE_NAME "b.out"
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
#define BMAGIC 0415
/* We don't accept the following (see N_BADMAG macro).
* They're just here so GNU code will compile.
*/
#define OMAGIC 0407 /* old impure format */
#define NMAGIC 0410 /* read-only text */
#define ZMAGIC 0413 /* demand load format */
/* FILE HEADER
* All 'lengths' are given as a number of bytes.
* All 'alignments' are for relinkable files only; an alignment of
* 'n' indicates the corresponding segment must begin at an
* address that is a multiple of (2**n).
*/
struct exec {
/* Standard stuff */
unsigned long a_magic; /* Identifies this as a b.out file */
unsigned long a_text; /* Length of text */
unsigned long a_data; /* Length of data */
unsigned long a_bss; /* Length of runtime uninitialized data area */
unsigned long a_syms; /* Length of symbol table */
unsigned long a_entry; /* Runtime start address */
unsigned long a_trsize; /* Length of text relocation info */
unsigned long a_drsize; /* Length of data relocation info */
/* Added for i960 */
unsigned long a_tload; /* Text runtime load address */
unsigned long a_dload; /* Data runtime load address */
unsigned char a_talign; /* Alignment of text segment */
unsigned char a_dalign; /* Alignment of data segment */
unsigned char a_balign; /* Alignment of bss segment */
unsigned char unused; /* (Just to make struct size a multiple of 4) */
};
#define N_BADMAG(x) (((x).a_magic) != BMAGIC)
#define N_TXTOFF(x) ( sizeof(struct exec) )
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize )
#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize )
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
/* A single entry in the symbol table
*/
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx; /* Index into string table */
} n_un;
unsigned char n_type; /* See below */
char n_other; /* Used in i80960 support -- see below */
short n_desc;
unsigned long n_value;
};
typedef struct nlist obj_symbol_type;
/* Legal values of n_type
*/
#define N_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol */
#define N_TEXT 4 /* Text symbol */
#define N_DATA 6 /* Data symbol */
#define N_BSS 8 /* BSS symbol */
#define N_FN 31 /* Filename symbol */
#define N_EXT 1 /* External symbol (OR'd in with one of above) */
#define N_TYPE 036 /* Mask for all the type bits */
#define N_STAB 0340 /* Mask for all bits used for SDB entries */
#ifndef CUSTOM_RELOC_FORMAT
struct relocation_info {
int r_address; /* File address of item to be relocated */
unsigned
r_index:24,/* Index of symbol on which relocation is based*/
r_pcrel:1, /* 1 => relocate PC-relative; else absolute
* On i960, pc-relative implies 24-bit
* address, absolute implies 32-bit.
*/
r_length:2, /* Number of bytes to relocate:
* 0 => 1 byte
* 1 => 2 bytes
* 2 => 4 bytes -- only value used for i960
*/
r_extern:1,
r_bsr:1, /* Something for the GNU NS32K assembler */
r_disp:1, /* Something for the GNU NS32K assembler */
r_callj:1, /* 1 if relocation target is an i960 'callj' */
nuthin:1; /* Unused */
};
#endif /* CUSTOM_RELOC_FORMAT */
/*
* 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.n_type & N_EXT)
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_DESC(s) != 0))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
(S_GET_NAME(s)[0] == '\001' || \
(S_LOCAL_NAME(s) && !flagseen['L'])))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == NULL)
/* Accessors */
/* The value of the symbol */
#define S_GET_VALUE(s) ((unsigned long) ((s)->sy_symbol.n_value))
/* The name of the symbol */
#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
/* The type of the symbol */
#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
/* The n_other expression value */
#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
/* The n_desc expression value */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Modifiers */
/* Set the value of the symbol */
#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v))
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is external */
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
/* Set the offset in the string table */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
/* File header macro and type definition */
#define H_GET_FILE_SIZE(h) (sizeof(struct exec) + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_SYMBOL_TABLE_SIZE(h) + \
H_GET_TEXT_RELOCATION_SIZE(h) + \
H_GET_DATA_RELOCATION_SIZE(h) + \
(h)->string_table_size)
#define H_GET_HEADER_SIZE(h) (sizeof(struct exec))
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info)
#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) (0)
#ifdef EXEC_MACHINE_TYPE
#define H_GET_MACHINE_TYPE(h) ((h)->header.a_machtype)
#endif /* EXEC_MACHINE_TYPE */
#ifdef EXEC_VERSION
#define H_GET_VERSION(h) ((h)->header.a_version)
#endif /* EXEC_VERSION */
#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = (v))
#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = (v))
#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = (v))
#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
H_SET_DATA_RELOCATION_SIZE((h),(d)))
#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
sizeof(struct nlist))
#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_magic = (v))
#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#ifdef EXEC_MACHINE_TYPE
#define H_SET_MACHINE_TYPE(h,v) ((h)->header.a_machtype = (v))
#endif /* EXEC_MACHINE_TYPE */
#ifdef EXEC_VERSION
#define H_SET_VERSION(h,v) ((h)->header.a_version = (v))
#endif /* EXEC_VERSION */
/*
* Current means for getting the name of a segment.
* This will change for infinite-segments support (e.g. COFF).
*/
#define segment_name(seg) ( seg_name[(int)(seg)] )
extern char *const seg_name[];
typedef struct {
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
} object_headers;
/* unused hooks. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
#if __STDC__
struct fix;
void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address);
#else /* not __STDC__ */
void tc_aout_fix_to_chars();
#endif /* not __STDC__ */
enum reloc_type {
NO_RELOC, RELOC_32,
};
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-bout.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,598 @@
/* coff object file format
Copyright (C) 1989, 1990, 1991, 1992 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. */
#define OBJ_COFF 1
#include "targ-cpu.h"
#ifdef BFD_HEADERS
#ifdef TC_A29K
#include "bfd.h"
#include "coff/a29k.h"
/* 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
/*
#undef RELOC
#undef SYMENT
#undef AUXENT
#undef LINENO
#undef FILHDR
#undef SCNHDR
#define RELOC struct internal_reloc
#define SYMENT struct internal_syment
#define AUXENT union internal_auxent
#define SCNHDR struct internal_scnhdr
#define LINENO struct bfd_internal_lineno
#define AOUTHDR struct internal_aouthdr
#define FILHDR struct internal_filehdr
#define AOUTHDRSZ sizeof(struct external_aouthdr)
*/
/*#define x_endndx x_endndx.l
#define x_tagndx x_tagndx.l*/
#define TARGET_FORMAT "coff-a29k-big"
extern bfd *stdoutput;
#else /* not TC_A29K */
# ifdef TC_I386
# include "bfd.h"
# include "coff/i386.h"
# define internal_lineno bfd_internal_lineno
# include "coff/internal.h"
# undef internal_lineno
# define TARGET_FORMAT "coff-i386"
extern bfd *stdoutput;
#else /* not TC_I386 */
#error help me
#endif /* not TC_I386 */
#endif /* not TC_A29K */
#else /* not BFD_HEADERS */
#ifdef USE_NATIVE_HEADERS
#include <filehdr.h>
#include <aouthdr.h>
#include <scnhdr.h>
#include <storclass.h>
#include <linenum.h>
#include <syms.h>
#include <reloc.h>
#include <sys/types.h>
#else /* not USE_NATIVE_HEADERS */
#include "coff.h"
#endif /* not USE_NATIVE_HEADERS */
#endif /* not BFD_HEADERS */
/* Define some processor dependent values according to the processor we are on. */
#ifdef 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
#ifndef OBJ_COFF_MAX_AUXENTRIES
#define OBJ_COFF_MAX_AUXENTRIES 1
#endif /* OBJ_COFF_MAX_AUXENTRIES */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
#ifndef BFD_HEADERS
/* Add these definitions to have a consistent convention for all the
types used in COFF format. */
#define AOUTHDR struct aouthdr
#define AOUTHDRSZ sizeof(AOUTHDR)
#endif
/* 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 {
#ifdef BFD_HEADERS
struct internal_syment ost_entry; /* Basic symbol */
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
#else
SYMENT ost_entry; /* Basic symbol */
AUXENT ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
#endif
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_TEXT_SECTION ((short)1)
#define C_DATA_SECTION ((short)2)
#define C_BSS_SECTION ((short)3)
#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 4
/*
* 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) (N_TYPE_seg[(s)->sy_symbol.ost_entry.n_scnum+4])
/* 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;
/* -------------- Line number handling ------- */
extern int text_lineno_number;
/* line numbering stuff. */
typedef struct internal_lineno {
#ifdef BFD_HEADERS
struct bfd_internal_lineno line;
#else
LINENO line; /* The lineno structure itself */
#endif
char* frag; /* Frag to which the line number is related */
struct internal_lineno* next; /* Forward chain pointer */
} lineno;
extern lineno *lineno_lastP;
extern lineno *lineno_rootP;
#define OBJ_EMIT_LINENO(a, b, c) obj_emit_lineno((a),(b),(c))
#if __STDC__ == 1
void obj_emit_lineno(char **where, lineno *line, char *file_start);
#else /* not __STDC__ */
void obj_emit_lineno();
#endif /* not __STDC__ */
/* stack stuff */
typedef struct {
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char* data;
unsigned long pointer;
} stack;
#if __STDC__ == 1
char *stack_pop(stack *st);
char *stack_push(stack *st, char *element);
char *stack_top(stack *st);
stack *stack_init(unsigned long chunk_size, unsigned long element_size);
void c_dot_file_symbol(char *filename);
void obj_extra_stuff(object_headers *headers);
void stack_delete(stack *st);
#ifndef tc_headers_hook
void tc_headers_hook(object_headers *headers);
#endif /* tc_headers_hook */
#ifndef tc_coff_symbol_emit_hook
void tc_coff_symbol_emit_hook(); /* really tc_coff_symbol_emit_hook(symbolS *symbolP) */
#endif /* tc_coff_symbol_emit_hook */
void c_section_header(
#ifdef BFD_HEADERS
struct internal_scnhdr *header,
#else
SCNHDR *header,
#endif
char *name,
long core_address,
long size,
long data_ptr,
long reloc_ptr,
long lineno_ptr,
long reloc_number,
long lineno_number,
long alignment);
#else /* not __STDC__ */
char *stack_pop();
char *stack_push();
char *stack_top();
stack *stack_init();
void c_dot_file_symbol();
void c_section_header();
void obj_extra_stuff();
void stack_delete();
void tc_headers_hook();
void tc_coff_symbol_emit_hook();
#endif /* not __STDC__ */
/* 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 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,516 @@
/* coff object file format
Copyright (C) 1989, 1990, 1991, 1992 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. */
#ifndef OBJ_FORMAT_H
#define OBJ_FORMAT_H
#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;
#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
#define DO_STRIP 1
#endif
/* 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
#endif
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-coffbfd.h */

View File

@ -0,0 +1,41 @@
/* This file is obj-generic.c and is intended to be a template for
object format specific source files.
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. */
/* Chars that can be used to separate mant from exp in floating point nums */
char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant */
/* As in 0f12.456 */
/* or 0d1.2345e12 */
char FLT_CHARS[] = "rRsSfFdDxXpP";
/* These chars start a comment anywhere in a source file (except inside
another comment */
const char comment_chars[] = "#";
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-generic.c */

View File

@ -0,0 +1,78 @@
/* This file is obj-generic.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 obj-generic.h and is intended to be a template for
* object format specific header files.
*/
/* define an obj specific macro off which target cpu back ends may key. */
#define OBJ_GENERIC 1
/* include whatever target cpu is appropriate. */
#include "targ-cpu.h"
/*
* SYMBOLS
*/
/*
* If your object format needs to reorder symbols, define this. When
* defined, symbols are kept on a doubly linked list and functions are
* made available for push, insert, append, and delete. If not defined,
* symbols are kept on a singly linked list, only the append and clear
* facilities are available, and they are macros.
*/
/* #define SYMBOLS_NEED_PACKPOINTERS */
/* */
typedef struct {
void *nothing;
} obj_symbol_type; /* should be the format's symbol structure */
typedef void *object_headers;
/* symbols have names */
#define S_GET_NAME(s) ("foo") /* get the name of a symbolP */
#define S_SET_NAME(s,v) ;
/* symbols have segments */
#define S_GET_SEGMENT(s) (SEG_UNKNOWN)
#define S_SET_SEGMENT(s,v) ;
/* symbols have a value */
#define S_GET_VALUE(s) (0)
#define S_SET_VALUE(s,v) ;
/* symbols may be external */
#define S_IS_EXTERNAL(s) (0)
#define S_SET_EXTERNAL(s) ;
/* symbols may or may not be defined */
#define S_IS_DEFINED(s) (0)
#define OBJ_EMIT_LINENO(a,b,c) /* must be *something*. This no-op's it out. */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-generic.h */

View File

@ -0,0 +1,539 @@
/* obj-format for ieee-695 records.
Copyright (C) 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. */
/*
created by
steve chamberlain steve@cygnus.com
*/
/*
this will hopefully become the port through which bfd and gas talk,
for the moment, only ieee is known to work well.
*/
#include "bfd.h"
#include "as.h"
#include "subsegs.h"
#include "output-file.h"
#include "frags.h"
bfd *abfd;
/* How many addresses does the .align take? */
static relax_addressT relax_align(address, alignment)
register relax_addressT address; /* Address now. */
register long alignment; /* Alignment (binary). */
{
relax_addressT mask;
relax_addressT new_address;
mask = ~ ( (~0) << alignment );
new_address = (address + mask) & (~ mask);
return (new_address - address);
} /* relax_align() */
/* calculate the size of the frag chain and create a bfd section
to contain all of it */
static void DEFUN(size_section,(abfd, idx),
bfd *abfd AND
unsigned int idx)
{
asection *sec;
unsigned int size = 0;
fragS *frag = segment_info[idx].frag_root;
while (frag) {
if (frag->fr_address != size) {
printf("Out of step\n");
size = frag->fr_address;
}
size += frag->fr_fix;
switch (frag->fr_type) {
case rs_fill:
case rs_org:
size += frag->fr_offset * frag->fr_var;
break;
case rs_align:
size += relax_align(size, frag->fr_offset);
}
frag = frag->fr_next;
}
if (size) {
char *name = segment_info[idx].name;
if (name == (char *)NULL) {
name = ".data";
}
segment_info[idx].user_stuff = (char *)(sec = bfd_make_section(abfd, name));
/* Make it output through itself */
sec->output_section = sec;
sec->flags |= SEC_HAS_CONTENTS;
bfd_set_section_size(abfd, sec, size);
}
}
/* run through a frag chain and write out the data to go with it */
static void DEFUN(fill_section,(abfd, idx),
bfd *abfd AND
unsigned int idx)
{
asection *sec = segment_info[idx].user_stuff;
if (sec) {
fragS *frag = segment_info[idx].frag_root;
unsigned int offset = 0;
while (frag) {
unsigned int fill_size;
unsigned int count;
switch (frag->fr_type) {
case rs_fill:
case rs_align:
case rs_org:
if (frag->fr_fix)
{
bfd_set_section_contents(abfd,
sec,
frag->fr_literal,
frag->fr_address,
frag->fr_fix);
}
offset += frag->fr_fix;
fill_size = frag->fr_var;
if (fill_size)
{
unsigned int off = frag->fr_fix;
for (count = frag->fr_offset; count; count--)
{
bfd_set_section_contents(abfd, sec,
frag->fr_literal +
frag->fr_fix,
frag->fr_address + off,
fill_size);
off += fill_size;
}
}
break;
default:
abort();
}
frag = frag->fr_next;
}
}
}
/* Count the relocations in a chain */
static unsigned int DEFUN(count_entries_in_chain,(idx),
unsigned int idx)
{
unsigned int nrelocs;
fixS *fixup_ptr;
/* Count the relocations */
fixup_ptr = segment_info[idx].fix_root;
nrelocs = 0;
while (fixup_ptr != (fixS *)NULL)
{
fixup_ptr = fixup_ptr->fx_next;
nrelocs ++ ;
}
return nrelocs;
}
/* output all the relocations for a section */
void DEFUN(do_relocs_for,(idx),
unsigned int idx)
{
unsigned int nrelocs;
arelent **reloc_ptr_vector;
arelent *reloc_vector;
asymbol **ptrs;
asection *section = (asection *)(segment_info[idx].user_stuff);
unsigned int i;
fixS *from;
if (section) {
nrelocs = count_entries_in_chain(idx);
reloc_ptr_vector = (arelent**)malloc((nrelocs+1) * sizeof(arelent *));
reloc_vector = (arelent*)malloc(nrelocs * sizeof(arelent));
ptrs = (asymbol **)malloc(nrelocs * sizeof(asymbol *));
from = segment_info[idx].fix_root;
for (i = 0; i < nrelocs; i++)
{
arelent *to = reloc_vector + i;
asymbol *s ;
reloc_ptr_vector[i] = to;
to->howto = (reloc_howto_type *)(from->fx_r_type);
/* We can't represent complicated things in a reloc yet */
/* if (from->fx_addsy == 0 ||
from->fx_subsy != 0) abort();
*/
s = &( from->fx_addsy->sy_symbol.sy);
to->address = ((char *)( from->fx_frag->fr_address +
from->fx_where))
- ((char *)(&(from->fx_frag->fr_literal)));
to->addend = from->fx_offset ;
/* If we know the symbol which we want to relocate to, turn this
reloaction into a section relative.
If this relocation is pcrelative, and we know the
destination, we still want to keep the relocation - since
the linker might relax some of the bytes, but it stops
being pc relative and turns into an absolute relocation.
*/
if (s) {
if ((s->flags & BSF_UNDEFINED) == 0) {
to->section = s->section;
to->addend += s->value ;
to->sym_ptr_ptr = 0;
if (to->howto->pcrel_offset) {
/* This is a pcrel relocation, the addend should be adjusted */
to->addend -= to->address +1;
}
}
else {
to->section = 0;
*ptrs = &(from->fx_addsy->sy_symbol.sy);
to->sym_ptr_ptr = ptrs;
if (to->howto->pcrel_offset) {
/* This is a pcrel relocation, the addend should be adjusted */
to->addend -= to->address -1;
}
}
}
else {
to->section = 0;
}
ptrs++;
from = from->fx_next;
}
/* attatch to the section */
section->orelocation = reloc_ptr_vector;
section->reloc_count = nrelocs;
section->flags |= SEC_LOAD;
}
}
/* do the symbols.. */
static void DEFUN(do_symbols, (abfd),
bfd *abfd)
{
extern symbolS *symbol_rootP;
symbolS *ptr;
asymbol **symbol_ptr_vec;
asymbol *symbol_vec;
unsigned int count = 0;
unsigned int index;
for (ptr = symbol_rootP;
ptr != (symbolS *)NULL;
ptr = ptr->sy_next)
{
if (SEG_NORMAL(ptr->sy_symbol.seg))
{
ptr->sy_symbol.sy.section =
(asection *)(segment_info[ptr->sy_symbol.seg].user_stuff);
ptr->sy_symbol.sy.value += ptr->sy_frag->fr_address;
if (ptr->sy_symbol.sy.flags == 0) {
ptr->sy_symbol.sy.flags = BSF_LOCAL ;
}
}
else {
switch (ptr->sy_symbol.seg) {
case SEG_ABSOLUTE:
ptr->sy_symbol.sy.flags |= BSF_ABSOLUTE;
ptr->sy_symbol.sy.section = 0;
break;
case SEG_UNKNOWN:
ptr->sy_symbol.sy.flags = BSF_UNDEFINED ;
ptr->sy_symbol.sy.section = 0;
break;
default:
abort();
}
}
count++;
}
symbol_ptr_vec = (asymbol **)malloc((count+1) * sizeof(asymbol *));
index = 0;
for (ptr = symbol_rootP;
ptr != (symbolS *)NULL;
ptr = ptr->sy_next)
{
symbol_ptr_vec[index] = &(ptr->sy_symbol.sy);
index++;
}
symbol_ptr_vec[index] =0;
abfd->outsymbols = symbol_ptr_vec;
abfd->symcount = count;
}
/* The generic as->bfd converter. Other backends may have special case
code */
void DEFUN_VOID(bfd_as_write_hook)
{
int i;
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
size_section(abfd, i);
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
fill_section(abfd,i);
do_symbols(abfd);
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
do_relocs_for(i);
}
S_GET_VALUE(x)
symbolS *x;
{
return x->sy_symbol.sy.value;
}
S_SET_SEGMENT(x,y)
symbolS *x ;
int y;
{
x->sy_symbol.seg = y;
}
S_IS_DEFINED(x)
symbolS *x;
{
if (SEG_NORMAL(x->sy_symbol.seg))
{
return 1;
}
switch (x->sy_symbol.seg)
{
case SEG_UNKNOWN:
return 0;
default:
abort();
}
}
S_IS_EXTERNAL(x) { abort(); }
S_GET_DESC(x) { abort() ; }
S_GET_SEGMENT(x)
symbolS *x;
{ return x->sy_symbol.seg; }
S_SET_EXTERNAL(x)
symbolS *x;
{
x->sy_symbol.sy.flags |= BSF_GLOBAL | BSF_EXPORT;
}
S_SET_NAME(x,y)
symbolS*x;
char *y; {
x->sy_symbol.sy.name = y; }
S_SET_VALUE(s,v)
symbolS *s;
long v;
{
s->sy_symbol.sy.value = v;
}
S_GET_OTHER(x) { abort() ;}
S_IS_DEBUG(x) { abort(); }
char *segment_name() { abort(); }
void obj_read_begin_hook() { }
static void obj_ieee_section(ignore)
int ignore;
{
extern char *input_line_pointer;
extern char is_end_of_line[];
char *p= input_line_pointer;
char *s = p;
int i;
/* Look up the name, if it doesn't exist, make it */
while (*p &&* p != ' ' && *p != ',' && !is_end_of_line[*p]) {
p++;
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
if (segment_info[i].hadone){
if (strncmp(segment_info[i].name, s, p-s) == 0) {
goto ok;
}
}
else break;
}
if (i == SEG_UNKNOWN) {
as_bad("too many sections");
return;
}
segment_info[i].hadone = 1;
segment_info[i].name = malloc(p-s + 1);
memcpy(segment_info[i].name, s, p-s);
segment_info[i].name[p-s] = 0;
ok:
subseg_new(i,0);
while (!is_end_of_line[*p])
p++;
input_line_pointer = p;
}
void cons();
void s_ignore();
/*
* stringer()
*
* We read 0 or more ',' seperated, double-quoted strings.
*
* Caller should have checked need_pass_2 is FALSE because we don't check it.
*/
void stringer();
void s_globl();
const pseudo_typeS obj_pseudo_table[] =
{
{"section", obj_ieee_section, 0},
{"data.b", cons, 1},
{"data.w", cons, 2},
{"data.l", cons, 4},
{"export", s_globl, 0},
{"option", s_ignore, 0},
{"end", s_ignore, 0},
{"import", s_ignore, 0},
{"sdata", stringer, 0},
0,
};
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
{
symbolP->sy_symbol.sy.the_bfd = abfd;
}
#if 1
extern void DEFUN_VOID(write_object_file)
{
int i;
struct frchain *frchain_ptr;
struct frag *frag_ptr;
abfd = bfd_openw(out_file_name, "ieee");
if (abfd == 0) {
as_perror ("FATAL: Can't create %s", out_file_name);
exit(42);
}
bfd_set_format(abfd, bfd_object);
bfd_set_arch_mach(abfd, bfd_arch_h8300, 0);
subseg_new(1,0);
subseg_new(2,0);
subseg_new(3,0);
for (frchain_ptr = frchain_root;
frchain_ptr != (struct frchain *)NULL;
frchain_ptr = frchain_ptr->frch_next) {
/* Run through all the sub-segments and align them up. Also close any
open frags. We tack a .fill onto the end of the frag chain so
that any .align's size can be worked by looking at the next
frag */
subseg_new(frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#define SUB_SEGMENT_ALIGN 2
frag_align(SUB_SEGMENT_ALIGN,0);
frag_wane(frag_now);
frag_now->fr_fix = 0;
know( frag_now->fr_next == NULL );
}
/* Now build one big frag chain for each segment, linked through
fr_next. */
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
fragS ** prev_frag_ptr_ptr ;
struct frchain *next_frchain_ptr;
/* struct frag **head_ptr = segment_info[i].frag_root;*/
segment_info[i].frag_root = segment_info[i].frchainP->frch_root;
#if 0
/* Im not sure what this is for */
for (frchain_ptr = segment_info[i].frchainP->frch_root;
frchain_ptr != (struct frchain *)NULL;
frchain_ptr = frchain_ptr->frch_next)
{
*head_ptr = frchain_ptr;
head_ptr = &frchain_ptr->next;
}
#endif
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
relax_segment(segment_info[i].frag_root, i);
}
/* Now the addresses of the frags are correct within the segment */
bfd_as_write_hook();
bfd_close(abfd);
}
#endif
H_SET_TEXT_SIZE(a,b) { abort(); }
H_GET_TEXT_SIZE() { abort(); }
H_SET_BSS_SIZE() { abort(); }
H_SET_STRING_SIZE() { abort(); }
H_SET_RELOCATION_SIZE() { abort(); }
H_SET_MAGIC_NUMBER() { abort(); }
H_GET_FILE_SIZE() { abort(); }
H_GET_TEXT_RELOCATION_SIZE() { abort(); }
/* end of obj-ieee.c */

View File

@ -0,0 +1,46 @@
/* This file is obj-ieee.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. */
#define BFD 1
#include <bfd.h>
typedef struct
{
asymbol sy;
int seg;
} obj_symbol_type;
#define S_GET_NAME(s) (((s)->sy_symbol.sy.name))
typedef struct {
int x;
}
object_headers;
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 1
int lineno_rootP;
#define IEEE_STYLE
/* end of obj-ieee.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,474 @@
/* VMS object file format
Copyright (C) 1989, 1990, 1991 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. */
/* Tag to validate a.out object file format processing */
#define OBJ_VMS 1
#include "targ-cpu.h"
/* This flag is used to remember whether we are in the const or the
data section. By and large they are identical, but we set a no-write
bit for psects in the const section. */
extern char const_flag;
/* These are defined in obj-vms.c. */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
enum reloc_type {
NO_RELOC, RELOC_32
};
#define N_BADMAG(x) (0)
#define N_TXTOFF(x) ( sizeof(struct exec) )
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize )
#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize )
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
/* We use this copy of the exec header for VMS. We do not actually use it, but
what we actually do is let gas fill in the relevant slots, and when we get
around to writing an obj file, we just pick out what we need. */
struct exec
{
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_entry; /* start address */
unsigned long a_syms; /* length of symbol table data in file, in bytes */
};
typedef struct {
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
} object_headers;
/* A single entry in the symbol table
*/
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx; /* Index into string table */
} n_un;
unsigned char n_type; /* See below */
char n_other; /* Used in i80960 support -- see below */
short n_desc;
unsigned long n_value;
};
/* Legal values of n_type
*/
#define N_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol */
#define N_TEXT 4 /* Text symbol */
#define N_DATA 6 /* Data symbol */
#define N_BSS 8 /* BSS symbol */
#define N_FN 31 /* Filename symbol */
#define N_EXT 1 /* External symbol (OR'd in with one of above) */
#define N_TYPE 036 /* Mask for all the type bits */
#define N_STAB 0340 /* Mask for all bits used for SDB entries */
#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
#define N_RSYM 0x40 /* register sym: name,,0,type,register */
#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
#define N_CATCH 0x54 /* */
#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
#define N_SO 0x64 /* source file name: name,,0,0,address */
#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
#define N_SOL 0x84 /* #included file name: name,,0,0,address */
#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
#define N_BCOMM 0xe2 /* begin common: name,, */
#define N_ECOMM 0xe4 /* end common: name,, */
#define N_ECOML 0xe8 /* end common (local name): ,,address */
#define N_LENG 0xfe /* second stab entry with length information */
/* SYMBOL TABLE */
/* Symbol table entry data type */
typedef struct nlist obj_symbol_type; /* Symbol table entry */
/* Symbol table macros and constants */
/*
* 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.
*/
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) (S_GET_TYPE(s) != N_UNDF)
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
(S_GET_NAME(s)[0] == '\001' || \
(S_LOCAL_NAME(s) && !flagseen['L'])))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
/* Accessors */
/* The value of the symbol */
#define S_GET_VALUE(s) (((s)->sy_symbol.n_value))
/* The name of the symbol */
#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
/* The raw type of the symbol */
#define S_GET_RAW_TYPE(s) ((s)->sy_symbol.n_type)
/* The type of the symbol */
#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
/* The n_other expression value */
#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
/* The n_desc expression value */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Modifiers */
/* Set the value of the symbol */
#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v))
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is external */
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
/* Set the offset in the string table */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
/* File header macro and type definition */
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v)))
#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v)))
#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v)))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
sizeof(struct nlist))
/*
* Current means for getting the name of a segment.
* This will change for infinite-segments support (e.g. COFF).
*/
#define segment_name(seg) ( seg_name[(int)(seg)] )
extern char *const seg_name[];
/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
#define obj_symbol_new_hook(s) {;}
#ifdef __STDC__
struct fix;
void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address);
#else
void tc_aout_fix_to_chars();
#endif /* __STDC__ */
/* The rest of this file contains definitions for constants used within the actual
VMS object file. We do not use a $ in the symbols (as per usual VMS
convention) since System V gags on it. */
#define OBJ_S_C_HDR 0
#define OBJ_S_C_HDR_MHD 0
#define OBJ_S_C_HDR_LNM 1
#define OBJ_S_C_HDR_SRC 2
#define OBJ_S_C_HDR_TTL 3
#define OBJ_S_C_HDR_CPR 4
#define OBJ_S_C_HDR_MTC 5
#define OBJ_S_C_HDR_GTX 6
#define OBJ_S_C_GSD 1
#define OBJ_S_C_GSD_PSC 0
#define OBJ_S_C_GSD_SYM 1
#define OBJ_S_C_GSD_EPM 2
#define OBJ_S_C_GSD_PRO 3
#define OBJ_S_C_GSD_SYMW 4
#define OBJ_S_C_GSD_EPMW 5
#define OBJ_S_C_GSD_PROW 6
#define OBJ_S_C_GSD_IDC 7
#define OBJ_S_C_GSD_ENV 8
#define OBJ_S_C_GSD_LSY 9
#define OBJ_S_C_GSD_LEPM 10
#define OBJ_S_C_GSD_LPRO 11
#define OBJ_S_C_GSD_SPSC 12
#define OBJ_S_C_TIR 2
#define OBJ_S_C_EOM 3
#define OBJ_S_C_DBG 4
#define OBJ_S_C_TBT 5
#define OBJ_S_C_LNK 6
#define OBJ_S_C_EOMW 7
#define OBJ_S_C_MAXRECTYP 7
#define OBJ_S_K_SUBTYP 1
#define OBJ_S_C_SUBTYP 1
#define OBJ_S_C_MAXRECSIZ 2048
#define OBJ_S_C_STRLVL 0
#define OBJ_S_C_SYMSIZ 31
#define OBJ_S_C_STOREPLIM -1
#define OBJ_S_C_PSCALILIM 9
#define MHD_S_C_MHD 0
#define MHD_S_C_LNM 1
#define MHD_S_C_SRC 2
#define MHD_S_C_TTL 3
#define MHD_S_C_CPR 4
#define MHD_S_C_MTC 5
#define MHD_S_C_GTX 6
#define MHD_S_C_MAXHDRTYP 6
#define GSD_S_K_ENTRIES 1
#define GSD_S_C_ENTRIES 1
#define GSD_S_C_PSC 0
#define GSD_S_C_SYM 1
#define GSD_S_C_EPM 2
#define GSD_S_C_PRO 3
#define GSD_S_C_SYMW 4
#define GSD_S_C_EPMW 5
#define GSD_S_C_PROW 6
#define GSD_S_C_IDC 7
#define GSD_S_C_ENV 8
#define GSD_S_C_LSY 9
#define GSD_S_C_LEPM 10
#define GSD_S_C_LPRO 11
#define GSD_S_C_SPSC 12
#define GSD_S_C_SYMV 13
#define GSD_S_C_EPMV 14
#define GSD_S_C_PROV 15
#define GSD_S_C_MAXRECTYP 15
#define GSY_S_M_WEAK 1
#define GSY_S_M_DEF 2
#define GSY_S_M_UNI 4
#define GSY_S_M_REL 8
#define GPS_S_M_PIC 1
#define GPS_S_M_LIB 2
#define GPS_S_M_OVR 4
#define GPS_S_M_REL 8
#define GPS_S_M_GBL 16
#define GPS_S_M_SHR 32
#define GPS_S_M_EXE 64
#define GPS_S_M_RD 128
#define GPS_S_M_WRT 256
#define GPS_S_M_VEC 512
#define GPS_S_K_NAME 9
#define GPS_S_C_NAME 9
#define TIR_S_C_STA_GBL 0
#define TIR_S_C_STA_SB 1
#define TIR_S_C_STA_SW 2
#define TIR_S_C_STA_LW 3
#define TIR_S_C_STA_PB 4
#define TIR_S_C_STA_PW 5
#define TIR_S_C_STA_PL 6
#define TIR_S_C_STA_UB 7
#define TIR_S_C_STA_UW 8
#define TIR_S_C_STA_BFI 9
#define TIR_S_C_STA_WFI 10
#define TIR_S_C_STA_LFI 11
#define TIR_S_C_STA_EPM 12
#define TIR_S_C_STA_CKARG 13
#define TIR_S_C_STA_WPB 14
#define TIR_S_C_STA_WPW 15
#define TIR_S_C_STA_WPL 16
#define TIR_S_C_STA_LSY 17
#define TIR_S_C_STA_LIT 18
#define TIR_S_C_STA_LEPM 19
#define TIR_S_C_MAXSTACOD 19
#define TIR_S_C_MINSTOCOD 20
#define TIR_S_C_STO_SB 20
#define TIR_S_C_STO_SW 21
#define TIR_S_C_STO_L 22
#define TIR_S_C_STO_BD 23
#define TIR_S_C_STO_WD 24
#define TIR_S_C_STO_LD 25
#define TIR_S_C_STO_LI 26
#define TIR_S_C_STO_PIDR 27
#define TIR_S_C_STO_PICR 28
#define TIR_S_C_STO_RSB 29
#define TIR_S_C_STO_RSW 30
#define TIR_S_C_STO_RL 31
#define TIR_S_C_STO_VPS 32
#define TIR_S_C_STO_USB 33
#define TIR_S_C_STO_USW 34
#define TIR_S_C_STO_RUB 35
#define TIR_S_C_STO_RUW 36
#define TIR_S_C_STO_B 37
#define TIR_S_C_STO_W 38
#define TIR_S_C_STO_RB 39
#define TIR_S_C_STO_RW 40
#define TIR_S_C_STO_RIVB 41
#define TIR_S_C_STO_PIRR 42
#define TIR_S_C_MAXSTOCOD 42
#define TIR_S_C_MINOPRCOD 50
#define TIR_S_C_OPR_NOP 50
#define TIR_S_C_OPR_ADD 51
#define TIR_S_C_OPR_SUB 52
#define TIR_S_C_OPR_MUL 53
#define TIR_S_C_OPR_DIV 54
#define TIR_S_C_OPR_AND 55
#define TIR_S_C_OPR_IOR 56
#define TIR_S_C_OPR_EOR 57
#define TIR_S_C_OPR_NEG 58
#define TIR_S_C_OPR_COM 59
#define TIR_S_C_OPR_INSV 60
#define TIR_S_C_OPR_ASH 61
#define TIR_S_C_OPR_USH 62
#define TIR_S_C_OPR_ROT 63
#define TIR_S_C_OPR_SEL 64
#define TIR_S_C_OPR_REDEF 65
#define TIR_S_C_OPR_DFLIT 66
#define TIR_S_C_MAXOPRCOD 66
#define TIR_S_C_MINCTLCOD 80
#define TIR_S_C_CTL_SETRB 80
#define TIR_S_C_CTL_AUGRB 81
#define TIR_S_C_CTL_DFLOC 82
#define TIR_S_C_CTL_STLOC 83
#define TIR_S_C_CTL_STKDL 84
#define TIR_S_C_MAXCTLCOD 84
/*
* Debugger symbol definitions: These are done by hand, as no
* machine-readable version seems
* to be available.
*/
#define DST_S_C_C 7 /* Language == "C" */
#define DST_S_C_VERSION 153
#define DST_S_C_SOURCE 155 /* Source file */
#define DST_S_C_PROLOG 162
#define DST_S_C_BLKBEG 176 /* Beginning of block */
#define DST_S_C_BLKEND 177 /* End of block */
#define DST_S_C_ENTRY 181
#define DST_S_C_PSECT 184
#define DST_S_C_LINE_NUM 185 /* Line Number */
#define DST_S_C_LBLORLIT 186
#define DST_S_C_LABEL 187
#define DST_S_C_MODBEG 188 /* Beginning of module */
#define DST_S_C_MODEND 189 /* End of module */
#define DST_S_C_RTNBEG 190 /* Beginning of routine */
#define DST_S_C_RTNEND 191 /* End of routine */
#define DST_S_C_DELTA_PC_W 1 /* Incr PC */
#define DST_S_C_INCR_LINUM 2 /* Incr Line # */
#define DST_S_C_INCR_LINUM_W 3 /* Incr Line # */
#define DST_S_C_SET_LINUM_INCR 4
#define DST_S_C_SET_LINUM_INCR_W 5
#define DST_S_C_RESET_LINUM_INCR 6
#define DST_S_C_BEG_STMT_MODE 7
#define DST_S_C_END_STMT_MODE 8
#define DST_S_C_SET_LINE_NUM 9 /* Set Line # */
#define DST_S_C_SET_PC 10
#define DST_S_C_SET_PC_W 11
#define DST_S_C_SET_PC_L 12
#define DST_S_C_SET_STMTNUM 13
#define DST_S_C_TERM 14 /* End of lines */
#define DST_S_C_TERM_W 15 /* End of lines */
#define DST_S_C_SET_ABS_PC 16 /* Set PC */
#define DST_S_C_DELTA_PC_L 17 /* Incr PC */
#define DST_S_C_INCR_LINUM_L 18 /* Incr Line # */
#define DST_S_C_SET_LINUM_B 19 /* Set Line # */
#define DST_S_C_SET_LINUM_L 20 /* Set Line # */
#define DST_S_C_TERM_L 21 /* End of lines */
/* these are used with DST_S_C_SOURCE */
#define DST_S_C_SRC_FORMFEED 16 /* ^L counts */
#define DST_S_C_SRC_DECLFILE 1 /* Declare file */
#define DST_S_C_SRC_SETFILE 2 /* Set file */
#define DST_S_C_SRC_SETREC_L 3 /* Set record */
#define DST_S_C_SRC_DEFLINES_W 10 /* # of line */
/* the following are the codes for the various data types. Anything not on
* the list is included under 'advanced_type'
*/
#define DBG_S_C_UCHAR 0x02
#define DBG_S_C_USINT 0x03
#define DBG_S_C_ULINT 0x04
#define DBG_S_C_SCHAR 0x06
#define DBG_S_C_SSINT 0x07
#define DBG_S_C_SLINT 0x08
#define DBG_S_C_REAL4 0x0a
#define DBG_S_C_REAL8 0x0b
#define DBG_S_C_FUNCTION_ADDR 0x17
#define DBG_S_C_ADVANCED_TYPE 0xa3
/* These are the codes that are used to generate the definitions of struct
* union and enum records
*/
#define DBG_S_C_ENUM_ITEM 0xa4
#define DBG_S_C_ENUM_START 0xa5
#define DBG_S_C_ENUM_END 0xa6
#define DBG_S_C_STRUCT_START 0xab
#define DBG_S_C_STRUCT_ITEM 0xff
#define DBG_S_C_STRUCT_END 0xac
/* These are the codes that are used in the suffix records to determine the
* actual data type
*/
#define DBG_S_C_BASIC 0x01
#define DBG_S_C_BASIC_ARRAY 0x02
#define DBG_S_C_STRUCT 0x03
#define DBG_S_C_POINTER 0x04
#define DBG_S_C_VOID 0x05
#define DBG_S_C_COMPLEX_ARRAY 0x07
/* These codes are used in the generation of the symbol definition records
*/
#define DBG_S_C_FUNCTION_PARAMETER 0xc9
#define DBG_S_C_LOCAL_SYM 0xd9
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of obj-vms.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
/* tc-a29k.h -- Assemble for the AMD 29000.
Copyright (C) 1989, 1990, 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 TC_A29K
#define NO_LISTING
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define tc_coff_symbol_emit_hook(a) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#define AOUT_MACHTYPE 101
#define TC_COFF_FIX2RTYPE(fix_ptr) tc_coff_fix2rtype(fix_ptr)
#define BFD_ARCH bfd_arch_a29k
#define COFF_MAGIC SIPFBOMAGIC
/* Should the reloc be output ?
on the 29k, this is true only if there is a symbol attatched.
on the h8, this is allways true, since no fixup is done
*/
#define TC_COUNT_RELOC(x) (x->fx_addsy)
/* end of tc-a29k.h */

View File

View File

@ -0,0 +1,37 @@
/* This file is tc-generic.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 tc-generic.h and is intended to be a template for target cpu
* specific header files. It is my intent that this file compile. It is also
* my intent that this file grow into something that can be used as both a
* template for porting, and a stub for testing. xoxorich.
*/
#define TC_GENERIC 1
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of tc-generic.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
/* This file is tc-h8300.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. */
#define TC_H8300
/* This macro translates between an internal fix and an coff reloc type */
#define TC_COFF_FIX2RTYPE(fixP) abort();
#define BFD_ARCH bfd_arch_h8300
#define COFF_MAGIC 0x8300
#define TC_COUNT_RELOC(x) (1)
#define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle(a,b,c)
#define DO_NOT_STRIP 1
#define DO_STRIP 0
#define LISTING_HEADER "Hitachi H8/300 GAS "
/* end of tc-h8300.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,254 @@
/* tc-i386.h -- Header file for tc-i386.c
Copyright (C) 1989, 1992 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 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: tc-i386.h,v 1.1 1993/10/02 20:59:21 pk Exp $
*/
#ifndef TC_I386
#define TC_I386 1
#if 0
#define AOUT_MACHTYPE 100
#endif
#define REVERSE_SORT_RELOCS
#define LOCAL_LABELS_FB
#define NO_LISTING
#define tc_coff_symbol_emit_hook(a) ; /* not used */
/* Local labels starts with .L */
/* fixme-now: this is for testing against old gas */
/* #define LOCAL_LABEL(name) ((name)[0] == '.' && (name)[1] == 'L') */
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#define MAX_OPERANDS 3 /* max operands per insn */
#define MAX_PREFIXES 4 /* max prefixes per opcode */
#define MAX_IMMEDIATE_OPERANDS 2 /* max immediates per insn */
#define MAX_MEMORY_OPERANDS 2 /* max memory ref per insn
* lcall uses 2
*/
/* we define the syntax here (modulo base,index,scale syntax) */
#define REGISTER_PREFIX '%'
#define IMMEDIATE_PREFIX '$'
#define ABSOLUTE_PREFIX '*'
#define PREFIX_SEPERATOR '/'
#define TWO_BYTE_OPCODE_ESCAPE 0x0f
#ifndef OLD_GAS
#define NOP_OPCODE 0x90
#else /* OLD_GAS */
#define NOP_OPCODE 0x00
#endif /* OLD_GAS */
/* register numbers */
#define EBP_REG_NUM 5
#define ESP_REG_NUM 4
/* modrm_byte.regmem for twobyte escape */
#define ESCAPE_TO_TWO_BYTE_ADDRESSING ESP_REG_NUM
/* index_base_byte.index for no index register addressing */
#define NO_INDEX_REGISTER ESP_REG_NUM
/* index_base_byte.base for no base register addressing */
#define NO_BASE_REGISTER EBP_REG_NUM
/* these are the att as opcode suffixes, making movl --> mov, for example */
#define DWORD_OPCODE_SUFFIX 'l'
#define WORD_OPCODE_SUFFIX 'w'
#define BYTE_OPCODE_SUFFIX 'b'
/* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
#define REGMEM_FIELD_HAS_REG 0x3 /* always = 0x3 */
#define REGMEM_FIELD_HAS_MEM (~REGMEM_FIELD_HAS_REG)
#define END_OF_INSN '\0'
/*
When an operand is read in it is classified by its type. This type includes
all the possible ways an operand can be used. Thus, '%eax' is both 'register
# 0' and 'The Accumulator'. In our language this is expressed by OR'ing
'Reg32' (any 32 bit register) and 'Acc' (the accumulator).
Operands are classified so that we can match given operand types with
the opcode table in i386-opcode.h.
*/
#define Unknown 0x0
/* register */
#define Reg8 0x1 /* 8 bit reg */
#define Reg16 0x2 /* 16 bit reg */
#define Reg32 0x4 /* 32 bit reg */
#define Reg (Reg8|Reg16|Reg32) /* gen'l register */
#define WordReg (Reg16|Reg32) /* for push/pop operands */
/* immediate */
#define Imm8 0x8 /* 8 bit immediate */
#define Imm8S 0x10 /* 8 bit immediate sign extended */
#define Imm16 0x20 /* 16 bit immediate */
#define Imm32 0x40 /* 32 bit immediate */
#define Imm1 0x80 /* 1 bit immediate */
#define ImmUnknown Imm32 /* for unknown expressions */
#define Imm (Imm8|Imm8S|Imm16|Imm32) /* gen'l immediate */
/* memory */
#define Disp8 0x200 /* 8 bit displacement (for jumps) */
#define Disp16 0x400 /* 16 bit displacement */
#define Disp32 0x800 /* 32 bit displacement */
#define Disp (Disp8|Disp16|Disp32) /* General displacement */
#define DispUnknown Disp32 /* for unknown size displacements */
#define Mem8 0x1000
#define Mem16 0x2000
#define Mem32 0x4000
#define BaseIndex 0x8000
#define Mem (Disp|Mem8|Mem16|Mem32|BaseIndex) /* General memory */
#define WordMem (Mem16|Mem32|Disp|BaseIndex)
#define ByteMem (Mem8|Disp|BaseIndex)
/* specials */
#define InOutPortReg 0x10000 /* register to hold in/out port addr = dx */
#define ShiftCount 0x20000 /* register to hold shift cound = cl */
#define Control 0x40000 /* Control register */
#define Debug 0x80000 /* Debug register */
#define Test 0x100000 /* Test register */
#define FloatReg 0x200000 /* Float register */
#define FloatAcc 0x400000 /* Float stack top %st(0) */
#define SReg2 0x800000 /* 2 bit segment register */
#define SReg3 0x1000000 /* 3 bit segment register */
#define Acc 0x2000000 /* Accumulator %al or %ax or %eax */
#define ImplicitRegister (InOutPortReg|ShiftCount|Acc|FloatAcc)
#define JumpAbsolute 0x4000000
#define Abs8 0x08000000
#define Abs16 0x10000000
#define Abs32 0x20000000
#define Abs (Abs8|Abs16|Abs32)
#define Byte (Reg8|Imm8|Imm8S)
#define Word (Reg16|Imm16)
#define DWord (Reg32|Imm32)
#define SMALLEST_DISP_TYPE(num) \
fits_in_signed_byte(num) ? (Disp8|Disp32|Abs8|Abs32) : (Disp32|Abs32)
typedef struct {
/* instruction name sans width suffix ("mov" for movl insns) */
char *name;
/* how many operands */
unsigned int operands;
/* base_opcode is the fundamental opcode byte with a optional prefix(es). */
unsigned int base_opcode;
/* extension_opcode is the 3 bit extension for group <n> insns.
If this template has no extension opcode (the usual case) use None */
unsigned char extension_opcode;
#define None 0xff /* If no extension_opcode is possible. */
/* the bits in opcode_modifier are used to generate the final opcode from
the base_opcode. These bits also are used to detect alternate forms of
the same instruction */
unsigned int opcode_modifier;
/* opcode_modifier bits: */
#define W 0x1 /* set if operands are words or dwords */
#define D 0x2 /* D = 0 if Reg --> Regmem; D = 1 if Regmem --> Reg */
/* direction flag for floating insns: MUST BE 0x400 */
#define FloatD 0x400
/* shorthand */
#define DW (D|W)
#define ShortForm 0x10 /* register is in low 3 bits of opcode */
#define ShortFormW 0x20 /* ShortForm and W bit is 0x8 */
#define Seg2ShortForm 0x40 /* encoding of load segment reg insns */
#define Seg3ShortForm 0x80 /* fs/gs segment register insns. */
#define Jump 0x100 /* special case for jump insns. */
#define JumpInterSegment 0x200 /* special case for intersegment leaps/calls */
/* 0x400 CANNOT BE USED since it's already used by FloatD above */
#define DONT_USE 0x400
#define NoModrm 0x800
#define Modrm 0x1000
#define imulKludge 0x2000
#define JumpByte 0x4000
#define JumpDword 0x8000
#define ReverseRegRegmem 0x10000
/* (opcode_modifier & COMES_IN_ALL_SIZES) is true if the
instuction comes in byte, word, and dword sizes and is encoded into
machine code in the canonical way. */
#define COMES_IN_ALL_SIZES (W)
/* (opcode_modifier & COMES_IN_BOTH_DIRECTIONS) indicates that the
source and destination operands can be reversed by setting either
the D (for integer insns) or the FloatD (for floating insns) bit
in base_opcode. */
#define COMES_IN_BOTH_DIRECTIONS (D|FloatD)
/* operand_types[i] describes the type of operand i. This is made
by OR'ing together all of the possible type masks. (e.g.
'operand_types[i] = Reg|Imm' specifies that operand i can be
either a register or an immediate operand */
unsigned int operand_types[3];
} template;
/*
'templates' is for grouping together 'template' structures for opcodes
of the same name. This is only used for storing the insns in the grand
ole hash table of insns.
The templates themselves start at START and range up to (but not including)
END.
*/
typedef struct {
template *start;
template *end;
} templates;
/* these are for register name --> number & type hash lookup */
typedef struct {
char *reg_name;
unsigned int reg_type;
unsigned int reg_num;
} reg_entry;
typedef struct {
char *seg_name;
unsigned int seg_prefix;
} seg_entry;
/* these are for prefix name --> prefix code hash lookup */
typedef struct {
char *prefix_name;
unsigned char prefix_code;
} prefix_entry;
/* 386 operand encoding bytes: see 386 book for details of this. */
typedef struct {
unsigned regmem:3; /* codes register or memory operand */
unsigned reg:3; /* codes register operand (or extended opcode) */
unsigned mode:2; /* how to interpret regmem & reg */
} modrm_byte;
/* 386 opcode byte to code indirect addressing. */
typedef struct {
unsigned base:3;
unsigned index:3;
unsigned scale:2;
} base_index_byte;
#endif /* TC_I386 */
/* end of tc-i386.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
/*
* This file is tc-i860.h.
*/
#define TC_I860 1
#define NO_LISTING
#ifdef OLD_GAS
#define REVERSE_SORT_RELOCS
#endif /* OLD_GAS */
#define tc_headers_hook(a) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_aout_pre_write_hook(x) {;} /* not used */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of tc-i860.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,281 @@
/* tc-i960.h - Basic 80960 instruction formats.
Copyright (C) 1989, 1990, 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. */
#ifndef TC_I960
#define TC_I960 1
#define NO_LISTING
/*
* The 'COJ' instructions are actually COBR instructions with the 'b' in
* the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary:
* if the displacement will not fit in 13 bits, the assembler will replace them
* with the corresponding compare and branch instructions.
*
* All of the 'MEMn' instructions are the same format; the 'n' in the name
* indicates the default index scale factor (the size of the datum operated on).
*
* The FBRA formats are not actually an instruction format. They are the
* "convenience directives" for branching on floating-point comparisons,
* each of which generates 2 instructions (a 'bno' and one other branch).
*
* The CALLJ format is not actually an instruction format. It indicates that
* the instruction generated (a CTRL-format 'call') should have its relocation
* specially flagged for link-time replacement with a 'bal' or 'calls' if
* appropriate.
*/
/* tailor gas */
#define SYMBOLS_NEED_BACKPOINTERS
#define LOCAL_LABELS_FB
#define WANT_BITFIELDS
/* tailor the coff format */
#define OBJ_COFF_SECTION_HEADER_HAS_ALIGNMENT
#define OBJ_COFF_MAX_AUXENTRIES (2)
/* other */
#define CTRL 0
#define COBR 1
#define COJ 2
#define REG 3
#define MEM1 4
#define MEM2 5
#define MEM4 6
#define MEM8 7
#define MEM12 8
#define MEM16 9
#define FBRA 10
#define CALLJ 11
/* Masks for the mode bits in REG format instructions */
#define M1 0x0800
#define M2 0x1000
#define M3 0x2000
/* Generate the 12-bit opcode for a REG format instruction by placing the
* high 8 bits in instruction bits 24-31, the low 4 bits in instruction bits
* 7-10.
*/
#define REG_OPC(opc) ((opc & 0xff0) << 20) | ((opc & 0xf) << 7)
/* Generate a template for a REG format instruction: place the opcode bits
* in the appropriate fields and OR in mode bits for the operands that will not
* be used. I.e.,
* set m1=1, if src1 will not be used
* set m2=1, if src2 will not be used
* set m3=1, if dst will not be used
*
* Setting the "unused" mode bits to 1 speeds up instruction execution(!).
* The information is also useful to us because some 1-operand REG instructions
* use the src1 field, others the dst field; and some 2-operand REG instructions
* use src1/src2, others src1/dst. The set mode bits enable us to distinguish.
*/
#define R_0(opc) ( REG_OPC(opc) | M1 | M2 | M3 ) /* No operands */
#define R_1(opc) ( REG_OPC(opc) | M2 | M3 ) /* 1 operand: src1 */
#define R_1D(opc) ( REG_OPC(opc) | M1 | M2 ) /* 1 operand: dst */
#define R_2(opc) ( REG_OPC(opc) | M3 ) /* 2 ops: src1/src2 */
#define R_2D(opc) ( REG_OPC(opc) | M2 ) /* 2 ops: src1/dst */
#define R_3(opc) ( REG_OPC(opc) ) /* 3 operands */
/* DESCRIPTOR BYTES FOR REGISTER OPERANDS
*
* Interpret names as follows:
* R: global or local register only
* RS: global, local, or (if target allows) special-function register only
* RL: global or local register, or integer literal
* RSL: global, local, or (if target allows) special-function register;
* or integer literal
* F: global, local, or floating-point register
* FL: global, local, or floating-point register; or literal (including
* floating point)
*
* A number appended to a name indicates that registers must be aligned,
* as follows:
* 2: register number must be multiple of 2
* 4: register number must be multiple of 4
*/
#define SFR 0x10 /* Mask for the "sfr-OK" bit */
#define LIT 0x08 /* Mask for the "literal-OK" bit */
#define FP 0x04 /* Mask for "floating-point-OK" bit */
/* This macro ors the bits together. Note that 'align' is a mask
* for the low 0, 1, or 2 bits of the register number, as appropriate.
*/
#define OP(align,lit,fp,sfr) ( align | lit | fp | sfr )
#define R OP( 0, 0, 0, 0 )
#define RS OP( 0, 0, 0, SFR )
#define RL OP( 0, LIT, 0, 0 )
#define RSL OP( 0, LIT, 0, SFR )
#define F OP( 0, 0, FP, 0 )
#define FL OP( 0, LIT, FP, 0 )
#define R2 OP( 1, 0, 0, 0 )
#define RL2 OP( 1, LIT, 0, 0 )
#define F2 OP( 1, 0, FP, 0 )
#define FL2 OP( 1, LIT, FP, 0 )
#define R4 OP( 3, 0, 0, 0 )
#define RL4 OP( 3, LIT, 0, 0 )
#define F4 OP( 3, 0, FP, 0 )
#define FL4 OP( 3, LIT, FP, 0 )
#define M 0x7f /* Memory operand (MEMA & MEMB format instructions) */
/* Macros to extract info from the register operand descriptor byte 'od'.
*/
#define SFR_OK(od) (od & SFR) /* TRUE if sfr operand allowed */
#define LIT_OK(od) (od & LIT) /* TRUE if literal operand allowed */
#define FP_OK(od) (od & FP) /* TRUE if floating-point op allowed */
#define REG_ALIGN(od,n) ((od & 0x3 & n) == 0)
/* TRUE if reg #n is properly aligned */
#define MEMOP(od) (od == M) /* TRUE if operand is a memory operand*/
/* Classes of 960 intructions:
* - each instruction falls into one class.
* - each target architecture supports one or more classes.
*
* EACH CONSTANT MUST CONTAIN 1 AND ONLY 1 SET BIT!: see targ_has_iclass().
*/
#define I_BASE 0x01 /* 80960 base instruction set */
#define I_CX 0x02 /* 80960Cx instruction */
#define I_DEC 0x04 /* Decimal instruction */
#define I_FP 0x08 /* Floating point instruction */
#define I_KX 0x10 /* 80960Kx instruction */
#define I_MIL 0x20 /* Military instruction */
/* MEANING OF 'n_other' in the symbol record.
*
* If non-zero, the 'n_other' fields indicates either a leaf procedure or
* a system procedure, as follows:
*
* 1 <= n_other <= 32 :
* The symbol is the entry point to a system procedure.
* 'n_value' is the address of the entry, as for any other
* procedure. The system procedure number (which can be used in
* a 'calls' instruction) is (n_other-1). These entries come from
* '.sysproc' directives.
*
* n_other == N_CALLNAME
* the symbol is the 'call' entry point to a leaf procedure.
* The *next* symbol in the symbol table must be the corresponding
* 'bal' entry point to the procedure (see following). These
* entries come from '.leafproc' directives in which two different
* symbols are specified (the first one is represented here).
*
*
* n_other == N_BALNAME
* the symbol is the 'bal' entry point to a leaf procedure.
* These entries result from '.leafproc' directives in which only
* one symbol is specified, or in which the same symbol is
* specified twice.
*
* Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
* but not every N_BALNAME entry must have an N_CALLNAME entry.
*/
#define N_CALLNAME (-1)
#define N_BALNAME (-2)
/* i960 uses a custom relocation record. */
/* let obj-aout.h know */
#define CUSTOM_RELOC_FORMAT 1
/* let a.out.gnu.h know */
#define N_RELOCATION_INFO_DECLARED 1
struct relocation_info {
int r_address; /* File address of item to be relocated */
unsigned
r_index:24,/* Index of symbol on which relocation is based*/
r_pcrel:1, /* 1 => relocate PC-relative; else absolute
* On i960, pc-relative implies 24-bit
* address, absolute implies 32-bit.
*/
r_length:2, /* Number of bytes to relocate:
* 0 => 1 byte
* 1 => 2 bytes
* 2 => 4 bytes -- only value used for i960
*/
r_extern:1,
r_bsr:1, /* Something for the GNU NS32K assembler */
r_disp:1, /* Something for the GNU NS32K assembler */
r_callj:1, /* 1 if relocation target is an i960 'callj' */
nuthin:1; /* Unused */
};
/* hacks for tracking callj's */
#if defined(OBJ_AOUT) | defined(OBJ_BOUT)
#define TC_S_IS_SYSPROC(s) ((1 <= S_GET_OTHER(s)) && (S_GET_OTHER(s) <= 32))
#define TC_S_IS_BALNAME(s) (S_GET_OTHER(s) == N_BALNAME)
#define TC_S_IS_CALLNAME(s) (S_GET_OTHER(s) == N_CALLNAME)
#define TC_S_IS_BADPROC(s) ((S_GET_OTHER(s) != 0) && !TC_S_IS_CALLNAME(s) && !TC_S_IS_BALNAME(s) && !TC_S_IS_SYSPROC(s))
#define TC_S_SET_SYSPROC(s, p) (S_SET_OTHER((s), (p)+1))
#define TC_S_GET_SYSPROC(s) (S_GET_OTHER(s)-1)
#define TC_S_FORCE_TO_BALNAME(s) (S_SET_OTHER((s), N_BALNAME))
#define TC_S_FORCE_TO_CALLNAME(s) (S_SET_OTHER((s), N_CALLNAME))
#define TC_S_FORCE_TO_SYSPROC(s) {;}
#elif defined(OBJ_COFF)
#define TC_S_IS_SYSPROC(s) (S_GET_STORAGE_CLASS(s) == C_SCALL)
#define TC_S_IS_BALNAME(s) (SF_GET_BALNAME(s))
#define TC_S_IS_CALLNAME(s) (SF_GET_CALLNAME(s))
#define TC_S_IS_BADPROC(s) (TC_S_IS_SYSPROC(s) && TC_S_GET_SYSPROC(s) < 0 && 31 < TC_S_GET_SYSPROC(s))
#define TC_S_SET_SYSPROC(s, p) ((s)->sy_symbol.ost_auxent[1].x_sc.x_stindx = (p))
#define TC_S_GET_SYSPROC(s) ((s)->sy_symbol.ost_auxent[1].x_sc.x_stindx)
#define TC_S_FORCE_TO_BALNAME(s) (SF_SET_BALNAME(s))
#define TC_S_FORCE_TO_CALLNAME(s) (SF_SET_CALLNAME(s))
#define TC_S_FORCE_TO_SYSPROC(s) (S_SET_STORAGE_CLASS((s), C_SCALL))
#else /* switch on OBJ */
you lose
#endif /* witch on OBJ */
#if __STDC__ == 1
void brtab_emit(void);
void reloc_callj(); /* this is really reloc_callj(fixS *fixP) but I don't want to change header inclusion order. */
void tc_set_bal_of_call(); /* this is really tc_set_bal_of_call(symbolS *callP, symbolS *balP) */
#else /* not __STDC__ */
void brtab_emit();
void reloc_callj();
void tc_set_bal_of_call();
#endif /* not __STDC__ */
char *_tc_get_bal_of_call(); /* this is really symbolS *tc_get_bal_of_call(symbolS *callP). */
#define tc_get_bal_of_call(c) ((symbolS *) _tc_get_bal_of_call(c))
#endif
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of tc-i960.h */

View File

@ -0,0 +1,304 @@
/* This file is tc-m68851.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. */
/*
* pmmu.h
*/
/* I suppose we have to copyright this file. Someone on the net sent it
to us as part of the changes for the m68851 Memory Management Unit */
/* Copyright (C) 1987 Free Software Foundation, Inc.
This file is part of Gas, the GNU Assembler.
The GNU assembler is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY. No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing. Refer to the GNU Assembler General
Public License for full details.
Everyone is granted permission to copy, modify and redistribute
the GNU Assembler, but only under the conditions described in the
GNU Assembler General Public License. A copy of this license is
supposed to have been given to you along with the GNU Assembler
so you can know your rights and responsibilities. It should be
in a file named COPYING. Among other things, the copyright
notice and this notice must be preserved on all copies. */
#ifdef m68851
/*
I didn't use much imagination in choosing the
following codes, so many of them aren't very
mnemonic. -rab
P pmmu register
Possible values:
000 TC Translation Control reg
100 CAL Current Access Level
101 VAL Validate Access Level
110 SCC Stack Change Control
111 AC Access Control
W wide pmmu registers
Possible values:
001 DRP Dma Root Pointer
010 SRP Supervisor Root Pointer
011 CRP Cpu Root Pointer
f function code register
0 SFC
1 DFC
V VAL register only
X BADx, BACx
100 BAD Breakpoint Acknowledge Data
101 BAC Breakpoint Acknowledge Control
Y PSR
Z PCSR
| memory (modes 2-6, 7.*)
*/
/*
* these defines should be in m68k.c but
* i put them here to keep all the m68851 stuff
* together -rab
* JF--Make sure these #s don't clash with the ones in m68k.c
* That would be BAD.
*/
#define TC (FPS+1) /* 48 */
#define DRP (TC+1) /* 49 */
#define SRP (DRP+1) /* 50 */
#define CRP (SRP+1) /* 51 */
#define CAL (CRP+1) /* 52 */
#define VAL (CAL+1) /* 53 */
#define SCC (VAL+1) /* 54 */
#define AC (SCC+1) /* 55 */
#define BAD (AC+1) /* 56,57,58,59, 60,61,62,63 */
#define BAC (BAD+8) /* 64,65,66,67, 68,69,70,71 */
#define PSR (BAC+8) /* 72 */
#define PCSR (PSR+1) /* 73 */
/* name */ /* opcode */ /* match */ /* args */
{"pbac", one(0xf0c7), one(0xffbf), "Bc"},
{"pbacw", one(0xf087), one(0xffbf), "Bc"},
{"pbas", one(0xf0c6), one(0xffbf), "Bc"},
{"pbasw", one(0xf086), one(0xffbf), "Bc"},
{"pbbc", one(0xf0c1), one(0xffbf), "Bc"},
{"pbbcw", one(0xf081), one(0xffbf), "Bc"},
{"pbbs", one(0xf0c0), one(0xffbf), "Bc"},
{"pbbsw", one(0xf080), one(0xffbf), "Bc"},
{"pbcc", one(0xf0cf), one(0xffbf), "Bc"},
{"pbccw", one(0xf08f), one(0xffbf), "Bc"},
{"pbcs", one(0xf0ce), one(0xffbf), "Bc"},
{"pbcsw", one(0xf08e), one(0xffbf), "Bc"},
{"pbgc", one(0xf0cd), one(0xffbf), "Bc"},
{"pbgcw", one(0xf08d), one(0xffbf), "Bc"},
{"pbgs", one(0xf0cc), one(0xffbf), "Bc"},
{"pbgsw", one(0xf08c), one(0xffbf), "Bc"},
{"pbic", one(0xf0cb), one(0xffbf), "Bc"},
{"pbicw", one(0xf08b), one(0xffbf), "Bc"},
{"pbis", one(0xf0ca), one(0xffbf), "Bc"},
{"pbisw", one(0xf08a), one(0xffbf), "Bc"},
{"pblc", one(0xf0c3), one(0xffbf), "Bc"},
{"pblcw", one(0xf083), one(0xffbf), "Bc"},
{"pbls", one(0xf0c2), one(0xffbf), "Bc"},
{"pblsw", one(0xf082), one(0xffbf), "Bc"},
{"pbsc", one(0xf0c5), one(0xffbf), "Bc"},
{"pbscw", one(0xf085), one(0xffbf), "Bc"},
{"pbss", one(0xf0c4), one(0xffbf), "Bc"},
{"pbssw", one(0xf084), one(0xffbf), "Bc"},
{"pbwc", one(0xf0c9), one(0xffbf), "Bc"},
{"pbwcw", one(0xf089), one(0xffbf), "Bc"},
{"pbws", one(0xf0c8), one(0xffbf), "Bc"},
{"pbwsw", one(0xf088), one(0xffbf), "Bc"},
{"pdbac", two(0xf048, 0x0007), two(0xfff8, 0xffff), "DsBw"},
{"pdbas", two(0xf048, 0x0006), two(0xfff8, 0xffff), "DsBw"},
{"pdbbc", two(0xf048, 0x0001), two(0xfff8, 0xffff), "DsBw"},
{"pdbbs", two(0xf048, 0x0000), two(0xfff8, 0xffff), "DsBw"},
{"pdbcc", two(0xf048, 0x000f), two(0xfff8, 0xffff), "DsBw"},
{"pdbcs", two(0xf048, 0x000e), two(0xfff8, 0xffff), "DsBw"},
{"pdbgc", two(0xf048, 0x000d), two(0xfff8, 0xffff), "DsBw"},
{"pdbgs", two(0xf048, 0x000c), two(0xfff8, 0xffff), "DsBw"},
{"pdbic", two(0xf048, 0x000b), two(0xfff8, 0xffff), "DsBw"},
{"pdbis", two(0xf048, 0x000a), two(0xfff8, 0xffff), "DsBw"},
{"pdblc", two(0xf048, 0x0003), two(0xfff8, 0xffff), "DsBw"},
{"pdbls", two(0xf048, 0x0002), two(0xfff8, 0xffff), "DsBw"},
{"pdbsc", two(0xf048, 0x0005), two(0xfff8, 0xffff), "DsBw"},
{"pdbss", two(0xf048, 0x0004), two(0xfff8, 0xffff), "DsBw"},
{"pdbwc", two(0xf048, 0x0009), two(0xfff8, 0xffff), "DsBw"},
{"pdbws", two(0xf048, 0x0008), two(0xfff8, 0xffff), "DsBw"},
{"pflusha", two(0xf000, 0x2400), two(0xffff, 0xffff), "" },
{"pflush", two(0xf000, 0x3010), two(0xffc0, 0xfe10), "T3T9" },
{"pflush", two(0xf000, 0x3810), two(0xffc0, 0xfe10), "T3T9&s" },
{"pflush", two(0xf000, 0x3008), two(0xffc0, 0xfe18), "D3T9" },
{"pflush", two(0xf000, 0x3808), two(0xffc0, 0xfe18), "D3T9&s" },
{"pflush", two(0xf000, 0x3000), two(0xffc0, 0xfe1e), "f3T9" },
{"pflush", two(0xf000, 0x3800), two(0xffc0, 0xfe1e), "f3T9&s" },
{"pflushs", two(0xf000, 0x3410), two(0xfff8, 0xfe10), "T3T9" },
{"pflushs", two(0xf000, 0x3c00), two(0xfff8, 0xfe00), "T3T9&s" },
{"pflushs", two(0xf000, 0x3408), two(0xfff8, 0xfe18), "D3T9" },
{"pflushs", two(0xf000, 0x3c08), two(0xfff8, 0xfe18), "D3T9&s" },
{"pflushs", two(0xf000, 0x3400), two(0xfff8, 0xfe1e), "f3T9" },
{"pflushs", two(0xf000, 0x3c00), two(0xfff8, 0xfe1e), "f3T9&s"},
{"pflushr", two(0xf000, 0xa000), two(0xffc0, 0xffff), "|s" },
{"ploadr", two(0xf000, 0x2210), two(0xffc0, 0xfff0), "T3&s" },
{"ploadr", two(0xf000, 0x2208), two(0xffc0, 0xfff8), "D3&s" },
{"ploadr", two(0xf000, 0x2200), two(0xffc0, 0xfffe), "f3&s" },
{"ploadw", two(0xf000, 0x2010), two(0xffc0, 0xfff0), "T3&s" },
{"ploadw", two(0xf000, 0x2008), two(0xffc0, 0xfff8), "D3&s" },
{"ploadw", two(0xf000, 0x2000), two(0xffc0, 0xfffe), "f3&s" },
/* TC, CRP, DRP, SRP, CAL, VAL, SCC, AC */
{"pmove", two(0xf000, 0x4000), two(0xffc0, 0xe3ff), "*sP8" },
{"pmove", two(0xf000, 0x4200), two(0xffc0, 0xe3ff), "P8%s" },
{"pmove", two(0xf000, 0x4000), two(0xffc0, 0xe3ff), "|sW8" },
{"pmove", two(0xf000, 0x4200), two(0xffc0, 0xe3ff), "W8~s" },
/* BADx, BACx */
{"pmove", two(0xf000, 0x6200), two(0xffc0, 0xe3e3), "*sX3" },
{"pmove", two(0xf000, 0x6000), two(0xffc0, 0xe3e3), "X3%s" },
/* PSR, PCSR */
/* {"pmove", two(0xf000, 0x6100), two(oxffc0, oxffff), "*sZ8" }, */
{"pmove", two(0xf000, 0x6000), two(0xffc0, 0xffff), "*sY8" },
{"pmove", two(0xf000, 0x6200), two(0xffc0, 0xffff), "Y8%s" },
{"pmove", two(0xf000, 0x6600), two(0xffc0, 0xffff), "Z8%s" },
{"prestore", one(0xf140), one(0xffc0), "&s"},
{"prestore", one(0xf158), one(0xfff8), "+s"},
{"psave", one(0xf100), one(0xffc0), "&s"},
{"psave", one(0xf100), one(0xffc0), "+s"},
{"psac", two(0xf040, 0x0007), two(0xffc0, 0xffff), "@s"},
{"psas", two(0xf040, 0x0006), two(0xffc0, 0xffff), "@s"},
{"psbc", two(0xf040, 0x0001), two(0xffc0, 0xffff), "@s"},
{"psbs", two(0xf040, 0x0000), two(0xffc0, 0xffff), "@s"},
{"pscc", two(0xf040, 0x000f), two(0xffc0, 0xffff), "@s"},
{"pscs", two(0xf040, 0x000e), two(0xffc0, 0xffff), "@s"},
{"psgc", two(0xf040, 0x000d), two(0xffc0, 0xffff), "@s"},
{"psgs", two(0xf040, 0x000c), two(0xffc0, 0xffff), "@s"},
{"psic", two(0xf040, 0x000b), two(0xffc0, 0xffff), "@s"},
{"psis", two(0xf040, 0x000a), two(0xffc0, 0xffff), "@s"},
{"pslc", two(0xf040, 0x0003), two(0xffc0, 0xffff), "@s"},
{"psls", two(0xf040, 0x0002), two(0xffc0, 0xffff), "@s"},
{"pssc", two(0xf040, 0x0005), two(0xffc0, 0xffff), "@s"},
{"psss", two(0xf040, 0x0004), two(0xffc0, 0xffff), "@s"},
{"pswc", two(0xf040, 0x0009), two(0xffc0, 0xffff), "@s"},
{"psws", two(0xf040, 0x0008), two(0xffc0, 0xffff), "@s"},
{"ptestr", two(0xf000, 0x8210), two(0xffc0, 0xe3f0), "T3&sQ8" },
{"ptestr", two(0xf000, 0x8310), two(0xffc0, 0xe310), "T3&sQ8A9" },
{"ptestr", two(0xf000, 0x8208), two(0xffc0, 0xe3f8), "D3&sQ8" },
{"ptestr", two(0xf000, 0x8308), two(0xffc0, 0xe318), "D3&sQ8A9" },
{"ptestr", two(0xf000, 0x8200), two(0xffc0, 0xe3fe), "f3&sQ8" },
{"ptestr", two(0xf000, 0x8300), two(0xffc0, 0xe31e), "f3&sQ8A9" },
{"ptestw", two(0xf000, 0x8010), two(0xffc0, 0xe3f0), "T3&sQ8" },
{"ptestw", two(0xf000, 0x8110), two(0xffc0, 0xe310), "T3&sQ8A9" },
{"ptestw", two(0xf000, 0x8008), two(0xffc0, 0xe3f8), "D3&sQ8" },
{"ptestw", two(0xf000, 0x8108), two(0xffc0, 0xe318), "D3&sQ8A9" },
{"ptestw", two(0xf000, 0x8000), two(0xffc0, 0xe3fe), "f3&sQ8" },
{"ptestw", two(0xf000, 0x8100), two(0xffc0, 0xe31e), "f3&sQ8A9" },
{"ptrapacw", two(0xf07a, 0x0007), two(0xffff, 0xffff), "#w"},
{"ptrapacl", two(0xf07b, 0x0007), two(0xffff, 0xffff), "#l"},
{"ptrapac", two(0xf07c, 0x0007), two(0xffff, 0xffff), ""},
{"ptrapasw", two(0xf07a, 0x0006), two(0xffff, 0xffff), "#w"},
{"ptrapasl", two(0xf07b, 0x0006), two(0xffff, 0xffff), "#l"},
{"ptrapas", two(0xf07c, 0x0006), two(0xffff, 0xffff), ""},
{"ptrapbcw", two(0xf07a, 0x0001), two(0xffff, 0xffff), "#w"},
{"ptrapbcl", two(0xf07b, 0x0001), two(0xffff, 0xffff), "#l"},
{"ptrapbc", two(0xf07c, 0x0001), two(0xffff, 0xffff), ""},
{"ptrapbsw", two(0xf07a, 0x0000), two(0xffff, 0xffff), "#w"},
{"ptrapbsl", two(0xf07b, 0x0000), two(0xffff, 0xffff), "#l"},
{"ptrapbs", two(0xf07c, 0x0000), two(0xffff, 0xffff), ""},
{"ptrapccw", two(0xf07a, 0x000f), two(0xffff, 0xffff), "#w"},
{"ptrapccl", two(0xf07b, 0x000f), two(0xffff, 0xffff), "#l"},
{"ptrapcc", two(0xf07c, 0x000f), two(0xffff, 0xffff), ""},
{"ptrapcsw", two(0xf07a, 0x000e), two(0xffff, 0xffff), "#w"},
{"ptrapcsl", two(0xf07b, 0x000e), two(0xffff, 0xffff), "#l"},
{"ptrapcs", two(0xf07c, 0x000e), two(0xffff, 0xffff), ""},
{"ptrapgcw", two(0xf07a, 0x000d), two(0xffff, 0xffff), "#w"},
{"ptrapgcl", two(0xf07b, 0x000d), two(0xffff, 0xffff), "#l"},
{"ptrapgc", two(0xf07c, 0x000d), two(0xffff, 0xffff), ""},
{"ptrapgsw", two(0xf07a, 0x000c), two(0xffff, 0xffff), "#w"},
{"ptrapgsl", two(0xf07b, 0x000c), two(0xffff, 0xffff), "#l"},
{"ptrapgs", two(0xf07c, 0x000c), two(0xffff, 0xffff), ""},
{"ptrapicw", two(0xf07a, 0x000b), two(0xffff, 0xffff), "#w"},
{"ptrapicl", two(0xf07b, 0x000b), two(0xffff, 0xffff), "#l"},
{"ptrapic", two(0xf07c, 0x000b), two(0xffff, 0xffff), ""},
{"ptrapisw", two(0xf07a, 0x000a), two(0xffff, 0xffff), "#w"},
{"ptrapisl", two(0xf07b, 0x000a), two(0xffff, 0xffff), "#l"},
{"ptrapis", two(0xf07c, 0x000a), two(0xffff, 0xffff), ""},
{"ptraplcw", two(0xf07a, 0x0003), two(0xffff, 0xffff), "#w"},
{"ptraplcl", two(0xf07b, 0x0003), two(0xffff, 0xffff), "#l"},
{"ptraplc", two(0xf07c, 0x0003), two(0xffff, 0xffff), ""},
{"ptraplsw", two(0xf07a, 0x0002), two(0xffff, 0xffff), "#w"},
{"ptraplsl", two(0xf07b, 0x0002), two(0xffff, 0xffff), "#l"},
{"ptrapls", two(0xf07c, 0x0002), two(0xffff, 0xffff), ""},
{"ptrapscw", two(0xf07a, 0x0005), two(0xffff, 0xffff), "#w"},
{"ptrapscl", two(0xf07b, 0x0005), two(0xffff, 0xffff), "#l"},
{"ptrapsc", two(0xf07c, 0x0005), two(0xffff, 0xffff), ""},
{"ptrapssw", two(0xf07a, 0x0004), two(0xffff, 0xffff), "#w"},
{"ptrapssl", two(0xf07b, 0x0004), two(0xffff, 0xffff), "#l"},
{"ptrapss", two(0xf07c, 0x0004), two(0xffff, 0xffff), ""},
{"ptrapwcw", two(0xf07a, 0x0009), two(0xffff, 0xffff), "#w"},
{"ptrapwcl", two(0xf07b, 0x0009), two(0xffff, 0xffff), "#l"},
{"ptrapwc", two(0xf07c, 0x0009), two(0xffff, 0xffff), ""},
{"ptrapwsw", two(0xf07a, 0x0008), two(0xffff, 0xffff), "#w"},
{"ptrapwsl", two(0xf07b, 0x0008), two(0xffff, 0xffff), "#l"},
{"ptrapws", two(0xf07c, 0x0008), two(0xffff, 0xffff), ""},
{"pvalid", two(0xf000, 0x2800), two(0xffc0, 0xffff), "Vs&s"},
{"pvalid", two(0xf000, 0x2c00), two(0xffc0, 0xfff8), "A3&s" },
#endif /* m68851 */
/* end of tc-m68851.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/* This file is tc-m68k.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
#define NO_LISTING
#ifdef OLD_GAS
#define REVERSE_SORT_RELOCS
#endif /* OLD_GAS */
#define AOUT_MACHTYPE 0x2
#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 2 /* One word on the first line */
#define LISTING_LHS_WIDTH_SECOND 2 /* 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 */ \
}
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
/* end of tc-m68k.h */

View File

@ -0,0 +1,64 @@
/* 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 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/* m88k.h -- Assembler for the Motorola 88000
Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science.
Copyright (C) 1989-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 TC_M88K 1
#define NO_LISTING
#define NO_DOT_PSEUDOS
#define ALLOW_ATSIGN
#define LOCAL_LABEL(name) (name[0] == '@' \
&& ( name[1] == 'L' || name[1] == '.' ))
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#define tc_aout_pre_write_hook(x) {;} /* not used */
/* end of tc-m88k.h */

View File

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/* tc-ns32k.h -- Opcode table for National Semi 32k processor
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. */
#include "bit_fix.h"
#define NO_LISTING
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
#ifndef DEF_MODEC
#define DEF_MODEC 20
#endif
#ifndef DEF_MODEL
#define DEF_MODEL 20
#endif
#define MAX_ARGS 4
#define ARG_LEN 50
#if __STDC__ == 1
void fix_new_ns32k(fragS *frag,
int where,
int size,
struct symbol *add_symbol,
struct symbol *sub_symbol,
long offset,
int pcrel,
int pcrel_adjust,
int im_disp,
bit_fixS *bit_fixP, /* really bit_fixS */
int bsr);
#else /* not __STDC__ */
void fix_new_ns32k();
#endif /* not __STDC__ */
/* end of tc-ns32k.h */

View File

View File

File diff suppressed because it is too large Load Diff

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