* Dwarf: write enum symbol constants with the size of the enum, as proposed in #41021

This commit is contained in:
florian 2025-04-16 23:19:08 +02:00
parent 23875bd8c4
commit eba0624535

View File

@ -1504,6 +1504,7 @@ implementation
var
hp : tenumsym;
i : integer;
entryform : Tdwarf_form;
begin
if assigned(def.typesym) then
append_entry(DW_TAG_enumeration_type,true,[
@ -1518,6 +1519,19 @@ implementation
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.basedef));
finish_entry;
case def.size of
1:
entryform:=DW_FORM_data1;
2:
entryform:=DW_FORM_data2;
4:
entryform:=DW_FORM_data4;
8:
entryform:=DW_FORM_data8;
else
Internalerror(2025041601);
end;
{ write enum symbols }
for i := 0 to def.symtable.SymList.Count - 1 do
begin
@ -1529,7 +1543,7 @@ implementation
break;
append_entry(DW_TAG_enumerator,false,[
DW_AT_name,DW_FORM_string,symname(hp, false)+#0,
DW_AT_const_value,DW_FORM_data4,hp.value
DW_AT_const_value,entryform,hp.value
]);
finish_entry;
end;