mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 12:22:20 +08:00
changes from Minh Tran-Le <TRANLE@INTELLICORP.COM> to support i386
coff as it appears to be used on aix386.
This commit is contained in:
@ -1,3 +1,18 @@
|
|||||||
|
Fri Feb 21 01:08:48 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)
|
||||||
|
|
||||||
|
* symbols.c (local_label_name): symbols now start with ^A.
|
||||||
|
|
||||||
|
* read.c, subsegs.c, write.c obj-coff.c: added handling of
|
||||||
|
`.bss` pseudo op for unitialized data. The new gcc (1.37.9x)
|
||||||
|
generate these sections. .align: will use NOP_OPCODE or 0
|
||||||
|
for padding. This is just for being nice to the
|
||||||
|
disassembler.
|
||||||
|
|
||||||
|
* expr.c (operand): changed to generate local label "\001L0"
|
||||||
|
starting with a ^A so that it is recognized as a local label.
|
||||||
|
|
||||||
|
* as.c (perform_an_assembly_pass): zero bss_fix_root, too.
|
||||||
|
|
||||||
Fri Feb 21 01:08:48 1992 K. Richard Pixley (rich@cygnus.com)
|
Fri Feb 21 01:08:48 1992 K. Richard Pixley (rich@cygnus.com)
|
||||||
|
|
||||||
* Makefile.in, configure.in, doc: use the doc. Build it, install
|
* Makefile.in, configure.in, doc: use the doc. Build it, install
|
||||||
|
@ -56,6 +56,7 @@ AR_FLAGS = qv
|
|||||||
BISON = bison
|
BISON = bison
|
||||||
MAKEINFO = makeinfo
|
MAKEINFO = makeinfo
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
|
MINUS_G = -g
|
||||||
|
|
||||||
# Lists of files for various purposes.
|
# Lists of files for various purposes.
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ clean-info:
|
|||||||
# Now figure out from those variables how to compile and link.
|
# Now figure out from those variables how to compile and link.
|
||||||
|
|
||||||
# This is the variable actually used when we compile.
|
# This is the variable actually used when we compile.
|
||||||
ALL_CFLAGS = -g $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
|
ALL_CFLAGS = $(MINUS_G) $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
|
||||||
|
|
||||||
# How to link with both our special library facilities
|
# How to link with both our special library facilities
|
||||||
# and the system's installed libraries.
|
# and the system's installed libraries.
|
||||||
|
@ -1,3 +1,34 @@
|
|||||||
|
Fri Feb 21 02:17:22 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)
|
||||||
|
|
||||||
|
* tc-i386.c: tc-i386.c: added handling of the following opcodes:
|
||||||
|
i/o opcodes - inb, inw, outb and outw. string manipulation with
|
||||||
|
att syntax - scmp, slod, smov, ssca, ssto.
|
||||||
|
|
||||||
|
Fri Feb 21 01:53:50 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM)
|
||||||
|
|
||||||
|
* obj-coff.c: (for aix386) Moved the symbols .text, .data and .bss
|
||||||
|
to just after .file .
|
||||||
|
|
||||||
|
In obj_crawl_symbol_chain() where it tries to put the external
|
||||||
|
symbols apart, with the condition:
|
||||||
|
(!S_IS_DEFINED(symbolP) &&
|
||||||
|
!S_IS_DEBUG(symbolP) &&
|
||||||
|
!SF_GET_STATICS(symbolP))
|
||||||
|
it was moving too many symbols out. So I switch it back to the
|
||||||
|
condition:
|
||||||
|
(S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP))
|
||||||
|
|
||||||
|
In obj_emit_relocations() added the conditional on KEEP_RELOC_INFO
|
||||||
|
so that we don't use the F_RELFLG which make the linker complain
|
||||||
|
that somebody has stripped the relocation info.
|
||||||
|
|
||||||
|
Also, the AIX ld program require that the relocation table
|
||||||
|
is sorted by r_vaddr like the standard ATT assembler does.
|
||||||
|
|
||||||
|
[he also changed the sizeof(struct ...)'s into the coff
|
||||||
|
style FOOSZ macros. I'm not sure this is right, but I can't
|
||||||
|
remember why. xoxorich.]
|
||||||
|
|
||||||
Tue Feb 18 02:11:10 1992 K. Richard Pixley (rich at cygnus.com)
|
Tue Feb 18 02:11:10 1992 K. Richard Pixley (rich at cygnus.com)
|
||||||
|
|
||||||
* tc-m88k.[hc]: pulled in from hack's unfinished work. These
|
* tc-m88k.[hc]: pulled in from hack's unfinished work. These
|
||||||
|
@ -166,6 +166,16 @@ SCNHDR text_section_header;
|
|||||||
#endif
|
#endif
|
||||||
/* Relocation. */
|
/* Relocation. */
|
||||||
|
|
||||||
|
static int reloc_compare(p1, p2)
|
||||||
|
#ifdef BFD_HEADERS
|
||||||
|
struct internal_reloc *p1, *p2;
|
||||||
|
#else
|
||||||
|
RELOC *p1, *p2;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return (int)(p1->r_vaddr - p2->r_vaddr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* emit_relocations()
|
* emit_relocations()
|
||||||
*
|
*
|
||||||
@ -178,43 +188,66 @@ fixS *fixP; /* Fixup chain for this segment. */
|
|||||||
relax_addressT segment_address_in_file;
|
relax_addressT segment_address_in_file;
|
||||||
{
|
{
|
||||||
#ifdef BFD_HEADERS
|
#ifdef BFD_HEADERS
|
||||||
struct internal_reloc ri;
|
struct internal_reloc *ri_table;
|
||||||
#else
|
#else
|
||||||
RELOC ri;
|
RELOC *ri_table;
|
||||||
#endif
|
#endif
|
||||||
symbolS *symbolP;
|
symbolS *symbolP;
|
||||||
|
int i, count;
|
||||||
|
fixS *p;
|
||||||
|
|
||||||
bzero((char *)&ri,sizeof(ri));
|
for (count = 0, p = fixP; p ; p = p->fx_next)
|
||||||
for (; fixP; fixP = fixP->fx_next) {
|
if (p->fx_addsy) count++;
|
||||||
|
if (!count)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef BFD_HEADERS
|
||||||
|
ri_table = (struct internal_reloc *) calloc(sizeof(*ri_table),count);
|
||||||
|
#else
|
||||||
|
ri_table = (RELOC *) calloc(sizeof(*ri_table),count);
|
||||||
|
#endif
|
||||||
|
if (!ri_table)
|
||||||
|
as_fatal ("obj_emit_relocations: Could not malloc relocation table");
|
||||||
|
|
||||||
|
#ifdef TC_I960
|
||||||
|
callj_table = (char *)malloc (sizeof(char)*count);
|
||||||
|
if (!callj_table)
|
||||||
|
as_fatal ("obj_emit_relocations: Could not malloc callj table");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (i = 0; fixP; fixP = fixP->fx_next) {
|
||||||
if (symbolP = fixP->fx_addsy) {
|
if (symbolP = fixP->fx_addsy) {
|
||||||
#if defined(TC_M68K)
|
#if defined(TC_M68K)
|
||||||
ri.r_type = (fixP->fx_pcrel ?
|
ri_table[i].r_type = (fixP->fx_pcrel ?
|
||||||
(fixP->fx_size == 1 ? R_PCRBYTE :
|
(fixP->fx_size == 1 ? R_PCRBYTE :
|
||||||
fixP->fx_size == 2 ? R_PCRWORD :
|
fixP->fx_size == 2 ? R_PCRWORD :
|
||||||
R_PCRLONG):
|
R_PCRLONG):
|
||||||
(fixP->fx_size == 1 ? R_RELBYTE :
|
(fixP->fx_size == 1 ? R_RELBYTE :
|
||||||
fixP->fx_size == 2 ? R_RELWORD :
|
fixP->fx_size == 2 ? R_RELWORD :
|
||||||
R_RELLONG));
|
R_RELLONG));
|
||||||
#elif defined(TC_I386)
|
#elif defined(TC_I386)
|
||||||
/* FIXME-SOON R_OFF8 & R_DIR16 are a vague guess, completly untested. */
|
/* FIXME-SOON R_OFF8 & R_DIR16 are a vague guess, completly
|
||||||
ri.r_type = (fixP->fx_pcrel ?
|
untested. */
|
||||||
(fixP->fx_size == 1 ? R_PCRBYTE :
|
ri_table[i].r_type = (fixP->fx_pcrel ?
|
||||||
fixP->fx_size == 2 ? R_PCRWORD :
|
(fixP->fx_size == 1 ? R_PCRBYTE :
|
||||||
R_PCRLONG):
|
fixP->fx_size == 2 ? R_PCRWORD :
|
||||||
(fixP->fx_size == 1 ? R_OFF8 :
|
R_PCRLONG):
|
||||||
fixP->fx_size == 2 ? R_DIR16 :
|
(fixP->fx_size == 1 ? R_OFF8 :
|
||||||
R_DIR32));
|
fixP->fx_size == 2 ? R_DIR16 :
|
||||||
|
R_DIR32));
|
||||||
#elif defined(TC_I960)
|
#elif defined(TC_I960)
|
||||||
ri.r_type = (fixP->fx_pcrel
|
ri_table[i].r_type = (fixP->fx_pcrel
|
||||||
? R_IPRMED
|
? R_IPRMED
|
||||||
: R_RELLONG);
|
: R_RELLONG);
|
||||||
|
callj_table[i] = fixP->fx_callj ? 1 : 0;
|
||||||
#elif defined(TC_A29K)
|
#elif defined(TC_A29K)
|
||||||
ri.r_type = tc_coff_fix2rtype(fixP);
|
ri_table[i].r_type = tc_coff_fix2rtype(fixP);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
you lose
|
#error you lose
|
||||||
#endif /* TC_M68K || TC_I386 */
|
#endif /* TC_M68K || TC_I386 */
|
||||||
ri.r_vaddr = fixP->fx_frag->fr_address + fixP->fx_where;
|
ri_table[i].r_vaddr = (fixP->fx_frag->fr_address
|
||||||
|
+ fixP->fx_where);
|
||||||
/* If symbol associated to relocation entry is a bss symbol
|
/* If symbol associated to relocation entry is a bss symbol
|
||||||
or undefined symbol just remember the index of the symbol.
|
or undefined symbol just remember the index of the symbol.
|
||||||
Otherwise store the index of the symbol describing the
|
Otherwise store the index of the symbol describing the
|
||||||
@ -225,62 +258,78 @@ relax_addressT segment_address_in_file;
|
|||||||
number because they won't be emitted in the final object.
|
number because they won't be emitted in the final object.
|
||||||
In the case where they are in the BSS section, this leads
|
In the case where they are in the BSS section, this leads
|
||||||
to an incorrect r_symndx.
|
to an incorrect r_symndx.
|
||||||
Under bsd the loader do not care if the symbol reference is
|
Under bsd the loader do not care if the symbol reference
|
||||||
incorrect. But the SYS V ld complains about this. To avoid
|
is incorrect. But the SYS V ld complains about this. To
|
||||||
this we associate the symbol to the associated section,
|
avoid this we associate the symbol to the associated
|
||||||
*even* if it is the BSS section. */
|
section, *even* if it is the BSS section. */
|
||||||
/* If someone can tell me why the other symbols of the bss
|
/* If someone can tell me why the other symbols of the bss
|
||||||
section are not associated with the .bss section entry,
|
section are not associated with the .bss section entry,
|
||||||
I'd be gratefull. I guess that it has to do with the special
|
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
|
nature of the .bss section. Or maybe this is because the
|
||||||
bss symbols are declared in the common section and can
|
bss symbols are declared in the common section and can
|
||||||
be resized later. Can it break code some where ? */
|
be resized later. Can it break code some where ? */
|
||||||
ri.r_symndx = (S_GET_SEGMENT(symbolP) == SEG_TEXT
|
ri_table[i].r_symndx = (S_GET_SEGMENT(symbolP) == SEG_TEXT
|
||||||
? dot_text_symbol->sy_number
|
? dot_text_symbol->sy_number
|
||||||
: (S_GET_SEGMENT(symbolP) == SEG_DATA
|
: (S_GET_SEGMENT(symbolP) == SEG_DATA
|
||||||
? dot_data_symbol->sy_number
|
? dot_data_symbol->sy_number
|
||||||
: ((SF_GET_LOCAL(symbolP)
|
: ((SF_GET_LOCAL(symbolP)
|
||||||
? dot_bss_symbol->sy_number
|
? dot_bss_symbol->sy_number
|
||||||
: symbolP->sy_number)))); /* bss or undefined */
|
: symbolP->sy_number)))); /* bss or undefined */
|
||||||
|
|
||||||
/* md_ri_to_chars((char *) &ri, ri); */ /* Last step : write md f */
|
/* md_ri_to_chars((char *) &ri, ri); */ /* Last step : write md f */
|
||||||
|
|
||||||
|
i++;
|
||||||
#ifdef BFD_HEADERS
|
|
||||||
*where += bfd_coff_swap_reloc_out(stdoutput, &ri, *where);
|
|
||||||
#if defined(TC_A29K)
|
|
||||||
/* The 29k has a special kludge for the high 16 bit reloc.
|
|
||||||
Two relocations are emmited, R_IHIHALF, and R_IHCONST. The second one
|
|
||||||
doesn't contain a symbol, but uses the value for offset */
|
|
||||||
if (ri.r_type == R_IHIHALF) {
|
|
||||||
/* now emit the second bit */
|
|
||||||
ri.r_type = R_IHCONST;
|
|
||||||
ri.r_symndx = fixP->fx_addnumber;
|
|
||||||
*where += bfd_coff_swap_reloc_out(stdoutput, &ri, *where);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
append(where, (char *) &ri, sizeof(ri));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TC_I960
|
|
||||||
if (fixP->fx_callj) {
|
|
||||||
ri.r_type = R_OPTCALL;
|
|
||||||
#ifdef BFD_HEADERS
|
|
||||||
*where += bfd_coff_swap_reloc_out(stdoutput, &ri, *where);
|
|
||||||
#else
|
|
||||||
append(where, (char *) &ri, sizeof(ri));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
} /* if it's a callj, do it again for the opcode */
|
|
||||||
#endif /* TC_I960 */
|
|
||||||
|
|
||||||
} /* if there's a symbol */
|
} /* if there's a symbol */
|
||||||
} /* for each fixP */
|
} /* for each fixP */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AIX ld prefer to have the reloc table with r_vaddr sorted.
|
||||||
|
* But sorting it should not hurt any other ld.
|
||||||
|
*/
|
||||||
|
qsort (ri_table, count, sizeof(*ri_table), reloc_compare);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
#ifdef BFD_HEADERS
|
||||||
|
*where += bfd_coff_swap_reloc_out(stdoutput, &ri_table[i], *where);
|
||||||
|
# ifdef TC_A29K
|
||||||
|
/* The 29k has a special kludge for the high 16 bit reloc.
|
||||||
|
Two relocations are emmited, R_IHIHALF, and R_IHCONST.
|
||||||
|
The second one doesn't contain a symbol, but uses the
|
||||||
|
value for offset */
|
||||||
|
if (ri_table[i].r_type == R_IHIHALF)
|
||||||
|
{
|
||||||
|
/* now emit the second bit */
|
||||||
|
ri_table[i].r_type = R_IHCONST;
|
||||||
|
ri_table[i].r_symndx = fixP->fx_addnumber;
|
||||||
|
*where += bfd_coff_swap_reloc_out(stdoutput, &ri_table[i],
|
||||||
|
*where);
|
||||||
|
}
|
||||||
|
# endif /* TC_A29K */
|
||||||
|
|
||||||
|
#else /* not BFD_HEADERS */
|
||||||
|
append(where, (char *) &ri_table[i], RELSZ);
|
||||||
|
#endif /* not BFD_HEADERS */
|
||||||
|
|
||||||
|
#ifdef TC_I960
|
||||||
|
if (callj_table[i])
|
||||||
|
{
|
||||||
|
ri_table[i].r_type = R_OPTCALL;
|
||||||
|
# ifdef BFD_HEADERS
|
||||||
|
*where += bfd_coff_swap_reloc_out(stdoutput, &ri_table[i],
|
||||||
|
*where);
|
||||||
|
# else
|
||||||
|
append(where, (char *) &ri_table[i], (unsigned long)RELSZ);
|
||||||
|
# endif /* BFD_HEADERS */
|
||||||
|
} /* if it's a callj, do it again for the opcode */
|
||||||
|
#endif /* TC_I960 */
|
||||||
|
}
|
||||||
|
|
||||||
|
free (ri_table);
|
||||||
|
#ifdef TC_I960
|
||||||
|
free (callj_table);
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} /* obj_emit_relocations() */
|
} /* obj_emit_relocations() */
|
||||||
|
|
||||||
@ -351,9 +400,9 @@ object_headers *headers;
|
|||||||
|
|
||||||
#else /* CROSS_COMPILE */
|
#else /* CROSS_COMPILE */
|
||||||
|
|
||||||
append(where, (char *) &headers->filehdr, sizeof(headers->filehdr));
|
append(where, (char *) &headers->filehdr, FILHSZ);
|
||||||
#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
|
#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
|
||||||
append(where, (char *) &headers->aouthdr, sizeof(headers->aouthdr));
|
append(where, (char *) &headers->aouthdr, AOUTHDRSZ);
|
||||||
#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
|
#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
|
||||||
|
|
||||||
#endif /* CROSS_COMPILE */
|
#endif /* CROSS_COMPILE */
|
||||||
@ -409,7 +458,7 @@ symbolS *symbolP;
|
|||||||
md_number_to_chars(*where, syment->n_numaux, sizeof(syment->n_numaux));
|
md_number_to_chars(*where, syment->n_numaux, sizeof(syment->n_numaux));
|
||||||
*where += sizeof(syment->n_numaux);
|
*where += sizeof(syment->n_numaux);
|
||||||
#else /* CROSS_COMPILE */
|
#else /* CROSS_COMPILE */
|
||||||
append(where, (char *) syment, sizeof(*syment));
|
append(where, (char *) syment, SYMESZ);
|
||||||
#endif /* CROSS_COMPILE */
|
#endif /* CROSS_COMPILE */
|
||||||
|
|
||||||
/* Should do the following : if (.file entry) MD(..)... else if (static entry) MD(..) */
|
/* Should do the following : if (.file entry) MD(..)... else if (static entry) MD(..) */
|
||||||
@ -458,7 +507,7 @@ symbolS *symbolP;
|
|||||||
}
|
}
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
#else /* CROSS_COMPILE */
|
#else /* CROSS_COMPILE */
|
||||||
append(where, (char *) &symbolP->sy_symbol.ost_auxent[i], sizeof(symbolP->sy_symbol.ost_auxent[i]));
|
append(where, (char *) &symbolP->sy_symbol.ost_auxent[i], AUXESZ);
|
||||||
#endif /* CROSS_COMPILE */
|
#endif /* CROSS_COMPILE */
|
||||||
|
|
||||||
}; /* for each aux in use */
|
}; /* for each aux in use */
|
||||||
@ -516,7 +565,7 @@ SCNHDR *header;
|
|||||||
|
|
||||||
#else /* CROSS_COMPILE */
|
#else /* CROSS_COMPILE */
|
||||||
|
|
||||||
append(where, (char *) header, sizeof(*header));
|
append(where, (char *) header, SCNHSZ);
|
||||||
|
|
||||||
#endif /* CROSS_COMPILE */
|
#endif /* CROSS_COMPILE */
|
||||||
|
|
||||||
@ -544,7 +593,7 @@ symbolS *symbol_rootP;
|
|||||||
S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
|
S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
|
||||||
S_SET_ZEROES(symbolP, 0);
|
S_SET_ZEROES(symbolP, 0);
|
||||||
} else {
|
} else {
|
||||||
bzero(symbolP->sy_symbol.ost_entry.n_name, SYMNMLEN);
|
memset(symbolP->sy_symbol.ost_entry.n_name, '\0', SYMNMLEN);
|
||||||
strncpy(symbolP->sy_symbol.ost_entry.n_name, temp, SYMNMLEN);
|
strncpy(symbolP->sy_symbol.ost_entry.n_name, temp, SYMNMLEN);
|
||||||
}
|
}
|
||||||
obj_symbol_to_chars(where, symbolP);
|
obj_symbol_to_chars(where, symbolP);
|
||||||
@ -797,7 +846,7 @@ symbolS *symbolP;
|
|||||||
/* Additional information */
|
/* Additional information */
|
||||||
symbolP->sy_symbol.ost_flags = 0;
|
symbolP->sy_symbol.ost_flags = 0;
|
||||||
/* Auxiliary entries */
|
/* Auxiliary entries */
|
||||||
bzero((char*)&symbolP->sy_symbol.ost_auxent[0], AUXESZ);
|
memset((char*) &symbolP->sy_symbol.ost_auxent[0], '\0', AUXESZ);
|
||||||
|
|
||||||
#ifdef STRIP_UNDERSCORE
|
#ifdef STRIP_UNDERSCORE
|
||||||
/* Remove leading underscore at the beginning of the symbol.
|
/* Remove leading underscore at the beginning of the symbol.
|
||||||
@ -933,7 +982,7 @@ int what;
|
|||||||
SKIP_WHITESPACES();
|
SKIP_WHITESPACES();
|
||||||
|
|
||||||
def_symbol_in_progress = (symbolS *) obstack_alloc(¬es, sizeof(*def_symbol_in_progress));
|
def_symbol_in_progress = (symbolS *) obstack_alloc(¬es, sizeof(*def_symbol_in_progress));
|
||||||
bzero(def_symbol_in_progress, sizeof(*def_symbol_in_progress));
|
memset(def_symbol_in_progress, '\0', sizeof(*def_symbol_in_progress));
|
||||||
|
|
||||||
symbol_name = input_line_pointer;
|
symbol_name = input_line_pointer;
|
||||||
name_end = get_symbol_end();
|
name_end = get_symbol_end();
|
||||||
@ -1349,7 +1398,8 @@ object_headers *headers;
|
|||||||
+ S_GET_VALUE(symbolP->sy_forward)
|
+ S_GET_VALUE(symbolP->sy_forward)
|
||||||
+ symbolP->sy_forward->sy_frag->fr_address));
|
+ symbolP->sy_forward->sy_frag->fr_address));
|
||||||
|
|
||||||
if (SF_GET_GET_SEGMENT(symbolP)) {
|
if (SF_GET_GET_SEGMENT(symbolP) &&
|
||||||
|
S_GET_SEGMENT(symbolP) == SEG_UNKNOWN) {
|
||||||
S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward));
|
S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward));
|
||||||
} /* forward segment also */
|
} /* forward segment also */
|
||||||
|
|
||||||
@ -1385,6 +1435,9 @@ object_headers *headers;
|
|||||||
H_GET_TEXT_SIZE(headers),
|
H_GET_TEXT_SIZE(headers),
|
||||||
0/*text_relocation_number */,
|
0/*text_relocation_number */,
|
||||||
0/*text_lineno_number */);
|
0/*text_lineno_number */);
|
||||||
|
symbol_remove(dot_text_symbol, &symbol_rootP, &symbol_lastP);
|
||||||
|
symbol_append(dot_text_symbol, previous_file_symbol,
|
||||||
|
&symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
dot_data_symbol = (symbolS*)
|
dot_data_symbol = (symbolS*)
|
||||||
c_section_symbol(".data",
|
c_section_symbol(".data",
|
||||||
@ -1392,6 +1445,9 @@ object_headers *headers;
|
|||||||
H_GET_DATA_SIZE(headers),
|
H_GET_DATA_SIZE(headers),
|
||||||
0/*data_relocation_number */,
|
0/*data_relocation_number */,
|
||||||
0); /* There are no data lineno entries */
|
0); /* There are no data lineno entries */
|
||||||
|
symbol_remove(dot_data_symbol, &symbol_rootP, &symbol_lastP);
|
||||||
|
symbol_append(dot_data_symbol, dot_text_symbol,
|
||||||
|
&symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
dot_bss_symbol = (symbolS*)
|
dot_bss_symbol = (symbolS*)
|
||||||
c_section_symbol(".bss",
|
c_section_symbol(".bss",
|
||||||
@ -1399,6 +1455,9 @@ object_headers *headers;
|
|||||||
H_GET_BSS_SIZE(headers),
|
H_GET_BSS_SIZE(headers),
|
||||||
0, /* No relocation for a bss section. */
|
0, /* No relocation for a bss section. */
|
||||||
0); /* There are no bss lineno entries */
|
0); /* There are no bss lineno entries */
|
||||||
|
symbol_remove(dot_bss_symbol, &symbol_rootP, &symbol_lastP);
|
||||||
|
symbol_append(dot_bss_symbol, dot_data_symbol,
|
||||||
|
&symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
verify_symbol_chain(symbol_rootP, symbol_lastP);
|
verify_symbol_chain(symbol_rootP, symbol_lastP);
|
||||||
@ -1495,8 +1554,8 @@ object_headers *headers;
|
|||||||
} /* make it at least 1 */
|
} /* make it at least 1 */
|
||||||
|
|
||||||
/* Clobber possible stale .dim information. */
|
/* Clobber possible stale .dim information. */
|
||||||
bzero(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen,
|
memset(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen,
|
||||||
sizeof(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen));
|
'\0', sizeof(symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen));
|
||||||
}
|
}
|
||||||
/* The C_FCN doesn't need any additional information.
|
/* The C_FCN doesn't need any additional information.
|
||||||
I don't even know if this is needed for sdb. But the
|
I don't even know if this is needed for sdb. But the
|
||||||
@ -1544,8 +1603,8 @@ object_headers *headers;
|
|||||||
/* next pointer remains valid */
|
/* next pointer remains valid */
|
||||||
symbol_remove(symbolP, &symbol_rootP, &symbol_lastP);
|
symbol_remove(symbolP, &symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
} else if (!S_IS_DEFINED(symbolP) && !S_IS_DEBUG(symbolP) && !SF_GET_STATICS(symbolP)) {
|
} else if (/*!S_IS_DEFINED(symbolP) && !S_IS_DEBUG(symbolP) && !SF_GET_STATICS(symbolP) */
|
||||||
/* S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP)) { */
|
S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP)) {
|
||||||
/* if external, Remove from the list */
|
/* if external, Remove from the list */
|
||||||
symbolS *hold = symbol_previous(symbolP);
|
symbolS *hold = symbol_previous(symbolP);
|
||||||
|
|
||||||
@ -1733,10 +1792,18 @@ object_headers *headers;
|
|||||||
#endif
|
#endif
|
||||||
/* symbol table size allready set */
|
/* symbol table size allready set */
|
||||||
H_SET_SIZEOF_OPTIONAL_HEADER(headers, OBJ_COFF_AOUTHDRSZ);
|
H_SET_SIZEOF_OPTIONAL_HEADER(headers, OBJ_COFF_AOUTHDRSZ);
|
||||||
|
|
||||||
|
/* do not added the F_RELFLG for the standard COFF.
|
||||||
|
* The AIX linker complain on file with relocation info striped flag.
|
||||||
|
*/
|
||||||
|
#ifdef KEEP_RELOC_INFO
|
||||||
|
H_SET_FLAGS(headers, (text_lineno_number == 0 ? F_LNNO : 0)
|
||||||
|
| BYTE_ORDERING);
|
||||||
|
#else
|
||||||
H_SET_FLAGS(headers, (text_lineno_number == 0 ? F_LNNO : 0)
|
H_SET_FLAGS(headers, (text_lineno_number == 0 ? F_LNNO : 0)
|
||||||
| ((text_relocation_number + data_relocation_number) ? 0 : F_RELFLG)
|
| ((text_relocation_number + data_relocation_number) ? 0 : F_RELFLG)
|
||||||
| BYTE_ORDERING);
|
| BYTE_ORDERING);
|
||||||
|
#endif
|
||||||
/* aouthdr */
|
/* aouthdr */
|
||||||
/* magic number allready set */
|
/* magic number allready set */
|
||||||
H_SET_VERSION_STAMP(headers, 0);
|
H_SET_VERSION_STAMP(headers, 0);
|
||||||
|
@ -239,6 +239,7 @@ void dummy ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pseudo_typeS md_pseudo_table[] = {
|
const pseudo_typeS md_pseudo_table[] = {
|
||||||
|
{ "align", s_align_bytes, 0 },
|
||||||
{ "ffloat", float_cons, 'f' },
|
{ "ffloat", float_cons, 'f' },
|
||||||
{ "dfloat", float_cons, 'd' },
|
{ "dfloat", float_cons, 'd' },
|
||||||
{ "tfloat", float_cons, 'x' },
|
{ "tfloat", float_cons, 'x' },
|
||||||
@ -1308,17 +1309,17 @@ char *operand_string;
|
|||||||
if ((r->reg_type & (SReg2|SReg3)) && op_string[3] == ':') {
|
if ((r->reg_type & (SReg2|SReg3)) && op_string[3] == ':') {
|
||||||
switch (r->reg_num) {
|
switch (r->reg_num) {
|
||||||
case 0:
|
case 0:
|
||||||
i.seg = &es; break;
|
i.seg = (seg_entry *) &es; break;
|
||||||
case 1:
|
case 1:
|
||||||
i.seg = &cs; break;
|
i.seg = (seg_entry *) &cs; break;
|
||||||
case 2:
|
case 2:
|
||||||
i.seg = &ss; break;
|
i.seg = (seg_entry *) &ss; break;
|
||||||
case 3:
|
case 3:
|
||||||
i.seg = &ds; break;
|
i.seg = (seg_entry *) &ds; break;
|
||||||
case 4:
|
case 4:
|
||||||
i.seg = &fs; break;
|
i.seg = (seg_entry *) &fs; break;
|
||||||
case 5:
|
case 5:
|
||||||
i.seg = &gs; break;
|
i.seg = (seg_entry *) &gs; break;
|
||||||
}
|
}
|
||||||
op_string += 4; /* skip % <x> s : */
|
op_string += 4; /* skip % <x> s : */
|
||||||
operand_string = op_string; /* Pretend given string starts here. */
|
operand_string = op_string; /* Pretend given string starts here. */
|
||||||
@ -1572,6 +1573,13 @@ char *operand_string;
|
|||||||
as_bad("register size mismatch in (base,index,scale) expression");
|
as_bad("register size mismatch in (base,index,scale) expression");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* special case for (%dx) while doing input/output op
|
||||||
|
*/
|
||||||
|
if ((i.base_reg &&
|
||||||
|
(i.base_reg->reg_type == (Reg16|InOutPortReg)) &&
|
||||||
|
(i.index_reg == 0)))
|
||||||
|
return 1;
|
||||||
if ((i.base_reg && (i.base_reg->reg_type & Reg32) == 0) ||
|
if ((i.base_reg && (i.base_reg->reg_type & Reg32) == 0) ||
|
||||||
(i.index_reg && (i.index_reg->reg_type & Reg32) == 0)) {
|
(i.index_reg && (i.index_reg->reg_type & Reg32) == 0)) {
|
||||||
as_bad("base/index register must be 32 bit register");
|
as_bad("base/index register must be 32 bit register");
|
||||||
@ -1718,7 +1726,7 @@ register fragS * fragP;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* now put displacement after opcode */
|
/* now put displacement after opcode */
|
||||||
md_number_to_chars (where_to_put_displacement,
|
md_number_to_chars ((char *) where_to_put_displacement,
|
||||||
displacement_from_opcode_start - extension,
|
displacement_from_opcode_start - extension,
|
||||||
SIZE_FROM_RELAX_STATE (fragP->fr_subtype));
|
SIZE_FROM_RELAX_STATE (fragP->fr_subtype));
|
||||||
fragP -> fr_fix += extension;
|
fragP -> fr_fix += extension;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# This file is configure.inj
|
# This file is configure.in
|
||||||
#
|
#
|
||||||
# Copyright (C) 1987-1992 Free Software Foundation, Inc.
|
# Copyright (C) 1987-1992 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
@ -40,6 +40,11 @@ mips)
|
|||||||
ultrix) gas_host=decstation ;;
|
ultrix) gas_host=decstation ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
i386)
|
||||||
|
case "${host_os}" in
|
||||||
|
aix*) gas_host=i386aix ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
ansi | ultrix | hpux | sysv*) gas_host=${host_os} ;;
|
ansi | ultrix | hpux | sysv*) gas_host=${host_os} ;;
|
||||||
@ -67,6 +72,14 @@ cpu_type=${target_cpu}
|
|||||||
|
|
||||||
# assign object format
|
# assign object format
|
||||||
case ${target_os} in
|
case ${target_os} in
|
||||||
|
aix*)
|
||||||
|
case "${target_cpu}" in
|
||||||
|
i386) obj_format=coff
|
||||||
|
target_cpu=i386aix
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
bout*) obj_format=bout ;;
|
bout*) obj_format=bout ;;
|
||||||
nindy*) obj_format=bout ;;
|
nindy*) obj_format=bout ;;
|
||||||
bsd* | sunos*) obj_format=aout ;;
|
bsd* | sunos*) obj_format=aout ;;
|
||||||
|
44
gas/read.c
44
gas/read.c
@ -39,6 +39,9 @@
|
|||||||
|
|
||||||
char *input_line_pointer; /*->next char of source file to parse. */
|
char *input_line_pointer; /*->next char of source file to parse. */
|
||||||
|
|
||||||
|
#ifndef NOP_OPCODE
|
||||||
|
# define NOP_OPCODE 0x00
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BITS_PER_CHAR != 8
|
#if BITS_PER_CHAR != 8
|
||||||
The following table is indexed by [ (char) ] and will break if
|
The following table is indexed by [ (char) ] and will break if
|
||||||
@ -180,6 +183,7 @@ static const pseudo_typeS
|
|||||||
{ "asciz", stringer, 1 },
|
{ "asciz", stringer, 1 },
|
||||||
/* block */
|
/* block */
|
||||||
{ "byte", cons, 1 },
|
{ "byte", cons, 1 },
|
||||||
|
{ "bss", s_bss, 0 },
|
||||||
{ "comm", s_comm, 0 },
|
{ "comm", s_comm, 0 },
|
||||||
{ "data", s_data, 0 },
|
{ "data", s_data, 0 },
|
||||||
/* dim */
|
/* dim */
|
||||||
@ -626,7 +630,7 @@ int arg;
|
|||||||
input_line_pointer ++;
|
input_line_pointer ++;
|
||||||
temp_fill = get_absolute_expression ();
|
temp_fill = get_absolute_expression ();
|
||||||
} else {
|
} else {
|
||||||
temp_fill = 0;
|
temp_fill = NOP_OPCODE;
|
||||||
}
|
}
|
||||||
/* Only make a frag if we HAVE to. . . */
|
/* Only make a frag if we HAVE to. . . */
|
||||||
if (temp && ! need_pass_2)
|
if (temp && ! need_pass_2)
|
||||||
@ -652,7 +656,7 @@ void s_align_ptwo() {
|
|||||||
input_line_pointer ++;
|
input_line_pointer ++;
|
||||||
temp_fill = get_absolute_expression ();
|
temp_fill = get_absolute_expression ();
|
||||||
} else
|
} else
|
||||||
temp_fill = 0;
|
temp_fill = NOP_OPCODE;
|
||||||
/* Only make a frag if we HAVE to. . . */
|
/* Only make a frag if we HAVE to. . . */
|
||||||
if (temp && ! need_pass_2)
|
if (temp && ! need_pass_2)
|
||||||
frag_align (temp, (int)temp_fill);
|
frag_align (temp, (int)temp_fill);
|
||||||
@ -662,6 +666,17 @@ void s_align_ptwo() {
|
|||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
} /* s_align_ptwo() */
|
} /* s_align_ptwo() */
|
||||||
|
|
||||||
|
|
||||||
|
void s_bss()
|
||||||
|
{
|
||||||
|
register int temp;
|
||||||
|
|
||||||
|
temp = get_absolute_expression ();
|
||||||
|
subseg_new (SEG_BSS, (subsegT)temp);
|
||||||
|
demand_empty_rest_of_line();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void s_comm() {
|
void s_comm() {
|
||||||
register char *name;
|
register char *name;
|
||||||
register char c;
|
register char c;
|
||||||
@ -1796,12 +1811,7 @@ void stringer(append_zero ) /* Worker to do .ascii etc statements. */
|
|||||||
/* Checks end-of-line. */
|
/* Checks end-of-line. */
|
||||||
register int append_zero; /* 0: don't append '\0', else 1 */
|
register int append_zero; /* 0: don't append '\0', else 1 */
|
||||||
{
|
{
|
||||||
/* register char * p; JF unused */
|
unsigned int c;
|
||||||
/* register int length; JF unused */ /* Length of string we read, excluding */
|
|
||||||
/* trailing '\0' implied by closing quote. */
|
|
||||||
/* register char * where; JF unused */
|
|
||||||
/* register fragS * fragP; JF unused */
|
|
||||||
register unsigned int c;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following awkward logic is to parse ZERO or more strings,
|
* The following awkward logic is to parse ZERO or more strings,
|
||||||
@ -1811,16 +1821,14 @@ register int append_zero; /* 0: don't append '\0', else 1 */
|
|||||||
* a 1st, expression. We keep demanding expressions for each
|
* a 1st, expression. We keep demanding expressions for each
|
||||||
* ','.
|
* ','.
|
||||||
*/
|
*/
|
||||||
if (is_it_end_of_statement())
|
if (is_it_end_of_statement()) {
|
||||||
{
|
c = 0; /* Skip loop. */
|
||||||
c = 0; /* Skip loop. */
|
++ input_line_pointer; /* Compensate for end of loop. */
|
||||||
++ input_line_pointer; /* Compensate for end of loop. */
|
} else {
|
||||||
}
|
c = ','; /* Do loop. */
|
||||||
else
|
}
|
||||||
{
|
|
||||||
c = ','; /* Do loop. */
|
while (c == ',' || c == '<' || c == '"') {
|
||||||
}
|
|
||||||
while (c == ',' || c == '<' || c == '"' ) {
|
|
||||||
SKIP_WHITESPACE();
|
SKIP_WHITESPACE();
|
||||||
switch (*input_line_pointer) {
|
switch (*input_line_pointer) {
|
||||||
case '\"':
|
case '\"':
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* subsegs.c - subsegments -
|
/* subsegs.c - subsegments -
|
||||||
Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GAS, the GNU Assembler.
|
This file is part of GAS, the GNU Assembler.
|
||||||
|
|
||||||
@ -35,7 +35,8 @@ frchainS* frchain_root,
|
|||||||
#else
|
#else
|
||||||
frchainS* frchain_root,
|
frchainS* frchain_root,
|
||||||
* frchain_now, /* Commented in "subsegs.h". */
|
* frchain_now, /* Commented in "subsegs.h". */
|
||||||
* data0_frchainP;
|
* data0_frchainP,
|
||||||
|
* bss0_frchainP;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
char * const /* in: segT out: char* */
|
char * const /* in: segT out: char* */
|
||||||
@ -108,6 +109,8 @@ void
|
|||||||
#else
|
#else
|
||||||
subseg_new (SEG_DATA, 0); /* .data 0 */
|
subseg_new (SEG_DATA, 0); /* .data 0 */
|
||||||
data0_frchainP = frchain_now;
|
data0_frchainP = frchain_now;
|
||||||
|
subseg_new (SEG_BSS, 0);
|
||||||
|
bss0_frchainP = frchain_now;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -133,7 +136,12 @@ register int subseg;
|
|||||||
seg_fix_rootP = & segment_info[seg].fix_root;
|
seg_fix_rootP = & segment_info[seg].fix_root;
|
||||||
seg_fix_tailP = & segment_info[seg].fix_tail;
|
seg_fix_tailP = & segment_info[seg].fix_tail;
|
||||||
#else
|
#else
|
||||||
if (seg == SEG_DATA)
|
if (seg == SEG_BSS)
|
||||||
|
{
|
||||||
|
seg_fix_rootP = & bss_fix_root;
|
||||||
|
seg_fix_tailP = & bss_fix_tail;
|
||||||
|
}
|
||||||
|
else if (seg == SEG_DATA)
|
||||||
{
|
{
|
||||||
seg_fix_rootP = & data_fix_root;
|
seg_fix_rootP = & data_fix_root;
|
||||||
seg_fix_tailP = & data_fix_tail;
|
seg_fix_tailP = & data_fix_tail;
|
||||||
@ -165,12 +173,12 @@ register int subseg;
|
|||||||
|
|
||||||
void
|
void
|
||||||
subseg_new (seg, subseg) /* begin assembly for a new sub-segment */
|
subseg_new (seg, subseg) /* begin assembly for a new sub-segment */
|
||||||
register segT seg; /* SEG_DATA or SEG_TEXT */
|
register segT seg; /* SEG_DATA or SEG_TEXT or SEG_BSS */
|
||||||
register subsegT subseg;
|
register subsegT subseg;
|
||||||
{
|
{
|
||||||
long tmp; /* JF for obstack alignment hacking */
|
long tmp; /* JF for obstack alignment hacking */
|
||||||
#ifndef MANY_SEGMENTS
|
#ifndef MANY_SEGMENTS
|
||||||
know( seg == SEG_DATA || seg == SEG_TEXT );
|
know( seg == SEG_DATA || seg == SEG_TEXT || seg == SEG_BSS);
|
||||||
#endif
|
#endif
|
||||||
if (seg != now_seg || subseg != now_subseg)
|
if (seg != now_seg || subseg != now_subseg)
|
||||||
{ /* we just changed sub-segments */
|
{ /* we just changed sub-segments */
|
||||||
|
82
gas/write.c
82
gas/write.c
@ -34,12 +34,22 @@
|
|||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include "output-file.h"
|
#include "output-file.h"
|
||||||
|
|
||||||
|
/* The NOP_OPCODE is for the alignment fill value.
|
||||||
|
* fill it a nop instruction so that the disassembler does not choke
|
||||||
|
* on it
|
||||||
|
*/
|
||||||
|
#ifndef NOP_OPCODE
|
||||||
|
#define NOP_OPCODE 0x00
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MANY_SEGMENTS
|
#ifndef MANY_SEGMENTS
|
||||||
static struct frag *text_frag_root;
|
static struct frag *text_frag_root;
|
||||||
static struct frag *data_frag_root;
|
static struct frag *data_frag_root;
|
||||||
|
static struct frag *bss_frag_root;
|
||||||
|
|
||||||
static struct frag *text_last_frag; /* Last frag in segment. */
|
static struct frag *text_last_frag; /* Last frag in segment. */
|
||||||
static struct frag *data_last_frag; /* Last frag in segment. */
|
static struct frag *data_last_frag; /* Last frag in segment. */
|
||||||
|
static struct frag *bss_last_frag; /* Last frag in segment. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static object_headers headers;
|
static object_headers headers;
|
||||||
@ -79,7 +89,7 @@ void relax_segment();
|
|||||||
fixS *fix_new(frag, where, size, add_symbol, sub_symbol, offset, pcrel, r_type)
|
fixS *fix_new(frag, where, size, add_symbol, sub_symbol, offset, pcrel, r_type)
|
||||||
fragS *frag; /* Which frag? */
|
fragS *frag; /* Which frag? */
|
||||||
int where; /* Where in that frag? */
|
int where; /* Where in that frag? */
|
||||||
short int size; /* 1, 2 or 4 usually. */
|
short int size; /* 1, 2, or 4 usually. */
|
||||||
symbolS *add_symbol; /* X_add_symbol. */
|
symbolS *add_symbol; /* X_add_symbol. */
|
||||||
symbolS *sub_symbol; /* X_subtract_symbol. */
|
symbolS *sub_symbol; /* X_subtract_symbol. */
|
||||||
long offset; /* X_add_number. */
|
long offset; /* X_add_number. */
|
||||||
@ -174,7 +184,7 @@ void write_object_file()
|
|||||||
#define SUB_SEGMENT_ALIGN ((frchainP->frch_seg != SEG_DATA) ? 2 : 0)
|
#define SUB_SEGMENT_ALIGN ((frchainP->frch_seg != SEG_DATA) ? 2 : 0)
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
subseg_new (frchainP->frch_seg, frchainP->frch_subseg);
|
subseg_new (frchainP->frch_seg, frchainP->frch_subseg);
|
||||||
frag_align (SUB_SEGMENT_ALIGN, 0);
|
frag_align (SUB_SEGMENT_ALIGN, NOP_OPCODE);
|
||||||
/* frag_align will have left a new frag. */
|
/* frag_align will have left a new frag. */
|
||||||
/* Use this last frag for an empty ".fill". */
|
/* Use this last frag for an empty ".fill". */
|
||||||
/*
|
/*
|
||||||
@ -197,17 +207,23 @@ void write_object_file()
|
|||||||
for (frchainP = frchain_root; frchainP; frchainP = next_frchainP) {
|
for (frchainP = frchain_root; frchainP; frchainP = next_frchainP) {
|
||||||
know( frchainP->frch_root );
|
know( frchainP->frch_root );
|
||||||
* prev_fragPP = frchainP->frch_root;
|
* prev_fragPP = frchainP->frch_root;
|
||||||
prev_fragPP = & frchainP->frch_last->fr_next;
|
prev_fragPP = & frchainP->frch_last->fr_next;
|
||||||
|
next_frchainP = frchainP->frch_next;
|
||||||
if (((next_frchainP = frchainP->frch_next) == NULL)
|
|
||||||
|| next_frchainP == data0_frchainP) {
|
if (next_frchainP == NULL)
|
||||||
prev_fragPP = & data_frag_root;
|
{
|
||||||
if (next_frchainP) {
|
bss_last_frag = frchainP->frch_last;
|
||||||
text_last_frag = frchainP->frch_last;
|
}
|
||||||
} else {
|
else if (next_frchainP == data0_frchainP)
|
||||||
data_last_frag = frchainP->frch_last;
|
{
|
||||||
}
|
text_last_frag = frchainP->frch_last;
|
||||||
}
|
prev_fragPP = & data_frag_root;
|
||||||
|
}
|
||||||
|
else if (next_frchainP == bss0_frchainP)
|
||||||
|
{
|
||||||
|
data_last_frag = frchainP->frch_last;
|
||||||
|
prev_fragPP = & bss_frag_root;
|
||||||
|
}
|
||||||
} /* walk the frag chain */
|
} /* walk the frag chain */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -232,6 +248,7 @@ void write_object_file()
|
|||||||
|
|
||||||
relax_segment(text_frag_root, SEG_TEXT);
|
relax_segment(text_frag_root, SEG_TEXT);
|
||||||
relax_segment(data_frag_root, SEG_DATA);
|
relax_segment(data_frag_root, SEG_DATA);
|
||||||
|
relax_segment(bss_frag_root, SEG_BSS);
|
||||||
/*
|
/*
|
||||||
* Now the addresses of frags are correct within the segment.
|
* Now the addresses of frags are correct within the segment.
|
||||||
*/
|
*/
|
||||||
@ -267,10 +284,21 @@ void write_object_file()
|
|||||||
data_siz = 0;
|
data_siz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bss_address_frag.fr_address = H_GET_TEXT_SIZE(&headers) +
|
bss_address_frag.fr_address = (H_GET_TEXT_SIZE(&headers) +
|
||||||
H_GET_DATA_SIZE(&headers);
|
H_GET_DATA_SIZE(&headers));
|
||||||
|
|
||||||
H_SET_BSS_SIZE(&headers,local_bss_counter);
|
H_SET_BSS_SIZE(&headers, bss_last_frag->fr_address);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* now fixup all bss frags addresses
|
||||||
|
*/
|
||||||
|
if (bss_frag_root)
|
||||||
|
{
|
||||||
|
relax_addressT slide;
|
||||||
|
slide = bss_address_frag.fr_address;
|
||||||
|
for (fragP = bss_frag_root; fragP; fragP = fragP->fr_next)
|
||||||
|
fragP->fr_address += slide;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -592,14 +620,14 @@ void write_object_file()
|
|||||||
|
|
||||||
void relax_segment(segment_frag_root, segment)
|
void relax_segment(segment_frag_root, segment)
|
||||||
struct frag * segment_frag_root;
|
struct frag * segment_frag_root;
|
||||||
segT segment; /* SEG_DATA or SEG_TEXT */
|
segT segment; /* SEG_DATA or SEG_TEXT or SEG_BSS */
|
||||||
{
|
{
|
||||||
register struct frag * fragP;
|
register struct frag * fragP;
|
||||||
register relax_addressT address;
|
register relax_addressT address;
|
||||||
/* register relax_addressT old_address; JF unused */
|
/* register relax_addressT old_address; JF unused */
|
||||||
/* register relax_addressT new_address; JF unused */
|
/* register relax_addressT new_address; JF unused */
|
||||||
#ifndef MANY_SEGMENTS
|
#ifndef MANY_SEGMENTS
|
||||||
know( segment == SEG_DATA || segment == SEG_TEXT );
|
know(segment == SEG_DATA || segment == SEG_TEXT || segment == SEG_BSS);
|
||||||
#endif
|
#endif
|
||||||
/* In case md_estimate_size_before_relax() wants to make fixSs. */
|
/* In case md_estimate_size_before_relax() wants to make fixSs. */
|
||||||
subseg_change(segment, 0);
|
subseg_change(segment, 0);
|
||||||
@ -740,7 +768,10 @@ segT segment; /* SEG_DATA or SEG_TEXT */
|
|||||||
if (symbolP) {
|
if (symbolP) {
|
||||||
#ifdef MANY_SEGMENTS
|
#ifdef MANY_SEGMENTS
|
||||||
#else
|
#else
|
||||||
know((S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE) || (S_GET_SEGMENT(symbolP) == SEG_DATA) || (S_GET_SEGMENT(symbolP) == SEG_TEXT));
|
know((S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE)
|
||||||
|
|| (S_GET_SEGMENT(symbolP) == SEG_DATA)
|
||||||
|
|| (S_GET_SEGMENT(symbolP) == SEG_TEXT)
|
||||||
|
|| (S_GET_SEGMENT(symbolP) == SEG_BSS));
|
||||||
know(symbolP->sy_frag);
|
know(symbolP->sy_frag);
|
||||||
know(!(S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE) || (symbolP->sy_frag == &zero_address_frag));
|
know(!(S_GET_SEGMENT(symbolP) == SEG_ABSOLUTE) || (symbolP->sy_frag == &zero_address_frag));
|
||||||
#endif
|
#endif
|
||||||
@ -1051,14 +1082,19 @@ segT this_segment_type; /* N_TYPE bits for segment. */
|
|||||||
continue;
|
continue;
|
||||||
} /* COBR */
|
} /* COBR */
|
||||||
#endif /* TC_I960 */
|
#endif /* TC_I960 */
|
||||||
/* FIXME-SOON: I think this is trash, but I'm not sure. xoxorich. */
|
|
||||||
#ifdef comment
|
|
||||||
#ifdef OBJ_COFF
|
#ifdef OBJ_COFF
|
||||||
|
/* This really needed to be
|
||||||
|
like this for COFF output.
|
||||||
|
- mtranle@paris
|
||||||
|
|
||||||
|
But I'm not sure it's right
|
||||||
|
for i960 or a29k coff.
|
||||||
|
xoxorich. */
|
||||||
|
|
||||||
if (S_IS_COMMON(add_symbolP))
|
if (S_IS_COMMON(add_symbolP))
|
||||||
add_number += S_GET_VALUE(add_symbolP);
|
add_number += S_GET_VALUE(add_symbolP);
|
||||||
#endif /* OBJ_COFF */
|
#endif /* OBJ_COFF */
|
||||||
#endif /* comment */
|
|
||||||
|
|
||||||
++seg_reloc_count;
|
++seg_reloc_count;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user