mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
* write set constants only as large as needed by taking care of resultdef.size, resolves issue #27886
git-svn-id: trunk@30655 -
This commit is contained in:
parent
3ded26a774
commit
6797685c86
@ -458,10 +458,10 @@ implementation
|
||||
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,result.name,const_align(8));
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lab));
|
||||
if (source_info.endian=target_info.endian) then
|
||||
for i:=0 to 31 do
|
||||
for i:=0 to resultdef.size-1 do
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(Psetbytes(value_set)^[i]))
|
||||
else
|
||||
for i:=0 to 31 do
|
||||
for i:=0 to resultdef.size-1 do
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(reverse_byte(Psetbytes(value_set)^[i])));
|
||||
end;
|
||||
|
||||
@ -474,7 +474,7 @@ implementation
|
||||
{ const already used ? }
|
||||
if not assigned(lab_set) then
|
||||
begin
|
||||
entry := current_asmdata.ConstPools[sp_varsets].FindOrAdd(value_set, 32);
|
||||
entry := current_asmdata.ConstPools[sp_varsets].FindOrAdd(value_set, resultdef.size);
|
||||
|
||||
{ :-(, we must generate a new entry }
|
||||
if not assigned(entry^.Data) then
|
||||
@ -515,41 +515,6 @@ implementation
|
||||
location.value:=location.value shr (32-resultdef.size*8);
|
||||
end;
|
||||
|
||||
procedure varsetconst;
|
||||
var
|
||||
lastlabel : tasmlabel;
|
||||
i : longint;
|
||||
entry : PHashSetItem;
|
||||
begin
|
||||
location_reset_ref(location,LOC_CREFERENCE,OS_NO,const_align(8));
|
||||
lastlabel:=nil;
|
||||
{ const already used ? }
|
||||
if not assigned(lab_set) then
|
||||
begin
|
||||
entry := current_asmdata.ConstPools[sp_varsets].FindOrAdd(value_set, 32);
|
||||
|
||||
lab_set := TAsmLabel(entry^.Data); // is it needed anymore?
|
||||
|
||||
{ :-(, we must generate a new entry }
|
||||
if not assigned(entry^.Data) then
|
||||
begin
|
||||
current_asmdata.getglobaldatalabel(lastlabel);
|
||||
lab_set:=lastlabel;
|
||||
entry^.Data:=lastlabel;
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]);
|
||||
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,lastlabel.name,const_align(8));
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel));
|
||||
if (source_info.endian=target_info.endian) then
|
||||
for i:=0 to 31 do
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(Psetbytes(value_set)^[i]))
|
||||
else
|
||||
for i:=0 to 31 do
|
||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(reverse_byte(Psetbytes(value_set)^[i])));
|
||||
end;
|
||||
end;
|
||||
location.reference.symbol:=lab_set;
|
||||
end;
|
||||
|
||||
begin
|
||||
adjustforsetbase;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user