SymAnsiStr: fix "make all" and webtbs/tw39661*

Fixes compilation with LLVM backend
This commit is contained in:
Jonas Maebe 2022-05-08 14:59:36 +02:00
parent 78f23a462e
commit fcaea21075
3 changed files with 30 additions and 12 deletions

View File

@ -707,11 +707,11 @@ implementation
realintfdef:=realintfdef.childof;
tmpstr:=_class.objname^+'_$_'+make_mangledname('',realintfdef.owner,'')+'_$$_'+realintfdef.objname^+'_$_'+tostr(i)+'_$_'+pd.mangledname;
if length(tmpstr)>100 then
if length(tmpstr)>50 then
begin
crc:=0;
crc:=UpdateCrc32(crc,tmpstr[101],length(tmpstr)-100);
hs:=copy(tmpstr,1,100)+'$CRC'+hexstr(crc,8);
crc:=UpdateCrc32(crc,tmpstr[51],length(tmpstr)-50);
hs:=copy(tmpstr,1,50)+'$CRC'+hexstr(crc,8);
end
else
hs:=tmpstr;

View File

@ -351,7 +351,7 @@ implementation
if checkdup then
begin
if sym.realname[1]='$' then
hashedid.id:=Copy(sym.realname,2,255)
hashedid.id:=Copy(sym.realname,2,maxidlen+1)
else
hashedid.id:=Upper(sym.realname);
{ First check for duplicates, this can change the symbol name
@ -361,7 +361,11 @@ implementation
{ Now we can insert the symbol, any duplicate entries
are renamed to an unique (and for users unaccessible) name }
if sym.realname[1]='$' then
sym.ChangeOwnerAndName(SymList,Copy(sym.realname,2,255))
sym.ChangeOwnerAndName(SymList,Copy(sym.realname,2,maxidlen+1))
{$ifdef symansistr}
else if length(sym.realname)>maxidlen then
sym.ChangeOwnerAndName(SymList,Upper(Copy(sym.realname,1,maxidlen)))
{$endif}
else
sym.ChangeOwnerAndName(SymList,Upper(sym.realname));
sym.Owner:=self;

View File

@ -1544,15 +1544,17 @@ implementation
s:=tprocdef(st.defowner).procsym.name;
s:=s+tprocdef(st.defowner).mangledprocparanames(Length(s));
if prefix<>'' then
prefix:=s+'_'+prefix
begin
if length(prefix)>(maxidlen-length(s)-1) then
begin
hash:=0;
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
prefix:='$H'+Base64Mangle(hash);
end;
prefix:=s+'_'+prefix
end
else
prefix:=s;
if length(prefix)>100 then
begin
hash:=0;
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
prefix:='$H'+Base64Mangle(hash);
end;
st:=st.defowner.owner;
end;
{ object/classes symtable, nested type definitions in classes require the while loop }
@ -1560,6 +1562,12 @@ implementation
begin
if not (st.defowner.typ in [objectdef,recorddef]) then
internalerror(200204174);
if length(prefix)>(maxidlen-length(tabstractrecorddef(st.defowner).objname^)-3) then
begin
hash:=0;
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
prefix:='$H'+Base64Mangle(hash);
end;
prefix:=tabstractrecorddef(st.defowner).objname^+'_$_'+prefix;
st:=st.defowner.owner;
end;
@ -1596,6 +1604,12 @@ implementation
result:=result+'$_$'+prefix;
if suffix<>'' then
result:=result+'_$$_'+suffix;
if length(result)>(maxidlen-1) then
begin
hash:=0;
hash:=UpdateFnv64(hash,result[1],length(result));
result:=copy(result,1,maxidlen-(high(Base64OfUint64String)-low(Base64OfUint64String)+1)-2)+'$H'+Base64Mangle(hash);
end;
{ the Darwin assembler assumes that all symbols starting with 'L' are local }
{ Further, the Mac OS X 10.5 linker does not consider symbols which do not }
{ start with '_' as regular symbols (it does not generate N_GSYM entries }