Fixed all the places where there were problems with the size and
alignments of structures on disk and structures in memory. #ifed out all the code in coffswap.c, since it should be done using the target swap routines now.
This commit is contained in:
parent
af773d1b0f
commit
e5b919b168
2506
bfd/coff-code.h
2506
bfd/coff-code.h
File diff suppressed because it is too large
Load Diff
|
@ -53,7 +53,7 @@ asection *ignore_input_section;
|
|||
/* So the target symbol has to be of coff type, and the symbol
|
||||
has to have the correct native information within it */
|
||||
if ((cs->symbol.the_bfd->xvec->flavour != bfd_target_coff_flavour_enum)
|
||||
|| (cs->native == (struct syment *)NULL)) {
|
||||
|| (cs->native == (struct internal_syment *)NULL)) {
|
||||
/* This is interesting, consider the case where we're outputting */
|
||||
/* coff from a mix n match input, linking from coff to a symbol */
|
||||
/* defined in a bout file will cause this match to be true. Should */
|
||||
|
@ -62,22 +62,23 @@ asection *ignore_input_section;
|
|||
result = bfd_reloc_dangerous;
|
||||
}
|
||||
else {
|
||||
switch (cs->native->n_sclass)
|
||||
switch (bfd_h_get_x(abfd, & cs->native->n_sclass))
|
||||
{
|
||||
case C_LEAFSTAT:
|
||||
case C_LEAFEXT:
|
||||
/* This is a call to a leaf procedure, replace instruction with a bal
|
||||
to the correct location */
|
||||
{
|
||||
union auxent *aux = (union auxent *)(cs->native+2);
|
||||
AUXENT *aux = (AUXENT *)(cs->native+2);
|
||||
int word = bfd_getlong(abfd, data + reloc_entry->address);
|
||||
BFD_ASSERT(cs->native->n_numaux==2);
|
||||
BFD_ASSERT(bfd_h_get_x(abfd, &cs->native->n_numaux)==2);
|
||||
/* We replace the original call instruction with a bal to */
|
||||
/* the bal entry point - the offset of which is described in the */
|
||||
/* 2nd auxent of the original symbol. We keep the native sym and */
|
||||
/* auxents untouched, so the delta between the two is the */
|
||||
/* offset of the bal entry point */
|
||||
word = ((word + (aux->x_bal.x_balntry - cs->native->n_value))
|
||||
word = ((word + (bfd_h_get_x(abfd, &aux->x_bal.x_balntry) -
|
||||
bfd_h_get_x(abfd, &cs->native->n_value)))
|
||||
& BAL_MASK) | BAL;
|
||||
bfd_putlong(abfd, word, data+reloc_entry->address);
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@ You should have received a copy of the GNU General Public License along with
|
|||
#include "libcoff.h" /* to allow easier abstraction-breaking */
|
||||
|
||||
#define sp(x) bfd_h_put_x(abfd, x, &x)
|
||||
#if 0
|
||||
/* All the generic swapping routines:
|
||||
|
||||
/* All the swapping routines:
|
||||
|
||||
FIXME, these routines assume that the sizes, alignments, and offsets of
|
||||
these fields are the same in the host and target. This is an invalid
|
||||
assumption, which in particular breaks on the 386 and SPARC. Fix this
|
||||
the same way that a.out.h and sunos.c were fixed: define char arrays
|
||||
that represent the headers in the target systems' file, and have these
|
||||
functions translate in from that format, and out to that format. */
|
||||
FIXME
|
||||
These routines cater for the sizes and alignments and offsets of
|
||||
all the contained fields. Because of this, the fields can change
|
||||
size, so these should be phased out to use the ones specific to the
|
||||
file format.
|
||||
*/
|
||||
|
||||
void
|
||||
DEFUN(bfd_coff_swap_name,(abfd, ptr),
|
||||
|
@ -53,7 +53,7 @@ DEFUN(bfd_coff_swap_name,(abfd, ptr),
|
|||
void
|
||||
DEFUN(bfd_coff_swap_sym,(abfd, se),
|
||||
bfd *abfd AND
|
||||
SYMENT *se)
|
||||
struct internal_syment *se)
|
||||
{
|
||||
bfd_coff_swap_name(abfd, (long*)(se->n_name));
|
||||
bfd_h_put_x(abfd, se->n_value, &se->n_value);
|
||||
|
@ -66,7 +66,7 @@ DEFUN(bfd_coff_swap_sym,(abfd, se),
|
|||
void
|
||||
DEFUN(bfd_coff_swap_aux,(abfd, au, type, class),
|
||||
bfd *abfd AND
|
||||
AUXENT *au AND
|
||||
struct internal_auxent *au AND
|
||||
int type AND
|
||||
int class)
|
||||
{
|
||||
|
@ -112,10 +112,12 @@ DEFUN(bfd_coff_swap_aux,(abfd, au, type, class),
|
|||
void
|
||||
DEFUN(bfd_coff_swap_lineno,(abfd, lineno),
|
||||
bfd *abfd AND
|
||||
LINENO *lineno)
|
||||
struct internal_lineno *lineno)
|
||||
{
|
||||
sp(lineno->l_addr.l_symndx);
|
||||
sp(lineno->l_lnno);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,12 +31,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#define obj_relocbase(bfd) (obj_icof(bfd)->relocbase)
|
||||
#define obj_raw_syments(bfd) (obj_icof(bfd)->raw_syments)
|
||||
#define obj_convert(bfd) (obj_icof(bfd)->conversion_table)
|
||||
#if CFILE_STUFF
|
||||
#define obj_symbol_slew(bfd) (obj_icof(bfd)->symbol_index_slew)
|
||||
#else
|
||||
#define obj_symbol_slew(bfd) 0
|
||||
#endif
|
||||
#define obj_string_table(bfd) (obj_icof(bfd)->string_table)
|
||||
|
||||
typedef struct {
|
||||
asymbol symbol;
|
||||
struct syment *native;
|
||||
struct internal_syment *native;
|
||||
struct lineno_cache_entry *lineno;
|
||||
} coff_symbol_type;
|
||||
|
||||
|
@ -50,7 +54,7 @@ typedef struct icofdata
|
|||
long symbol_index_slew; /* used during read to mark whether a
|
||||
C_FILE symbol as been added. */
|
||||
|
||||
struct syment *raw_syments;
|
||||
struct internal_syment *raw_syments;
|
||||
struct lineno *raw_linenos;
|
||||
unsigned int raw_syment_count;
|
||||
char *string_table;
|
||||
|
|
Loading…
Reference in New Issue