diff options
author | Ian Lance Taylor <ian@airs.com> | 1992-08-29 00:16:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1992-08-29 00:16:47 +0000 |
commit | 8ae35e59193c5677ad779f1d4468b7946df2bf01 (patch) | |
tree | 04fcdf22a940efd7ae0bc2461b3c91bebc25e6dc /gas/config | |
parent | e41a1546e10d7d4794abed2df54cc25101dc2c18 (diff) | |
download | gdb-8ae35e59193c5677ad779f1d4468b7946df2bf01.zip gdb-8ae35e59193c5677ad779f1d4468b7946df2bf01.tar.gz gdb-8ae35e59193c5677ad779f1d4468b7946df2bf01.tar.bz2 |
Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com)
* obj-bout.h, obj-bout.c (obj_header_append, obj_symbol_to_chars),
tc-i960.c (md_ri_to_chars): Always output bout object file in
little endian byte order (used to use endianness of host).
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/obj-bout.c | 36 | ||||
-rw-r--r-- | gas/config/obj-bout.h | 8 | ||||
-rw-r--r-- | gas/config/tc-i960.c | 19 |
4 files changed, 62 insertions, 7 deletions
diff --git a/gas/config/ChangeLog b/gas/config/ChangeLog index 9bfeafb..9f2f786 100644 --- a/gas/config/ChangeLog +++ b/gas/config/ChangeLog @@ -1,3 +1,9 @@ +Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com) + + * obj-bout.h, obj-bout.c (obj_header_append, obj_symbol_to_chars), + tc-i960.c (md_ri_to_chars): Always output bout object file in + little endian byte order (used to use endianness of host). + Tue Aug 25 15:11:08 1992 Steve Chamberlain (sac@thepub.cygnus.com) * z8k.c, z8k.h, z8k.mt: z8000 support stuff diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c index 4199efc..0cca3b03 100644 --- a/gas/config/obj-bout.c +++ b/gas/config/obj-bout.c @@ -134,14 +134,48 @@ object_headers *headers; headers->header.a_relaxable = linkrelax; +#ifdef CROSS_COMPILE + md_number_to_chars(*where, headers->header.a_magic, sizeof(headers->header.a_magic)); + *where += sizeof(headers->header.a_magic); + md_number_to_chars(*where, headers->header.a_text, sizeof(headers->header.a_text)); + *where += sizeof(headers->header.a_text); + md_number_to_chars(*where, headers->header.a_data, sizeof(headers->header.a_data)); + *where += sizeof(headers->header.a_data); + md_number_to_chars(*where, headers->header.a_bss, sizeof(headers->header.a_bss)); + *where += sizeof(headers->header.a_bss); + md_number_to_chars(*where, headers->header.a_syms, sizeof(headers->header.a_syms)); + *where += sizeof(headers->header.a_syms); + md_number_to_chars(*where, headers->header.a_entry, sizeof(headers->header.a_entry)); + *where += sizeof(headers->header.a_entry); + md_number_to_chars(*where, headers->header.a_trsize, sizeof(headers->header.a_trsize)); + *where += sizeof(headers->header.a_trsize); + md_number_to_chars(*where, headers->header.a_drsize, sizeof(headers->header.a_drsize)); + *where += sizeof(headers->header.a_drsize); + md_number_to_chars(*where, headers->header.a_tload, sizeof(headers->header.a_tload)); + *where += sizeof(headers->header.a_tload); + md_number_to_chars(*where, headers->header.a_dload, sizeof(headers->header.a_dload)); + *where += sizeof(headers->header.a_dload); + md_number_to_chars(*where, headers->header.a_talign, sizeof(headers->header.a_talign)); + *where += sizeof(headers->header.a_talign); + md_number_to_chars(*where, headers->header.a_dalign, sizeof(headers->header.a_dalign)); + *where += sizeof(headers->header.a_dalign); + md_number_to_chars(*where, headers->header.a_balign, sizeof(headers->header.a_balign)); + *where += sizeof(headers->header.a_balign); + md_number_to_chars(*where, headers->header.a_relaxable, sizeof(headers->header.a_relaxable)); + *where += sizeof(headers->header.a_relaxable); +#else /* ! CROSS_COMPILE */ append(where, (char *) &headers->header, sizeof(headers->header)); +#endif /* ! CROSS_COMPILE */ } /* a_header_append() */ void obj_symbol_to_chars(where, symbolP) char **where; symbolS *symbolP; { - /* leave in host byte order */ + md_number_to_chars((char *)&(S_GET_OFFSET(symbolP)), S_GET_OFFSET(symbolP), sizeof(S_GET_OFFSET(symbolP))); + md_number_to_chars((char *)&(S_GET_DESC(symbolP)), S_GET_DESC(symbolP), sizeof(S_GET_DESC(symbolP))); + md_number_to_chars((char *)&(S_GET_VALUE(symbolP)), S_GET_VALUE(symbolP), sizeof(S_GET_VALUE(symbolP))); + append(where, (char *)&symbolP->sy_symbol, sizeof(obj_symbol_type)); } /* obj_symbol_to_chars() */ diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h index 8489004..bb6460c 100644 --- a/gas/config/obj-bout.h +++ b/gas/config/obj-bout.h @@ -45,6 +45,9 @@ * are in host byte-order: object files CANNOT be lifted from a * little-end host and used on a big-endian (or vice versa) without * modification. + * ==> THIS IS NO LONGER TRUE USING BFD. WE CAN GENERATE ANY BYTE ORDER + * FOR THE HEADER, AND READ ANY BYTE ORDER. PREFERENCE WOULD BE TO + * USE LITTLE-ENDIAN BYTE ORDER THROUGHOUT, REGARDLESS OF HOST. <== * * o The downloader ('comm960') takes care to generate a pseudo-header * with correct (i80960) byte-ordering before shipping text and data @@ -57,11 +60,6 @@ #include "targ-cpu.h" -/* bout uses host byte order for headers */ -#ifdef CROSS_COMPILE -#undef CROSS_COMPILE -#endif /* CROSS_COMPILE */ - /* We want \v. */ #define BACKSLASH_V 1 diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c index 6e173fc1..dc8d4c2 100644 --- a/gas/config/tc-i960.c +++ b/gas/config/tc-i960.c @@ -29,6 +29,10 @@ * the downloader converts the file format and corrects the byte-ordering * of the relevant fields while doing so.) * + * ==> THIS IS NO LONGER TRUE USING BFD. WE CAN GENERATE ANY BYTE ORDER + * FOR THE HEADER, AND READ ANY BYTE ORDER. PREFERENCE WOULD BE TO + * USE LITTLE-ENDIAN BYTE ORDER THROUGHOUT, REGARDLESS OF HOST. <== + * ***************************************************************************** */ /* There are 4 different lengths of (potentially) symbol-based displacements @@ -955,12 +959,25 @@ register segT segment_type; * executable code is actually downloaded to the i80960). Therefore, * we leave it in host byte order. * + * The above comment is no longer true. This routine now really + * does do the reordering (Ian Taylor 28 Aug 92). + * **************************************************************************** */ void md_ri_to_chars(where, ri) char *where; struct relocation_info *ri; { - *((struct relocation_info *) where) = *ri; /* structure assignment */ + md_number_to_chars (where, ri->r_address, + sizeof (ri->r_address)); + where[4] = ri->r_index & 0x0ff; + where[5] = (ri->r_index >> 8) & 0x0ff; + where[6] = (ri->r_index >> 16) & 0x0ff; + where[7] = ((ri->r_pcrel << 0) + | (ri->r_length << 1) + | (ri->r_extern << 3) + | (ri->r_bsr << 4) + | (ri->r_disp << 5) + | (ri->r_callj << 6)); } /* md_ri_to_chars() */ #ifndef WORKING_DOT_WORD |