home *** CD-ROM | disk | FTP | other *** search
- From: loic@adesign.uucp (Loic Dachary)
- Newsgroups: alt.sources
- Subject: gas-1.36 patches for COFF generation
- Message-ID: <LOIC.90Oct16093019@adesign.uucp>
- Date: 16 Oct 90 08:30:19 GMT
-
-
- Hello,
-
- I have posted an article last week on gnu.gcc to announce that patches
- to gas-1.36 for COFF object file generation were availables.
- About 30 mails have asked for it since then. Sorry if I'm wrong but I will
- consider this enough to post. Is there a precise definition of "popular
- demand" somewhere ?-)
-
- The patches will be posted in the alt.sources newsgroup. They are about
- 160 K due to diff -c verbosity and are splitted in 5 articles. To apply
- them just concat all the articles together and pipe the result to patch. They
- will succeed on gas-1.36.
- They have been tested on Unisoft 1.3, SunOs 3.5 & 4.0.3, Esix rev C,
- CTIX 3.2, Ix 2.02 and SCO unix. They have been used to compile the following :
- Unisoft V.3.2 kernel with tcp/ip extensions, MIT X11R4 libraries and clients,
- bison-1.11, compress-4.0, cproto, cshar, diff-1.14, dist-18.55, flex-2.3,
- gas-1.36, gcc-1.37.1, gdb-3.6, grep-1.5, kermit, make-3.58, makedep, patch,
- printf, tar-1.08, texi2roff, uuencode, uutraf-1.2, bash-1.05.
-
- How to make it work ?
-
- . There is a new file named config.gas. It is a shell script that make the
- appropriate links for a given configuration.
- If you have a 68k or an i386, there is a good chance that nothing else
- needs to be done.
- However, if your processor is a sparc, ns32k or vax, you will need to
- patch the machine dependent files. I strongly encourage you to contact me.
- By mail or voice. I will offer all the assistance I'm able to provide.
-
- . When the links are set up, edit the file Makefile.new according to you
- system (BSD or USG). Refer to the original Makefile if more flags
- or comments are needed.
-
- . Run make -f Makefile.new gas
-
- . Move gas to /usr/local/lib/gcc-as, i.e. a place where gcc can find it.
-
- If you are curious or plan to do some work on gas, read the file
- README.coff.
-
- I hope it will help,
-
- Loic
-
-
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- Makefile.new Mon Oct 15 19:38:09 1990
- ***************
- *** 0 ****
- --- 1,200 ----
- + # 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 oformat.c oformat.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 \
- + oformat.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)
- +
- + atof.o: \
- + flonum.h \
- + bignum.h
- + oformat.o: \
- + as.h \
- + md.h \
- + aout.h \
- + a.out.h \
- + struc-symbol.h \
- + write.h \
- + append.h
- + read.o: \
- + oformat.h \
- + a.out.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: \
- + oformat.h \
- + a.out.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: \
- + oformat.h \
- + a.out.h \
- + as.h \
- + hash.h \
- + obstack.h \
- + struc-symbol.h \
- + symbols.h \
- + frags.h
- + subsegs.o: \
- + oformat.h \
- + a.out.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: \
- + oformat.h \
- + a.out.h \
- + as.h \
- + subsegs.h \
- + obstack.h \
- + frags.h \
- + struc-symbol.h
- + expr.o: \
- + oformat.h \
- + a.out.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: \
- + oformat.h \
- + a.out.h \
- + as.h \
- + struc-symbol.h \
- + write.h
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- aout.h Mon Oct 15 10:22:20 1990
- ***************
- *** 0 ****
- --- 1,160 ----
- + #ifndef AOUT_H
- + #define AOUT_H
- +
- + #include "a.out.h"
- +
- + /* Tag to validate a.out object file format processing */
- + #define aout
- +
- + /* RELOCATION INFORMATION */
- +
- + #define relocation_type struct relocation_info /* Relocation table entry */
- + #define RELSZ sizeof(relocation_type) /* For coff compatibility */
- +
- + /* SYMBOL TABLE */
- + /* Symbol table entry data type */
- +
- + #define symbol_type struct nlist /* Symbol table entry */
- +
- + /* If compiler generate leading underscores, remove them. */
- +
- + #ifndef STRIP_UNDERSCORE
- + #define STRIP_UNDERSCORE 0
- + #endif /* STRIP_UNDERSCORE */
- +
- + /* Symbol table macros and constants */
- +
- + /*
- + * Macros to extract information from a symbol table entry.
- + * This syntaxic indirection allows independence regarding a.out or coff.
- + * The argument (s) of all these macros is a pointer to a symbol table entry.
- + */
- +
- + /* Predicates */
- + /* True if in text segment */
- + #define S_IS_TEXT(s) (((s)->sy_type & N_TYPE) == N_TEXT)
- + /* True if in data segment */
- + #define S_IS_DATA(s) (((s)->sy_type & N_TYPE) == N_DATA)
- + /* True if in bss segment */
- + #define S_IS_BSS(s) (((s)->sy_type & N_TYPE) == N_BSS)
- + /* True if in abs segment */
- + #define S_IS_ABS(s) (((s)->sy_type & N_TYPE) == N_ABS)
- + /* True if the symbol is external */
- + #define S_IS_EXTERNAL(s) ((s)->sy_type & N_EXT)
- + /* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
- + #define S_IS_DEFINED(s) (((s)->sy_type & N_TYPE) != N_UNDF)
- + /* True if a debug special symbol entry */
- + #define S_IS_DEBUG(s) ((s)->sy_type & N_STAB)
- + /* True if a symbol is local symbol name */
- + /* A symbol name whose name begin with ^A is a gas internal pseudo symbol
- + nameless symbols come from .stab directives. */
- + #define S_IS_LOCAL(s) (S_GET_NAME(s) && \
- + !S_IS_DEBUG(s) && \
- + (S_GET_NAME(s)[0] == '\001' || \
- + (S_GET_NAME(s)[0] == 'L' && !flagseen['L'])))
- + /* True if a symbol is not defined in this file */
- + #define S_IS_EXTERN(s) ((s)->sy_type & N_EXT)
- + /* True if the symbol has been generated because of a .stabd directive */
- + #define S_IS_STABD(s) ((s)->sy_name == (char *)0)
- +
- + /* Accessors */
- + /* The value of the symbol */
- + #define S_GET_VALUE(s) ((s)->sy_value)
- + /* The name of the symbol */
- + #define S_GET_NAME(s) ((s)->sy_name)
- + /* The pointer to the string table */
- + #define S_GET_OFFSET(s) ((s)->sy_strx)
- + /* The numeric value of the segment */
- + #define S_GET_SEGMENT(s) ((s)->sy_type & N_TYPE)
- + /* The n_other expression value */
- + #define S_GET_OTHER(s) ((s)->sy_other)
- + /* The n_desc expression value */
- + #define S_GET_DESC(s) ((s)->sy_desc)
- +
- + /* Modifiers */
- + /* Set the value of the symbol */
- + #define S_SET_VALUE(s,v) ((s)->sy_value = (v))
- + /* Assume that a symbol cannot be simultaneously in more than on segment */
- + /* Set the segment to text */
- + #define S_SET_TEXT(s) ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_TEXT)
- + /* Set the segment to data */
- + #define S_SET_DATA(s) ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_DATA)
- + /* Set the segment to bss */
- + #define S_SET_BSS(s) ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_BSS)
- + /* Set the segment to abs */
- + #define S_SET_ABS(s) ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_ABS)
- + /* The symbol is external */
- + #define S_SET_EXTERNAL(s) ((s)->sy_type |= N_EXT)
- + /* The symbol is not external */
- + #define S_CLEAR_EXTERNAL(s) ((s)->sy_type &= ~N_EXT)
- + /* Set the name of the symbol */
- + #define S_SET_NAME(s,v) ((s)->sy_name = v)
- + /* Set the offset in the string table */
- + #define S_SET_OFFSET(s,v) ((s)->sy_strx = v)
- + /* Set the n_other expression value */
- + #define S_SET_OTHER(s,v) ((s)->sy_other = (v))
- + /* Set the n_desc expression value */
- + #define S_SET_DESC(s,v) ((s)->sy_desc = (v))
- +
- + /* File header macro and type definition */
- +
- + #define H_GET_FILE_SIZE(h) (sizeof(struct exec) + \
- + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
- + H_GET_SYMBOL_TABLE_SIZE(h) + \
- + H_GET_TEXT_RELOCATION_SIZE(h) + \
- + H_GET_DATA_RELOCATION_SIZE(h) + \
- + (h)->string_table_size)
- +
- + #define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
- + #define H_GET_DATA_SIZE(h) ((h)->header.a_data)
- + #define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
- + #define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
- + #define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
- + #define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
- + #define H_GET_MAGIC_NUMBER(h) ((h)->header.a_magic)
- + #define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
- + #define H_GET_STRING_SIZE(h) ((h)->string_table_size)
- + #ifdef EXEC_MACHINE_TYPE
- + #define H_GET_MACHINE_TYPE(h) ((h)->header.a_machtype)
- + #endif /* EXEC_MACHINE_TYPE */
- + #ifdef EXEC_VERSION
- + #define H_GET_VERSION(h) ((h)->header.a_version)
- + #endif /* EXEC_VERSION */
- +
- + #define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = (v))
- + #define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = (v))
- + #define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = (v))
- + #define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
- + H_SET_DATA_RELOCATION_SIZE((h),(d)))
- + #define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
- + #define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
- + #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
- + sizeof(struct nlist))
- + #define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_magic = (v))
- + #define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
- + #define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
- + #ifdef EXEC_MACHINE_TYPE
- + #define H_SET_MACHINE_TYPE(h,v) ((h)->header.a_machtype = (v))
- + #endif /* EXEC_MACHINE_TYPE */
- + #ifdef EXEC_VERSION
- + #define H_SET_VERSION(h,v) ((h)->header.a_version = (v))
- + #endif /* EXEC_VERSION */
- +
- + /* Output the file(s) header(s) in a character array */
- + #define H_OUTPUT(h,where) a_header_append(&(h)->header,(where))
- +
- + /* Output a symbol entry */
- + #define SYMBOL_OUTPUT(s,w) a_symbol_append((s), (w))
- +
- + typedef struct {
- + struct exec header; /* a.out header */
- + long int string_table_size; /* names + '\0' + sizeof(int) */
- + } object_headers;
- +
- + /* Format independent interface functions */
- + extern void emit_relocations();
- + extern void emit_symbols();
- + extern void a_header_append();
- + extern void a_symbol_append();
- +
- + #endif /* AOUT_H */
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- coff.h Mon Oct 15 09:59:28 1990
- ***************
- *** 0 ****
- --- 1,366 ----
- + #ifndef COFF_H
- + #define COFF_H
- +
- + #include <filehdr.h>
- + #include <aouthdr.h>
- + #include <scnhdr.h>
- + #include <storclass.h>
- + #include <linenum.h>
- + #include <syms.h>
- + #include <reloc.h>
- +
- + #include "machine.h"
- + #include "stack.h"
- +
- + /* Tag to validate coff object file format processing */
- + #define coff
- +
- + /* Define some processor dependent values according to the processor we are
- + on. */
- + #if defined(PROCESSOR_68000)
- +
- + #define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
- + #define FILE_HEADER_MAGIC MC68MAGIC /* ... */
- +
- + #elif defined(PROCESSOR_i386)
- +
- + #define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
- + #define FILE_HEADER_MAGIC I386MAGIC /* ... */
- +
- + #elif
- + you lose
- + #endif
- +
- + /* Magic number of paged executable. */
- + #define OMAGIC 0413
- +
- + /* Add these definitions to have a consistent convention for all the
- + types used in COFF format. */
- + #define AOUTHDR struct aouthdr
- + #define AOUTHDRSZ sizeof(AOUTHDR)
- +
- + /* RELOCATION INFORMATION */
- +
- + #define relocation_type RELOC /* Relocation table entry */
- +
- + /* SYMBOL TABLE */
- +
- + /* Symbol table entry data type */
- +
- + #define symbol_type SYMENT /* Symbol table entry */
- +
- + /* If compiler generate leading underscores, remove them. */
- +
- + #ifndef STRIP_UNDERSCORE
- + #define STRIP_UNDERSCORE 0
- + #endif /* STRIP_UNDERSCORE */
- + #define DO_NOT_STRIP 0
- + #define DO_STRIP 1
- +
- + /* Symbol table macros and constants */
- +
- + /* Possible and usefull section number in symbol table
- + * The values of TEXT, DATA and BSS may not be portable.
- + */
- +
- + #define C_TEXT_SECTION 1
- + #define C_DATA_SECTION 2
- + #define C_BSS_SECTION 3
- + #define C_ABS_SECTION N_ABS
- + #define C_UNDEF_SECTION N_UNDEF
- + #define C_DEBUG_SECTION N_DEBUG
- + #define C_NTV_SECTION N_TV
- + #define C_PTV_SECTION P_TV
- +
- + /*
- + * Macros to extract information from a symbol table entry.
- + * This syntaxic indirection allows independence regarding a.out or coff.
- + * The argument (s) of all these macros is a pointer to a symbol table entry.
- + */
- +
- + /* Predicates */
- + /* True if in text segment */
- + #define S_IS_TEXT(s) ((s)->sy_scnum == C_TEXT_SECTION)
- + /* True if in data segment */
- + #define S_IS_DATA(s) ((s)->sy_scnum == C_DATA_SECTION)
- + /* True if in bss segment */
- + #define S_IS_BSS(s) ((s)->sy_scnum == C_BSS_SECTION)
- + /* True if in bss segment */
- + #define S_IS_ABS(s) ((s)->sy_scnum == C_ABS_SECTION)
- + /* True if the symbol is external */
- + #define S_IS_EXTERNAL(s) ((s)->sy_scnum == C_UNDEF_SECTION)
- + /* True if symbol has been defined, ie :
- + section > 0 (DATA, TEXT or BSS)
- + section == 0 and value > 0 (external bss symbol) */
- + #define S_IS_DEFINED(s) ((s)->sy_scnum > C_UNDEF_SECTION || \
- + ((s)->sy_scnum == C_UNDEF_SECTION && \
- + (s)->sy_value > 0))
- + /* True if a debug special symbol entry */
- + #define S_IS_DEBUG(s) ((s)->sy_scnum == C_DEGUG_SECTION)
- + /* True if a symbol is local symbol name */
- + /* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
- + #define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \
- + (S_LOCAL_NAME(s) && !flagseen['L']))
- + /* True if a symbol is not defined in this file */
- + #define S_IS_EXTERN(s) ((s)->sy_scnum == 0 && (s)->sy_value == 0)
- + /*
- + * True if a symbol can be multiply defined (bss symbols have this def
- + * though it is bad practice)
- + */
- + #define S_IS_COMMON(s) ((s)->sy_scnum == 0 && (s)->sy_value != 0)
- + /* True if a symbol name is in the string table, i.e. its length is > 8. */
- + #define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
- +
- + /* Accessors */
- + /* The name of the symbol */
- + #define S_GET_NAME(s) ((char*)(s)->sy_offset)
- + /* The pointer to the string table */
- + #define S_GET_OFFSET(s) ((s)->sy_offset)
- + /* The zeroes if symbol name is longer than 8 chars */
- + #define S_GET_ZEROES(s) ((s)->sy_zeroes)
- + /* The value of the symbol */
- + #define S_GET_VALUE(s) ((s)->sy_value)
- + /* The numeric value of the segment */
- + #define S_GET_SEGMENT(s) ((s)->sy_scnum)
- + /* The data type */
- + #define S_GET_DATA_TYPE(s) ((s)->sy_type)
- + /* The storage class */
- + #define S_GET_STORAGE_CLASS(s) ((s)->sy_sclass)
- + /* The number of auxiliary entries */
- + #define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_numaux)
- +
- + /* Modifiers */
- + /* Set the name of the symbol */
- + #define S_SET_NAME(s,v) ((s)->sy_offset = (unsigned long)(v))
- + /* Set the offset of the symbol */
- + #define S_SET_OFFSET(s,v) ((s)->sy_offset = (v))
- + /* The zeroes if symbol name is longer than 8 chars */
- + #define S_SET_ZEROES(s,v) ((s)->sy_zeroes = (v))
- + /* Set the value of the symbol */
- + #define S_SET_VALUE(s,v) ((s)->sy_value = (v))
- + /* The numeric value of the segment */
- + #define S_SET_SEGMENT(s,v) ((s)->sy_scnum = (v))
- + /* The data type */
- + #define S_SET_DATA_TYPE(s,v) ((s)->sy_type = (v))
- + /* The storage class */
- + #define S_SET_STORAGE_CLASS(s,v) ((s)->sy_sclass = (v))
- + /* The number of auxiliary entries */
- + #define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_numaux = (v))
- +
- + /* Additional modifiers */
- + /* Assume that a symbol cannot be simultaneously in more than on segment */
- + /* Set the segment to text */
- + #define S_SET_TEXT(s) ((s)->sy_scnum = C_TEXT_SECTION)
- + /* Set the segment to data */
- + #define S_SET_DATA(s) ((s)->sy_scnum = C_DATA_SECTION)
- + /* Set the segment to bss */
- + #define S_SET_BSS(s) ((s)->sy_scnum = C_BSS_SECTION)
- + /* Set the segment to abs */
- + #define S_SET_ABS(s) ((s)->sy_scnum = C_ABS_SECTION)
- + /* The symbol is external (does not mean undefined) */
- + #define S_SET_EXTERNAL(s) S_SET_STORAGE_CLASS(s,C_EXT)
- +
- + /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
- + /* Omit the tv related fields */
- + /* Accessors */
- + #define SA_GET_SYM_TAGNDX(s) ((s)->sy_auxent.x_sym.x_tagndx)
- + #define SA_GET_SYM_LNNO(s) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_lnno)
- + #define SA_GET_SYM_SIZE(s) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_size)
- + #define SA_GET_SYM_FSIZE(s) ((s)->sy_auxent.x_sym.x_misc.x_fsize)
- + #define SA_GET_SYM_LNNOPTR(s) ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr)
- + #define SA_GET_SYM_ENDNDX(s) ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_endndx)
- + #define SA_GET_SYM_DIMEN(s,i) ((s)->sy_auxent.x_sym.x_fcnary.x_ary.x_dimen[(i)])
- + #define SA_GET_FILE_FNAME(s) ((s)->sy_auxent.x_file.x_fname)
- + #define SA_GET_SCN_SCNLEN(s) ((s)->sy_auxent.x_scn.x_scnlen)
- + #define SA_GET_SCN_NRELOC(s) ((s)->sy_auxent.x_scn.x_nreloc)
- + #define SA_GET_SCN_NLINNO(s) ((s)->sy_auxent.x_scn.x_nlinno)
- +
- + /* Modifiers */
- + #define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_auxent.x_sym.x_tagndx=(v))
- + #define SA_SET_SYM_LNNO(s,v) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_lnno=(v))
- + #define SA_SET_SYM_SIZE(s,v) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_size=(v))
- + #define SA_SET_SYM_FSIZE(s,v) ((s)->sy_auxent.x_sym.x_misc.x_fsize=(v))
- + #define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
- + #define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_endndx=(v))
- + #define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_auxent.x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
- + #define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_auxent.x_file.x_fname,(v),FILNMLEN)
- + #define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_auxent.x_scn.x_scnlen=(v))
- + #define SA_SET_SCN_NRELOC(s,v) ((s)->sy_auxent.x_scn.x_nreloc=(v))
- + #define SA_SET_SCN_NLINNO(s,v) ((s)->sy_auxent.x_scn.x_nlinno=(v))
- +
- + /* Internal use only definitions. SF_ stands for symbol flags. */
- +
- + /* These values can be assigned to sy_flags field of a symbolS */
- + /* The first 16 bits are general purpose. The last 16 bits are debug info */
- +
- + #define SF_STATICS 0x00000001 /* Mark the .text & all symbols */
- + #define SF_DEFINED 0x00000002 /* Symbol is defined in this file */
- + #define SF_STRING 0x00000004 /* Symbol name length > 8 */
- + #define SF_LOCAL 0x00000008 /* Symbol must not be emitted */
- +
- + #define SF_FUNCTION 0x00010000 /* The symbol is a function */
- + #define SF_PROCESS 0x00020000 /* Process symbol before write */
- + #define SF_TAGGED 0x00040000 /* Is associated with a tag */
- + #define SF_TAG 0x00080000 /* Is a tag */
- + #define SF_DEBUG 0x00100000 /* Is in debug or abs section */
- +
- + /* Masks */
- + #define SF_NORMAL_MASK 0x0000ffff /* Non debug information */
- + #define SF_DEBUG_MASK 0xffff0000 /* Debug information */
- +
- + /* Accessors */
- + #define SF_GET(s) ((s)->sy_flags)
- + #define SF_GET_NORMAL_FIELD(s) ((s)->sy_flags & SF_NORMAL_MASK)
- + #define SF_GET_DEBUG_FIELD(s) ((s)->sy_flags & SF_DEBUG_MASK)
- + #define SF_GET_FILE(s) ((s)->sy_flags & SF_FILE)
- + #define SF_GET_STATICS(s) ((s)->sy_flags & SF_STATICS)
- + #define SF_GET_DEFINED(s) ((s)->sy_flags & SF_DEFINED)
- + #define SF_GET_STRING(s) ((s)->sy_flags & SF_STRING)
- + #define SF_GET_LOCAL(s) ((s)->sy_flags & SF_LOCAL)
- + #define SF_GET_FUNCTION(s) ((s)->sy_flags & SF_FUNCTION)
- + #define SF_GET_PROCESS(s) ((s)->sy_flags & SF_PROCESS)
- + #define SF_GET_DEBUG(s) ((s)->sy_flags & SF_DEBUG)
- + #define SF_GET_TAGGED(s) ((s)->sy_flags & SF_TAGGED)
- + #define SF_GET_TAG(s) ((s)->sy_flags & SF_TAG)
- +
- + /* Modifiers */
- + #define SF_SET(s,v) ((s)->sy_flags = (v))
- + #define SF_SET_NORMAL_FIELD(s,v)((s)->sy_flags |= ((v) & SF_NORMAL_MASK))
- + #define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_flags |= ((v) & SF_DEBUG_MASK))
- + #define SF_SET_FILE(s) ((s)->sy_flags |= SF_FILE)
- + #define SF_SET_STATICS(s) ((s)->sy_flags |= SF_STATICS)
- + #define SF_SET_DEFINED(s) ((s)->sy_flags |= SF_DEFINED)
- + #define SF_SET_STRING(s) ((s)->sy_flags |= SF_STRING)
- + #define SF_SET_LOCAL(s) ((s)->sy_flags |= SF_LOCAL)
- + #define SF_SET_FUNCTION(s) ((s)->sy_flags |= SF_FUNCTION)
- + #define SF_SET_PROCESS(s) ((s)->sy_flags |= SF_PROCESS)
- + #define SF_SET_DEBUG(s) ((s)->sy_flags |= SF_DEBUG)
- + #define SF_SET_TAGGED(s) ((s)->sy_flags |= SF_TAGGED)
- + #define SF_SET_TAG(s) ((s)->sy_flags |= SF_TAG)
- +
- + /* File header macro and type definition */
- +
- + /*
- + * File position calculators. Beware to use them when all the
- + * appropriate fields are set in the header.
- + */
- +
- + #define H_GET_FILE_SIZE(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
- + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
- + H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
- + H_GET_SYMBOL_TABLE_SIZE(h) * SYMESZ + \
- + (h)->string_table_size)
- + #define H_GET_TEXT_FILE_OFFSET(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
- + #define H_GET_DATA_FILE_OFFSET(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
- + H_GET_TEXT_SIZE(h))
- + #define H_GET_BSS_FILE_OFFSET(h) 0
- + #define H_GET_RELOCATION_FILE_OFFSET(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
- + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
- + #define H_GET_LINENO_FILE_OFFSET(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
- + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
- + H_GET_RELOCATION_SIZE(h))
- + #define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
- + (long)(FILHSZ + AOUTHDRSZ + \
- + H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
- + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
- + H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
- +
- + /* Accessors */
- + /* aouthdr */
- + #define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
- + #define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
- + #define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
- + #define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize)
- + #define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize)
- + #define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
- + #define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
- + #define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
- + /* filehdr */
- + #define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
- + #define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
- + #define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
- + #define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr)
- + #define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->filehdr.f_nsyms)
- + #define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
- + #define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
- + /* Extra fields to achieve bsd a.out compatibility and for convinience */
- + #define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
- + #define H_GET_STRING_SIZE(h) ((h)->string_table_size)
- + #define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
- +
- + /* Modifiers */
- + /* aouthdr */
- + #define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
- + #define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
- + #define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
- + #define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v))
- + #define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v))
- + #define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
- + #define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
- + #define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
- + /* filehdr */
- + #define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
- + #define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
- + #define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
- + #define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v))
- + #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
- + #define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
- + #define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
- + /* Extra fields to achieve bsd a.out compatibility and for convinience */
- + #define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
- + #define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
- + #define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
- +
- + /* Output the file(s) header(s) in a character array */
- + #define H_OUTPUT(h,where) c_header_append(&(h)->aouthdr, &(h)->filehdr,(where))
- +
- + /* Output a symbol entry */
- + #define SYMBOL_OUTPUT(s,w) c_symbol_append((s), (w))
- +
- + typedef struct {
- + AOUTHDR aouthdr; /* a.out header */
- + FILHDR filehdr; /* File header, not machine dep. */
- + long int string_table_size; /* names + '\0' + sizeof(int) */
- + long int relocation_size; /* Cumulated size of relocation
- + information for all sections in
- + bytes. */
- + long int lineno_size; /* Size of the line number information
- + table in bytes */
- + } object_headers;
- +
- + /* Format independent interface functions */
- + extern void emit_relocations();
- + extern void emit_symbols();
- + extern void c_symbol_merge();
- + extern void c_header_append();
- + extern void c_symbol_append();
- + extern void c_section_header_append();
- + extern char* c_section_symbol();
- + extern void c_section_header();
- +
- + /* -------------- Line number handling ------- */
- + extern int text_lineno_number;
- +
- + typedef struct internal_lineno {
- + LINENO line; /* The lineno structure itself */
- + char* frag; /* Frag the line number is related to*/
- + struct internal_lineno* next; /* Forward chain pointer */
- + } lineno;
- +
- + extern lineno* c_new_file();
- + extern void emit_lineno();
- + extern lineno* lineno_rootP;
- + extern lineno* lineno_lastP;
- + #endif /* COFF_H */
- +
- +
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- m-motor.h Mon Oct 15 08:12:50 1990
- ***************
- *** 0 ****
- --- 1,10 ----
- + /* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */
- + #define unisoft
- + #define PROCESSOR_68000
- +
- + /* Return true if s (a non null string pointer), points to a local variable
- + name. */
- + #define S_LOCAL_NAME(s) (S_GET_NAME(s)[0] == 'L')
- +
- + /* Remove leading underscore from the gcc generated symbol names */
- + #define STRIP_UNDERSCORE 1
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- README.coff Mon Oct 15 17:42:45 1990
- ***************
- *** 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.36/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, cshar, diff-1.14,
- + dist-18.55, flex-2.3, gas-1.36, gcc-1.37.1, gdb-3.6, grep-1.5,
- + kermit, make-3.58, makedep, patch, printf,
- + tar-1.08, texi2roff, uuencode, uutraf-1.2
- +
- + 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)
- +
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- append.h Thu Aug 2 15:00:24 1990
- ***************
- *** 0 ****
- --- 1,1 ----
- + extern void append();
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- config.gas Mon Oct 15 17:22:59 1990
- ***************
- *** 0 ****
- --- 1,61 ----
- + # Set the appropriate links for machine dependent files
- +
- + # Chose one of
- + #
- + # i386 for 386 box running SCO unix (ODT),
- + # Esix rev C
- + # Ix 2.02
- + # CTIX 3.2
- + #
- + # sun-3 for sun3 running SunOs 3.5
- + # SunOs 4.0.3
- + #
- + # motorola-3600-unisoft-1.3 for Motorola 3600 running Unisoft 1.3 (V.3.2)
- + # microlec-2030-lectra-1 for Microlec 2030 running Lectra 1.1
- +
- + case $1 in
- + default)
- + cp /dev/null dependencies
- + ln aout.h oformat.h
- + exit
- + ;;
- + sun-3)
- + [ -f m68k.h ] && rm -f m68k.h
- + ln m-sun3.h m68k.h
- + machine_file=m68k.c
- + atof_file=atof-ieee.c
- + machine_header=m-sun3.h
- + opcode_header=m68k-opcode.h
- + object_format=aout
- + ;;
- + motorola-3600-unisoft-1.3|microlec-2030-lectra-1.1)
- + [ -f m68k.h ] && rm -f m68k.h
- + ln m-sun3.h m68k.h
- + machine_file=m68k.c
- + atof_file=atof-ieee.c
- + machine_header=m-motor.h
- + opcode_header=m68k-opcode.h
- + object_format=coff
- + ;;
- + i386)
- + [ -f m68k.h ] && rm -f m68k.h
- + machine_file=i386.c
- + atof_file=atof-ieee.c
- + machine_header=m-i386.h
- + opcode_header=i386-opcode.h
- + object_format=coff
- + ;;
- + *)
- + echo $1 not a known configuration
- + exit 1
- + ;;
- + esac
- +
- + rm -f machine.c atof.c machine.h oformat.h oformat.c opcode.h
- + set -x
- + ln $machine_file machine.c
- + ln $atof_file atof.c
- + ln $machine_header machine.h
- + ln ${object_format}.c oformat.c
- + ln ${object_format}.h oformat.h
- + ln ${opcode_header} opcode.h
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- stack.c Wed Aug 29 13:22:32 1990
- ***************
- *** 0 ****
- --- 1,59 ----
- + #include "stack.h"
- +
- + extern char* malloc();
- + extern char* realloc();
- +
- + stack* stack_init(chunk_size, element_size)
- + unsigned long chunk_size;
- + unsigned long element_size;
- + {
- + stack* st;
- + if((st = (stack*)malloc(sizeof(stack))) == (stack*)0)
- + return (stack*)0;
- + if((st->data = malloc(chunk_size)) == (char*)0) {
- + free(st);
- + return (stack*)0;
- + }
- + st->pointer = 0;
- + st->size = chunk_size;
- + st->chunk_size = chunk_size;
- + st->element_size = element_size;
- + return st;
- + }
- +
- + void stack_delete(st)
- + stack* st;
- + {
- + free(st->data);
- + free(st);
- + }
- +
- + char* stack_push(st, element)
- + stack* st;
- + char* element;
- + {
- + if(st->pointer + st->element_size >= st->size) {
- + st->size += st->chunk_size;
- + if((st->data = realloc(st->data, st->size)) == (char*)0)
- + return (char*)0;
- + }
- + memcpy(st->data + st->pointer, element, st->element_size);
- + st->pointer += st->element_size;
- + return st->data + st->pointer;
- + }
- +
- + char* stack_pop(st)
- + stack* st;
- + {
- + if((st->pointer -= st->element_size) < 0) {
- + st->pointer = 0;
- + return (char*)0;
- + }
- + return st->data + st->pointer;
- + }
- +
- + char* stack_top(st)
- + stack* st;
- + {
- + return st->data + st->pointer - st->element_size;
- + }
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- aout.c Mon Oct 15 08:53:32 1990
- ***************
- *** 0 ****
- --- 1,146 ----
- + #include "as.h"
- + #include "md.h"
- + #include "aout.h"
- + #include "struc-symbol.h"
- + #include "write.h"
- + #include "append.h"
- +
- + /* Relocation. */
- +
- + /*
- + * In: length of relocation (or of address) in chars: 1, 2 or 4.
- + * Out: GNU LD relocation length code: 0, 1, or 2.
- + */
- +
- + static unsigned char
- +
- + nbytes_r_length [] = {
- + 42, 0, 1, 42, 2
- + };
- +
- +
- + /* The sparc needs its own emit_relocations() */
- + #ifndef SPARC
- + /*
- + * emit_relocations()
- + *
- + * Crawl along a fixS chain. Emit the segment's relocations.
- + */
- + void
- + emit_relocations (fixP, segment_address_in_file)
- + register fixS * fixP; /* Fixup chain for this segment. */
- + relax_addressT segment_address_in_file;
- + {
- + struct relocation_info ri;
- + register symbolS * symbolP;
- +
- + /* JF this is for paranoia */
- + bzero((char *)&ri,sizeof(ri));
- + for ( ; fixP; fixP = fixP -> fx_next)
- + {
- + if (symbolP = fixP -> fx_addsy)
- + {
- +
- + #ifndef hpux
- + /* These two 'cuz of NS32K */
- + ri . r_bsr = fixP -> fx_bsr;
- + ri . r_disp = fixP -> fx_im_disp;
- + #endif
- +
- + ri . r_length = nbytes_r_length [fixP -> fx_size];
- + ri . r_pcrel = fixP -> fx_pcrel;
- + ri . r_address = fixP -> fx_frag -> fr_address
- + + fixP -> fx_where
- + - segment_address_in_file;
- + if ((symbolP -> sy_type & N_TYPE) == N_UNDF)
- + {
- + ri . r_extern = 1;
- + ri . r_symbolnum = symbolP -> sy_number;
- + }
- + else
- + {
- + ri . r_extern = 0;
- + ri . r_symbolnum = symbolP -> sy_type & N_TYPE;
- + }
- +
- + /*
- + The 68k machines assign bit-fields from higher bits to
- + lower bits ("left-to-right") within the int. VAXen assign
- + bit-fields from lower bits to higher bits ("right-to-left").
- + Both handle multi-byte numbers in their usual fashion
- + (Big-endian and little-endian stuff).
- + Thus we need a machine dependent routine to make
- + sure the structure is written out correctly. FUN!
- + */
- + md_ri_to_chars((char *) &ri, ri);
- + append (&next_object_file_charP, (char *)& ri, (unsigned long)sizeof(ri));
- + }
- + }
- +
- + }
- + #endif
- +
- + /* Aout file generation & utilities */
- +
- + /* Convert a lvalue to machine dependent data */
- + #define MD(v) \
- + md_number_to_chars((char *)&header->v,header->v, sizeof(header->v))
- +
- + void a_header_append(header, where)
- + struct exec * header;
- + char** where;
- + {
- + MD(a_text);
- + MD(a_data);
- + MD(a_bss);
- + MD(a_trsize);
- + MD(a_drsize);
- + MD(a_syms);
- + MD(a_magic);
- + MD(a_entry);
- + #ifdef EXEC_MACHINE_TYPE
- + MD(a_machtype);
- + #endif /* EXEC_MACHINE_TYPE */
- + #ifdef EXEC_VERSION
- + MD(a_version);
- + #endif /* EXEC_VERSION */
- + append(where, (char *)header, sizeof(struct exec));
- + }
- +
- + #undef MD
- + /* Convert a lvalue to machine dependent data */
- + #define MD(v) \
- + md_number_to_chars((char *)&symbolP->v,symbolP->v, sizeof(symbolP->v))
- +
- + void a_symbol_append(symbolP, where)
- + symbolS * symbolP;
- + char** where;
- + {
- + MD(sy_strx);
- + MD(sy_desc);
- + MD(sy_value);
- + append(where, (char *)&symbolP->sy_symbol, sizeof(symbol_type));
- + }
- +
- + void emit_symbols(symbol_rootP, where)
- + symbolS * symbol_rootP;
- + char** where;
- + {
- + symbolS * symbolP;
- + /*
- + * Emit all symbols left in the symbol chain.
- + */
- + for(symbolP = symbol_rootP; symbolP; symbolP = symbolP -> sy_next) {
- + /* Used to save the offset of the name. It is used to point
- + to the string in memory but must be a file offset. */
- + register char * temp;
- +
- + temp = S_GET_NAME(symbolP);
- + S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
- + /* Any symbol still undefined is made N_EXT. */
- + if (!S_IS_DEFINED(symbolP))
- + S_SET_EXTERNAL(symbolP);
- + SYMBOL_OUTPUT(symbolP, where);
- + S_SET_NAME(symbolP,temp);
- + }
- + }
- --
- Loic Dachary loic@adesign.uucp or loic@afp.uucp
- Voice +33 1 40 35 20 20
-