aboutsummaryrefslogtreecommitdiff
path: root/dynasm/dasm_arm.h
diff options
context:
space:
mode:
Diffstat (limited to 'dynasm/dasm_arm.h')
-rw-r--r--dynasm/dasm_arm.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/dynasm/dasm_arm.h b/dynasm/dasm_arm.h
index f7f3d0db..fbfebee0 100644
--- a/dynasm/dasm_arm.h
+++ b/dynasm/dasm_arm.h
@@ -294,7 +294,7 @@ int dasm_link(Dst_DECL, size_t *szp)
294 294
295 { /* Handle globals not defined in this translation unit. */ 295 { /* Handle globals not defined in this translation unit. */
296 int idx; 296 int idx;
297 for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) { 297 for (idx = 10; idx*sizeof(int) < D->lgsize; idx++) {
298 int n = D->lglabels[idx]; 298 int n = D->lglabels[idx];
299 /* Undefined label: Collapse rel chain and replace with marker (< 0). */ 299 /* Undefined label: Collapse rel chain and replace with marker (< 0). */
300 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } 300 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
@@ -371,7 +371,10 @@ int dasm_encode(Dst_DECL, void *buffer)
371 ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000; 371 ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
372 break; 372 break;
373 case DASM_REL_LG: 373 case DASM_REL_LG:
374 CK(n >= 0, UNDEF_LG); 374 if (n < 0) {
375 n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp - 4);
376 goto patchrel;
377 }
375 /* fallthrough */ 378 /* fallthrough */
376 case DASM_REL_PC: 379 case DASM_REL_PC:
377 CK(n >= 0, UNDEF_PC); 380 CK(n >= 0, UNDEF_PC);