- don't emit DEBUGSTART and DEBUGEND symbols for WebAssembly. See https://bugs.llvm.org/show_bug.cgi?id=48971

git-svn-id: branches/wasm@48509 -
This commit is contained in:
nickysn 2021-02-04 10:07:17 +00:00
parent 9de09f1d28
commit c073362928

View File

@ -3257,30 +3257,33 @@ implementation
flist : TFPList; flist : TFPList;
dbgname : String; dbgname : String;
begin begin
{ insert DEBUGSTART and DEBUGEND labels } if not (target_info.system in systems_wasm) then
dbgname:=make_mangledname('DEBUGSTART',current_module.localsymtable,''); begin
{ Darwin's linker does not like two global labels both pointing to the { insert DEBUGSTART and DEBUGEND labels }
end of a section, which can happen in case of units without code -> dbgname:=make_mangledname('DEBUGSTART',current_module.localsymtable,'');
make them local; we don't need the debugtable stuff there either, { Darwin's linker does not like two global labels both pointing to the
so it doesn't matter that they are not global. end of a section, which can happen in case of units without code ->
} make them local; we don't need the debugtable stuff there either,
if (target_info.system in systems_darwin) then so it doesn't matter that they are not global.
dbgname:='L'+dbgname; }
new_section(current_asmdata.asmlists[al_start],sec_code,dbgname,0,secorder_begin); if (target_info.system in systems_darwin) then
if not(target_info.system in systems_darwin) then dbgname:='L'+dbgname;
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype)) new_section(current_asmdata.asmlists[al_start],sec_code,dbgname,0,secorder_begin);
else if not(target_info.system in systems_darwin) then
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype)); current_asmdata.asmlists[al_start].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype))
else
current_asmdata.asmlists[al_start].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype));
dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,''); dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,'');
{ See above. } { See above. }
if (target_info.system in systems_darwin) then if (target_info.system in systems_darwin) then
dbgname:='L'+dbgname; dbgname:='L'+dbgname;
new_section(current_asmdata.asmlists[al_end],sec_code,dbgname,0,secorder_end); new_section(current_asmdata.asmlists[al_end],sec_code,dbgname,0,secorder_end);
if not(target_info.system in systems_darwin) then if not(target_info.system in systems_darwin) then
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype)) current_asmdata.asmlists[al_end].concat(tai_symbol.Createname_global(dbgname,AT_METADATA,0,voidpointertype))
else else
current_asmdata.asmlists[al_end].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype)); current_asmdata.asmlists[al_end].concat(tai_symbol.Createname(dbgname,AT_METADATA,0,voidpointertype));
end;
{ insert .Ldebug_abbrev0 label } { insert .Ldebug_abbrev0 label }
templist:=TAsmList.create; templist:=TAsmList.create;
@ -3575,19 +3578,27 @@ implementation
if (m_objectivec1 in current_settings.modeswitches) then if (m_objectivec1 in current_settings.modeswitches) then
append_attribute(DW_AT_APPLE_major_runtime_vers,DW_FORM_data1,[1]); append_attribute(DW_AT_APPLE_major_runtime_vers,DW_FORM_data1,[1]);
dbgname:=make_mangledname('DEBUGSTART',current_module.localsymtable,''); if target_info.system in systems_wasm then
if (target_info.system in systems_darwin) then
begin begin
bind:=AB_LOCAL; append_attribute(DW_AT_low_pc,DW_FORM_data4,[0]);
dbgname:='L'+dbgname; { todo: append DW_AT_ranges }
end end
else else
bind:=AB_GLOBAL; begin
append_labelentry(DW_AT_low_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype)); dbgname:=make_mangledname('DEBUGSTART',current_module.localsymtable,'');
dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,''); if (target_info.system in systems_darwin) then
if (target_info.system in systems_darwin) then begin
dbgname:='L'+dbgname; bind:=AB_LOCAL;
append_labelentry(DW_AT_high_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype)); dbgname:='L'+dbgname;
end
else
bind:=AB_GLOBAL;
append_labelentry(DW_AT_low_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype));
dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,'');
if (target_info.system in systems_darwin) then
dbgname:='L'+dbgname;
append_labelentry(DW_AT_high_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_METADATA,voidpointertype));
end;
finish_entry; finish_entry;
@ -3671,7 +3682,7 @@ implementation
begin begin
{ Reference all DEBUGINFO sections from the main .fpc section } { Reference all DEBUGINFO sections from the main .fpc section }
{ to prevent eliminating them by smartlinking } { to prevent eliminating them by smartlinking }
if (target_info.system in ([system_powerpc_macosclassic]+systems_darwin)) then if (target_info.system in ([system_powerpc_macosclassic]+systems_darwin+systems_wasm)) then
exit; exit;
new_section(list,sec_fpc,'links',0); new_section(list,sec_fpc,'links',0);