aboutsummaryrefslogtreecommitdiff
path: root/dynasm/dasm_arm64.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dynasm/dasm_arm64.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/dynasm/dasm_arm64.h b/dynasm/dasm_arm64.h
index b2251532..5ff4414c 100644
--- a/dynasm/dasm_arm64.h
+++ b/dynasm/dasm_arm64.h
@@ -354,7 +354,7 @@ int dasm_link(Dst_DECL, size_t *szp)
354 354
355 { /* Handle globals not defined in this translation unit. */ 355 { /* Handle globals not defined in this translation unit. */
356 int idx; 356 int idx;
357 for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) { 357 for (idx = 10; idx*sizeof(int) < D->lgsize; idx++) {
358 int n = D->lglabels[idx]; 358 int n = D->lglabels[idx];
359 /* Undefined label: Collapse rel chain and replace with marker (< 0). */ 359 /* Undefined label: Collapse rel chain and replace with marker (< 0). */
360 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } 360 while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
@@ -432,7 +432,10 @@ int dasm_encode(Dst_DECL, void *buffer)
432 ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000; 432 ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
433 break; 433 break;
434 case DASM_REL_LG: 434 case DASM_REL_LG:
435 CK(n >= 0, UNDEF_LG); 435 if (n < 0) {
436 n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp + 4);
437 goto patchrel;
438 }
436 /* fallthrough */ 439 /* fallthrough */
437 case DASM_REL_PC: 440 case DASM_REL_PC:
438 CK(n >= 0, UNDEF_PC); 441 CK(n >= 0, UNDEF_PC);