Debian Codegraph @

debian/patches/Version_2_6_15pre9

raw
1 Description: <short summary of the patch>
2 TODO: Put a short summary on the line above and replace this paragraph
3 with a longer explanation of this change. Complete the meta-information
4 with other relevant fields (see below for details). To make it easier, the
5 information below has been extracted from the changelog. Adjust it or drop
6 it.
7 .
8 gcl (2.6.14-10) unstable; urgency=medium
9 .
10 * Version_2_6_15pre9
11 Author: Camm Maguire <[email protected]>
12
13 ---
14 The information above should follow the Patch Tagging Guidelines, please
15 checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
16 are templates for supplementary fields that you might want to add:
17
18 Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
19 Bug: <upstream-bugtracker-url>
20 Bug-Debian: https://bugs.debian.org/<bugnumber>
21 Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
22 Forwarded: (no|not-needed|<patch-forwarded-url>)
23 Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
24 Reviewed-By: <name and email of someone who approved/reviewed the patch>
25 Last-Update: 2024-07-14
26
27 --- gcl-2.6.14.orig/configure
28 +++ gcl-2.6.14/configure
29 @@ -3042,6 +3042,7 @@ case $canonical in
30 s390*linux*) use=s390-linux;;
31 ia64*linux*) use=ia64-linux;;
32 hppa*linux*) use=hppa-linux;;
33 + loongarch64*linux*) use=loongarch64-linux;;
34 powerpc*linux*) use=powerpc-linux;;
35 powerpc-*-darwin*) use=powerpc-macosx;;
36 *86*darwin*) use=386-macosx;;
37 @@ -4664,6 +4665,9 @@ case $use in
38 assert_arg_to_ldflags -pg
39 GPL_FLAG="-pg"
40 LDFLAGS=$OLD_LDFLAGS;;
41 + loongarch64-linux)
42 + add_arg_to_cflags -mno-relax
43 + add_arg_to_cflags -Wa,-mno-relax;;
44 386-macosx)
45 # assert_arg_to_cflags -Wno-error=implicit-function-declaration
46 add_arg_to_cflags -Wno-incomplete-setjmp-declaration
47 --- gcl-2.6.14.orig/configure.in
48 +++ gcl-2.6.14/configure.in
49 @@ -43,6 +43,7 @@ case $canonical in
50 s390*linux*) use=s390-linux;;
51 ia64*linux*) use=ia64-linux;;
52 hppa*linux*) use=hppa-linux;;
53 + loongarch64*linux*) use=loongarch64-linux;;
54 powerpc*linux*) use=powerpc-linux;;
55 powerpc-*-darwin*) use=powerpc-macosx;;
56 *86*darwin*) use=386-macosx;;
57 @@ -328,6 +329,9 @@ case $use in
58 assert_arg_to_ldflags -pg
59 GPL_FLAG="-pg"
60 LDFLAGS=$OLD_LDFLAGS;;
61 + loongarch64-linux)
62 + add_arg_to_cflags -mno-relax
63 + add_arg_to_cflags -Wa,-mno-relax;;
64 386-macosx)
65 # assert_arg_to_cflags -Wno-error=implicit-function-declaration
66 add_arg_to_cflags -Wno-incomplete-setjmp-declaration
67 --- gcl-2.6.14.orig/git.tag
68 +++ gcl-2.6.14/git.tag
69 @@ -1 +1 @@
70 -"Version_2_6_15pre8"
71 +"Version_2_6_15pre9"
72 --- /dev/null
73 +++ gcl-2.6.14/h/elf64_loongarch64_reloc.h
74 @@ -0,0 +1,93 @@
75 +#define get_insn_page(x) ((x) & ~0xffful)
76 +#define get_page_delta(dest, pc) ({ \
77 + ul res = get_insn_page(dest) - get_insn_page(pc); \
78 + if ((dest) & 0x800) \
79 + res += 0x1000ul - 0x100000000ul; \
80 + if (res & 0x80000000) \
81 + res += 0x100000000ul; \
82 + res; \
83 +})
84 +#define get_page_low(dest) ((dest) & 0xfff)
85 +#define bdest (((long)((s+a)-p))>>2)
86 +#define bgdest (((long)(((ul)got)-p))>>2)
87 +
88 + case R_LARCH_RELAX:
89 + case R_LARCH_ALIGN:
90 + massert(!emsg("Unsupport relaxation, please compile with '-mno-relax -Wa,-mno-relax'\n"));
91 + break;
92 + case R_LARCH_64:
93 + store_val(where,~0L,(s+a));
94 + break;
95 + case R_LARCH_32:
96 + store_val(where,MASK(32),(s+a));
97 + break;
98 + case R_LARCH_32_PCREL:
99 + store_val(where,MASK(32),(s+a)-p);
100 + break;
101 + case R_LARCH_ADD6:
102 + add_val(where,MASK(6),(s+a));
103 + break;
104 + case R_LARCH_ADD8:
105 + add_val(where,MASK(8),(s+a));
106 + break;
107 + case R_LARCH_ADD16:
108 + add_val(where,MASK(16),(s+a));
109 + break;
110 + case R_LARCH_ADD32:
111 + add_val(where,MASK(32),(s+a));
112 + break;
113 + case R_LARCH_ADD64:
114 + add_val(where,~0L,(s+a));
115 + break;
116 + case R_LARCH_SUB6:
117 + add_val(where,MASK(6),-(s+a));
118 + break;
119 + case R_LARCH_SUB8:
120 + add_val(where,MASK(8),-(s+a));
121 + break;
122 + case R_LARCH_SUB16:
123 + add_val(where,MASK(16),-(s+a));
124 + break;
125 + case R_LARCH_SUB32:
126 + add_val(where,MASK(32),-(s+a));
127 + break;
128 + case R_LARCH_SUB64:
129 + add_val(where,~0L,-(s+a));
130 + break;
131 + case R_LARCH_B16:
132 + store_val(where,MASK(16)<<10,bdest<<10);
133 + break;
134 + case R_LARCH_B21:
135 + store_val(where,(MASK(16)<<10)|MASK(5),bdest<<10|((bdest>>16)&0x1f));
136 + break;
137 + case R_LARCH_B26:
138 + {
139 + if ((bdest&(~MASK(25)))==0||((~bdest)&(~MASK(25)))==0) {
140 + store_val(where,MASK(26),bdest<<10|((bdest>>16)&0x3ff));
141 + break;
142 + }
143 + if (!(sym->st_size&0x2))
144 + massert(!emsg("Unresolved R_LARCH_B26 symbol\n"));
145 + got+=(sym->st_size>>2)+(sym->st_size&0x1?1:0);
146 + store_val(where,MASK(26),bgdest<<10|((bgdest>>16)&0x3ff));
147 + memcpy(got,tramp,sizeof(tramp));
148 + store_val(got,MASK(20)<<5,(get_insn_page(s+a)-get_insn_page((ul)got))>>12<<5);
149 + store_val((ul*)((ul)got+4),MASK(16)<<10,(((s+a)>>2)&0x3ff)<<10);
150 + }
151 + break;
152 + case R_LARCH_PCALA_HI20:
153 + store_val(where,MASK(20)<<5,get_page_delta(s+a,p)>>12<<5);
154 + break;
155 + case R_LARCH_PCALA_LO12:
156 + store_val(where,MASK(12)<<10,get_page_low(s+a)<<10);
157 + break;
158 + case R_LARCH_GOT_PC_HI20:
159 + got+=sym->st_size>>2;
160 + *got=s+a;
161 + store_val(where,MASK(20)<<5,get_page_delta((ul)got,p)>>12<<5);
162 + break;
163 + case R_LARCH_GOT_PC_LO12:
164 + got+=sym->st_size>>2;
165 + // *got=s+a;
166 + store_val(where,MASK(12)<<10,get_page_low((ul)got)<<10);
167 + break;
168 --- /dev/null
169 +++ gcl-2.6.14/h/elf64_loongarch64_reloc_special.h
170 @@ -0,0 +1,70 @@
171 +#define R_LARCH_B16 64
172 +#define R_LARCH_B21 65
173 +#define R_LARCH_B26 66
174 +#define R_LARCH_PCALA_HI20 71
175 +#define R_LARCH_PCALA_LO12 72
176 +#define R_LARCH_GOT_PC_HI20 75
177 +#define R_LARCH_GOT_PC_LO12 76
178 +#define R_LARCH_32_PCREL 99
179 +#define R_LARCH_RELAX 100
180 +#define R_LARCH_ALIGN 102
181 +#define R_LARCH_ADD6 105
182 +#define R_LARCH_SUB6 106
183 +
184 +static unsigned int tramp[] = {
185 + 0x1a00000c, /* pcalau12i $t0, %hi(sym) */
186 + 0x4c000180 /* jirl $zero, $t0, %lo(sym) */};
187 +
188 +static int
189 +find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
190 + const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
191 + return 0;
192 +
193 +}
194 +
195 +static int
196 +label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char *st1,const char *sn,ul *gs) {
197 + Rela *r;
198 + Sym *sym;
199 + Shdr *sec;
200 + void *v,*ve;
201 + int idx;
202 + const int gz = sizeof(ul)/sizeof(ul), tz = sizeof(tramp)/sizeof(ul);
203 + massert(gz==1);
204 + massert(tz==1);
205 +
206 + for (sym=sym1;sym<syme;sym++)
207 + sym->st_size=0;
208 +
209 + /* Count the symbols need to be fixed first. */
210 + for (sec=sec1;sec<sece;sec++)
211 + if (sec->sh_type==SHT_RELA)
212 + for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
213 + if (
214 + ELF_R_TYPE(r->r_info)==R_LARCH_GOT_PC_HI20 ||
215 + ELF_R_TYPE(r->r_info)==R_LARCH_B26
216 + ) {
217 + sym=sym1+ELF_R_SYM(r->r_info);
218 + if (ELF_R_TYPE(r->r_info)==R_LARCH_B26 && LOCAL_SYM(sym))
219 + continue;
220 +
221 + if (ELF_R_TYPE(r->r_info)==R_LARCH_GOT_PC_HI20)
222 + sym->st_size|=0x1;
223 + if (ELF_R_TYPE(r->r_info)==R_LARCH_B26)
224 + sym->st_size|=0x2;
225 + }
226 +
227 + for (idx=0,sym=sym1;sym<syme;sym++) {
228 + if (sym->st_size==0)
229 + continue;
230 + massert(!(sym->st_size>>2));
231 + sym->st_size|=idx<<2;
232 + if (sym->st_size&0x1)
233 + idx+=gz;
234 + if (sym->st_size&0x2)
235 + idx+=tz;
236 + }
237 +
238 + *gs=idx;
239 + return 0;
240 +}
241 --- /dev/null
242 +++ gcl-2.6.14/h/loongarch64-linux.h
243 @@ -0,0 +1,27 @@
244 +#include "linux.h"
245 +
246 +#ifdef IN_GBC
247 +#undef MPROTECT_ACTION_FLAGS
248 +#define MPROTECT_ACTION_FLAGS SA_RESTART|SA_SIGINFO
249 +#define GET_FAULT_ADDR(sig,code,sv,a) \
250 + ((siginfo_t *)code)->si_addr
251 +#endif
252 +
253 +/*#define NULL_OR_ON_C_STACK(x) ((x)==0 || ((unsigned int)x) > (unsigned int)(pagetochar(MAXPAGE+1)))*/
254 +
255 +/* #define ADDITIONAL_FEATURES \ */
256 +/* ADD_FEATURE("BSD386"); \ */
257 +/* ADD_FEATURE("MC68020") */
258 +
259 +
260 +/* #define I386 */
261 +#define SGC
262 +
263 +/* Apparently stack pointers can be 4 byte aligned, at least &argc -- CM */
264 +#define C_GC_OFFSET 4
265 +
266 +#define RELOC_H "elf64_loongarch64_reloc.h"
267 +#define SPECIAL_RELOC_H "elf64_loongarch64_reloc_special.h"
268 +/* #define MAX_CODE_ADDRESS (1L<<31)/\*large memory model broken gcc 4.8*\/ */
269 +
270 +#define NEED_STACK_CHK_GUARD
271 --- gcl-2.6.14.orig/o/gmp_big.c
272 +++ gcl-2.6.14/o/gmp_big.c
273 @@ -292,54 +292,52 @@ big_minus(object x)
274 #endif
275
276
277 -static int
278 -double_exponent(double d) {
279 +/* static int */
280 +/* double_exponent(double d) { */
281
282 - union {double d;int i[2];} u;
283 +/* union {double d;int i[2];} u; */
284
285 - if (d == 0.0)
286 - return(0);
287 +/* if (d == 0.0) */
288 +/* return(0); */
289
290 - u.d=d;
291 - return (((u.i[HIND] & 0x7ff00000) >> 20) - 1022);
292 +/* u.d=d; */
293 +/* return (((u.i[HIND] & 0x7ff00000) >> 20) - 1022); */
294
295 -}
296 +/* } */
297
298 -static double
299 -set_exponent(double d, int e) {
300 +/* static double */
301 +/* set_exponent(double d, int e) { */
302
303 - union {double d;int i[2];} u;
304 +/* union {double d;int i[2];} u; */
305
306 - if (d == 0.0)
307 - return(0.0);
308 +/* if (d == 0.0) */
309 +/* return(0.0); */
310
311 - u.d=d;
312 - u.i[HIND]= (u.i[HIND] & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000);
313 - return(u.d);
314 +/* u.d=d; */
315 +/* u.i[HIND]= (u.i[HIND] & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000); */
316 +/* return(u.d); */
317
318 -}
319 +/* } */
320
321 double
322 big_to_double(object x) {
323
324 - double d=mpz_get_d(MP(x));
325 - int s=mpz_sizeinbase(MP(x),2);
326 - if (s>=54 && mpz_tstbit(MP(x),s-54)) {
327 -
328 - union {double d;int i[2];} u;
329 -
330 - u.i[HIND]=0;
331 - u.i[LIND]=1;
332 -
333 - d+=(d>0.0 ? 1.0 : -1.0)*set_exponent(u.d,double_exponent(d)-53);
334 + int s=mpz_sizeinbase(MP(x),2),i=0,j;
335
336 + if (s>=54 && mpz_tstbit(MP(x),s-54))
337 + for (i=mpz_tstbit(MP(x),s-53),j=s-55;!i && j>=0 && !(i=mpz_tstbit(MP(x),j));j--);
338 +
339 + if (i) {
340 + mpz_set_si(MP(big_fixnum1),mpz_sgn(MP(x))>0 ? 1 : -1);
341 + mpz_mul_2exp(MP(big_fixnum1),MP(big_fixnum1),s-54);
342 + mpz_add(MP(big_fixnum1),MP(big_fixnum1),MP(x));
343 + x=big_fixnum1;
344 }
345
346 - return d;
347 + return mpz_get_d(MP(x));
348
349 }
350
351 -
352 /* static object copy_big(object x) */
353 /* { */
354 /* if (type_of(x)==t_bignum) */