From 37cacdafa7acfc1384157b8bb3ad45838dc3eaa6 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Wed, 14 May 2025 18:18:13 +0200 Subject: [PATCH] Improve cross compilation unit template matching --- oscar64/Declaration.cpp | 2 +- oscar64/Linker.cpp | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index c77e5e5..cfb7b11 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -2842,7 +2842,7 @@ bool Declaration::IsSame(const Declaration* dec) const return true; } - else if (mType == DT_TYPE_TEMPLATE) + else if (mType == DT_TYPE_TEMPLATE || mType == DT_PACK_TEMPLATE) { return mIdent == dec->mIdent; } diff --git a/oscar64/Linker.cpp b/oscar64/Linker.cpp index 3276b3e..54ebad4 100644 --- a/oscar64/Linker.cpp +++ b/oscar64/Linker.cpp @@ -1903,6 +1903,8 @@ bool Linker::WriteDbjFile(FILE* file) return true; } +static const char hexchars[] = "0123456789abcdef"; + bool Linker::WriteLblFile(const char* filename) { FILE* file; @@ -1916,7 +1918,28 @@ bool Linker::WriteLblFile(const char* filename) if (obj->mFlags & LOBJF_REFERENCED) { if (obj->mIdent) - fprintf(file, "al %04x .%s\n", obj->mAddress, obj->mIdent->mString); + { + char buffer[400]; + char nbuffer[500]; + + strcpy_s(buffer, obj->mIdent->mString); + int i = 0, j = 0; + while (buffer[i]) + { + if (buffer[i] >= '0' && buffer[i] <= '9' || buffer[i] >= 'a' && buffer[i] <= 'z' || buffer[i] >= 'A' && buffer[i] <= 'Z' || buffer[i] == '_' || buffer[i] == ':') + nbuffer[j++] = buffer[i]; + else + { + nbuffer[j++] = '?'; + nbuffer[j++] = hexchars[(buffer[i] >> 4) & 0x0f]; + nbuffer[j++] = hexchars[buffer[i] & 0x0f]; + + } + i++; + } + nbuffer[j] = 0; + fprintf(file, "al %04x .%s\n", obj->mAddress, nbuffer); + } } }