* use for threadvars on RiscV always the size optimization code path as loading addresses is expensive

This commit is contained in:
florian 2025-04-03 23:14:43 +02:00
parent fc43e66f05
commit 6c4d218b8d

View File

@ -326,8 +326,12 @@ implementation
else
reference_reset_symbol(tvref,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),0,sizeof(pint),[]);
{ Enable size optimization with -Os or PIC code is generated and PIC uses GOT }
size_opt:=(cs_opt_size in current_settings.optimizerswitches)
or ((cs_create_pic in current_settings.moduleswitches) and (tf_pic_uses_got in target_info.flags));
size_opt:={$if defined(RISCV)}
true
{$else defined(RISCV)}
(cs_opt_size in current_settings.optimizerswitches)
or ((cs_create_pic in current_settings.moduleswitches) and (tf_pic_uses_got in target_info.flags))
{$endif defined(RISCV)};
hreg_tv_rec:=NR_INVALID;
if size_opt then
begin