Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com)
authorIan Lance Taylor <ian@airs.com>
Sat, 29 Aug 1992 00:16:47 +0000 (00:16 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 29 Aug 1992 00:16:47 +0000 (00:16 +0000)
* 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).

gas/config/ChangeLog
gas/config/obj-bout.c
gas/config/obj-bout.h
gas/config/tc-i960.c

index 9bfeafbf2b33284bec5648757276e61f856b3a41..9f2f7861e0fd85edc4dbb264926d16d5203c0ef8 100644 (file)
@@ -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
index 4199efc6588bc9857018f40a2dfb748156c1567c..0cca3b0309e1cc78a586517a5595d50970d28450 100644 (file)
@@ -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() */
 
index 8489004ddb3925cad76af6b913b4bc1a0c824ad2..bb6460c627368ae747a4f0e60d0a978111880ebf 100644 (file)
@@ -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
 
 #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
 
index 6e173fc1ad474f76efb08fee5aa672eac998c6f1..dc8d4c2e35eb017f6a6f610af3db306fd9d7ce06 100644 (file)
  *     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