summaryrefslogtreecommitdiffstats
path: root/contrib/crossrpms/patches/binutils-2.16.1-rtems-20050708.diff
blob: 37d102c8b9ab62a9339b2999582e1eeb3bb1d7d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
--- binutils-2.16.1/bfd/config.bfd	31 Jan 2005 17:18:47 -0000	1.181
+++ binutils-2.16.1/bfd/config.bfd	5 Jul 2005 15:32:00 -0000
@@ -369,7 +369,12 @@
     targ_selvecs=bfd_elf32_frv_vec
     ;;
 
-  h8300*-*-elf)
+  h8300*-*-rtemscoff*)
+    targ_defvec=h8300coff_vec
+    targ_underscore=yes
+    ;;
+
+  h8300*-*-elf | h8300*-*-rtems*)
     targ_defvec=bfd_elf32_h8300_vec
     targ_underscore=yes
     ;;
--- binutils-2.16.1/gas/configure.tgt	31 Jan 2005 17:18:51 -0000	1.3
+++ binutils-2.16.1/gas/configure.tgt	5 Jul 2005 15:32:03 -0000
@@ -163,9 +163,9 @@
   hppa-*-bsd*)				fmt=som em=hppa ;;
   hppa-*-hiux*)				fmt=som em=hppa ;;
 
-  h8300-*-rtems*)			fmt=coff ;;
+  h8300-*-rtemscoff*)			fmt=coff ;;
   h8300-*-coff)				fmt=coff ;;
-  h8300-*-elf)				fmt=elf ;;
+  h8300-*-elf | h8300-*-rtems*)		fmt=elf ;;
   h8500-*-rtems*)			fmt=coff ;;
   h8500-*-coff)				fmt=coff ;;
 
--- binutils-2.16.1/ld/configure.tgt	8 Feb 2005 19:54:27 -0000	1.165
+++ binutils-2.16.1/ld/configure.tgt	5 Jul 2005 15:32:18 -0000
@@ -280,10 +280,10 @@
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
 xscale-*-coff)		targ_emul=armcoff ;;
 xscale-*-elf)		targ_emul=armelf ;;
-h8300-*-hms* | h8300-*-coff* | h8300-*-rtems*)
+h8300-*-hms* | h8300-*-coff* | h8300-*-rtemscoff*)
 			targ_emul=h8300; targ_extra_emuls="h8300h h8300s h8300hn h8300sn h8300sx h8300sxn"
 			;;
-h8300-*-elf*)
+h8300-*-elf* | h8300-*-rtems*)
 			targ_emul=h8300elf;
 			targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf"
 			;;
--- binutils-2.16.1/bfd/archive.c	3 Mar 2005 11:40:56 -0000	1.34
+++ binutils-2.16.1/bfd/archive.c	8 Jul 2005 06:28:30 -0000
@@ -1308,6 +1308,13 @@
 #define getgid() 0
 #endif
 
+static void print_ar_size( struct ar_hdr* hdr, int val )
+{
+  char buffer[sizeof(hdr->ar_size)+1];
+  sprintf(buffer,"%-10d", val);
+  memcpy(hdr->ar_size,buffer,sizeof(hdr->ar_size));
+}
+
 /* Takes a filename, returns an arelt_data for it, or NULL if it can't
    make one.  The filename must refer to a filename in the filesystem.
    The filename field of the ar_hdr will NOT be initialized.  If member
@@ -1368,7 +1375,7 @@
 #endif
   sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
   sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
-  sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size);
+  print_ar_size(hdr, (long) status.st_size);
   /* Correct for a lossage in sprintf whereby it null-terminates.  I cannot
      understand how these C losers could design such a ramshackle bunch of
      IO operations.  */
@@ -1660,7 +1667,7 @@
       memset (&hdr, 0, sizeof (struct ar_hdr));
       strcpy (hdr.ar_name, ename);
       /* Round size up to even number in archive header.  */
-      sprintf (&(hdr.ar_size[0]), "%-10d",
+      print_ar_size(&hdr,
 	       (int) ((elength + 1) & ~(bfd_size_type) 1));
       strncpy (hdr.ar_fmag, ARFMAG, 2);
       for (i = 0; i < sizeof (struct ar_hdr); i++)
@@ -1913,7 +1920,7 @@
   sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
   sprintf (hdr.ar_uid, "%ld", (long) getuid ());
   sprintf (hdr.ar_gid, "%ld", (long) getgid ());
-  sprintf (hdr.ar_size, "%-10d", (int) mapsize);
+  print_ar_size(&hdr, (int) mapsize);
   strncpy (hdr.ar_fmag, ARFMAG, 2);
   for (i = 0; i < sizeof (struct ar_hdr); i++)
     if (((char *) (&hdr))[i] == '\0')
@@ -2068,7 +2075,7 @@
 
   memset (&hdr, 0, sizeof (struct ar_hdr));
   hdr.ar_name[0] = '/';
-  sprintf (hdr.ar_size, "%-10d", (int) mapsize);
+  print_ar_size (&hdr, (int) mapsize);
   sprintf (hdr.ar_date, "%ld", (long) time (NULL));
   /* This, at least, is what Intel coff sets the values to.  */
   sprintf ((hdr.ar_uid), "%d", 0);