summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-29 11:34:38 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-29 11:34:38 -0700
commitf6cd2be083fa6bc254009a3f67bd93a6e9b40390 (patch)
treed53350112ef686666b5d6b9c7ecc3325342796da
parent4d53abdcc9ac77b51f3856886d0e585f9f0b3225 (diff)
downloadsamples-f6cd2be083fa6bc254009a3f67bd93a6e9b40390.tar.gz
samples-f6cd2be083fa6bc254009a3f67bd93a6e9b40390.tar.xz
samples-f6cd2be083fa6bc254009a3f67bd93a6e9b40390.zip
rel32.asm: don't bother supporting more than 16,367 relocations
We can save 9 bytes if the relocation count is limited to 16,367 which is very likely to be the case (that's 64K of memory just containing relocatable values!) If we have more than that we are probably doing something involving extended memory and we should do this in protected mode anyway. See: DJGPP.
-rw-r--r--elf2exe/rel32.asm5
1 files changed, 5 insertions, 0 deletions
diff --git a/elf2exe/rel32.asm b/elf2exe/rel32.asm
index 984823e..2b743ac 100644
--- a/elf2exe/rel32.asm
+++ b/elf2exe/rel32.asm
@@ -48,10 +48,15 @@ _start:
add [es:di],ax
adc [es:di+2],dx
add si,4
+%ifdef SUPPORT_64K_RELOCS
+ ;; Without these instructions, all relocations plus the
+ ;; stub have to fit in 64K, which still allows for just under
+ ;; 16K relocations.
jnc .ok
mov di,ds
add di,1000h
mov ds,di
+%endif
.ok:
loop .relocloop