Improve cross compilation unit template matching

This commit is contained in:
drmortalwombat 2025-05-14 18:18:13 +02:00
parent 78e3696663
commit 37cacdafa7
2 changed files with 25 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}
}
}