Make stub files compatible with binutils-multiarch-2.18.
This commit is contained in:
parent
ec1bd342b8
commit
590767c299
@ -181,7 +181,7 @@ __tc_varsearch = $(firstword $(foreach v,$1,$(if $($v),$v,)))
|
||||
# error sentinel for missing commands
|
||||
__tc_FALSE = false tc_FALSE: '1:$1 2:$2 3:$3 4:$4 5:$5' '$@' '$<' '$(tc_list)'
|
||||
# call (expand) the first variable that is not empty
|
||||
# [move the next line within the "tc" macro for debugging]
|
||||
# [move the next comment line within the "tc" macro for debugging]
|
||||
# tc debug '1:$1 2:$2 3:$3 4:$4 5:$5' '$@' '$<' '$(tc_list)'
|
||||
define tc
|
||||
$(call $(call __tc_varsearch,$(call __tc_varlist,$1) __tc_FALSE),$2,$3,$4,$5)
|
||||
@ -199,12 +199,12 @@ tc.default.sstrip = sstrip
|
||||
tc.default.xstrip = $(PYTHON) $(top_srcdir)/src/stub/scripts/xstrip.py
|
||||
|
||||
# default multiarch-binutils
|
||||
tc.default.m-ar = multiarch-ar-2.17
|
||||
tc.default.m-ld = multiarch-ld-2.17 $(if $(tc_bfdname),-b $(tc_bfdname))
|
||||
tc.default.m-nm = multiarch-nm-2.17 $(if $(tc_bfdname),--target=$(tc_bfdname))
|
||||
tc.default.m-objcopy = multiarch-objcopy-2.17 $(if $(tc_bfdname),-F $(tc_bfdname))
|
||||
tc.default.m-objdump = multiarch-objdump-2.17 $(if $(tc_bfdname),-b $(tc_bfdname)) $(if $(tc_bfdarch),-m $(tc_bfdarch))
|
||||
tc.default.m-readelf = multiarch-readelf-2.17
|
||||
tc.default.m-ar = multiarch-ar-2.18
|
||||
tc.default.m-ld = multiarch-ld-2.18 $(if $(tc_bfdname),-b $(tc_bfdname))
|
||||
tc.default.m-nm = multiarch-nm-2.18 $(if $(tc_bfdname),--target=$(tc_bfdname))
|
||||
tc.default.m-objcopy = multiarch-objcopy-2.18 $(if $(tc_bfdname),-F $(tc_bfdname))
|
||||
tc.default.m-objdump = multiarch-objdump-2.18 $(if $(tc_bfdname),-b $(tc_bfdname)) $(if $(tc_bfdarch),-m $(tc_bfdarch))
|
||||
tc.default.m-readelf = multiarch-readelf-2.18
|
||||
|
||||
# default binutils
|
||||
tc.default.ld = $(call tc,m-ld)
|
||||
@ -253,7 +253,9 @@ amd64-linux.elf-entry.h: $(srcdir)/src/$$T.S
|
||||
$(call tc,bin2h) tmp/$T.bin $@
|
||||
|
||||
amd64-linux.elf-fold.h : tmp/$$T.o tmp/amd64-linux.elf-main.o $(srcdir)/src/$$T.lds
|
||||
$(call tc,ld) --strip-all -T $(srcdir)/src/$T.lds -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin
|
||||
# # FIXME: multiarch-ld-2.18 creates a huge file here, so use 2.17
|
||||
# ####$(call tc,ld) --strip-all -T $(srcdir)/src/$T.lds -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin
|
||||
multiarch-ld-2.17 --strip-all -T $(srcdir)/src/$T.lds -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin
|
||||
$(call tc,f-objstrip,tmp/$T.bin)
|
||||
$(call tc,sstrip) tmp/$T.bin
|
||||
$(call tc,bin2h) tmp/$T.bin $@
|
||||
|
||||
@ -53,7 +53,9 @@ lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,f-objstrip,tmp/$T.o)
|
||||
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
||||
head -c-0 tmp/$T.bin > tmp/$T.out
|
||||
$(call tc,objdump) -b binary -m armv4 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
# # info: multiarch-objdump-2.18 segfaults here, so use 2.17
|
||||
# ####$(call tc,objdump) -b binary -m armv4 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
multiarch-objdump-2.17 -b binary -m armv4 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
@ -51,7 +51,9 @@ lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,f-objstrip,tmp/$T.o)
|
||||
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
||||
head -c-0 tmp/$T.bin > tmp/$T.out
|
||||
$(call tc,objdump) -b binary -m armv4t -M force-thumb -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
# # info: multiarch-objdump-2.18 segfaults here, so use 2.17
|
||||
# ####$(call tc,objdump) -b binary -m armv4t -M force-thumb -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
multiarch-objdump-2.17 -b binary -m armv4t -M force-thumb -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
@ -259,6 +259,7 @@ l_test_all: tmp/l_test_gcc_i386.out
|
||||
ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),)
|
||||
tmp/l_test_bc.% : tc_list = method-lzma arch-i086 default
|
||||
tmp/l_test_bc.exe: l_test.c $(L_TEST_DEPS)
|
||||
@rm -f l_test.o l_test.obj tmp/test.exe $@
|
||||
$(call tc,bcc) -o$(subst /,\\,$@) $<
|
||||
@rm -f l_test.o l_test.obj
|
||||
cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe
|
||||
@ -268,6 +269,7 @@ endif
|
||||
ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),)
|
||||
tmp/l_test_dm.% : tc_list = method-lzma arch-i086 default
|
||||
tmp/l_test_dm.exe: l_test.c $(L_TEST_DEPS)
|
||||
@rm -f l_test.o l_test.obj tmp/test.exe $@
|
||||
$(call tc,dmc) -ml -o$(subst /,\\,$@) $<
|
||||
@rm -f l_test.o l_test.obj
|
||||
cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe
|
||||
@ -277,6 +279,7 @@ endif
|
||||
ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),)
|
||||
tmp/l_test_vc.% : tc_list = method-lzma arch-i086 default
|
||||
tmp/l_test_vc.exe: l_test.c $(L_TEST_DEPS)
|
||||
@rm -f l_test.o l_test.obj tmp/test.exe $@
|
||||
$(call tc,cl) -Fe$(subst /,\\,$@) $<
|
||||
@rm -f l_test.o l_test.obj
|
||||
cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe
|
||||
@ -286,6 +289,7 @@ endif
|
||||
ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
||||
tmp/l_test_wc.% : tc_list = method-lzma arch-i086 default
|
||||
tmp/l_test_wc.exe: l_test.c $(L_TEST_DEPS)
|
||||
@rm -f l_test.o l_test.obj tmp/test.exe $@
|
||||
$(call tc,wcl) -fe=$@ $<
|
||||
@rm -f l_test.o l_test.obj
|
||||
cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe
|
||||
|
||||
@ -176,9 +176,9 @@ def main(argv):
|
||||
args = ""
|
||||
if m.group(3): args = m.group(3).strip()
|
||||
#
|
||||
if inst in ["movl",] and re.search(r"\b[de]s\b", args):
|
||||
# fix bug in objdump
|
||||
inst = "movw"
|
||||
if 1 and inst in ["movl",] and re.search(r"\b[de]s\b", args):
|
||||
# work around a bug in objdump 2.17 (fixed in binutils 2.18)
|
||||
inst = "mov"
|
||||
m = re.search(r"^(.+?)\b0x0\s+(\w+):\s+(1|2|R_386_16|R_386_PC16)\s+(__\w+)$", args)
|
||||
if m:
|
||||
# 1 or 2 byte reloc
|
||||
@ -197,10 +197,10 @@ def main(argv):
|
||||
if v[:2] == [1, 2]: # external 2-byte
|
||||
if k == "__aNahdiff":
|
||||
s = [
|
||||
["push", "word ptr [bp+8]"],
|
||||
["push", "word ptr [bp+6]"],
|
||||
["push", r"word ptr \[bp([+-]\d+)\]$"],
|
||||
["push", r"word ptr \[bp([+-]\d+)\]$"],
|
||||
["push", "word ptr [bp+(8|0x8)]"],
|
||||
["push", "word ptr [bp+(6|0x6)]"],
|
||||
["push", r"word ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
["push", r"word ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
]
|
||||
dpos = omatch(i-1, -4, s)
|
||||
if dpos:
|
||||
@ -276,7 +276,7 @@ def main(argv):
|
||||
["rcl", "di,1"],
|
||||
]
|
||||
s2 = [
|
||||
["les", r"^bx,dword ptr \[bp([+-]\d+)\]$"],
|
||||
["les", r"^bx,dword ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
]
|
||||
dpos1 = omatch(i-1, -3, s1)
|
||||
dpos2 = omatch(i+1, 1, s2)
|
||||
@ -292,7 +292,7 @@ def main(argv):
|
||||
]
|
||||
s2 = [
|
||||
["mov", "si,ax"],
|
||||
["les", r"^bx,dword ptr \[bp([+-]\d+)\]$"],
|
||||
["les", r"^bx,dword ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
]
|
||||
dpos1 = omatch(i-1, -4, s1)
|
||||
dpos2 = omatch(i+1, 2, s2)
|
||||
@ -302,8 +302,8 @@ def main(argv):
|
||||
continue
|
||||
s1 = [
|
||||
["mov", r"^c[lx],0x8$"],
|
||||
["shl", r"^word ptr \[bp([+-]\d+)\],1$"],
|
||||
["rcl", r"^word ptr \[bp([+-]\d+)\],1$"],
|
||||
["shl", r"^word ptr \[bp([+-](\d+|0x\w+))\],1$"],
|
||||
["rcl", r"^word ptr \[bp([+-](\d+|0x\w+))\],1$"],
|
||||
]
|
||||
s2 = [
|
||||
["mov", r"^dx,word ptr"],
|
||||
@ -322,17 +322,17 @@ def main(argv):
|
||||
orewrite_inst(i, m, "", dpos1)
|
||||
continue
|
||||
s1 = [
|
||||
["mov", r"^word ptr \[bp([+-]\d+)\],si$"],
|
||||
["mov", r"^word ptr \[bp([+-]\d+)\],di$"],
|
||||
["mov", r"^word ptr \[bp([+-](\d+|0x\w+))\],si$"],
|
||||
["mov", r"^word ptr \[bp([+-](\d+|0x\w+))\],di$"],
|
||||
["mov", r"^c[lx],0xb$"],
|
||||
["shr", r"^word ptr \[bp([+-]\d+)\],1$"],
|
||||
["rcr", r"^word ptr \[bp([+-]\d+)\],1$"],
|
||||
["shr", r"^word ptr \[bp([+-](\d+|0x\w+))\],1$"],
|
||||
["rcr", r"^word ptr \[bp([+-](\d+|0x\w+))\],1$"],
|
||||
]
|
||||
s2 = [
|
||||
["mov", r"^bx,word ptr"],
|
||||
["mov", r"^bx,word ptr"],
|
||||
["mov", r"^ax,word ptr \[bp([+-]\d+)\]$"],
|
||||
["mov", r"^dx,word ptr \[bp([+-]\d+)\]$"],
|
||||
["mov", r"^ax,word ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
["mov", r"^dx,word ptr \[bp([+-](\d+|0x\w+))\]$"],
|
||||
]
|
||||
dpos1 = omatch(i-1, -5, s1)
|
||||
dpos2 = omatch(i+1, 4, s2)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user