This file is indexed.

/usr/src/gcc-4.6/debian/patches/libffi-m68k.diff is in gcc-4.6-source 4.6.4-6ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# DP: Apply #660525 fix to in-tree libffi

--- a/src/libffi/src/m68k/sysv.S
+++ b/src/libffi/src/m68k/sysv.S
@@ -2,6 +2,7 @@
 	
    sysv.S - Copyright (c) 1998 Andreas Schwab
 	    Copyright (c) 2008 Red Hat, Inc. 
+	    Copyright (c) 2012 Thorsten Glaser
    
    m68k Foreign Function Interface 
 
@@ -87,7 +87,7 @@
 
 	| If the return value pointer is NULL, assume no return value.
 	| NOTE: On the mc68000, tst on an address register is not supported.
-#if defined(__mc68000__) && !defined(__mcoldfire__)
+#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
 	cmp.w	#0, %a1
 #else
 	tst.l	%a1
@@ -109,7 +109,7 @@
 retfloat:
 	btst	#2,%d2
 	jbeq	retdouble
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.s	%fp0,(%a1)
 #else
 	move.l	%d0,(%a1)
@@ -119,7 +119,7 @@
 retdouble:
 	btst	#3,%d2
 	jbeq	retlongdouble
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.d	%fp0,(%a1)
 #else
 	move.l	%d0,(%a1)+
@@ -130,7 +130,7 @@
 retlongdouble:
 	btst	#4,%d2
 	jbeq	retpointer
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.x	%fp0,(%a1)
 #else
 	move.l	%d0,(%a1)+
@@ -153,8 +154,22 @@
 
 retstruct2:
 	btst	#7,%d2
-	jbeq	noretval
+	jbeq	retsint8
 	move.w	%d0,(%a1)
+	jbra	epilogue
+
+retsint8:
+	btst	#8,%d2
+	jbeq	retsint16
+	extb.l	%d0
+	move.l	%d0,(%a1)
+	jbra	epilogue
+
+retsint16:
+	btst	#9,%d2
+	jbeq	noretval
+	ext.l	%d0
+	move.l	%d0,(%a1)
 
 noretval:
 epilogue:
@@ -199,7 +199,7 @@
 	move.l	(%a0),%d1
 	jra	.Lcls_epilogue
 .Lcls_ret_float:
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.s	(%a0),%fp0
 #else
 	move.l	(%a0),%d0
@@ -209,7 +209,7 @@
 	lsr.l	#2,%d0
 	jne	1f
 	jcs	.Lcls_ret_ldouble
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.d	(%a0),%fp0
 #else
 	move.l	(%a0)+,%d0
@@ -217,7 +217,7 @@
 #endif
 	jra	.Lcls_epilogue
 .Lcls_ret_ldouble:
-#if defined(__MC68881__)
+#if defined(__MC68881__) || defined(__HAVE_68881__)
 	fmove.x	(%a0),%fp0
 #else
 	move.l	(%a0)+,%d0
@@ -227,17 +246,31 @@
 	jra	.Lcls_epilogue
 1:
 	lsr.l	#2,%d0
-	jne	.Lcls_ret_struct2
+	jne	1f
 	jcs	.Lcls_ret_struct1
+	| CIF_FLAGS_POINTER
 	move.l	(%a0),%a0
 	move.l	%a0,%d0
 	jra	.Lcls_epilogue
 .Lcls_ret_struct1:
 	move.b	(%a0),%d0
 	jra	.Lcls_epilogue
-.Lcls_ret_struct2:
+1:
+	lsr.l	#2,%d0
+	jne	1f
+	jcs	.Lcls_ret_sint8
+	| CIF_FLAGS_STRUCT2
 	move.w	(%a0),%d0
 	jra	.Lcls_epilogue
+.Lcls_ret_sint8:
+	move.l	(%a0),%d0
+	extb.l	%d0
+	jra	.Lcls_epilogue
+1:
+	| CIF_FLAGS_SINT16
+	move.l	(%a0),%d0
+	ext.l	%d0
+	jra	.Lcls_epilogue
 	CFI_ENDPROC()
 
 	.size	ffi_closure_SYSV,.-ffi_closure_SYSV
--- a/src/libffi/src/m68k/ffi.c
+++ b/src/libffi/src/m68k/ffi.c
@@ -107,6 +107,8 @@
 #define CIF_FLAGS_POINTER	32
 #define CIF_FLAGS_STRUCT1	64
 #define CIF_FLAGS_STRUCT2	128
+#define CIF_FLAGS_SINT8		256
+#define CIF_FLAGS_SINT16	512
 
 /* Perform machine dependent cif processing */
 ffi_status
@@ -120,6 +122,13 @@
       break;
 
     case FFI_TYPE_STRUCT:
+      if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT &&
+          cif->rtype->elements[1])
+        {
+          cif->flags = 0;
+          break;
+        }
+
       switch (cif->rtype->size)
 	{
 	case 1:
@@ -163,6 +172,14 @@
       cif->flags = CIF_FLAGS_DINT;
       break;
 
+    case FFI_TYPE_SINT16:
+      cif->flags = CIF_FLAGS_SINT16;
+      break;
+
+    case FFI_TYPE_SINT8:
+      cif->flags = CIF_FLAGS_SINT8;
+      break;
+
     default:
       cif->flags = CIF_FLAGS_INT;
       break;
@@ -261,7 +261,8 @@
 		      void *user_data,
 		      void *codeloc)
 {
-  FFI_ASSERT (cif->abi == FFI_SYSV);
+  if (cif->abi != FFI_SYSV)
+    return FFI_BAD_ABI;
 
   *(unsigned short *)closure->tramp = 0x207c;
   *(void **)(closure->tramp + 2) = codeloc;
--- a/src/libffi/src/m68k/ffitarget.h
+++ b/src/libffi/src/m68k/ffitarget.h
@@ -34,8 +34,8 @@
 typedef enum ffi_abi {
   FFI_FIRST_ABI = 0,
   FFI_SYSV,
-  FFI_DEFAULT_ABI = FFI_SYSV,
-  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
+  FFI_LAST_ABI,
+  FFI_DEFAULT_ABI = FFI_SYSV
 } ffi_abi;
 #endif