diff options
author | Mike Pall <mike> | 2023-06-02 12:54:46 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-06-02 12:54:46 +0200 |
commit | 51fb2f2c3af778f03258fccee9092401ee4a0215 (patch) | |
tree | 685bb8a57ea383c5b8a3297b2af8a6893f2bbb40 /dynasm | |
parent | 2d8300c1944f3a62c10f0829e9b7847c5a6f0482 (diff) | |
download | luajit-51fb2f2c3af778f03258fccee9092401ee4a0215.tar.gz luajit-51fb2f2c3af778f03258fccee9092401ee4a0215.tar.bz2 luajit-51fb2f2c3af778f03258fccee9092401ee4a0215.zip |
DynASM: Fix warnings.
Reported by Ilija Tovilo.
Diffstat (limited to 'dynasm')
-rw-r--r-- | dynasm/dasm_arm.h | 16 | ||||
-rw-r--r-- | dynasm/dasm_arm64.h | 16 | ||||
-rw-r--r-- | dynasm/dasm_mips.h | 16 | ||||
-rw-r--r-- | dynasm/dasm_ppc.h | 16 | ||||
-rw-r--r-- | dynasm/dasm_x86.h | 18 |
5 files changed, 26 insertions, 56 deletions
diff --git a/dynasm/dasm_arm.h b/dynasm/dasm_arm.h index fbfebee0..aa16014e 100644 --- a/dynasm/dasm_arm.h +++ b/dynasm/dasm_arm.h | |||
@@ -70,7 +70,7 @@ struct dasm_State { | |||
70 | size_t lgsize; | 70 | size_t lgsize; |
71 | int *pclabels; /* PC label chains/pos ptrs. */ | 71 | int *pclabels; /* PC label chains/pos ptrs. */ |
72 | size_t pcsize; | 72 | size_t pcsize; |
73 | void **globals; /* Array of globals (bias -10). */ | 73 | void **globals; /* Array of globals. */ |
74 | dasm_Section *section; /* Pointer to active section. */ | 74 | dasm_Section *section; /* Pointer to active section. */ |
75 | size_t codesize; /* Total size of all code sections. */ | 75 | size_t codesize; /* Total size of all code sections. */ |
76 | int maxsection; /* 0 <= sectionidx < maxsection. */ | 76 | int maxsection; /* 0 <= sectionidx < maxsection. */ |
@@ -87,7 +87,6 @@ void dasm_init(Dst_DECL, int maxsection) | |||
87 | { | 87 | { |
88 | dasm_State *D; | 88 | dasm_State *D; |
89 | size_t psz = 0; | 89 | size_t psz = 0; |
90 | int i; | ||
91 | Dst_REF = NULL; | 90 | Dst_REF = NULL; |
92 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); | 91 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); |
93 | D = Dst_REF; | 92 | D = Dst_REF; |
@@ -98,12 +97,7 @@ void dasm_init(Dst_DECL, int maxsection) | |||
98 | D->pcsize = 0; | 97 | D->pcsize = 0; |
99 | D->globals = NULL; | 98 | D->globals = NULL; |
100 | D->maxsection = maxsection; | 99 | D->maxsection = maxsection; |
101 | for (i = 0; i < maxsection; i++) { | 100 | memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section)); |
102 | D->sections[i].buf = NULL; /* Need this for pass3. */ | ||
103 | D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); | ||
104 | D->sections[i].bsize = 0; | ||
105 | D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ | ||
106 | } | ||
107 | } | 101 | } |
108 | 102 | ||
109 | /* Free DynASM state. */ | 103 | /* Free DynASM state. */ |
@@ -123,7 +117,7 @@ void dasm_free(Dst_DECL) | |||
123 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) | 117 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) |
124 | { | 118 | { |
125 | dasm_State *D = Dst_REF; | 119 | dasm_State *D = Dst_REF; |
126 | D->globals = gl - 10; /* Negative bias to compensate for locals. */ | 120 | D->globals = gl; |
127 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); | 121 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); |
128 | } | 122 | } |
129 | 123 | ||
@@ -372,7 +366,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
372 | break; | 366 | break; |
373 | case DASM_REL_LG: | 367 | case DASM_REL_LG: |
374 | if (n < 0) { | 368 | if (n < 0) { |
375 | n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp - 4); | 369 | n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp - 4); |
376 | goto patchrel; | 370 | goto patchrel; |
377 | } | 371 | } |
378 | /* fallthrough */ | 372 | /* fallthrough */ |
@@ -396,7 +390,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
396 | } | 390 | } |
397 | break; | 391 | break; |
398 | case DASM_LABEL_LG: | 392 | case DASM_LABEL_LG: |
399 | ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); | 393 | ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n); |
400 | break; | 394 | break; |
401 | case DASM_LABEL_PC: break; | 395 | case DASM_LABEL_PC: break; |
402 | case DASM_IMM: | 396 | case DASM_IMM: |
diff --git a/dynasm/dasm_arm64.h b/dynasm/dasm_arm64.h index 47c9c37d..e04898f1 100644 --- a/dynasm/dasm_arm64.h +++ b/dynasm/dasm_arm64.h | |||
@@ -72,7 +72,7 @@ struct dasm_State { | |||
72 | size_t lgsize; | 72 | size_t lgsize; |
73 | int *pclabels; /* PC label chains/pos ptrs. */ | 73 | int *pclabels; /* PC label chains/pos ptrs. */ |
74 | size_t pcsize; | 74 | size_t pcsize; |
75 | void **globals; /* Array of globals (bias -10). */ | 75 | void **globals; /* Array of globals. */ |
76 | dasm_Section *section; /* Pointer to active section. */ | 76 | dasm_Section *section; /* Pointer to active section. */ |
77 | size_t codesize; /* Total size of all code sections. */ | 77 | size_t codesize; /* Total size of all code sections. */ |
78 | int maxsection; /* 0 <= sectionidx < maxsection. */ | 78 | int maxsection; /* 0 <= sectionidx < maxsection. */ |
@@ -89,7 +89,6 @@ void dasm_init(Dst_DECL, int maxsection) | |||
89 | { | 89 | { |
90 | dasm_State *D; | 90 | dasm_State *D; |
91 | size_t psz = 0; | 91 | size_t psz = 0; |
92 | int i; | ||
93 | Dst_REF = NULL; | 92 | Dst_REF = NULL; |
94 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); | 93 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); |
95 | D = Dst_REF; | 94 | D = Dst_REF; |
@@ -100,12 +99,7 @@ void dasm_init(Dst_DECL, int maxsection) | |||
100 | D->pcsize = 0; | 99 | D->pcsize = 0; |
101 | D->globals = NULL; | 100 | D->globals = NULL; |
102 | D->maxsection = maxsection; | 101 | D->maxsection = maxsection; |
103 | for (i = 0; i < maxsection; i++) { | 102 | memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section)); |
104 | D->sections[i].buf = NULL; /* Need this for pass3. */ | ||
105 | D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); | ||
106 | D->sections[i].bsize = 0; | ||
107 | D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ | ||
108 | } | ||
109 | } | 103 | } |
110 | 104 | ||
111 | /* Free DynASM state. */ | 105 | /* Free DynASM state. */ |
@@ -125,7 +119,7 @@ void dasm_free(Dst_DECL) | |||
125 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) | 119 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) |
126 | { | 120 | { |
127 | dasm_State *D = Dst_REF; | 121 | dasm_State *D = Dst_REF; |
128 | D->globals = gl - 10; /* Negative bias to compensate for locals. */ | 122 | D->globals = gl; |
129 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); | 123 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); |
130 | } | 124 | } |
131 | 125 | ||
@@ -444,7 +438,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
444 | break; | 438 | break; |
445 | case DASM_REL_LG: | 439 | case DASM_REL_LG: |
446 | if (n < 0) { | 440 | if (n < 0) { |
447 | ptrdiff_t na = (ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp + 4; | 441 | ptrdiff_t na = (ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp + 4; |
448 | n = (int)na; | 442 | n = (int)na; |
449 | CK((ptrdiff_t)n == na, RANGE_REL); | 443 | CK((ptrdiff_t)n == na, RANGE_REL); |
450 | goto patchrel; | 444 | goto patchrel; |
@@ -487,7 +481,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
487 | goto patchrel; | 481 | goto patchrel; |
488 | } | 482 | } |
489 | case DASM_LABEL_LG: | 483 | case DASM_LABEL_LG: |
490 | ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); | 484 | ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n); |
491 | break; | 485 | break; |
492 | case DASM_LABEL_PC: break; | 486 | case DASM_LABEL_PC: break; |
493 | case DASM_IMM: | 487 | case DASM_IMM: |
diff --git a/dynasm/dasm_mips.h b/dynasm/dasm_mips.h index 3e99a005..495eaa0e 100644 --- a/dynasm/dasm_mips.h +++ b/dynasm/dasm_mips.h | |||
@@ -69,7 +69,7 @@ struct dasm_State { | |||
69 | size_t lgsize; | 69 | size_t lgsize; |
70 | int *pclabels; /* PC label chains/pos ptrs. */ | 70 | int *pclabels; /* PC label chains/pos ptrs. */ |
71 | size_t pcsize; | 71 | size_t pcsize; |
72 | void **globals; /* Array of globals (bias -10). */ | 72 | void **globals; /* Array of globals. */ |
73 | dasm_Section *section; /* Pointer to active section. */ | 73 | dasm_Section *section; /* Pointer to active section. */ |
74 | size_t codesize; /* Total size of all code sections. */ | 74 | size_t codesize; /* Total size of all code sections. */ |
75 | int maxsection; /* 0 <= sectionidx < maxsection. */ | 75 | int maxsection; /* 0 <= sectionidx < maxsection. */ |
@@ -86,7 +86,6 @@ void dasm_init(Dst_DECL, int maxsection) | |||
86 | { | 86 | { |
87 | dasm_State *D; | 87 | dasm_State *D; |
88 | size_t psz = 0; | 88 | size_t psz = 0; |
89 | int i; | ||
90 | Dst_REF = NULL; | 89 | Dst_REF = NULL; |
91 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); | 90 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); |
92 | D = Dst_REF; | 91 | D = Dst_REF; |
@@ -97,12 +96,7 @@ void dasm_init(Dst_DECL, int maxsection) | |||
97 | D->pcsize = 0; | 96 | D->pcsize = 0; |
98 | D->globals = NULL; | 97 | D->globals = NULL; |
99 | D->maxsection = maxsection; | 98 | D->maxsection = maxsection; |
100 | for (i = 0; i < maxsection; i++) { | 99 | memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section)); |
101 | D->sections[i].buf = NULL; /* Need this for pass3. */ | ||
102 | D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); | ||
103 | D->sections[i].bsize = 0; | ||
104 | D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ | ||
105 | } | ||
106 | } | 100 | } |
107 | 101 | ||
108 | /* Free DynASM state. */ | 102 | /* Free DynASM state. */ |
@@ -122,7 +116,7 @@ void dasm_free(Dst_DECL) | |||
122 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) | 116 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) |
123 | { | 117 | { |
124 | dasm_State *D = Dst_REF; | 118 | dasm_State *D = Dst_REF; |
125 | D->globals = gl - 10; /* Negative bias to compensate for locals. */ | 119 | D->globals = gl; |
126 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); | 120 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); |
127 | } | 121 | } |
128 | 122 | ||
@@ -350,7 +344,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
350 | break; | 344 | break; |
351 | case DASM_REL_LG: | 345 | case DASM_REL_LG: |
352 | if (n < 0) { | 346 | if (n < 0) { |
353 | n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp); | 347 | n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp); |
354 | goto patchrel; | 348 | goto patchrel; |
355 | } | 349 | } |
356 | /* fallthrough */ | 350 | /* fallthrough */ |
@@ -369,7 +363,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
369 | } | 363 | } |
370 | break; | 364 | break; |
371 | case DASM_LABEL_LG: | 365 | case DASM_LABEL_LG: |
372 | ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); | 366 | ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n); |
373 | break; | 367 | break; |
374 | case DASM_LABEL_PC: break; | 368 | case DASM_LABEL_PC: break; |
375 | case DASM_IMMS: | 369 | case DASM_IMMS: |
diff --git a/dynasm/dasm_ppc.h b/dynasm/dasm_ppc.h index fdb89bce..30b757e3 100644 --- a/dynasm/dasm_ppc.h +++ b/dynasm/dasm_ppc.h | |||
@@ -69,7 +69,7 @@ struct dasm_State { | |||
69 | size_t lgsize; | 69 | size_t lgsize; |
70 | int *pclabels; /* PC label chains/pos ptrs. */ | 70 | int *pclabels; /* PC label chains/pos ptrs. */ |
71 | size_t pcsize; | 71 | size_t pcsize; |
72 | void **globals; /* Array of globals (bias -10). */ | 72 | void **globals; /* Array of globals. */ |
73 | dasm_Section *section; /* Pointer to active section. */ | 73 | dasm_Section *section; /* Pointer to active section. */ |
74 | size_t codesize; /* Total size of all code sections. */ | 74 | size_t codesize; /* Total size of all code sections. */ |
75 | int maxsection; /* 0 <= sectionidx < maxsection. */ | 75 | int maxsection; /* 0 <= sectionidx < maxsection. */ |
@@ -86,7 +86,6 @@ void dasm_init(Dst_DECL, int maxsection) | |||
86 | { | 86 | { |
87 | dasm_State *D; | 87 | dasm_State *D; |
88 | size_t psz = 0; | 88 | size_t psz = 0; |
89 | int i; | ||
90 | Dst_REF = NULL; | 89 | Dst_REF = NULL; |
91 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); | 90 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); |
92 | D = Dst_REF; | 91 | D = Dst_REF; |
@@ -97,12 +96,7 @@ void dasm_init(Dst_DECL, int maxsection) | |||
97 | D->pcsize = 0; | 96 | D->pcsize = 0; |
98 | D->globals = NULL; | 97 | D->globals = NULL; |
99 | D->maxsection = maxsection; | 98 | D->maxsection = maxsection; |
100 | for (i = 0; i < maxsection; i++) { | 99 | memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section)); |
101 | D->sections[i].buf = NULL; /* Need this for pass3. */ | ||
102 | D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); | ||
103 | D->sections[i].bsize = 0; | ||
104 | D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ | ||
105 | } | ||
106 | } | 100 | } |
107 | 101 | ||
108 | /* Free DynASM state. */ | 102 | /* Free DynASM state. */ |
@@ -122,7 +116,7 @@ void dasm_free(Dst_DECL) | |||
122 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) | 116 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) |
123 | { | 117 | { |
124 | dasm_State *D = Dst_REF; | 118 | dasm_State *D = Dst_REF; |
125 | D->globals = gl - 10; /* Negative bias to compensate for locals. */ | 119 | D->globals = gl; |
126 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); | 120 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); |
127 | } | 121 | } |
128 | 122 | ||
@@ -354,7 +348,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
354 | break; | 348 | break; |
355 | case DASM_REL_LG: | 349 | case DASM_REL_LG: |
356 | if (n < 0) { | 350 | if (n < 0) { |
357 | n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp); | 351 | n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp); |
358 | goto patchrel; | 352 | goto patchrel; |
359 | } | 353 | } |
360 | /* fallthrough */ | 354 | /* fallthrough */ |
@@ -368,7 +362,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
368 | cp[-1] |= ((n+4) & ((ins & 2048) ? 0x0000fffc: 0x03fffffc)); | 362 | cp[-1] |= ((n+4) & ((ins & 2048) ? 0x0000fffc: 0x03fffffc)); |
369 | break; | 363 | break; |
370 | case DASM_LABEL_LG: | 364 | case DASM_LABEL_LG: |
371 | ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); | 365 | ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n); |
372 | break; | 366 | break; |
373 | case DASM_LABEL_PC: break; | 367 | case DASM_LABEL_PC: break; |
374 | case DASM_IMM: | 368 | case DASM_IMM: |
diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h index f0327302..66a68ea5 100644 --- a/dynasm/dasm_x86.h +++ b/dynasm/dasm_x86.h | |||
@@ -68,7 +68,7 @@ struct dasm_State { | |||
68 | size_t lgsize; | 68 | size_t lgsize; |
69 | int *pclabels; /* PC label chains/pos ptrs. */ | 69 | int *pclabels; /* PC label chains/pos ptrs. */ |
70 | size_t pcsize; | 70 | size_t pcsize; |
71 | void **globals; /* Array of globals (bias -10). */ | 71 | void **globals; /* Array of globals. */ |
72 | dasm_Section *section; /* Pointer to active section. */ | 72 | dasm_Section *section; /* Pointer to active section. */ |
73 | size_t codesize; /* Total size of all code sections. */ | 73 | size_t codesize; /* Total size of all code sections. */ |
74 | int maxsection; /* 0 <= sectionidx < maxsection. */ | 74 | int maxsection; /* 0 <= sectionidx < maxsection. */ |
@@ -85,7 +85,6 @@ void dasm_init(Dst_DECL, int maxsection) | |||
85 | { | 85 | { |
86 | dasm_State *D; | 86 | dasm_State *D; |
87 | size_t psz = 0; | 87 | size_t psz = 0; |
88 | int i; | ||
89 | Dst_REF = NULL; | 88 | Dst_REF = NULL; |
90 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); | 89 | DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection)); |
91 | D = Dst_REF; | 90 | D = Dst_REF; |
@@ -96,12 +95,7 @@ void dasm_init(Dst_DECL, int maxsection) | |||
96 | D->pcsize = 0; | 95 | D->pcsize = 0; |
97 | D->globals = NULL; | 96 | D->globals = NULL; |
98 | D->maxsection = maxsection; | 97 | D->maxsection = maxsection; |
99 | for (i = 0; i < maxsection; i++) { | 98 | memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section)); |
100 | D->sections[i].buf = NULL; /* Need this for pass3. */ | ||
101 | D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i); | ||
102 | D->sections[i].bsize = 0; | ||
103 | D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */ | ||
104 | } | ||
105 | } | 99 | } |
106 | 100 | ||
107 | /* Free DynASM state. */ | 101 | /* Free DynASM state. */ |
@@ -121,7 +115,7 @@ void dasm_free(Dst_DECL) | |||
121 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) | 115 | void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl) |
122 | { | 116 | { |
123 | dasm_State *D = Dst_REF; | 117 | dasm_State *D = Dst_REF; |
124 | D->globals = gl - 10; /* Negative bias to compensate for locals. */ | 118 | D->globals = gl; |
125 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); | 119 | DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int)); |
126 | } | 120 | } |
127 | 121 | ||
@@ -445,7 +439,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
445 | break; | 439 | break; |
446 | } | 440 | } |
447 | case DASM_REL_LG: p++; if (n >= 0) goto rel_pc; | 441 | case DASM_REL_LG: p++; if (n >= 0) goto rel_pc; |
448 | b++; n = (int)(ptrdiff_t)D->globals[-n]; | 442 | b++; n = (int)(ptrdiff_t)D->globals[-n-10]; |
449 | /* fallthrough */ | 443 | /* fallthrough */ |
450 | case DASM_REL_A: rel_a: | 444 | case DASM_REL_A: rel_a: |
451 | n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */ | 445 | n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */ |
@@ -459,7 +453,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
459 | } | 453 | } |
460 | case DASM_IMM_LG: | 454 | case DASM_IMM_LG: |
461 | p++; | 455 | p++; |
462 | if (n < 0) { dasma((ptrdiff_t)D->globals[-n]); break; } | 456 | if (n < 0) { dasma((ptrdiff_t)D->globals[-n-10]); break; } |
463 | /* fallthrough */ | 457 | /* fallthrough */ |
464 | case DASM_IMM_PC: { | 458 | case DASM_IMM_PC: { |
465 | int *pb = DASM_POS2PTR(D, n); | 459 | int *pb = DASM_POS2PTR(D, n); |
@@ -469,7 +463,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
469 | case DASM_LABEL_LG: { | 463 | case DASM_LABEL_LG: { |
470 | int idx = *p++; | 464 | int idx = *p++; |
471 | if (idx >= 10) | 465 | if (idx >= 10) |
472 | D->globals[idx] = (void *)(base + (*p == DASM_SETLABEL ? *b : n)); | 466 | D->globals[idx-10] = (void *)(base + (*p == DASM_SETLABEL ? *b : n)); |
473 | break; | 467 | break; |
474 | } | 468 | } |
475 | case DASM_LABEL_PC: case DASM_SETLABEL: break; | 469 | case DASM_LABEL_PC: case DASM_SETLABEL: break; |