From 39dff26a3bec02d03f6283657c45f33070ff7d7a Mon Sep 17 00:00:00 2001 From: ggn Date: Sun, 1 Mar 2020 22:24:50 +0200 Subject: [PATCH] Supplementary fix for bug #140. Apparently bf4dbb2860116dd1d0fd934b28a16f9eb15cd7fd wasn't enough, we needed to add some extra logic to AddBSDSymEntry --- maketabs.bat | 2 +- object.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/maketabs.bat b/maketabs.bat index 0d993c0..c5947a9 100644 --- a/maketabs.bat +++ b/maketabs.bat @@ -25,7 +25,7 @@ if not exist %FILE2% GOTO BUILD for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i if %NEWEST%==%FILE1% GOTO BUILD -SET FILE1=dsp56k.tab +SET FILE1=dsp56k.mch SET FILE2=dsp56ktab.h if not exist %FILE2% GOTO BUILD for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i diff --git a/object.c b/object.c index 7545866..0b7df7e 100644 --- a/object.c +++ b/object.c @@ -173,14 +173,16 @@ uint8_t * AddBSDSymEntry(uint8_t * buf, SYM * sym, int globflag) { z = 0x02000000; // Set equated flag } - else + + // If a symbol is both EQUd and flagged as TBD then we let + // the later take precedence. Otherwise the linker will not even + // bother trying to relocate the address during link time + + switch (w1 & TDB) { - switch (w1 & TDB) - { - case TEXT: z = 0x04000000; break; // Set TEXT segment flag - case DATA: z = 0x06000000; break; // Set DATA segment flag - case BSS : z = 0x08000000; break; // Set BSS segment flag - } + case TEXT: z = 0x04000000; break; // Set TEXT segment flag + case DATA: z = 0x06000000; break; // Set DATA segment flag + case BSS : z = 0x08000000; break; // Set BSS segment flag } if (globflag) -- 2.37.2