new gas main line
This commit is contained in:
parent
3c0c9328b9
commit
0e39a8bbfe
|
@ -0,0 +1,4 @@
|
||||||
|
break as_warn
|
||||||
|
break as_bad
|
||||||
|
break as_fatal
|
||||||
|
set caution off
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALL := $(shell ls -d =*)
|
||||||
|
|
||||||
|
%:
|
||||||
|
$(foreach subdir,$(ALL),$(MAKE) -C $(subdir) $@ &&) true
|
||||||
|
|
||||||
|
gas:
|
|
@ -0,0 +1,203 @@
|
||||||
|
# Makefile for GAS.
|
||||||
|
# Copyright (C) 1989, Free Software Foundation
|
||||||
|
#
|
||||||
|
# This file is part of GAS, the GNU Assembler.
|
||||||
|
#
|
||||||
|
# GAS is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 1, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# GAS is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with GAS; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
BINDIR = /usr/local/bin
|
||||||
|
|
||||||
|
BINARY = gas
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add these flags to XCFLAGS below for specific use.
|
||||||
|
#
|
||||||
|
# If you machine does not have vfprintf, but does have _doprnt(),
|
||||||
|
# -DNO_VARARGS
|
||||||
|
#
|
||||||
|
# If the return-type of a signal-hander is void (instead of int),
|
||||||
|
# -DSIGTY
|
||||||
|
#
|
||||||
|
# To include the mc68851 mmu coprocessor instructions in the 68020 assembler,
|
||||||
|
# -Dm68851
|
||||||
|
#
|
||||||
|
# If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr
|
||||||
|
# opcodes (unlike most 80386 assemblers)
|
||||||
|
# -DNON_BROKEN_WORDS
|
||||||
|
#
|
||||||
|
XCFLAGS =
|
||||||
|
|
||||||
|
# Your favorite compiler
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
# Uncomment the following lines if you use USG
|
||||||
|
|
||||||
|
INCLUDE_DIRS = -I.
|
||||||
|
COFF_OBJECTS = stack.o
|
||||||
|
CPPFLAGS = -DUSG
|
||||||
|
CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
|
||||||
|
LDFLAGS =
|
||||||
|
#LOADLIBES = -lPW
|
||||||
|
|
||||||
|
# Uncomment the following lines if you use BSD
|
||||||
|
#INCLUDE_DIRS = -I.
|
||||||
|
#CPPFLAGS =
|
||||||
|
#CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
|
||||||
|
#LDFLAGS =
|
||||||
|
#LOADLIBES =
|
||||||
|
|
||||||
|
CONFIG_FILES = \
|
||||||
|
machine.c machine.h atof.c obj-format.c obj-format.h opcode.h
|
||||||
|
|
||||||
|
OBJECTS = \
|
||||||
|
as.o xrealloc.o xmalloc.o hash.o hex-value.o \
|
||||||
|
atof-generic.o append.o messages.o expr.o app.o \
|
||||||
|
frags.o input-file.o input-scrub.o output-file.o \
|
||||||
|
subsegs.o symbols.o version.o flonum-const.o flonum-copy.o \
|
||||||
|
flonum-mult.o strstr.o bignum-copy.o obstack.o write.o read.o \
|
||||||
|
obj-format.o machine.o atof.o $(COFF_OBJECTS)
|
||||||
|
|
||||||
|
SOURCES = $(OBJECTS:.o=.c)
|
||||||
|
|
||||||
|
all : $(BINARY)
|
||||||
|
|
||||||
|
install : all
|
||||||
|
cp $(BINARY) $(BINDIR)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f $(OBJECTS)
|
||||||
|
|
||||||
|
clobber : clean
|
||||||
|
rm -f $(BINARY) $(CONFIG_FILES) dependencies TAGS m68k.h
|
||||||
|
|
||||||
|
$(BINARY) : $(OBJECTS)
|
||||||
|
$(CC) -o $(BINARY) $(LDFLAGS) $(OBJECTS) $(LOADLIBES)
|
||||||
|
|
||||||
|
TAGS : $(SOURCES)
|
||||||
|
etags $(SOURCES) *.h
|
||||||
|
|
||||||
|
CXREF : $(SOURCES)
|
||||||
|
cxref -c $(INCLUDE_DIRS) $(SOURCES)
|
||||||
|
|
||||||
|
stack.o: stack.c
|
||||||
|
$(CC) $(CFLAGS) -c stack.c
|
||||||
|
|
||||||
|
atof.o: \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h
|
||||||
|
obj-format.o: \
|
||||||
|
as.h \
|
||||||
|
md.h \
|
||||||
|
aout.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
write.h \
|
||||||
|
append.h
|
||||||
|
read.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
read.h \
|
||||||
|
md.h \
|
||||||
|
hash.h \
|
||||||
|
obstack.h \
|
||||||
|
frags.h \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
expr.h \
|
||||||
|
symbols.h \
|
||||||
|
sparc.h
|
||||||
|
write.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
md.h \
|
||||||
|
subsegs.h \
|
||||||
|
obstack.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
write.h \
|
||||||
|
symbols.h \
|
||||||
|
append.h \
|
||||||
|
sparc.h
|
||||||
|
obstack.o: \
|
||||||
|
obstack.h
|
||||||
|
bignum-copy.o: \
|
||||||
|
bignum.h
|
||||||
|
flonum-mult.o: \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h
|
||||||
|
flonum-copy.o: \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h
|
||||||
|
flonum-const.o: \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h
|
||||||
|
symbols.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
hash.h \
|
||||||
|
obstack.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
symbols.h \
|
||||||
|
frags.h
|
||||||
|
subsegs.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
subsegs.h \
|
||||||
|
obstack.h \
|
||||||
|
frags.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
write.h
|
||||||
|
input-scrub.o: \
|
||||||
|
as.h \
|
||||||
|
read.h \
|
||||||
|
input-file.h
|
||||||
|
input-file.o: \
|
||||||
|
input-file.h
|
||||||
|
frags.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
subsegs.h \
|
||||||
|
obstack.h \
|
||||||
|
frags.h \
|
||||||
|
struc-symbol.h
|
||||||
|
expr.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h \
|
||||||
|
read.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
expr.h \
|
||||||
|
obstack.h \
|
||||||
|
symbols.h
|
||||||
|
messages.o: \
|
||||||
|
as.h
|
||||||
|
atof-generic.o: \
|
||||||
|
flonum.h \
|
||||||
|
bignum.h
|
||||||
|
hash.o: \
|
||||||
|
hash.h
|
||||||
|
as.o: \
|
||||||
|
obj-format.h \
|
||||||
|
a.out.gnu.h \
|
||||||
|
as.h \
|
||||||
|
struc-symbol.h \
|
||||||
|
write.h
|
|
@ -0,0 +1,434 @@
|
||||||
|
# Makefile for GAS.
|
||||||
|
# Copyright (C) 1989, Free Software Foundation
|
||||||
|
#
|
||||||
|
# This file is part of GAS, the GNU Assembler.
|
||||||
|
#
|
||||||
|
# GAS is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 1, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# GAS is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with GAS; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# This makefile may be used to make the VAX, 68020, 80386,
|
||||||
|
# SPARC, AMD 29000, ns32k, or i860 assembler(s).
|
||||||
|
ALL = asm29k avax a68 a386 asparc a32k a860 a960
|
||||||
|
MDSRC=vax.c m68k.c i386.c sparc.c am29k.c ns32k.c
|
||||||
|
|
||||||
|
BINDIR = $(DESTDIR)/bin
|
||||||
|
|
||||||
|
# If you are on a BSD system, un-comment the next two lines, and comment out
|
||||||
|
# the lines for SystemV and HPUX below
|
||||||
|
#G0 = -g -I. #-O -Wall
|
||||||
|
#LDFLAGS = $(CFLAGS)
|
||||||
|
#
|
||||||
|
# To compile gas on a System Five machine, comment out the two lines above
|
||||||
|
# and un-comment out the next three lines
|
||||||
|
# Comment out the -lPW on the LOADLIBES line if you are using GCC.
|
||||||
|
G0 = -g -I. -DUSG
|
||||||
|
LDFLAGS = $(CFLAGS)
|
||||||
|
LOADLIBES = # -lmalloc -lPW
|
||||||
|
#
|
||||||
|
# To compile gas for HPUX, link m-hpux.h to m68k.h , and un-comment the
|
||||||
|
# next two lines. (If you are using GCC, comment out the alloca.o part)
|
||||||
|
# (Get alloca from the emacs distribution, or use GCC.)
|
||||||
|
# HPUX 7.0 may have a bug in setvbuf. gas gives an error message like
|
||||||
|
# 1:"Unknown operator" -- Statement 'NO_APP' ignored
|
||||||
|
# if setvbuf is broken. Re-compile input-file.c (and only input-file.c
|
||||||
|
# with -DVMS and the problem should go away.
|
||||||
|
#
|
||||||
|
# G0 = -g -I. -DUSG
|
||||||
|
# LOADLIBES = alloca.o
|
||||||
|
#
|
||||||
|
# To compile gas for a Sequent Symmetry, comment out all the above lines,
|
||||||
|
# and un-comment the next two lines.
|
||||||
|
# G0 = -g -I. -DUSE_SYSTEM_HDR -DEXEC_VERSION=1
|
||||||
|
# LOADLIBES = -lc /usr/att/lib/libc.a
|
||||||
|
|
||||||
|
# Use these lines to build gas using hc.
|
||||||
|
#CC=hc29 -cmdlink.cmd -Dconst= -I../include/msdos
|
||||||
|
#CC=gcc29k
|
||||||
|
#LOADLIBES= ../binutils/alloca.o
|
||||||
|
|
||||||
|
# If you just want to compile the vax assembler, type 'make avax'
|
||||||
|
|
||||||
|
# If you just want to compile the i386 assembler, type 'make a386'
|
||||||
|
|
||||||
|
# If you just want to compile the ns32k assembler, type 'make a32k'
|
||||||
|
|
||||||
|
# If you just want to compile the sparc assembler, type 'make asparc'
|
||||||
|
|
||||||
|
# If you just want to compile the AMD 29000 assembler, type 'make asm29k'
|
||||||
|
|
||||||
|
# If you just want to compile the a860 assembler, type 'make a860'
|
||||||
|
|
||||||
|
# If you just want to compile the a960 assembler, type 'make a960'
|
||||||
|
|
||||||
|
# If you just want to compile the mc68020 assembler, make sure m68k.h
|
||||||
|
# is correctly set up, and type type 'make a68' (Except on HPUX machines,
|
||||||
|
# where you will have to make the changes marked below before typing
|
||||||
|
# 'make a68'
|
||||||
|
# m68k.h should be a symbolic or hard-link to one of
|
||||||
|
# m-sun3.h , m-hpux.h or m-generic.h
|
||||||
|
# depending on which machine you want to compile the 68020 assembler for.
|
||||||
|
#
|
||||||
|
# If you want the 68k assembler to be completely compatable with the the
|
||||||
|
# SUN one, un-comment the -DLOCAL_LABELS_FB and -DLOCAL_LABELS_DOLLAR
|
||||||
|
# lines below.
|
||||||
|
#
|
||||||
|
# Gas prefers STDARG's, but if your machine doesn't have stdarg.h, you
|
||||||
|
# should define remove the # from the -DNO_STDARG line below. In this
|
||||||
|
# case gas will try to use VARARGS instead. (but keep reading).
|
||||||
|
#
|
||||||
|
# If your machine does not have vfprintf, but does have _doprnt(),
|
||||||
|
# remove the # from the -DNO_VARARGS line below.
|
||||||
|
#
|
||||||
|
# If the return-type of a signal-hander is void (instead of int),
|
||||||
|
# remove the # from the -DSIGTY line below.
|
||||||
|
#
|
||||||
|
# To include the mc68851 mmu coprocessor instructions in the 68020 assembler,
|
||||||
|
# remove the # from the -Dm68851 line below.
|
||||||
|
#
|
||||||
|
# If you want the 68020 assembler use a register prefix character, un-comment
|
||||||
|
# the REGISTER_PREFIX line, and (maybe) change the '%' to the appropriate
|
||||||
|
# character.
|
||||||
|
#
|
||||||
|
# If you want the assembler to treat .L* or ..* symbols as local, instead of
|
||||||
|
# the usual L* symbols, un-comment the DOT_LABEL_PREFIX line.
|
||||||
|
#
|
||||||
|
# If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr
|
||||||
|
# opcodes (unlike most 80386 assemblers), remove the # from
|
||||||
|
# the -DNON_BROKEN_WORDS line below.
|
||||||
|
#
|
||||||
|
# To compile 80386 Gas for the Sequent Symmetry, un-comment the -DEXEC_VERSION
|
||||||
|
# and the -DUSE_SYSTEM_HDR lines below.
|
||||||
|
#
|
||||||
|
# To compile gas for the HP 9000/300 un-comment the -DUSE_HP_HDR line below.
|
||||||
|
#
|
||||||
|
# For the ns32k, the options are 32532 or 32032 CPU and 32381 or 32081 FPU.
|
||||||
|
# To select the NS32532, remove the # from the -DNS32532 line below.
|
||||||
|
# To compile in tne NS32381 opcodes in addition to the NS32081 opcodes
|
||||||
|
# (the 32381 is a superset of the 32081), remove the # from the -DNS32381
|
||||||
|
# line below.
|
||||||
|
#
|
||||||
|
# For the ns32k on a Sequent, uncomment the SEQUENT_COMPATABILITY line below.
|
||||||
|
#
|
||||||
|
# If you want character constants to *require* closing single quotes,
|
||||||
|
# eg 'c' rather than 'c then use the -DREQUIRE_CHAR_CLOSE_QUOTE lines
|
||||||
|
# below. The default is for the closing quote to be optional.
|
||||||
|
#
|
||||||
|
# To produce intel's b.out format, use the B_OUT line below.
|
||||||
|
#
|
||||||
|
# if you want to allow "\v" to mean a control-k, use the BACKSLASH_V
|
||||||
|
# line below.
|
||||||
|
|
||||||
|
# [Why is there a distinction between "Ox" and "Gx"? It would seem easier
|
||||||
|
# to not have to figure out that your code isn't working because some
|
||||||
|
# define's are only seen by some modules and you tested it in a module
|
||||||
|
# where it never gets defined... gnu@cygnus.com]
|
||||||
|
|
||||||
|
O1 = -DNO_STDARG
|
||||||
|
O2 = # -DNO_VARARGS
|
||||||
|
O3 = # -DNON_BROKEN_WORDS
|
||||||
|
O4 = # -Dm68851
|
||||||
|
O5 = # -DEXEC_VERSION=1
|
||||||
|
O6 = # -DSIGTY=void
|
||||||
|
O6 = # -DNS32532
|
||||||
|
O7 = # -DNS32381
|
||||||
|
O8 = # -DDOT_LABEL_PREFIX
|
||||||
|
O9 = # -DSEQUENT_COMPATABILITY
|
||||||
|
|
||||||
|
G1 = # -DREGISTER_PREFIX=\'%\'
|
||||||
|
G2 = # -DUSE_SYSTEM_HDR
|
||||||
|
G3 = # -DUSE_HP_HDR
|
||||||
|
G4 = # -DLOCAL_LABELS_DOLLAR
|
||||||
|
G5 = # -DLOCAL_LABELS_FB
|
||||||
|
G6 = # -DDEBUG
|
||||||
|
G7 = # -DREQUIRE_CHAR_CLOSE_QUOTE
|
||||||
|
G8 = -DB_OUT
|
||||||
|
G9 = -DBACKSLASH_V
|
||||||
|
|
||||||
|
OPTIONS = $(O1) $(O2) $(O3) $(O4) $(O5) $(O6) $(O7) $(O8) $(O9)
|
||||||
|
|
||||||
|
CFLAGS = $(G0) $(G1) $(G2) $(G3) $(G4) $(G5) $(G6) $(G7) $(G8) $(G9) $(OPTIONS)
|
||||||
|
|
||||||
|
#
|
||||||
|
# To make the 68020 assembler compile as the default, un-comment the next
|
||||||
|
# line, and comment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=a68
|
||||||
|
#
|
||||||
|
# To make the VAX assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=avax
|
||||||
|
#
|
||||||
|
# To make the 80386 assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=a386
|
||||||
|
#
|
||||||
|
# To make the ns32k assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=a32k
|
||||||
|
#
|
||||||
|
# To make the sparc assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=asparc
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# To make the i860 assembler compile as the default, un-comment the next
|
||||||
|
# line and comment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=a860
|
||||||
|
#
|
||||||
|
# To make the asm29k assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=asm29k
|
||||||
|
#
|
||||||
|
# To make the i960 assembler compile as the default, un-comment the next
|
||||||
|
# line and commment out all the other lines that start with DEFAULT_GAS
|
||||||
|
#DEFAULT_GAS=a960
|
||||||
|
|
||||||
|
# Global Sources -------------------------------------------------------------
|
||||||
|
|
||||||
|
a =\
|
||||||
|
as.o xrealloc.o xmalloc.o hash.o hex-value.o \
|
||||||
|
atof-generic.o messages.o expr.o app.o \
|
||||||
|
frags.o input-file.o input-scrub.o output-file.o \
|
||||||
|
subsegs.o symbols.o version.o \
|
||||||
|
flonum-const.o flonum-copy.o flonum-mult.o strstr.o bignum-copy.o \
|
||||||
|
obstack.o cond.o
|
||||||
|
#gdb.o gdb-file.o gdb-symbols.o gdb-blocks.o gdb-lines.o
|
||||||
|
|
||||||
|
a: $(DEFAULT_GAS)
|
||||||
|
@rm -f a
|
||||||
|
@ln $(DEFAULT_GAS) a
|
||||||
|
|
||||||
|
# i960 GAS ------------------------------------------------------------------
|
||||||
|
t = i960.o i960-opcode.o atof-ieee.o ver960.o read-i960.o write-i960.o
|
||||||
|
|
||||||
|
T = i960.c i960-opcode.c atof-ieee.c ver960.c
|
||||||
|
|
||||||
|
i960.o: i960.c i960-opcode.h as.h frags.h struc-symbol.h
|
||||||
|
i960.o: flonum.h expr.h hash.h md.h write.h read.h symbols.h
|
||||||
|
$(CC) -c $(CFLAGS) -DI80960 i960.c
|
||||||
|
|
||||||
|
write-i960.o: write.c
|
||||||
|
$(CC) -c $(CFLAGS) write.c
|
||||||
|
mv write.o write-i960.o
|
||||||
|
|
||||||
|
read-i960.o: read.c
|
||||||
|
$(CC) -c $(CFLAGS) read.c
|
||||||
|
mv read.o read-i960.o
|
||||||
|
|
||||||
|
a960_cheat: $a $t
|
||||||
|
$(CC) -o a960 $(LDFLAGS) $a $t $(LOADLIBES)
|
||||||
|
|
||||||
|
a960: force
|
||||||
|
$(MAKE) 'CFLAGS=$(CFLAGS) -DI80960' a960_cheat
|
||||||
|
|
||||||
|
force:
|
||||||
|
|
||||||
|
# AM29K GAS ------------------------------------------------------------------
|
||||||
|
u = am29k.o atof-ieee.o write.o read.o
|
||||||
|
|
||||||
|
U = am29k.c am29k-opcode.h
|
||||||
|
|
||||||
|
am29k.o: am29k.c a.out.gnu.h as.h expr.h flonum.h frags.h hash.h
|
||||||
|
am29k.o: am29k-opcode.h md.h obstack.h struc-symbol.h
|
||||||
|
$(CC) $(CFLAGS) -c am29k.c
|
||||||
|
|
||||||
|
asm29k: $a $u
|
||||||
|
$(CC) -o asm29k $(LDFLAGS) $a $u $(LOADLIBES)
|
||||||
|
|
||||||
|
# I860 GAS ------------------------------------------------------------------
|
||||||
|
u = i860.o atof-ieee.o write.o read.o
|
||||||
|
|
||||||
|
U = i860.c i860-opcode.h
|
||||||
|
|
||||||
|
i860.o: i860.c i860-opcode.h as.h frags.h struc-symbol.h
|
||||||
|
i860.o: flonum.h expr.h hash.h md.h write.h read.h symbols.h
|
||||||
|
$(CC) -c $(CFLAGS) i860.c
|
||||||
|
|
||||||
|
atof-ieee.o: flonum.h
|
||||||
|
|
||||||
|
a860: $a $u
|
||||||
|
$(CC) -o a860 $(LDFLAGS) $a $u $(LOADLIBES)
|
||||||
|
|
||||||
|
# SPARC GAS ------------------------------------------------------------------
|
||||||
|
v = sparc.o atof-ieee.o write.o read.o
|
||||||
|
|
||||||
|
V = sparc.c sparc-opcode.h
|
||||||
|
|
||||||
|
atof-ieee.o: flonum.h
|
||||||
|
sparc.o: sparc.c reloc.h sparc-opcode.h as.h frags.h struc-symbol.h
|
||||||
|
sparc.o: flonum.h expr.h hash.h md.h write.h read.h symbols.h
|
||||||
|
$(CC) -c $(CFLAGS) -DSPARC sparc.c
|
||||||
|
|
||||||
|
asparc: $a $v
|
||||||
|
$(CC) -o asparc $(LDFLAGS) $a $v $(LOADLIBES)
|
||||||
|
|
||||||
|
# NS32K GAS ------------------------------------------------------------------
|
||||||
|
w = ns32k.o atof-ieee.o write-ns32k.o read-ns32k.o
|
||||||
|
|
||||||
|
W = ns32k.c ns32k-opcode.h
|
||||||
|
|
||||||
|
atof-ieee.o: flonum.h
|
||||||
|
ns32k.o: as.h frags.h struc-symbol.h flonum.h expr.h md.h hash.h
|
||||||
|
ns32k.o: write.h symbols.h ns32k-opcode.h ns32k.c
|
||||||
|
$(CC) $(CFLAGS) $(OPTIONS) -c ns32k.c
|
||||||
|
|
||||||
|
write-ns32k.o: write.c
|
||||||
|
rm -f write-ns32k.c
|
||||||
|
cp write.c write-ns32k.c
|
||||||
|
$(CC) -c -DNS32K $(CFLAGS) write-ns32k.c
|
||||||
|
rm -f write-ns32k.c
|
||||||
|
|
||||||
|
read-ns32k.o: read.c
|
||||||
|
rm -f read-ns32k.c
|
||||||
|
cp read.c read-ns32k.c
|
||||||
|
$(CC) -c -DNS32K $(CFLAGS) read-ns32k.c
|
||||||
|
rm -f read-ns32k.c
|
||||||
|
|
||||||
|
a32k: $a $w
|
||||||
|
$(CC) -o a32k $(LDFLAGS) $a $w $(LOADLIBES)
|
||||||
|
|
||||||
|
# 80386 GAS ------------------------------------------------------------------
|
||||||
|
x = i386.o atof-ieee.o write.o read.o
|
||||||
|
|
||||||
|
X = i386.c i386.h i386-opcode.h
|
||||||
|
|
||||||
|
i386.o: i386.c as.h read.h flonum.h frags.h struc-symbol.h expr.h
|
||||||
|
i386.o: symbols.h hash.h md.h i386.h i386-opcode.h
|
||||||
|
$(CC) $(CFLAGS) $(OPTIONS) -c i386.c
|
||||||
|
|
||||||
|
atof-ieee.o: flonum.h
|
||||||
|
|
||||||
|
a386: $a $x
|
||||||
|
$(CC) -o a386 $(LDFLAGS) $a $x $(LOADLIBES)
|
||||||
|
|
||||||
|
# 68020 GAS ------------------------------------------------------------------
|
||||||
|
y = m68k.o atof-ieee.o write.o read.o
|
||||||
|
|
||||||
|
Y = m68k.c atof-ieee.c m68k-opcode.h m-hpux.h m-sun3.h m-generic.h
|
||||||
|
|
||||||
|
atof-ieee.o: flonum.h
|
||||||
|
|
||||||
|
m68k.o: m68k.c a.out.gnu.h as.h expr.h flonum.h frags.h hash.h
|
||||||
|
m68k.o: m68k-opcode.h m68k.h md.h obstack.h struc-symbol.h
|
||||||
|
$(CC) $(CFLAGS) $(OPTIONS) -c m68k.c
|
||||||
|
|
||||||
|
a68: $a $y
|
||||||
|
$(CC) -o a68 $(LDFLAGS) $a $y $(LOADLIBES)
|
||||||
|
|
||||||
|
# VAX GAS --------------------------------------------------------------------
|
||||||
|
z = vax.o atof-vax.o write.o read.o
|
||||||
|
|
||||||
|
Z = vax.c atof-vax.c vax-opcode.h vax-inst.h \
|
||||||
|
make-gas.com objrecdef.h vms.c vms-dbg.c README-vms-dbg
|
||||||
|
|
||||||
|
vax.o: vax.c a.out.gnu.h as.h expr.h flonum.h frags.h md.h obstack.h
|
||||||
|
vax.o: read.h struc-symbol.h symbols.h vax-inst.h vax-opcode.h
|
||||||
|
atof-vax.o: as.h flonum.h read.h
|
||||||
|
|
||||||
|
avax: $a $z
|
||||||
|
$(CC) -o avax $(LDFLAGS) $a $z $(LOADLIBES)
|
||||||
|
|
||||||
|
# global files ---------------------------------------------------------------
|
||||||
|
|
||||||
|
hash.o: hash.c
|
||||||
|
$(CC) $(CFLAGS) -Derror=as_fatal -c hash.c
|
||||||
|
|
||||||
|
xmalloc.o: xmalloc.c
|
||||||
|
$(CC) $(CFLAGS) -Derror=as_fatal -c xmalloc.c
|
||||||
|
|
||||||
|
xrealloc.o: xrealloc.c
|
||||||
|
$(CC) $(CFLAGS) -Derror=as_fatal -c xrealloc.c
|
||||||
|
|
||||||
|
A =\
|
||||||
|
as.c xrealloc.c xmalloc.c hash.c hex-value.c \
|
||||||
|
atof-generic.c messages.c expr.c bignum-copy.c \
|
||||||
|
frags.c input-file.c input-scrub.c output-file.c read.c \
|
||||||
|
subsegs.c symbols.c write.c strstr.c \
|
||||||
|
flonum-const.c flonum-copy.c flonum-mult.c app.c version.c \
|
||||||
|
obstack.c cond.c \
|
||||||
|
#gdb.c gdb-file.c gdb-symbols.c gdb-blocks.c \
|
||||||
|
#gdb-lines.c
|
||||||
|
|
||||||
|
H = \
|
||||||
|
a.out.gnu.h as.h bignum.h expr.h flonum.h \
|
||||||
|
frags.h hash.h input-file.h md.h \
|
||||||
|
obstack.h read.h reloc.h struc-symbol.h subsegs.h \
|
||||||
|
symbols.h write.h
|
||||||
|
|
||||||
|
dist: COPYING README ChangeLog $A $H $U $V $W $X $Y $Z Makefile
|
||||||
|
echo gas-`sed -n -e '/ version /s/[^0-9.]*\([0-9.]*\).*/\1/p' < version.c` > .fname
|
||||||
|
mkdir `cat .fname`
|
||||||
|
|
||||||
|
ln COPYING README ChangeLog $A $H $U $V $W $X $Y $Z Makefile `cat .fname`
|
||||||
|
tar cvhZf `cat .fname`.tar.Z `cat .fname`
|
||||||
|
-rm -rf .fname `cat .fname`
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f a avax a68 a386 a32k asparc asm29k a860 a960 $a $u $v $w $x $y $z a core gmon.out bugs a.out
|
||||||
|
|
||||||
|
all: $(ALL)
|
||||||
|
|
||||||
|
install: install_tools
|
||||||
|
install_tools: a
|
||||||
|
cp a $(BINDIR)/as
|
||||||
|
|
||||||
|
# For things like: emacs `make mdsrc`
|
||||||
|
mdsrc:
|
||||||
|
@ls $(MDSRC)
|
||||||
|
|
||||||
|
LINT = /usr/5bin/lint
|
||||||
|
LINTFLAGS =
|
||||||
|
|
||||||
|
lint:
|
||||||
|
$(LINT) $(LINTFLAGS) $(CFLAGS) $A
|
||||||
|
|
||||||
|
# General .o-->.h dependencies
|
||||||
|
|
||||||
|
app.o: as.h
|
||||||
|
as.o: a.out.gnu.h as.h read.h struc-symbol.h write.h
|
||||||
|
atof-generic.o: flonum.h
|
||||||
|
bignum-copy.o: bignum.h
|
||||||
|
expr.o: a.out.gnu.h as.h expr.h flonum.h obstack.h read.h struc-symbol.h
|
||||||
|
expr.o: symbols.h
|
||||||
|
flonum-const.o: flonum.h
|
||||||
|
flonum-copy.o: flonum.h
|
||||||
|
flonum-mult.o: flonum.h
|
||||||
|
flonum-normal.o:flonum.h
|
||||||
|
flonum-print.o: flonum.h
|
||||||
|
frags.o: a.out.gnu.h as.h frags.h obstack.h struc-symbol.h subsegs.h
|
||||||
|
#gdb.o: as.h
|
||||||
|
#gdb-blocks.o: as.h
|
||||||
|
#gdb-lines.o: as.h frags.h obstack.h
|
||||||
|
#gdb-symbols.o: a.out.gnu.h as.h struc-symbol.h
|
||||||
|
hash.o: hash.h
|
||||||
|
input-file.o: input-file.h
|
||||||
|
input-scrub.o: as.h input-file.h read.h
|
||||||
|
messages.o: as.h
|
||||||
|
obstack.o: obstack.h
|
||||||
|
read.o: a.out.gnu.h as.h expr.h flonum.h frags.h hash.h md.h obstack.h
|
||||||
|
read.o: read.h struc-symbol.h symbols.h reloc.h
|
||||||
|
subsegs.o: a.out.gnu.h as.h frags.h obstack.h struc-symbol.h subsegs.h write.h
|
||||||
|
symbols.o: a.out.gnu.h as.h frags.h hash.h obstack.h struc-symbol.h symbols.h
|
||||||
|
write.o: a.out.gnu.h as.h md.h obstack.h struc-symbol.h subsegs.h
|
||||||
|
write.o: symbols.h write.h reloc.h
|
||||||
|
|
||||||
|
flonum.h: bignum.h
|
||||||
|
|
||||||
|
etags tags: TAGS
|
||||||
|
|
||||||
|
TAGS: force
|
||||||
|
etags Makefile* README* config.gas *.[hc]
|
||||||
|
|
||||||
|
force:
|
||||||
|
|
||||||
|
# End of Makefile
|
|
@ -0,0 +1,19 @@
|
||||||
|
to do:
|
||||||
|
|
||||||
|
fucked up on a.out.gnu.h, etc.
|
||||||
|
fucked up on foo-opcode.h.
|
||||||
|
remove the ifdef's from fx_callj tests?
|
||||||
|
what are callj tests?
|
||||||
|
search for (), build prototypes.
|
||||||
|
space tighten sparc alignment.
|
||||||
|
convert md_ri_to_chars to not pass structs.
|
||||||
|
convert md_ri_to_chars to emit fixP's.
|
||||||
|
fix number_to_chars, & family to have no side effects.
|
||||||
|
prototype.
|
||||||
|
md_ => tp_
|
||||||
|
use CROSS_ASSEMBLE
|
||||||
|
multiple segments.
|
||||||
|
share b.out with a.out.
|
||||||
|
|
||||||
|
|
||||||
|
stack:
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
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 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.
|
|
@ -0,0 +1,127 @@
|
||||||
|
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.
|
|
@ -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)
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1 @@
|
||||||
|
1.2
|
|
@ -31,6 +31,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.1.1.1 1991/04/04 18:15:39 rich
|
||||||
|
* new gas main line
|
||||||
|
*
|
||||||
* Revision 1.1 1991/04/04 18:15:38 rich
|
* Revision 1.1 1991/04/04 18:15:38 rich
|
||||||
* Initial revision
|
* Initial revision
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,6 +32,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.1.1.1 1991/04/04 18:15:42 rich
|
||||||
|
* new gas main line
|
||||||
|
*
|
||||||
* Revision 1.1 1991/04/04 18:15:40 rich
|
* Revision 1.1 1991/04/04 18:15:40 rich
|
||||||
* Initial revision
|
* Initial revision
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* ho-pmax.h Host-specific header file for decstation 3100.
|
||||||
|
Copyright (C) 1987, 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 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 <string.h>
|
||||||
|
|
||||||
|
extern char *malloc();
|
||||||
|
extern int free();
|
||||||
|
|
||||||
|
/* end of ho-pmax.h */
|
|
@ -23,6 +23,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.1.1.1 1991/04/04 18:15:43 rich
|
||||||
|
* new gas main line
|
||||||
|
*
|
||||||
* Revision 1.1 1991/04/04 18:15:42 rich
|
* Revision 1.1 1991/04/04 18:15:42 rich
|
||||||
* Initial revision
|
* Initial revision
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* ho-rs6000.h Rs6000 host-specific header file.
|
||||||
|
Copyright (C) 1987, 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 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. */
|
||||||
|
|
||||||
|
#define M_RS6000 1
|
||||||
|
|
||||||
|
/* end of ho-rs6000.h */
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* ho-vax.h Intended for vax ultrix
|
||||||
|
Copyright (C) 1987, 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 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. */
|
||||||
|
|
||||||
|
#define M_VAX 1
|
||||||
|
|
||||||
|
#ifndef __STDC__
|
||||||
|
#define NO_STDARG
|
||||||
|
#endif /* not ansi */
|
||||||
|
|
||||||
|
extern char *malloc();
|
||||||
|
extern int free();
|
||||||
|
|
||||||
|
/* end of ho-vax.h */
|
|
@ -0,0 +1,8 @@
|
||||||
|
CC = gcc -b$(target) -Wall -nostdinc -nostdlib \
|
||||||
|
-I$(srcdir)/../clib/ansi/include -I$(srcdir)/../os-layer/include
|
||||||
|
|
||||||
|
CLIB = $(srcdir)/../clib/Host-$(host)/Target-$(target)/libc.a \
|
||||||
|
$(srcdir)/../gcc/Host-sun4/Target-$(target)/gnulib
|
||||||
|
|
||||||
|
LDFLAGS = /lib/crt0.o
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALLOCA=alloca.o
|
|
@ -0,0 +1,51 @@
|
||||||
|
#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 */
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* 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 */
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */
|
||||||
|
|
||||||
|
/* Remove leading underscore from the gcc generated symbol names */
|
||||||
|
#define STRIP_UNDERSCORE 1
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* Machine specific defines for the SCO Unix V.3.2 ODT */
|
||||||
|
#define scounix
|
||||||
|
|
||||||
|
/* Return true if s (a non null string pointer), points to a local variable name. */
|
||||||
|
#define LOCAL_LABEL(n) ((n)[0] == '.' && (n)[1] == 'L')
|
||||||
|
|
||||||
|
/* Compiler does not generate symbol names with a leading underscore. */
|
||||||
|
#define STRIP_UNDERSCORE 0
|
|
@ -0,0 +1,52 @@
|
||||||
|
/* sparc.h -- Header file for the SPARC
|
||||||
|
Copyright (C) 1989 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. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following enum and struct were borrowed from
|
||||||
|
* sunOS /usr/include/sun4/a.out.h
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum reloc_type
|
||||||
|
{
|
||||||
|
RELOC_8, RELOC_16, RELOC_32, RELOC_DISP8,
|
||||||
|
RELOC_DISP16, RELOC_DISP32, RELOC_WDISP30, RELOC_WDISP22,
|
||||||
|
RELOC_HI22, RELOC_22, RELOC_13, RELOC_LO10,
|
||||||
|
RELOC_SFA_BASE, RELOC_SFA_OFF13, RELOC_BASE10, RELOC_BASE13,
|
||||||
|
RELOC_BASE22, RELOC_PC10, RELOC_PC22, RELOC_JMP_TBL,
|
||||||
|
RELOC_SEGOFF16, RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE,
|
||||||
|
|
||||||
|
NO_RELOC
|
||||||
|
};
|
||||||
|
|
||||||
|
struct reloc_info_sparc
|
||||||
|
{
|
||||||
|
unsigned long r_address;
|
||||||
|
/*
|
||||||
|
* Using bit fields here is a bad idea because the order is not portable. :-(
|
||||||
|
*/
|
||||||
|
unsigned int r_index : 24;
|
||||||
|
unsigned int r_extern : 1;
|
||||||
|
unsigned int unused : 2;
|
||||||
|
enum reloc_type r_type : 5;
|
||||||
|
long r_addend;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define relocation_info reloc_info_sparc
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */
|
||||||
|
|
||||||
|
/* Remove leading underscore from the gcc generated symbol names */
|
||||||
|
#define STRIP_UNDERSCORE 1
|
|
@ -0,0 +1 @@
|
||||||
|
# This line from make-sun3.
|
|
@ -0,0 +1,255 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* $OBJRECDEF
|
||||||
|
* Generated automatically by "vms_struct Version 1.00"
|
||||||
|
* Created from VMS definition file "objrecdef.mar"
|
||||||
|
* Mon Oct 14 14:01:29 1985
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
struct OBJREC {
|
||||||
|
unsigned char obj$b_rectyp;
|
||||||
|
unsigned char obj$b_subtyp;
|
||||||
|
unsigned char obj$b_mhd_strlv;
|
||||||
|
unsigned char obj$b_mhd_recsz[2];
|
||||||
|
unsigned char obj$t_mhd_name[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define OBJ$C_HDR 0
|
||||||
|
#define OBJ$C_HDR_MHD 0
|
||||||
|
#define OBJ$C_HDR_LNM 1
|
||||||
|
#define OBJ$C_HDR_SRC 2
|
||||||
|
#define OBJ$C_HDR_TTL 3
|
||||||
|
#define OBJ$C_HDR_CPR 4
|
||||||
|
#define OBJ$C_HDR_MTC 5
|
||||||
|
#define OBJ$C_HDR_GTX 6
|
||||||
|
#define OBJ$C_GSD 1
|
||||||
|
#define OBJ$C_GSD_PSC 0
|
||||||
|
#define OBJ$C_GSD_SYM 1
|
||||||
|
#define OBJ$C_GSD_EPM 2
|
||||||
|
#define OBJ$C_GSD_PRO 3
|
||||||
|
#define OBJ$C_GSD_SYMW 4
|
||||||
|
#define OBJ$C_GSD_EPMW 5
|
||||||
|
#define OBJ$C_GSD_PROW 6
|
||||||
|
#define OBJ$C_GSD_IDC 7
|
||||||
|
#define OBJ$C_GSD_ENV 8
|
||||||
|
#define OBJ$C_GSD_LSY 9
|
||||||
|
#define OBJ$C_GSD_LEPM 10
|
||||||
|
#define OBJ$C_GSD_LPRO 11
|
||||||
|
#define OBJ$C_GSD_SPSC 12
|
||||||
|
#define OBJ$C_TIR 2
|
||||||
|
#define OBJ$C_EOM 3
|
||||||
|
#define OBJ$C_DBG 4
|
||||||
|
#define OBJ$C_TBT 5
|
||||||
|
#define OBJ$C_LNK 6
|
||||||
|
#define OBJ$C_EOMW 7
|
||||||
|
#define OBJ$C_MAXRECTYP 7
|
||||||
|
#define OBJ$K_SUBTYP 1
|
||||||
|
#define OBJ$C_SUBTYP 1
|
||||||
|
#define OBJ$C_MAXRECSIZ 2048
|
||||||
|
#define OBJ$C_STRLVL 0
|
||||||
|
#define OBJ$C_SYMSIZ 31
|
||||||
|
#define OBJ$C_STOREPLIM -1
|
||||||
|
#define OBJ$C_PSCALILIM 9
|
||||||
|
|
||||||
|
#define MHD$C_MHD 0
|
||||||
|
#define MHD$C_LNM 1
|
||||||
|
#define MHD$C_SRC 2
|
||||||
|
#define MHD$C_TTL 3
|
||||||
|
#define MHD$C_CPR 4
|
||||||
|
#define MHD$C_MTC 5
|
||||||
|
#define MHD$C_GTX 6
|
||||||
|
#define MHD$C_MAXHDRTYP 6
|
||||||
|
|
||||||
|
#define GSD$K_ENTRIES 1
|
||||||
|
#define GSD$C_ENTRIES 1
|
||||||
|
#define GSD$C_PSC 0
|
||||||
|
#define GSD$C_SYM 1
|
||||||
|
#define GSD$C_EPM 2
|
||||||
|
#define GSD$C_PRO 3
|
||||||
|
#define GSD$C_SYMW 4
|
||||||
|
#define GSD$C_EPMW 5
|
||||||
|
#define GSD$C_PROW 6
|
||||||
|
#define GSD$C_IDC 7
|
||||||
|
#define GSD$C_ENV 8
|
||||||
|
#define GSD$C_LSY 9
|
||||||
|
#define GSD$C_LEPM 10
|
||||||
|
#define GSD$C_LPRO 11
|
||||||
|
#define GSD$C_SPSC 12
|
||||||
|
#define GSD$C_SYMV 13
|
||||||
|
#define GSD$C_EPMV 14
|
||||||
|
#define GSD$C_PROV 15
|
||||||
|
#define GSD$C_MAXRECTYP 15
|
||||||
|
|
||||||
|
#define GSY$M_WEAK 1
|
||||||
|
#define GSY$M_DEF 2
|
||||||
|
#define GSY$M_UNI 4
|
||||||
|
#define GSY$M_REL 8
|
||||||
|
|
||||||
|
#define GPS$M_PIC 1
|
||||||
|
#define GPS$M_LIB 2
|
||||||
|
#define GPS$M_OVR 4
|
||||||
|
#define GPS$M_REL 8
|
||||||
|
#define GPS$M_GBL 16
|
||||||
|
#define GPS$M_SHR 32
|
||||||
|
#define GPS$M_EXE 64
|
||||||
|
#define GPS$M_RD 128
|
||||||
|
#define GPS$M_WRT 256
|
||||||
|
#define GPS$M_VEC 512
|
||||||
|
#define GPS$K_NAME 9
|
||||||
|
#define GPS$C_NAME 9
|
||||||
|
|
||||||
|
#define TIR$C_STA_GBL 0
|
||||||
|
#define TIR$C_STA_SB 1
|
||||||
|
#define TIR$C_STA_SW 2
|
||||||
|
#define TIR$C_STA_LW 3
|
||||||
|
#define TIR$C_STA_PB 4
|
||||||
|
#define TIR$C_STA_PW 5
|
||||||
|
#define TIR$C_STA_PL 6
|
||||||
|
#define TIR$C_STA_UB 7
|
||||||
|
#define TIR$C_STA_UW 8
|
||||||
|
#define TIR$C_STA_BFI 9
|
||||||
|
#define TIR$C_STA_WFI 10
|
||||||
|
#define TIR$C_STA_LFI 11
|
||||||
|
#define TIR$C_STA_EPM 12
|
||||||
|
#define TIR$C_STA_CKARG 13
|
||||||
|
#define TIR$C_STA_WPB 14
|
||||||
|
#define TIR$C_STA_WPW 15
|
||||||
|
#define TIR$C_STA_WPL 16
|
||||||
|
#define TIR$C_STA_LSY 17
|
||||||
|
#define TIR$C_STA_LIT 18
|
||||||
|
#define TIR$C_STA_LEPM 19
|
||||||
|
#define TIR$C_MAXSTACOD 19
|
||||||
|
#define TIR$C_MINSTOCOD 20
|
||||||
|
#define TIR$C_STO_SB 20
|
||||||
|
#define TIR$C_STO_SW 21
|
||||||
|
#define TIR$C_STO_L 22
|
||||||
|
#define TIR$C_STO_BD 23
|
||||||
|
#define TIR$C_STO_WD 24
|
||||||
|
#define TIR$C_STO_LD 25
|
||||||
|
#define TIR$C_STO_LI 26
|
||||||
|
#define TIR$C_STO_PIDR 27
|
||||||
|
#define TIR$C_STO_PICR 28
|
||||||
|
#define TIR$C_STO_RSB 29
|
||||||
|
#define TIR$C_STO_RSW 30
|
||||||
|
#define TIR$C_STO_RL 31
|
||||||
|
#define TIR$C_STO_VPS 32
|
||||||
|
#define TIR$C_STO_USB 33
|
||||||
|
#define TIR$C_STO_USW 34
|
||||||
|
#define TIR$C_STO_RUB 35
|
||||||
|
#define TIR$C_STO_RUW 36
|
||||||
|
#define TIR$C_STO_B 37
|
||||||
|
#define TIR$C_STO_W 38
|
||||||
|
#define TIR$C_STO_RB 39
|
||||||
|
#define TIR$C_STO_RW 40
|
||||||
|
#define TIR$C_STO_RIVB 41
|
||||||
|
#define TIR$C_STO_PIRR 42
|
||||||
|
#define TIR$C_MAXSTOCOD 42
|
||||||
|
#define TIR$C_MINOPRCOD 50
|
||||||
|
#define TIR$C_OPR_NOP 50
|
||||||
|
#define TIR$C_OPR_ADD 51
|
||||||
|
#define TIR$C_OPR_SUB 52
|
||||||
|
#define TIR$C_OPR_MUL 53
|
||||||
|
#define TIR$C_OPR_DIV 54
|
||||||
|
#define TIR$C_OPR_AND 55
|
||||||
|
#define TIR$C_OPR_IOR 56
|
||||||
|
#define TIR$C_OPR_EOR 57
|
||||||
|
#define TIR$C_OPR_NEG 58
|
||||||
|
#define TIR$C_OPR_COM 59
|
||||||
|
#define TIR$C_OPR_INSV 60
|
||||||
|
#define TIR$C_OPR_ASH 61
|
||||||
|
#define TIR$C_OPR_USH 62
|
||||||
|
#define TIR$C_OPR_ROT 63
|
||||||
|
#define TIR$C_OPR_SEL 64
|
||||||
|
#define TIR$C_OPR_REDEF 65
|
||||||
|
#define TIR$C_OPR_DFLIT 66
|
||||||
|
#define TIR$C_MAXOPRCOD 66
|
||||||
|
#define TIR$C_MINCTLCOD 80
|
||||||
|
#define TIR$C_CTL_SETRB 80
|
||||||
|
#define TIR$C_CTL_AUGRB 81
|
||||||
|
#define TIR$C_CTL_DFLOC 82
|
||||||
|
#define TIR$C_CTL_STLOC 83
|
||||||
|
#define TIR$C_CTL_STKDL 84
|
||||||
|
#define TIR$C_MAXCTLCOD 84
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Debugger symbol definitions: These are done by hand, as no
|
||||||
|
* machine-readable version seems
|
||||||
|
* to be available.
|
||||||
|
*/
|
||||||
|
#define DST$C_C 7 /* Language == "C" */
|
||||||
|
#define DST$C_VERSION 153
|
||||||
|
#define DST$C_SOURCE 155 /* Source file */
|
||||||
|
#define DST$C_PROLOG 162
|
||||||
|
#define DST$C_BLKBEG 176 /* Beginning of block */
|
||||||
|
#define DST$C_BLKEND 177 /* End of block */
|
||||||
|
#define DST$C_ENTRY 181
|
||||||
|
#define DST$C_PSECT 184
|
||||||
|
#define DST$C_LINE_NUM 185 /* Line Number */
|
||||||
|
#define DST$C_LBLORLIT 186
|
||||||
|
#define DST$C_LABEL 187
|
||||||
|
#define DST$C_MODBEG 188 /* Beginning of module */
|
||||||
|
#define DST$C_MODEND 189 /* End of module */
|
||||||
|
#define DST$C_RTNBEG 190 /* Beginning of routine */
|
||||||
|
#define DST$C_RTNEND 191 /* End of routine */
|
||||||
|
#define DST$C_DELTA_PC_W 1 /* Incr PC */
|
||||||
|
#define DST$C_INCR_LINUM 2 /* Incr Line # */
|
||||||
|
#define DST$C_INCR_LINUM_W 3 /* Incr Line # */
|
||||||
|
#define DST$C_SET_LINUM_INCR 4
|
||||||
|
#define DST$C_SET_LINUM_INCR_W 5
|
||||||
|
#define DST$C_RESET_LINUM_INCR 6
|
||||||
|
#define DST$C_BEG_STMT_MODE 7
|
||||||
|
#define DST$C_END_STMT_MODE 8
|
||||||
|
#define DST$C_SET_LINE_NUM 9 /* Set Line # */
|
||||||
|
#define DST$C_SET_PC 10
|
||||||
|
#define DST$C_SET_PC_W 11
|
||||||
|
#define DST$C_SET_PC_L 12
|
||||||
|
#define DST$C_SET_STMTNUM 13
|
||||||
|
#define DST$C_TERM 14 /* End of lines */
|
||||||
|
#define DST$C_TERM_W 15 /* End of lines */
|
||||||
|
#define DST$C_SET_ABS_PC 16 /* Set PC */
|
||||||
|
#define DST$C_DELTA_PC_L 17 /* Incr PC */
|
||||||
|
#define DST$C_INCR_LINUM_L 18 /* Incr Line # */
|
||||||
|
#define DST$C_SET_LINUM_B 19 /* Set Line # */
|
||||||
|
#define DST$C_SET_LINUM_L 20 /* Set Line # */
|
||||||
|
#define DST$C_TERM_L 21 /* End of lines */
|
||||||
|
/* these are used with DST$C_SOURCE */
|
||||||
|
#define DST$C_SRC_FORMFEED 16 /* ^L counts */
|
||||||
|
#define DST$C_SRC_DECLFILE 1 /* Declare file */
|
||||||
|
#define DST$C_SRC_SETFILE 2 /* Set file */
|
||||||
|
#define DST$C_SRC_SETREC_L 3 /* Set record */
|
||||||
|
#define DST$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$C_UCHAR 0x02
|
||||||
|
#define DBG$C_USINT 0x03
|
||||||
|
#define DBG$C_ULINT 0x04
|
||||||
|
#define DBG$C_SCHAR 0x06
|
||||||
|
#define DBG$C_SSINT 0x07
|
||||||
|
#define DBG$C_SLINT 0x08
|
||||||
|
#define DBG$C_REAL4 0x0a
|
||||||
|
#define DBG$C_REAL8 0x0b
|
||||||
|
#define DBG$C_FUNCTION_ADDR 0x17
|
||||||
|
#define DBG$C_ADVANCED_TYPE 0xa3
|
||||||
|
/* These are the codes that are used to generate the definitions of struct
|
||||||
|
* union and enum records
|
||||||
|
*/
|
||||||
|
#define DBG$C_ENUM_ITEM 0xa4
|
||||||
|
#define DBG$C_ENUM_START 0xa5
|
||||||
|
#define DBG$C_ENUM_END 0xa6
|
||||||
|
#define DBG$C_STRUCT_START 0xab
|
||||||
|
#define DBG$C_STRUCT_ITEM 0xff
|
||||||
|
#define DBG$C_STRUCT_END 0xac
|
||||||
|
/* These are the codes that are used in the suffix records to determine the
|
||||||
|
* actual data type
|
||||||
|
*/
|
||||||
|
#define DBG$C_BASIC 0x01
|
||||||
|
#define DBG$C_BASIC_ARRAY 0x02
|
||||||
|
#define DBG$C_STRUCT 0x03
|
||||||
|
#define DBG$C_POINTER 0x04
|
||||||
|
#define DBG$C_VOID 0x05
|
||||||
|
#define DBG$C_COMPLEX_ARRAY 0x07
|
||||||
|
/* These codes are used in the generation of the symbol definition records
|
||||||
|
*/
|
||||||
|
#define DBG$C_FUNCTION_PARAMETER 0xc9
|
||||||
|
#define DBG$C_LOCAL_SYM 0xd9
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,56 @@
|
||||||
|
$! Set the def dir to proper place for use in batch. Works for interactive to.
|
||||||
|
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
|
||||||
|
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||||
|
$!
|
||||||
|
$! Command file to build a GNU assembler on VMS
|
||||||
|
$!
|
||||||
|
$! If you are using a version of GCC that supports global constants
|
||||||
|
$! you should remove the define="const=" from the gcc lines.
|
||||||
|
$ if "''p1'" .eqs. "LINK" then goto Link
|
||||||
|
$ gcc/debug/define=("VMS","const=") as.c
|
||||||
|
$ gcc/debug/define=("VMS", "error=as_fatal","const=") xrealloc.c
|
||||||
|
$ gcc/debug/define=("VMS", "error=as_fatal","const=") xmalloc.c
|
||||||
|
$ gcc/debug/define=("VMS", "error=as_fatal","const=") hash.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") obstack.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") hex-value.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") atof-generic.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") append.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") messages.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") expr.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") app.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") frags.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") input-file.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") input-scrub.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") output-file.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") read.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") subsegs.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") symbols.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") write.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") version.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") flonum-const.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") flonum-copy.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") flonum-mult.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") strstr.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") bignum-copy.c
|
||||||
|
$ gcc/debug/define=("VMS", "error=as_fatal","const=") vax.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") atof-vax.c
|
||||||
|
$ write sys$output " If you are building gas to work with the G++ compiler"
|
||||||
|
$ write sys$output " based upon gcc version 1.37.n or earlier, you should"
|
||||||
|
$ write sys$output " edit make-gas.com and make the changes indicated in the"
|
||||||
|
$ write sys$output "comments."
|
||||||
|
$! For older versions of G++, we need the jsb hack, the HACK_DEC_C_STARTUP
|
||||||
|
$! enables this. Just use the compilation for vms.c that defines this instead
|
||||||
|
$! of the other one.
|
||||||
|
$ gcc/debug/define=("VMS", "error=as_fatal","const=") vms.c
|
||||||
|
$! gcc/debug/define=("VMS", "error=as_fatal","HACK_DEC_C_STARTUP","const=") vms.c
|
||||||
|
$ gcc/debug/define=("VMS","const=") vms-dbg.c
|
||||||
|
$ Link:
|
||||||
|
$ link/exec=gcc-as sys$input:/opt
|
||||||
|
!
|
||||||
|
! Linker options file for GNU assembler
|
||||||
|
!
|
||||||
|
as,xrealloc,xmalloc,hash,hex-value,atof-generic,append,messages,expr,app,-
|
||||||
|
frags,input-file,input-scrub,output-file,read,subsegs,symbols,write,-
|
||||||
|
version,flonum-const,flonum-copy,flonum-mult,strstr,bignum-copy,-
|
||||||
|
obstack,vax,atof-vax,vms,vms-dbg,-
|
||||||
|
gnu_cc:[000000]gcclib/lib,sys$share:vaxcrtl/lib
|
|
@ -0,0 +1,289 @@
|
||||||
|
/* gdb_block.c - Deal with GDB blocks
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implements .gdbblk, .gdbbeg, .gdbend concepts.
|
||||||
|
* No other modules need to know the details of these concepts.
|
||||||
|
*
|
||||||
|
* During assembly, note the addresses of block beginnings and ends.
|
||||||
|
* Each block has a begin-address, an end-address, a number, and
|
||||||
|
* a place in the GDB symbol file to place the 2 addresses.
|
||||||
|
* Block numbers are 0, 1, ... with no gaps.
|
||||||
|
*
|
||||||
|
* During assembly, we don't actually know the addresses, so they are
|
||||||
|
* expressed as {frag-address + offset-in-frag}.
|
||||||
|
*
|
||||||
|
* gdb_block_begin ()
|
||||||
|
* Call once before using this package.
|
||||||
|
*
|
||||||
|
* gdb_block_beg (number, frag, offset)
|
||||||
|
* Note a block beginning.
|
||||||
|
*
|
||||||
|
* gdb_block_end (number, frag, offset)
|
||||||
|
* Note a block end.
|
||||||
|
*
|
||||||
|
* gdb_block_position (block_number, pos)
|
||||||
|
* Remember, after assembly, to copy a structure containing
|
||||||
|
* the beginning and ending addresses of block number
|
||||||
|
* block_number into the gdb file, starting at position pos.
|
||||||
|
*
|
||||||
|
* gdb_block_emit (block_number, where_in_gdb_symbol_file)
|
||||||
|
* Emit a block begin/end locations to a place in the GDB symbol
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* uses:
|
||||||
|
* xmalloc()
|
||||||
|
* gdb_alter()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "as.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* malloc() calls are considered expensive. So ...
|
||||||
|
*
|
||||||
|
* We remember blocks by making a tree, and each block number has a leaf.
|
||||||
|
* The tree is 3 levels, and we don't allocate interior nodes until they
|
||||||
|
* are needed. Both leaves and interior nodes are allocated in lumps,
|
||||||
|
* which should save on malloc() calls. Due to the way we break up a
|
||||||
|
* block number to navigate through the tree, we insist that lumps of
|
||||||
|
* memory contain a power of 2 items each. Powers of 2 may differ
|
||||||
|
* for different levels of tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A block number:
|
||||||
|
*
|
||||||
|
* +---------------+---------------+---------------+
|
||||||
|
* | | | |
|
||||||
|
* | Z2-part bits | Z1-part bits | Z0-part bits |
|
||||||
|
* | | | |
|
||||||
|
* +---------------+---------------+---------------+
|
||||||
|
*
|
||||||
|
* High order Low order
|
||||||
|
*
|
||||||
|
* "Z" is short for "siZe".
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOG_2_Z0 (8) /* How many bits are in Z0 part? */
|
||||||
|
#define LOG_2_Z1 (8) /* How many bits are in Z1 part? */
|
||||||
|
#define LOG_2_Z2 (8) /* How many bits are in Z2 part? */
|
||||||
|
|
||||||
|
#define BLOCK_NUMBER_LIMIT (1 << (LOG_2_Z0 + LOG_2_Z1 + LOG_2_Z2))
|
||||||
|
/* What is the first block number that is */
|
||||||
|
/* "too big"? */
|
||||||
|
|
||||||
|
struct gdb_block
|
||||||
|
{
|
||||||
|
fragS * begin_frag;
|
||||||
|
fragS * end_frag;
|
||||||
|
long int begin_where_in_frag;
|
||||||
|
long int end_where_in_frag;
|
||||||
|
long int position; /* In GDB symbols file. */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct gdb_block node_0_T [1 << LOG_2_Z0];
|
||||||
|
|
||||||
|
typedef node_0_T * node_1_T [1 << LOG_2_Z1];
|
||||||
|
|
||||||
|
typedef node_1_T * node_2_T [1 << LOG_2_Z2];
|
||||||
|
|
||||||
|
|
||||||
|
static long int highest_block_number_seen;
|
||||||
|
static node_2_T * root; /* 3 level tree of block locations. */
|
||||||
|
|
||||||
|
static node_2_T * new_2 ();
|
||||||
|
|
||||||
|
|
||||||
|
char * xmalloc();
|
||||||
|
void gdb_alter();
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_block_begin ()
|
||||||
|
{
|
||||||
|
root = new_2 ();
|
||||||
|
highest_block_number_seen = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static node_0_T *
|
||||||
|
new_0 ()
|
||||||
|
{
|
||||||
|
register node_0_T * place;
|
||||||
|
|
||||||
|
place = (node_0_T *) xmalloc ((long)sizeof(node_0_T));
|
||||||
|
bzero ((char *)place, sizeof(node_0_T));
|
||||||
|
return (place);
|
||||||
|
}
|
||||||
|
|
||||||
|
static node_1_T *
|
||||||
|
new_1 ()
|
||||||
|
{
|
||||||
|
register node_1_T * place;
|
||||||
|
|
||||||
|
place = (node_1_T *) xmalloc ((long)sizeof(node_1_T));
|
||||||
|
bzero ((char *)place, sizeof(node_1_T));
|
||||||
|
return (place);
|
||||||
|
}
|
||||||
|
|
||||||
|
static node_2_T *
|
||||||
|
new_2 ()
|
||||||
|
{
|
||||||
|
register node_2_T * place;
|
||||||
|
|
||||||
|
place = (node_2_T *) xmalloc ((long)sizeof(node_2_T));
|
||||||
|
bzero ((char *)place, sizeof(node_2_T));
|
||||||
|
return (place);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct gdb_block *
|
||||||
|
find (block_number)
|
||||||
|
register long int block_number;
|
||||||
|
{
|
||||||
|
register node_1_T ** pp_1;
|
||||||
|
register node_0_T ** pp_0;
|
||||||
|
register struct gdb_block * b;
|
||||||
|
register int index0;
|
||||||
|
register int index1;
|
||||||
|
register int index2;
|
||||||
|
|
||||||
|
#ifdef SUSPECT
|
||||||
|
if (block_number >= BLOCK_NUMBER_LIMIT)
|
||||||
|
{
|
||||||
|
as_fatal ("gdb_block: Block number = %ld.", block_number);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
index2 = block_number >> (LOG_2_Z0 + LOG_2_Z1);
|
||||||
|
index1 = block_number >> (LOG_2_Z0) & ((1 << LOG_2_Z1) - 1);
|
||||||
|
index0 = block_number & ((1 << LOG_2_Z0) - 1);
|
||||||
|
pp_1 = * root + index2;
|
||||||
|
if (* pp_1 == 0)
|
||||||
|
{
|
||||||
|
* pp_1 = new_1 ();
|
||||||
|
}
|
||||||
|
pp_0 = ** pp_1 + index1;
|
||||||
|
if (* pp_0 == 0)
|
||||||
|
{
|
||||||
|
* pp_0 = new_0 ();
|
||||||
|
}
|
||||||
|
b = ** pp_0 + index0;
|
||||||
|
return (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct gdb_block *
|
||||||
|
find_create (block_number)
|
||||||
|
long int block_number;
|
||||||
|
{
|
||||||
|
if (highest_block_number_seen < block_number)
|
||||||
|
{
|
||||||
|
highest_block_number_seen = block_number;
|
||||||
|
}
|
||||||
|
return (find (block_number));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_block_beg (block_number, frag, offset)
|
||||||
|
long int block_number;
|
||||||
|
fragS * frag;
|
||||||
|
long int offset;
|
||||||
|
{
|
||||||
|
struct gdb_block * pointer;
|
||||||
|
|
||||||
|
pointer = find_create (block_number);
|
||||||
|
#ifdef SUSPECT
|
||||||
|
if (pointer -> begin_frag != 0)
|
||||||
|
{
|
||||||
|
as_warn( "Overwriting begin_frag for block # %ld.", block_number );
|
||||||
|
}
|
||||||
|
if (pointer -> begin_where_in_frag != 0)
|
||||||
|
{
|
||||||
|
as_warn( "Overwriting begin_where_in_frag for block # %ld.", block_number );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pointer -> begin_frag = frag;
|
||||||
|
pointer -> begin_where_in_frag = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_block_end (block_number, frag, offset)
|
||||||
|
long int block_number;
|
||||||
|
fragS * frag;
|
||||||
|
long int offset;
|
||||||
|
{
|
||||||
|
struct gdb_block * pointer;
|
||||||
|
|
||||||
|
pointer = find_create (block_number);
|
||||||
|
#ifdef SUSPECT
|
||||||
|
if (pointer -> end_frag != 0)
|
||||||
|
{
|
||||||
|
as_warn( "Overwriting end_frag for block # %ld.", block_number );
|
||||||
|
}
|
||||||
|
if (pointer -> end_where_in_frag != 0)
|
||||||
|
{
|
||||||
|
as_warn( "Overwriting end_where_in_frag for block # %ld.", block_number );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pointer -> end_frag = frag;
|
||||||
|
pointer -> end_where_in_frag = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_block_position (block_number, pos)
|
||||||
|
long int block_number;
|
||||||
|
long int pos;
|
||||||
|
{
|
||||||
|
struct gdb_block * pointer;
|
||||||
|
|
||||||
|
pointer = find_create (block_number);
|
||||||
|
if (pointer -> position != 0)
|
||||||
|
{
|
||||||
|
as_warn( "Overwriting old position %ld. in block #%ld.",
|
||||||
|
pointer -> position, block_number);
|
||||||
|
}
|
||||||
|
pointer -> position = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_block_emit ()
|
||||||
|
{
|
||||||
|
long int block_number;
|
||||||
|
struct gdb_block * b;
|
||||||
|
|
||||||
|
for (block_number = 0;
|
||||||
|
block_number <= highest_block_number_seen;
|
||||||
|
block_number ++)
|
||||||
|
{
|
||||||
|
b = find (block_number);
|
||||||
|
if (b -> begin_frag)
|
||||||
|
{
|
||||||
|
gdb_alter (b -> position,
|
||||||
|
(long int)
|
||||||
|
(b -> begin_frag -> fr_address + b -> begin_where_in_frag));
|
||||||
|
}
|
||||||
|
if (b -> end_frag)
|
||||||
|
{
|
||||||
|
gdb_alter (b -> position + sizeof( long int ),
|
||||||
|
(long int)
|
||||||
|
(b -> end_frag -> fr_address + b -> end_where_in_frag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end: gdb_block.c */
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* gdb_file.c -o/s specific-
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
static long file_len;
|
||||||
|
static FILE *file;
|
||||||
|
extern long get_len();
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_file_begin ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_file_end()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
long int /* Open file, return size. 0: failed. */
|
||||||
|
gdb_file_size (filename)
|
||||||
|
char *filename;
|
||||||
|
{
|
||||||
|
struct stat stat_buf;
|
||||||
|
void as_perror();
|
||||||
|
|
||||||
|
file= fopen (filename, "r");
|
||||||
|
if (file == (FILE *)NULL)
|
||||||
|
{
|
||||||
|
as_perror ("Can't read GDB symbolic information file", filename);
|
||||||
|
file_len=0;
|
||||||
|
} else {
|
||||||
|
(void)fstat (fileno(file), &stat_buf);
|
||||||
|
file_len=stat_buf . st_size;
|
||||||
|
}
|
||||||
|
return ((long int)file_len );
|
||||||
|
}
|
||||||
|
|
||||||
|
void /* Read the file, don't return if failed. */
|
||||||
|
gdb_file_read (buffer, filename)
|
||||||
|
char * buffer;
|
||||||
|
char * filename;
|
||||||
|
{
|
||||||
|
register off_t size_wanted;
|
||||||
|
void as_perror();
|
||||||
|
|
||||||
|
size_wanted = file_len;
|
||||||
|
if (fread (buffer, size_wanted, 1, file) != 1)
|
||||||
|
{
|
||||||
|
as_perror ("Can't read GDB symbolic info file", filename);
|
||||||
|
as_fatal ("Failed to read %ld. chars of GDB symbolic information",
|
||||||
|
size_wanted);
|
||||||
|
}
|
||||||
|
if (fclose(file)==EOF)
|
||||||
|
{
|
||||||
|
as_perror ("Can't close GDB symbolic info file", filename);
|
||||||
|
as_fatal ("I quit in disgust");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end: gdb_file.c */
|
|
@ -0,0 +1,241 @@
|
||||||
|
/* gdb-lines.c -- Deal with source lines for GDB format
|
||||||
|
Copyright (C) 1989, Free Software Foundation.
|
||||||
|
|
||||||
|
This file is part of GAS, the GNU Assembler.
|
||||||
|
|
||||||
|
GAS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 1, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
GAS is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with GAS; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include "as.h"
|
||||||
|
#include "obstack.h"
|
||||||
|
#include "frags.h"
|
||||||
|
|
||||||
|
/* This is a souce file that we're storing .gdbline information about */
|
||||||
|
/* .gdbline refers to files by numbers. We keep a linked list of them
|
||||||
|
We store a list of vectors for each file. Each element of the vector
|
||||||
|
contains a line-number, a frag, and an offset within the frag. */
|
||||||
|
struct g_line_file {
|
||||||
|
int gdb_line_file_file_number; /* fnum */
|
||||||
|
int gdb_line_file_number_of_vectors; /* nv */
|
||||||
|
long gdb_line_table_offset; /* taboff */
|
||||||
|
struct g_line_vector *gdb_line_file_vectors; /* vec */
|
||||||
|
struct g_line_file *gdb_line_file_next_file; /* nfile */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* In order to save on space (We expect there to be LOTS of lines), we
|
||||||
|
store line-number/address pairs in bunches of MAX_LINES_PER_VECTOR
|
||||||
|
(originally fifty). Each vector descriptor contains
|
||||||
|
|
||||||
|
gdb_line_number_of_lines the number of line-number/address pairs
|
||||||
|
actually in this vector.
|
||||||
|
gdb_line_lines The actual vector.
|
||||||
|
|
||||||
|
gdb_line_next_vector The next vector descriptor in the linked list.
|
||||||
|
*/
|
||||||
|
struct g_line_vector {
|
||||||
|
int gdb_line_number_of_lines; /* nlines */
|
||||||
|
struct g_line *gdb_line_lines; /* lines */
|
||||||
|
struct g_line_vector *gdb_line_next_vector; /* nvec */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* A .gdbline wants to store a line-number/address pair. Unfortunatly, we
|
||||||
|
don't know addresses yet, so we store frag/offset which we can use to
|
||||||
|
generate the address at write-out time. */
|
||||||
|
struct g_line {
|
||||||
|
int gdb_line_line_number; /* lno */
|
||||||
|
fragS *gdb_line_frag; /* lfrag */
|
||||||
|
int gdb_line_offset; /* loff */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* The following is stolen from (gdb's? (or is it gcc's?) symseg.h file.
|
||||||
|
These structures describe the format for the line# symbolic info in
|
||||||
|
the gdb symbolic info file. This info is not particularly useful,
|
||||||
|
except to show what we're writing into. . . */
|
||||||
|
|
||||||
|
/* Source-file information.
|
||||||
|
This describes the relation between source files and line numbers
|
||||||
|
and addresses in the program text. */
|
||||||
|
|
||||||
|
struct sourcevector
|
||||||
|
{
|
||||||
|
int length; /* Number of source files described */
|
||||||
|
struct source *source[1]; /* Descriptions of the files */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Line number and address of one line. */
|
||||||
|
|
||||||
|
struct line
|
||||||
|
{
|
||||||
|
int linenum;
|
||||||
|
int address;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* All the information on one source file. */
|
||||||
|
|
||||||
|
struct source
|
||||||
|
{
|
||||||
|
char *name; /* Name of file */
|
||||||
|
int nlines; /* Number of lines that follow */
|
||||||
|
struct line lines[1]; /* Information on each line */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* End of text from symseg.h */
|
||||||
|
|
||||||
|
struct g_line_file *first_file;
|
||||||
|
|
||||||
|
struct g_line_file *add_file();
|
||||||
|
struct g_line_vector *add_vector();
|
||||||
|
|
||||||
|
#define MAX_LINES_PER_VECTOR 50 /* lpv */
|
||||||
|
|
||||||
|
/* We've been told that the current address corresponds to line LINENO in
|
||||||
|
file FILE_NUMBER */
|
||||||
|
void
|
||||||
|
gdb_line(file_number,lineno)
|
||||||
|
int file_number;
|
||||||
|
int lineno;
|
||||||
|
{
|
||||||
|
struct g_line_file *f;
|
||||||
|
struct g_line_vector *v;
|
||||||
|
struct g_line *line;
|
||||||
|
|
||||||
|
for(f=first_file;f;f=f->gdb_line_file_next_file)
|
||||||
|
if(f->gdb_line_file_file_number==file_number)
|
||||||
|
break;
|
||||||
|
if(!f) f=add_file(file_number);
|
||||||
|
v=f->gdb_line_file_vectors;
|
||||||
|
if(!v || v->gdb_line_number_of_lines==MAX_LINES_PER_VECTOR)
|
||||||
|
v=add_vector(f);
|
||||||
|
line= &(v->gdb_line_lines)[v->gdb_line_number_of_lines];
|
||||||
|
v->gdb_line_number_of_lines++;
|
||||||
|
line->gdb_line_line_number=lineno;
|
||||||
|
line->gdb_line_frag= frag_now;
|
||||||
|
line->gdb_line_offset=obstack_next_free(&frags)-frag_now->fr_literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We've been told where to store the .line table for file FILE_NUMBER */
|
||||||
|
void
|
||||||
|
gdb_line_tab(file_number,offset)
|
||||||
|
int file_number;
|
||||||
|
int offset;
|
||||||
|
{
|
||||||
|
struct g_line_file *f;
|
||||||
|
|
||||||
|
for(f=first_file;f;f=f->gdb_line_file_next_file)
|
||||||
|
if(f->gdb_line_file_file_number==file_number)
|
||||||
|
break;
|
||||||
|
if(!f) f=add_file(file_number);
|
||||||
|
if(f->gdb_line_table_offset)
|
||||||
|
as_warn("Ignoring duplicate .linetab for file %d",file_number);
|
||||||
|
else
|
||||||
|
f->gdb_line_table_offset=offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We've got a file (FILE_NUMBER) that we haven't heard about before. Create
|
||||||
|
an entry for it, etc. . . */
|
||||||
|
struct g_line_file *
|
||||||
|
add_file(file_number)
|
||||||
|
{
|
||||||
|
struct g_line_file *f;
|
||||||
|
|
||||||
|
f=(struct g_line_file *)xmalloc(sizeof(struct g_line_file));
|
||||||
|
f->gdb_line_file_file_number=file_number;
|
||||||
|
f->gdb_line_table_offset = 0;
|
||||||
|
f->gdb_line_file_number_of_vectors=0;
|
||||||
|
f->gdb_line_file_vectors=(struct g_line_vector *)0;
|
||||||
|
f->gdb_line_file_next_file=first_file;
|
||||||
|
first_file=f;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The last vector for file F is full. Allocate a new one. */
|
||||||
|
struct g_line_vector *
|
||||||
|
add_vector(f)
|
||||||
|
struct g_line_file *f;
|
||||||
|
{
|
||||||
|
struct g_line_vector *tmp_vec;
|
||||||
|
|
||||||
|
f->gdb_line_file_number_of_vectors++;
|
||||||
|
tmp_vec=(struct g_line_vector *)xmalloc(sizeof(struct g_line_vector));
|
||||||
|
tmp_vec->gdb_line_number_of_lines=0;
|
||||||
|
tmp_vec->gdb_line_lines=(struct g_line *)xmalloc(MAX_LINES_PER_VECTOR*sizeof(struct g_line));
|
||||||
|
tmp_vec->gdb_line_next_vector=f->gdb_line_file_vectors;
|
||||||
|
f->gdb_line_file_vectors=tmp_vec;
|
||||||
|
return tmp_vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* All done. Time to write the stuff out. This should be fun. */
|
||||||
|
void
|
||||||
|
gdb_lines_emit()
|
||||||
|
{
|
||||||
|
struct g_line_file *f;
|
||||||
|
struct g_line_vector *v,*old_v,*v_tmp;
|
||||||
|
struct g_line *current_line_pointer; /* lp */
|
||||||
|
int n;
|
||||||
|
int previous_line_number;
|
||||||
|
long int current_gdb_segment_pos;
|
||||||
|
unsigned int number_of_things_in_table;
|
||||||
|
|
||||||
|
for(f=first_file;f;f=f->gdb_line_file_next_file) {
|
||||||
|
if(!f->gdb_line_table_offset) {
|
||||||
|
as_warn("No .gdblinetab given for file %d. Ignoring .gdbline(s) for it.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reverse the linked list of vectors. Since we built it
|
||||||
|
last entry first, this puts the first entry at the start
|
||||||
|
of the list. Thus we can manage to put out low line #s
|
||||||
|
at the start of the table. . .*/
|
||||||
|
v_tmp=0;
|
||||||
|
old_v=0;
|
||||||
|
for(v=f->gdb_line_file_vectors;v;v=v_tmp) {
|
||||||
|
v_tmp=v->gdb_line_next_vector;
|
||||||
|
v->gdb_line_next_vector=old_v;
|
||||||
|
old_v=v;
|
||||||
|
}
|
||||||
|
f->gdb_line_file_vectors=old_v;
|
||||||
|
|
||||||
|
/* Start putting stuff at the beginning of the table */
|
||||||
|
current_gdb_segment_pos=f->gdb_line_table_offset+sizeof(long int);
|
||||||
|
previous_line_number = -2;
|
||||||
|
number_of_things_in_table = 0;
|
||||||
|
|
||||||
|
/* For every vector in the table: */
|
||||||
|
for(v=f->gdb_line_file_vectors;v;v=v->gdb_line_next_vector) {
|
||||||
|
current_line_pointer=v->gdb_line_lines;
|
||||||
|
|
||||||
|
/* For every element of every vector */
|
||||||
|
for(n=v->gdb_line_number_of_lines;n;n--) {
|
||||||
|
|
||||||
|
if(current_line_pointer->gdb_line_line_number != previous_line_number + 1) {
|
||||||
|
/* Write out the line number */
|
||||||
|
gdb_alter(current_gdb_segment_pos, -(current_line_pointer->gdb_line_line_number));
|
||||||
|
current_gdb_segment_pos+=sizeof(long int);
|
||||||
|
number_of_things_in_table++;
|
||||||
|
}
|
||||||
|
previous_line_number = current_line_pointer->gdb_line_line_number;
|
||||||
|
|
||||||
|
/* And write out the address */
|
||||||
|
gdb_alter(current_gdb_segment_pos,current_line_pointer->gdb_line_frag->fr_address+current_line_pointer->gdb_line_offset);
|
||||||
|
current_gdb_segment_pos+=sizeof(long int);
|
||||||
|
number_of_things_in_table++;
|
||||||
|
|
||||||
|
current_line_pointer++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gdb_alter(f->gdb_line_table_offset,number_of_things_in_table);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
/* gdb_symbols.c - Deal with symbols for GDB format
|
||||||
|
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. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* During assembly, note requests to place symbol values in the GDB
|
||||||
|
* symbol file. When symbol values are known and the symbol file is
|
||||||
|
* in memory, place the symbol values in the memory image of the file.
|
||||||
|
*
|
||||||
|
* This has static data: it is not data_sharable.
|
||||||
|
*
|
||||||
|
* gdb_symbols_begin ()
|
||||||
|
* Call once before using this package.
|
||||||
|
*
|
||||||
|
* gdb_symbols_fixup (symbolP, offset_in_file)
|
||||||
|
* Remember to put the value of a symbol into the GDB file.
|
||||||
|
*
|
||||||
|
* gdb_symbols_emit ()
|
||||||
|
* Perform all the symbol fixups.
|
||||||
|
*
|
||||||
|
* uses:
|
||||||
|
* xmalloc()
|
||||||
|
* gdb_alter()
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "as.h"
|
||||||
|
#include "struc-symbol.h"
|
||||||
|
|
||||||
|
#define SYM_GROUP (100) /* We allocate storage in lumps this big. */
|
||||||
|
|
||||||
|
|
||||||
|
struct gdb_symbol /* 1 fixup request. */
|
||||||
|
{
|
||||||
|
symbolS * gs_symbol;
|
||||||
|
long int gs_offset; /* Where in GDB symbol file. */
|
||||||
|
};
|
||||||
|
typedef struct gdb_symbol gdb_symbolS;
|
||||||
|
|
||||||
|
struct symbol_fixup_group
|
||||||
|
{
|
||||||
|
struct symbol_fixup_group * sfg_next;
|
||||||
|
gdb_symbolS sfg_item [SYM_GROUP];
|
||||||
|
};
|
||||||
|
typedef struct symbol_fixup_group symbol_fixup_groupS;
|
||||||
|
|
||||||
|
static symbol_fixup_groupS * root;
|
||||||
|
static short int used; /* # of last slot used. */
|
||||||
|
/* Counts down from SYM_GROUP. */
|
||||||
|
|
||||||
|
static symbol_fixup_groupS * /* Make storage for some more reminders. */
|
||||||
|
new_sfg ()
|
||||||
|
{
|
||||||
|
symbol_fixup_groupS * newP;
|
||||||
|
char * xmalloc();
|
||||||
|
|
||||||
|
newP = (symbol_fixup_groupS *) xmalloc ((long)sizeof(symbol_fixup_groupS));
|
||||||
|
newP -> sfg_next = root;
|
||||||
|
used = SYM_GROUP;
|
||||||
|
root = newP;
|
||||||
|
return (newP);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_symbols_begin ()
|
||||||
|
{
|
||||||
|
root = 0;
|
||||||
|
(void)new_sfg ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void /* Build a reminder to put a symbol value */
|
||||||
|
gdb_symbols_fixup (sy, offset) /* into the GDB symbol file. */
|
||||||
|
symbolS * sy; /* Which symbol. */
|
||||||
|
long int offset; /* Where in GDB symbol file. */
|
||||||
|
{
|
||||||
|
register symbol_fixup_groupS * p;
|
||||||
|
register gdb_symbolS * q;
|
||||||
|
|
||||||
|
p = root;
|
||||||
|
know( used >= 0 );
|
||||||
|
if ( used == 0)
|
||||||
|
{
|
||||||
|
p = new_sfg ();
|
||||||
|
}
|
||||||
|
q = p -> sfg_item + -- used;
|
||||||
|
q -> gs_symbol = sy;
|
||||||
|
q -> gs_offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_symbols_emit () /* Append GDB symbols to object file. */
|
||||||
|
{
|
||||||
|
symbol_fixup_groupS * sfgP;
|
||||||
|
void gdb_alter();
|
||||||
|
|
||||||
|
for (sfgP = root; sfgP; sfgP = sfgP -> sfg_next)
|
||||||
|
{
|
||||||
|
register gdb_symbolS * gsP;
|
||||||
|
register gdb_symbolS * limit;
|
||||||
|
|
||||||
|
limit = sfgP -> sfg_item +
|
||||||
|
(sfgP -> sfg_next ? 0 : used);
|
||||||
|
for (gsP = sfgP -> sfg_item + SYM_GROUP - 1;
|
||||||
|
gsP >= limit;
|
||||||
|
gsP --)
|
||||||
|
{
|
||||||
|
gdb_alter (gsP -> gs_offset,
|
||||||
|
(long int) gsP -> gs_symbol -> sy_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end: gdb_symbols.c */
|
|
@ -0,0 +1,110 @@
|
||||||
|
/* gdb.c -as supports gdb-
|
||||||
|
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 code is independent of the underlying operating system. */
|
||||||
|
|
||||||
|
#include "as.h"
|
||||||
|
|
||||||
|
static long int size; /* 0 or size of GDB symbol file. */
|
||||||
|
static char * where; /* Where we put symbol file in memory. */
|
||||||
|
|
||||||
|
#define SUSPECT /* JF */
|
||||||
|
|
||||||
|
long int /* 0 means don't call gdb_... routines */
|
||||||
|
gdb_begin (filename) /* because we failed to establish file */
|
||||||
|
/* in memory. */
|
||||||
|
char * filename; /* NULL: we have nothing to do. */
|
||||||
|
{
|
||||||
|
long int gdb_file_size();
|
||||||
|
char * xmalloc();
|
||||||
|
void gdb_file_begin();
|
||||||
|
void gdb_file_read();
|
||||||
|
void gdb_block_begin();
|
||||||
|
void gdb_symbols_begin();
|
||||||
|
|
||||||
|
gdb_file_begin();
|
||||||
|
size = 0;
|
||||||
|
if (filename && (size = gdb_file_size (filename)))
|
||||||
|
{
|
||||||
|
where = xmalloc( (long) size );
|
||||||
|
gdb_file_read (where, filename); /* Read, then close file. */
|
||||||
|
gdb_block_begin();
|
||||||
|
gdb_symbols_begin();
|
||||||
|
}
|
||||||
|
return (size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_end()
|
||||||
|
{
|
||||||
|
void gdb_file_end();
|
||||||
|
|
||||||
|
gdb_file_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_emit (filename) /* Append GDB symbols to object file. */
|
||||||
|
char * filename;
|
||||||
|
{
|
||||||
|
void gdb_block_emit();
|
||||||
|
void gdb_symbols_emit();
|
||||||
|
void gdb_lines_emit();
|
||||||
|
void output_file_append();
|
||||||
|
|
||||||
|
gdb_block_emit ();
|
||||||
|
gdb_symbols_emit ();
|
||||||
|
gdb_lines_emit();
|
||||||
|
output_file_append (where, size, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Notes: We overwrite what was there.
|
||||||
|
We assume all overwrites are 4-char numbers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gdb_alter (offset, value) /* put value into GDB file + offset. */
|
||||||
|
long int offset;
|
||||||
|
long int value;
|
||||||
|
{
|
||||||
|
void md_number_to_chars();
|
||||||
|
|
||||||
|
#ifdef SUSPECT
|
||||||
|
if (offset > size - sizeof(long int) || offset < 0)
|
||||||
|
{
|
||||||
|
as_warn( "gdb_alter: offset=%d. size=%ld.\n", offset, size );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef B_OUT
|
||||||
|
/* Symbol info will be used on the host machine only (only executable
|
||||||
|
* code is actually downloaded to the i80960). Therefore, leave it
|
||||||
|
* in host byte order.
|
||||||
|
*/
|
||||||
|
|
||||||
|
*(long int *)(where + offset) = value;
|
||||||
|
#else
|
||||||
|
md_number_to_chars (where + offset, value, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end: gdb.c */
|
|
@ -0,0 +1 @@
|
||||||
|
char gas960_ver[]= "gas960 1.2, Fri Nov 30 03:01:56 PST 1990";
|
|
@ -0,0 +1,23 @@
|
||||||
|
#if defined(__STDC__) || defined(const)
|
||||||
|
const
|
||||||
|
#endif
|
||||||
|
char version_string[] = "GNU assembler version 1.38.1 (Cygnus Support pre-release)\n";
|
||||||
|
|
||||||
|
/* DO NOT PUT COMMENTS ABOUT CHANGES IN THIS FILE.
|
||||||
|
|
||||||
|
This file exists only to define `version_string'.
|
||||||
|
|
||||||
|
Log changes in ChangeLog. The easiest way to do this is with
|
||||||
|
the Emacs command `add-change-log-entry'. If you don't use Emacs,
|
||||||
|
add entries of the form:
|
||||||
|
|
||||||
|
Thu Jan 1 00:00:00 1970 Dennis Ritchie (dmr at alice)
|
||||||
|
|
||||||
|
* universe.c (temporal_reality): Began Time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef VMS
|
||||||
|
dummy3()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue