From cf5af0f5f17a5cd19cce1ede7ef48788713afd47 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Fri, 18 Oct 2019 13:21:28 +0800 Subject: [PATCH] Fix another relocation bug This time I was swapping the meaning of the RelocBySectC/D opcodes. This wasn't terribly bad, because they were rarely used. I identified the bug while figuring out how to handle the rare fragment that uses XTOC glue to access its own guts in a patchable manner. --- cfmtool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cfmtool.py b/cfmtool.py index 353ee41..8dbad99 100755 --- a/cfmtool.py +++ b/cfmtool.py @@ -472,12 +472,12 @@ def dump_lowlevel(basepath): if subopcode == 0b0000: # RelocBySectC #print('RelocBySectC runLength=%d' % (runLength)) for i in range(runLength): - relocations.append(dict(section=sectionIndex, offset=relocAddress, to=('section', sectionD))); relocAddress += 4 + relocations.append(dict(section=sectionIndex, offset=relocAddress, to=('section', sectionC))); relocAddress += 4 elif subopcode == 0b0001: # RelocBySectD #print('RelocBySectD runLength=%d' % (runLength)) for i in range(runLength): - relocations.append(dict(section=sectionIndex, offset=relocAddress, to=('section', sectionC))); relocAddress += 4 + relocations.append(dict(section=sectionIndex, offset=relocAddress, to=('section', sectionD))); relocAddress += 4 elif subopcode == 0b0010: # RelocTVector12 #print('RelocTVector12 runLength=%d' % (runLength))