mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
* 8086: Fixed very long section names when $HUGECODE is ON and section based smartlinking is used.
* Added a utility function TrimStrCRC32(). git-svn-id: trunk@46511 -
This commit is contained in:
parent
b1ee6f7fdc
commit
1002a7c590
@ -26,7 +26,9 @@ Unit fpccrc;
|
||||
Interface
|
||||
|
||||
Function UpdateCrc32(InitCrc:cardinal;const InBuf;InLen:integer):cardinal;
|
||||
|
||||
{ If needed trims the string to maxlen, adding at the end the CRC32 of discarded chars.
|
||||
The resulting string is guaranteed to be not longer than maxlen. }
|
||||
function TrimStrCRC32(const s: ansistring; maxlen: longint): ansistring;
|
||||
|
||||
Implementation
|
||||
|
||||
@ -73,4 +75,21 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TrimStrCRC32(const s: ansistring; maxlen: longint): ansistring;
|
||||
var
|
||||
crc: DWord;
|
||||
len: longint;
|
||||
begin
|
||||
len:=length(s);
|
||||
if (len<=maxlen) or (len<12) then
|
||||
result:=s
|
||||
else
|
||||
begin
|
||||
dec(maxlen,11);
|
||||
crc:=0;
|
||||
crc:=UpdateCrc32(crc,s[maxlen+1],len-maxlen);
|
||||
result:=copy(s,1,maxlen)+'$CRC'+hexstr(crc,8);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -803,7 +803,7 @@ implementation
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
cutils,verbose,globals,
|
||||
cutils,verbose,globals,fpccrc,
|
||||
fmodule,aasmtai,aasmdata,
|
||||
ogmap,owomflib,elfbase,
|
||||
version
|
||||
@ -1053,7 +1053,7 @@ implementation
|
||||
if current_settings.x86memorymodel in x86_far_code_models then
|
||||
begin
|
||||
if cs_huge_code in current_settings.moduleswitches then
|
||||
result:=aname + '_TEXT'
|
||||
result:=TrimStrCRC32(aname,30) + '_TEXT'
|
||||
else
|
||||
result:=current_module.modulename^ + '_TEXT';
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cutils,globals,systems,
|
||||
cutils,globals,systems,fpccrc,
|
||||
fmodule,finput,verbose,cpuinfo,cgbase,omfbase
|
||||
;
|
||||
|
||||
@ -306,7 +306,7 @@ interface
|
||||
if current_settings.x86memorymodel in x86_far_code_models then
|
||||
begin
|
||||
if cs_huge_code in current_settings.moduleswitches then
|
||||
result:=aname + '_TEXT'
|
||||
result:=TrimStrCRC32(aname,30) + '_TEXT'
|
||||
else
|
||||
result:=current_module.modulename^ + '_TEXT';
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user