diff options
Diffstat (limited to '')
-rw-r--r-- | dynasm/dasm_ppc.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dynasm/dasm_ppc.h b/dynasm/dasm_ppc.h index ae540e46..35264f2e 100644 --- a/dynasm/dasm_ppc.h +++ b/dynasm/dasm_ppc.h | |||
@@ -277,7 +277,7 @@ int dasm_link(Dst_DECL, size_t *szp) | |||
277 | 277 | ||
278 | { /* Handle globals not defined in this translation unit. */ | 278 | { /* Handle globals not defined in this translation unit. */ |
279 | int idx; | 279 | int idx; |
280 | for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) { | 280 | for (idx = 10; idx*sizeof(int) < D->lgsize; idx++) { |
281 | int n = D->lglabels[idx]; | 281 | int n = D->lglabels[idx]; |
282 | /* Undefined label: Collapse rel chain and replace with marker (< 0). */ | 282 | /* Undefined label: Collapse rel chain and replace with marker (< 0). */ |
283 | while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } | 283 | while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; } |
@@ -353,7 +353,10 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
353 | ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000; | 353 | ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000; |
354 | break; | 354 | break; |
355 | case DASM_REL_LG: | 355 | case DASM_REL_LG: |
356 | CK(n >= 0, UNDEF_LG); | 356 | if (n < 0) { |
357 | n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp); | ||
358 | goto patchrel; | ||
359 | } | ||
357 | /* fallthrough */ | 360 | /* fallthrough */ |
358 | case DASM_REL_PC: | 361 | case DASM_REL_PC: |
359 | CK(n >= 0, UNDEF_PC); | 362 | CK(n >= 0, UNDEF_PC); |