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.90Oct16093447@adesign.uucp>
- Date: 16 Oct 90 08:34:47 GMT
-
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- coff.c Mon Oct 15 08:53:16 1990
- ***************
- *** 0 ****
- --- 1,367 ----
- + #include "oformat.h"
- + #include "as.h"
- + #include "md.h"
- + #include "struc-symbol.h"
- + #include "symbols.h"
- + #include "write.h"
- +
- + /* Relocation. */
- +
- + /*
- + * 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;
- + {
- + RELOC ri;
- + register symbolS * symbolP;
- +
- + bzero((char *)&ri,sizeof(ri));
- + for ( ; fixP; fixP = fixP->fx_next) {
- + if (symbolP = fixP->fx_addsy) {
- + #if defined(PROCESSOR_68000)
- + ri.r_type = (fixP->fx_pcrel ?
- + ( fixP->fx_size == 1 ? R_PCRBYTE :
- + fixP->fx_size == 2 ? R_PCRWORD :
- + R_PCRLONG):
- + ( fixP->fx_size == 1 ? R_RELBYTE :
- + fixP->fx_size == 2 ? R_RELWORD :
- + R_RELLONG));
- + #elif defined(PROCESSOR_i386)
- + /* !!!! R_OFF8 & R_DIR16 are a vague guess, completly unested. */
- + ri.r_type = (fixP->fx_pcrel ?
- + ( fixP->fx_size == 1 ? R_PCRBYTE :
- + fixP->fx_size == 2 ? R_PCRWORD :
- + R_PCRLONG):
- + ( fixP->fx_size == 1 ? R_OFF8 :
- + fixP->fx_size == 2 ? R_DIR16 :
- + R_DIR32));
- + #else
- + you lose
- + #endif /* PROCESSOR_68000 || PROCESSOR_i386 */
- + ri.r_vaddr = fixP->fx_frag->fr_address + fixP->fx_where;
- + /* If symbol associated to relocation entry is a bss symbol
- + or undefined symbol just remember the index of the symbol.
- + Otherwise store the index of the symbol describing the
- + section the symbol belong to. This heuristic speeds up ld.
- + */
- + /* Local symbols can generate relocation information. In case
- + of structure return for instance. But they have no symbol
- + number because they won't be emitted in the final object.
- + In the case where they are in the BSS section, this leads
- + to an incorrect r_symndx.
- + Under bsd the loader do not care if the symbol reference is
- + incorrect. But the SYS V ld complains about this. To avoid
- + this we associate the symbol to the associated section,
- + *even* if it is the BSS section. */
- + /* If someone can tell me why the other symbols of the bss
- + section are not associated with the .bss section entry,
- + I'd be gratefull. I guess that it has to do with the special
- + nature of the .bss section. Or maybe this is because the
- + bss symbols are declared in the common section and can
- + be resized later. Can it break code some where ? */
- + ri.r_symndx =
- + S_GET_SEGMENT(symbolP) == C_TEXT_SECTION ? dot_text_symbol->sy_number :
- + S_GET_SEGMENT(symbolP) == C_DATA_SECTION ? dot_data_symbol->sy_number :
- + (SF_GET_LOCAL(symbolP) ? dot_bss_symbol->sy_number :
- + symbolP->sy_number); /* bss or undefined */
- +
- + /* md_ri_to_chars((char *) &ri, ri); /* Last step : write md f */
- + append (&next_object_file_charP,
- + (char *)& ri,
- + (unsigned long)RELSZ);
- + }
- + }
- + }
- +
- + /* Coff file generation & utilities */
- +
- + /* Convert a lvalue to machine dependent data */
- + #define MD(s,v) \
- + md_number_to_chars((char *)&(s)->v,(s)->v, sizeof((s)->v))
- +
- + void
- + c_header_append(aouthdr, filehdr, where)
- + AOUTHDR* aouthdr;
- + FILHDR* filehdr;
- + char** where;
- + {
- + /* Eventually swap bytes for cross compilation for file header */
- + MD(filehdr, f_magic);
- + MD(filehdr, f_nscns);
- + MD(filehdr, f_timdat);
- + MD(filehdr, f_symptr);
- + MD(filehdr, f_nsyms);
- + MD(filehdr, f_opthdr);
- + MD(filehdr, f_flags);
- + append(where, (char *)filehdr, FILHSZ);
- +
- + /* Eventually swap bytes for cross compilation for a.out header */
- + MD(aouthdr, magic);
- + MD(aouthdr, vstamp);
- + MD(aouthdr, tsize);
- + MD(aouthdr, dsize);
- + MD(aouthdr, bsize);
- + MD(aouthdr, entry);
- + MD(aouthdr, text_start);
- + MD(aouthdr, data_start);
- + append(where, (char *)aouthdr, sizeof(struct aouthdr));
- + }
- +
- + /*
- + * Beware ! If you cross compile to another ENDIAN machine,
- + * the symbol table values will not be valid any more.
- + */
- +
- + void
- + c_symbol_append(symbolP, where)
- + symbolS * symbolP;
- + char** where;
- + {
- + SYMENT *syment = &symbolP->sy_symbol;
- + char numaux = syment->n_numaux;
- + register AUXENT* auxP = &symbolP->sy_auxent;
- + register unsigned short type = S_GET_DATA_TYPE(symbolP);
- +
- + MD(syment, n_value);
- + MD(syment, n_scnum);
- + MD(syment, n_type);
- + MD(syment, n_sclass);
- + MD(syment, n_numaux);
- + append(where, (char *)syment, SYMESZ);
- +
- + /* Should do the following : if(.file entry) MD(..)... else
- + if(static entry) MD(..)
- + */
- + if(numaux == 1) {
- + #if 0 /* This code has never been tested */
- + /* The most common case, x_sym entry. */
- + if((SF_GET(symbolP) & (SF_FILE | SF_STATICS)) == 0) {
- + MD(auxP, x_sym.x_tagndx);
- + if(ISFCN(type))
- + MD(auxP, x_sym.x_misc.x_fsize);
- + else {
- + MD(auxP, x_sym.x_misc.x_lnno);
- + MD(auxP, x_sym.x_misc.x_size);
- + }
- + if(ISARY(type)) {
- + register int index;
- + for(index = 0; index < DIMNUM; index++)
- + MD(auxP, x_sym.x_fcnary.x_ary.x_dimen[index]);
- + } else {
- + MD(auxP, x_sym.x_fcnary.x_fcn.x_lnnoptr);
- + MD(auxP, x_sym.x_fcnary.x_fcn.x_endndx);
- + }
- + MD(auxP, x_sym.x_tvndx);
- + } else if(SF_GET_FILE(symbolP)) /* .file */
- + ;
- + else if(SF_GET_STATICS(symbolP)) { /* .text, .data, .bss symbols */
- + MD(auxP, x_scn.x_scnlen);
- + MD(auxP, x_scn.x_nreloc);
- + MD(auxP, x_scn.x_nlinno);
- + }
- + #endif /* 0 */
- + append(where, (char *)auxP, AUXESZ);
- + } else if(numaux > 0)
- + as_warn("more than one auxent for symbol");
- +
- + return;
- + }
- +
- + void
- + c_section_header_append(header, where)
- + SCNHDR* header;
- + char** where;
- + {
- + MD(header, s_paddr);
- + MD(header, s_vaddr);
- + MD(header, s_size);
- + MD(header, s_scnptr);
- + MD(header, s_relptr);
- + MD(header, s_lnnoptr);
- + MD(header, s_nreloc);
- + MD(header, s_nlnno);
- + MD(header, s_flags);
- + append(where, (char *)header, SCNHSZ);
- +
- + return;
- + }
- +
- +
- + 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);
- + if (SF_GET_STRING(symbolP)) {
- + S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
- + S_SET_ZEROES(symbolP, 0);
- + } else {
- + memset(symbolP->sy_name, '\0', SYMNMLEN);
- + strncpy(symbolP->sy_name, temp, SYMNMLEN);
- + }
- + SYMBOL_OUTPUT(symbolP, where);
- + S_SET_NAME(symbolP,temp);
- + }
- + }
- +
- + /* Merge a debug symbol containing debug information into a normal
- + symbol. */
- +
- + void
- + c_symbol_merge(debug, normal)
- + symbolS* debug;
- + symbolS* normal;
- + {
- + S_SET_DATA_TYPE(normal, S_GET_DATA_TYPE(debug));
- + S_SET_STORAGE_CLASS(normal, S_GET_STORAGE_CLASS(debug));
- + S_SET_NUMBER_AUXILIARY(normal, S_GET_NUMBER_AUXILIARY(debug));
- + /* Move all the auxiliary information */
- + if(S_GET_NUMBER_AUXILIARY(debug))
- + memcpy((char*)&normal->sy_auxent, (char*)&debug->sy_auxent,
- + AUXESZ);
- + /* Move the debug flags. */
- + SF_SET_DEBUG_FIELD(normal, SF_GET_DEBUG_FIELD(debug));
- + }
- +
- + c_dot_file_symbol(filename)
- + char* filename;
- + {
- + symbolS* symbolP;
- + symbolS* ante_lastP;
- +
- + ante_lastP = symbol_lastP;
- +
- + symbolP = symbol_new(".file", SEG_DEBUG, 0,
- + C_FILE, &zero_address_frag);
- + S_SET_NUMBER_AUXILIARY(symbolP, 1);
- + SA_SET_FILE_FNAME(symbolP, filename);
- + SF_SET_DEBUG(symbolP);
- +
- + /* Make sure that the symbol is first on the symbol chain */
- + if(symbol_rootP != symbolP) {
- + symbol_lastP = ante_lastP;
- + symbol_lastP->sy_next = NULL;
- + symbolP->sy_next = symbol_rootP;
- + symbol_rootP = symbolP;
- + }
- + }
- + /*
- + * Build a 'section static' symbol.
- + */
- +
- + char*
- + c_section_symbol(name, value, length, nreloc, nlnno)
- + char* name;
- + long value;
- + long length;
- + unsigned short nreloc;
- + unsigned short nlnno;
- + {
- + symbolS* symbolP;
- +
- + symbolP = symbol_new(name,
- + (name[1] == 't' ? SEG_TEXT :
- + name[1] == 'd' ? SEG_DATA :
- + SEG_BSS),
- + value,
- + C_STAT,
- + &zero_address_frag);
- +
- + S_SET_NUMBER_AUXILIARY(symbolP, 1);
- +
- + SA_SET_SCN_SCNLEN(symbolP, length);
- + SA_SET_SCN_NRELOC(symbolP, nreloc);
- + SA_SET_SCN_NLINNO(symbolP, nlnno);
- +
- + SF_SET_STATICS(symbolP);
- +
- + return (char*)symbolP;
- + }
- +
- + void
- + c_section_header(header, name, core_address, size,
- + data_ptr, reloc_ptr, lineno_ptr,
- + reloc_number, lineno_number)
- + SCNHDR* header;
- + char* name;
- + long core_address;
- + long size;
- + long data_ptr;
- + long reloc_ptr;
- + long lineno_ptr;
- + long reloc_number;
- + long lineno_number;
- + {
- + strncpy(header->s_name, name, 8);
- + header->s_paddr = header->s_vaddr = core_address;
- + header->s_size = size;
- + header->s_scnptr = data_ptr;
- + header->s_relptr = reloc_ptr;
- + header->s_lnnoptr = lineno_ptr;
- + header->s_nreloc = reloc_number;
- + header->s_nlnno = lineno_number;
- + header->s_flags = STYP_REG | ( name[1] == 't' ? STYP_TEXT :
- + name[1] == 'd' ? STYP_DATA :
- + name[1] == 'b' ? STYP_BSS :
- + STYP_INFO );
- + return ;
- + }
- +
- + /* Line number handling */
- +
- + int text_lineno_number = 0;
- + lineno* lineno_rootP = (lineno*)0;
- + lineno* lineno_lastP = (lineno*)0;
- +
- + lineno*
- + c_line_new(paddr, line_number, frag)
- + long paddr;
- + unsigned short line_number;
- + fragS* frag;
- + {
- + lineno* new_line = (lineno*)xmalloc(sizeof(lineno));
- +
- + new_line->line.l_addr.l_paddr = paddr;
- + new_line->line.l_lnno = line_number;
- + new_line->frag = (char*)frag;
- + new_line->next = (lineno*)0;
- +
- + if(lineno_rootP == (lineno*)0)
- + lineno_rootP = new_line;
- + else
- + lineno_lastP->next = new_line;
- + lineno_lastP = new_line;
- + }
- +
- + void
- + emit_lineno(line, where)
- + lineno* line;
- + char** where;
- + {
- + register LINENO* line_entry;
- +
- + for(;line;line = line->next) {
- + line_entry = &line->line;
- + /* No matter which member of the union we process, they are
- + both long. */
- + MD(line_entry, l_addr.l_paddr);
- + MD(line_entry, l_lnno);
- + append(where, (char *)line_entry, LINESZ);
- + }
- + return ;
- + }
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- m-i386.h Mon Oct 15 08:14:18 1990
- ***************
- *** 0 ****
- --- 1,10 ----
- + /* Machine specific defines for the SCO Unix V.3.2 ODT */
- + #define scounix
- + #define PROCESSOR_i386
- +
- + /* 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] == '.' && S_GET_NAME(s)[1] == 'L')
- +
- + /* Compiler does not generate symbol names with a leading underscore. */
- + #define STRIP_UNDERSCORE 0
- *** /dev/null Mon Oct 15 09:51:48 1990
- --- stack.h Wed Aug 29 13:17:30 1990
- ***************
- *** 0 ****
- --- 1,13 ----
- + typedef struct {
- + unsigned long chunk_size;
- + unsigned long element_size;
- + unsigned long size;
- + char* data;
- + unsigned long pointer;
- + } stack;
- +
- + extern stack* stack_init();
- + extern void stack_delete();
- + extern char* stack_push();
- + extern char* stack_pop();
- + extern char* stack_top();
- *** as.c Tue Mar 20 19:33:57 1990
- --- /lasvegas/spare/usenet/port/gas-1.36/as.c Mon Oct 15 09:24:35 1990
- ***************
- *** 35,40 ****
- --- 35,41 ----
- #include <signal.h>
-
- #define COMMON
- + #include "oformat.h"
- #include "as.h"
- #include "struc-symbol.h"
- #include "write.h"
- *** as.h Wed Mar 1 23:49:37 1989
- --- /lasvegas/spare/usenet/port/gas-1.36/as.h Sat Oct 13 09:29:35 1990
- ***************
- *** 158,166 ****
- /* Invented so we don't crash printing */
- /* error message involving weird segment. */
- SEG_BIG, /* Bigger than 32 bits constant. */
- ! SEG_DIFFERENCE /* Mythical Segment: absolute difference. */
- } segT;
- #define SEG_MAXIMUM_ORDINAL (SEG_DIFFERENCE)
-
- typedef unsigned char subsegT;
-
- --- 158,175 ----
- /* Invented so we don't crash printing */
- /* error message involving weird segment. */
- SEG_BIG, /* Bigger than 32 bits constant. */
- ! SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
- ! #ifdef coff
- ! SEG_DEBUG, /* Debug segment */
- ! SEG_NTV, /* Transfert vector preload segment */
- ! SEG_PTV, /* Transfert vector postload segment */
- ! #endif /* coff */
- } segT;
- + #ifdef coff
- + #define SEG_MAXIMUM_ORDINAL (SEG_PTV)
- + #else /* coff */
- #define SEG_MAXIMUM_ORDINAL (SEG_DIFFERENCE)
- + #endif /* coff */
-
- typedef unsigned char subsegT;
-
- ***************
- *** 176,181 ****
- --- 185,207 ----
- extern char *seg_name[];
- extern int seg_N_TYPE[];
- extern segT N_TYPE_seg[];
- + #ifdef coff
- + #define segment_name(v) (seg_name[(v)])
- + /* Machine independent -> machine dependent */
- + #define seg_SEG(v) (seg_N_TYPE[(v)])
- + /*
- + * +4 shift the value of the mnemonics from -4, -3, -2, -1, 0, 1, 2, 3
- + * to 0, 1, 2, 3, 4, 5, 6, 7
- + */
- + /* Machine dependent -> machine independent */
- + #define SEG_seg(v) (N_TYPE_seg[(v) + 4])
- + #else /* coff */
- + #define segment_name(v) (seg_name[(v)])
- + /* Machine independent -> machine dependent */
- + #define seg_SEG(v) (seg_N_TYPE[(v)])
- + /* Machine dependent -> machine independent */
- + #define SEG_seg(v) (N_TYPE_seg[(v)])
- + #endif /* coff */
- void subsegs_begin();
- void subseg_change();
- void subseg_new();
- *** expr.c Fri Apr 6 17:51:21 1990
- --- /lasvegas/spare/usenet/port/gas-1.36/expr.c Wed Sep 12 09:28:48 1990
- ***************
- *** 25,30 ****
- --- 25,31 ----
- */
-
- #include <ctype.h>
- + #include "oformat.h"
- #include "as.h"
- #include "flonum.h"
- #include "read.h"
- ***************
- *** 84,90 ****
- {
- register char c;
- register char *name; /* points to name of symbol */
- ! register struct symbol * symbolP; /* Points to symbol */
-
- extern char hex_value[]; /* In hex_value.c */
- char *local_label_name();
- --- 85,91 ----
- {
- register char c;
- register char *name; /* points to name of symbol */
- ! register symbolS * symbolP; /* Points to symbol */
-
- extern char hex_value[]; /* In hex_value.c */
- char *local_label_name();
- ***************
- *** 249,263 ****
- */
- name = local_label_name ((int)number, 0);
- if ( (symbolP = symbol_table_lookup(name)) /* seen before */
- ! && (symbolP -> sy_type & N_TYPE) != N_UNDF /* symbol is defined: OK */
- ! )
- { /* Expected path: symbol defined. */
- /* Local labels are never absolute. Don't waste time checking absoluteness. */
- ! know( (symbolP -> sy_type & N_TYPE) == N_DATA
- ! || (symbolP -> sy_type & N_TYPE) == N_TEXT );
- expressionP -> X_add_symbol = symbolP;
- expressionP -> X_add_number = 0;
- ! expressionP -> X_seg = N_TYPE_seg [symbolP -> sy_type];
- }
- else
- { /* Either not seen or not defined. */
- --- 250,262 ----
- */
- name = local_label_name ((int)number, 0);
- if ( (symbolP = symbol_table_lookup(name)) /* seen before */
- ! && (S_IS_DEFINED(symbolP)))
- { /* Expected path: symbol defined. */
- /* Local labels are never absolute. Don't waste time checking absoluteness. */
- ! know((S_IS_DATA(symbolP)) || S_IS_TEXT(symbolP));
- expressionP -> X_add_symbol = symbolP;
- expressionP -> X_add_number = 0;
- ! expressionP -> X_seg = SEG_seg(S_GET_SEGMENT(symbolP));
- }
- else
- { /* Either not seen or not defined. */
- ***************
- *** 288,300 ****
- if ( symbolP = symbol_table_lookup( name ))
- {
- /* We have no need to check symbol properties. */
- ! know( (symbolP -> sy_type & N_TYPE) == N_UNDF
- ! || (symbolP -> sy_type & N_TYPE) == N_DATA
- ! || (symbolP -> sy_type & N_TYPE) == N_TEXT);
- }
- else
- {
- ! symbolP = symbol_new (name, N_UNDF, 0,0,0, & zero_address_frag);
- symbol_table_insert (symbolP);
- }
- expressionP -> X_add_symbol = symbolP;
- --- 287,305 ----
- if ( symbolP = symbol_table_lookup( name ))
- {
- /* We have no need to check symbol properties. */
- ! know(!S_IS_DEFINED(symbolP) ||
- ! S_IS_DATA(symbolP) || S_IS_TEXT(symbolP));
- }
- else
- {
- ! #ifdef coff
- ! symbolP = symbol_new(name, SEG_UNKNOWN,
- ! 0, 0,
- ! &zero_address_frag);
- ! #else /* coff */
- ! symbolP = symbol_new (name, N_UNDF, 0,0,0,
- ! & zero_address_frag);
- ! #endif /* coff */
- symbol_table_insert (symbolP);
- }
- expressionP -> X_add_symbol = symbolP;
- ***************
- *** 357,368 ****
- JF: '.' is pseudo symbol with value of current location in current
- segment. . .
- */
- symbolP = symbol_new("L0\001",
- ! (unsigned char)(seg_N_TYPE[(int)now_seg]),
- 0,
- 0,
- (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
- frag_now);
- expressionP->X_add_number=0;
- expressionP->X_add_symbol=symbolP;
- expressionP->X_seg = now_seg;
- --- 362,378 ----
- JF: '.' is pseudo symbol with value of current location in current
- segment. . .
- */
- + #ifdef coff
- + symbolP = symbol_new("L0\001", now_seg, (valueT)(obstack_next_free(&frags)-
- + frag_now->fr_literal), 0, frag_now);
- + #else /* coff */
- symbolP = symbol_new("L0\001",
- ! (unsigned char)(seg_SEG((int)now_seg)),
- 0,
- 0,
- (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
- frag_now);
- + #endif /* coff */
- expressionP->X_add_number=0;
- expressionP->X_add_symbol=symbolP;
- expressionP->X_seg = now_seg;
- ***************
- *** 383,389 ****
- */
- register segT seg;
-
- ! seg = N_TYPE_seg [(int) symbolP -> sy_type & N_TYPE];
- if ((expressionP -> X_seg = seg) == SEG_ABSOLUTE )
- {
- expressionP -> X_add_number = symbolP -> sy_value;
- --- 393,399 ----
- */
- register segT seg;
-
- ! seg = SEG_seg((int)S_GET_SEGMENT(symbolP));
- if ((expressionP -> X_seg = seg) == SEG_ABSOLUTE )
- {
- expressionP -> X_add_number = symbolP -> sy_value;
- ***************
- *** 398,404 ****
- --- 408,418 ----
- {
- expressionP -> X_add_symbol
- = symbolP
- + #ifdef coff
- + = symbol_new (name, SEG_UNKNOWN, 0, 0, &zero_address_frag);
- + #else /* coff */
- = symbol_new (name, N_UNDF, 0,0,0, & zero_address_frag);
- + #endif /* coff */
-
- expressionP -> X_add_number = 0;
- expressionP -> X_seg = SEG_UNKNOWN;
- ***************
- *** 553,578 ****
-
- static segT
- expr_part (symbol_1_PP, symbol_2_P)
- ! struct symbol ** symbol_1_PP;
- ! struct symbol * symbol_2_P;
- {
- segT return_value;
-
- know( (* symbol_1_PP) == NULL
- ! || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_TEXT
- ! || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_DATA
- ! || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_BSS
- ! || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF
- );
- know( symbol_2_P == NULL
- ! || (symbol_2_P -> sy_type & N_TYPE) == N_TEXT
- ! || (symbol_2_P -> sy_type & N_TYPE) == N_DATA
- ! || (symbol_2_P -> sy_type & N_TYPE) == N_BSS
- ! || (symbol_2_P -> sy_type & N_TYPE) == N_UNDF
- );
- if (* symbol_1_PP)
- {
- ! if (((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF)
- {
- if (symbol_2_P)
- {
- --- 567,592 ----
-
- static segT
- expr_part (symbol_1_PP, symbol_2_P)
- ! symbolS ** symbol_1_PP;
- ! symbolS * symbol_2_P;
- {
- segT return_value;
-
- know( (* symbol_1_PP) == NULL
- ! || (S_IS_TEXT(* symbol_1_PP))
- ! || (S_IS_DATA(* symbol_1_PP))
- ! || (S_IS_BSS(* symbol_1_PP))
- ! || (!S_IS_DEFINED(* symbol_1_PP))
- );
- know( symbol_2_P == NULL
- ! || (S_IS_TEXT(symbol_2_P))
- ! || (S_IS_DATA(symbol_2_P))
- ! || (S_IS_BSS(symbol_2_P))
- ! || (!S_IS_DEFINED(symbol_2_P))
- );
- if (* symbol_1_PP)
- {
- ! if (!S_IS_DEFINED(* symbol_1_PP))
- {
- if (symbol_2_P)
- {
- ***************
- *** 581,587 ****
- }
- else
- {
- ! know( ((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF)
- return_value = SEG_UNKNOWN;
- }
- }
- --- 595,601 ----
- }
- else
- {
- ! know(!S_IS_DEFINED(* symbol_1_PP));
- return_value = SEG_UNKNOWN;
- }
- }
- ***************
- *** 589,595 ****
- {
- if (symbol_2_P)
- {
- ! if ((symbol_2_P -> sy_type & N_TYPE) == N_UNDF)
- {
- * symbol_1_PP = NULL;
- return_value = SEG_PASS1;
- --- 603,609 ----
- {
- if (symbol_2_P)
- {
- ! if (!S_IS_DEFINED(symbol_2_P))
- {
- * symbol_1_PP = NULL;
- return_value = SEG_PASS1;
- ***************
- *** 598,604 ****
- {
- /* {seg1} - {seg2} */
- as_warn( "Expression too complex, 2 symbols forgotten: \"%s\" \"%s\"",
- ! (* symbol_1_PP) -> sy_name, symbol_2_P -> sy_name );
- * symbol_1_PP = NULL;
- return_value = SEG_ABSOLUTE;
- }
- --- 612,618 ----
- {
- /* {seg1} - {seg2} */
- as_warn( "Expression too complex, 2 symbols forgotten: \"%s\" \"%s\"",
- ! S_GET_NAME(* symbol_1_PP), S_GET_NAME(symbol_2_P));
- * symbol_1_PP = NULL;
- return_value = SEG_ABSOLUTE;
- }
- ***************
- *** 605,611 ****
- }
- else
- {
- ! return_value = N_TYPE_seg [(* symbol_1_PP) -> sy_type & N_TYPE];
- }
- }
- }
- --- 619,625 ----
- }
- else
- {
- ! return_value = SEG_seg(S_GET_SEGMENT(* symbol_1_PP));
- }
- }
- }
- ***************
- *** 614,620 ****
- if (symbol_2_P)
- {
- * symbol_1_PP = symbol_2_P;
- ! return_value = N_TYPE_seg [(symbol_2_P) -> sy_type & N_TYPE];
- }
- else
- {
- --- 628,634 ----
- if (symbol_2_P)
- {
- * symbol_1_PP = symbol_2_P;
- ! return_value = SEG_seg(S_GET_SEGMENT(symbol_2_P));
- }
- else
- {
- ***************
- *** 630,636 ****
- || return_value == SEG_PASS1
- );
- know( (* symbol_1_PP) == NULL
- ! || ((* symbol_1_PP) -> sy_type & N_TYPE) == seg_N_TYPE [(int) return_value] );
- return (return_value);
- } /* expr_part() */
-
- --- 644,650 ----
- || return_value == SEG_PASS1
- );
- know( (* symbol_1_PP) == NULL
- ! || (S_GET_SEGMENT(* symbol_1_PP) == seg_SEG((int) return_value) ));
- return (return_value);
- } /* expr_part() */
-
- ***************
- *** 792,798 ****
- * does not cause any further inaccuracy.
- */
-
- ! register struct symbol * symbolP;
-
- right . X_add_number = - right . X_add_number;
- symbolP = right . X_add_symbol;
- --- 806,812 ----
- * does not cause any further inaccuracy.
- */
-
- ! register symbolS * symbolP;
-
- right . X_add_number = - right . X_add_number;
- symbolP = right . X_add_symbol;
- ***************
- *** 858,865 ****
- know( resultP -> X_add_symbol );
- know( resultP -> X_subtract_symbol );
- as_warn("Expression too complex: forgetting %s - %s",
- ! resultP -> X_add_symbol -> sy_name,
- ! resultP -> X_subtract_symbol -> sy_name);
- resultP -> X_seg = SEG_ABSOLUTE;
- /* Clean_up_expression() will do the rest. */
- }
- --- 872,879 ----
- know( resultP -> X_add_symbol );
- know( resultP -> X_subtract_symbol );
- as_warn("Expression too complex: forgetting %s - %s",
- ! S_GET_NAME(resultP -> X_add_symbol),
- ! S_GET_NAME(resultP -> X_subtract_symbol));
- resultP -> X_seg = SEG_ABSOLUTE;
- /* Clean_up_expression() will do the rest. */
- }
- *** frags.c Thu Aug 17 20:53:21 1989
- --- /lasvegas/spare/usenet/port/gas-1.36/frags.c Wed Sep 12 09:28:49 1990
- ***************
- *** 17,22 ****
- --- 17,23 ----
- along with GAS; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- + #include "oformat.h"
- #include "as.h"
- #include "subsegs.h"
- #include "obstack.h"
- *** hash.c Wed Mar 1 23:49:18 1989
- --- /lasvegas/spare/usenet/port/gas-1.36/hash.c Wed Sep 12 09:28:45 1990
- ***************
- *** 129,134 ****
- --- 129,137 ----
- #define min(a, b) ((a) < (b) ? (a) : (b))
-
- #include "hash.h"
- +
- + #define error as_fatal
- +
- char *xmalloc();
-
- #define DELETED ((char *)1) /* guarenteed invalid address */
- *** i386.c Wed May 16 16:29:04 1990
- --- /lasvegas/spare/usenet/port/gas-1.36/i386.c Sat Oct 13 11:34:21 1990
- ***************
- *** 37,42 ****
- --- 37,43 ----
- #define index strchr
- #endif
-
- + #include "oformat.h"
- #include "as.h"
- #include "read.h"
- #include "flonum.h"
- ***************
- *** 168,176 ****
- { "tfloat", float_cons, 'x' },
- { "value", cons, 2 },
- { "ident", dummy, 0 }, /* ignore these directives */
- ! { "def", dummy, 0 },
- { "version", dummy, 0 },
- ! { "ln", dummy, 0 },
- { 0, 0, 0 }
- };
-
- --- 169,177 ----
- { "tfloat", float_cons, 'x' },
- { "value", cons, 2 },
- { "ident", dummy, 0 }, /* ignore these directives */
- ! /* { "def", dummy, 0 },*/
- { "version", dummy, 0 },
- ! /* { "ln", dummy, 0 },*/
- { 0, 0, 0 }
- };
-
- ***************
- *** 372,391 ****
- }
- }
-
- ! #define SYMBOL_TYPE(t) \
- ! (((t&N_TYPE) == N_UNDF) ? "UNDEFINED" : \
- ! (((t&N_TYPE) == N_ABS) ? "ABSOLUTE" : \
- ! (((t&N_TYPE) == N_TEXT) ? "TEXT" : \
- ! (((t&N_TYPE) == N_DATA) ? "DATA" : \
- ! (((t&N_TYPE) == N_BSS) ? "BSS" : "Bad n_type!")))))
-
- static void ps (s)
- symbolS *s;
- {
- fprintf (stdout, "%s type %s%s",
- ! s->sy_nlist.n_un.n_name,
- ! (s->sy_nlist.n_type&N_EXT) ? "EXTERNAL " : "",
- ! SYMBOL_TYPE (s->sy_nlist.n_type));
- }
-
- struct type_name {
- --- 373,387 ----
- }
- }
-
- ! #define SYMBOL_TYPE(t) segment_name(SEG_seg(t))
-
- static void ps (s)
- symbolS *s;
- {
- fprintf (stdout, "%s type %s%s",
- ! S_GET_NAME(s),
- ! S_IS_EXTERNAL(s) ? "EXTERNAL " : "",
- ! SYMBOL_TYPE(S_GET_SEGMENT(s))
- }
-
- struct type_name {
- ***************
- *** 1543,1549 ****
- int
- md_estimate_size_before_relax (fragP, segment_type)
- register fragS * fragP;
- ! register int segment_type; /* N_DATA or N_TEXT. */
- {
- register uchar * opcode;
- register int old_fr_fix;
- --- 1539,1545 ----
- int
- md_estimate_size_before_relax (fragP, segment_type)
- register fragS * fragP;
- ! register int segment_type; /* DATA or TEXT. */
- {
- register uchar * opcode;
- register int old_fr_fix;
- ***************
- *** 1552,1558 ****
- opcode = (uchar *) fragP -> fr_opcode;
- /* We've already got fragP->fr_subtype right; all we have to do is check
- for un-relaxable symbols. */
- ! if ((fragP -> fr_symbol -> sy_type & N_TYPE) != segment_type) {
- /* symbol is undefined in this segment */
- switch (opcode[0]) {
- case JUMP_PC_RELATIVE: /* make jmp (0xeb) a dword displacement jump */
- --- 1548,1554 ----
- opcode = (uchar *) fragP -> fr_opcode;
- /* We've already got fragP->fr_subtype right; all we have to do is check
- for un-relaxable symbols. */
- ! if (S_GET_SEGMENT(fragP->fr_symbol) != segment_type) {
- /* symbol is undefined in this segment */
- switch (opcode[0]) {
- case JUMP_PC_RELATIVE: /* make jmp (0xeb) a dword displacement jump */
- ***************
- *** 1605,1611 ****
- opcode = (uchar *) fragP -> fr_opcode;
-
- /* Address we want to reach in file space. */
- ! target_address = fragP->fr_symbol->sy_value + fragP->fr_offset;
-
- /* Address opcode resides at in file space. */
- opcode_address = fragP->fr_address + fragP->fr_fix;
- --- 1601,1607 ----
- opcode = (uchar *) fragP -> fr_opcode;
-
- /* Address we want to reach in file space. */
- ! target_address = S_GET_VALUE(fragP->fr_symbol) + fragP->fr_offset;
-
- /* Address opcode resides at in file space. */
- opcode_address = fragP->fr_address + fragP->fr_fix;
- ***************
- *** 1684,1690 ****
- long offset;
-
- if (flagseen['m']) {
- ! offset = to_addr - to_symbol->sy_value;
- md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */
- md_number_to_chars (ptr + 1, offset, 4);
- fix_new (frag, (ptr+1) - frag->fr_literal, 4,
- --- 1680,1686 ----
- long offset;
-
- if (flagseen['m']) {
- ! offset = to_addr - S_GET_VALUE(to_symbol);
- md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */
- md_number_to_chars (ptr + 1, offset, 4);
- fix_new (frag, (ptr+1) - frag->fr_literal, 4,
- ***************
- *** 1833,1838 ****
- --- 1829,1837 ----
- return retval;
- }
-
- + /* Not needed for coff since relocation structure does not
- + contain bitfields. */
- + #ifdef aout
- void md_ri_to_chars(ri_p, ri)
- struct relocation_info *ri_p, ri;
- {
- ***************
- *** 1849,1854 ****
- --- 1848,1854 ----
- /* now put it back where you found it */
- bcopy (the_bytes, (char *)ri_p, sizeof(struct relocation_info));
- }
- + #endif /* aout */
-
-
- #define MAX_LITTLENUMS 6
- --
- Loic Dachary loic@adesign.uucp or loic@afp.uucp
- Voice +33 1 40 35 20 20
-