mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-25 23:22:33 +02:00
+ dwarf support for tls threadvars
git-svn-id: trunk@43134 -
This commit is contained in:
parent
df4ec9e8e3
commit
8ecdb2e9ca
@ -151,6 +151,8 @@ interface
|
|||||||
aitconst_got,
|
aitconst_got,
|
||||||
{ offset of symbol itself from GOT }
|
{ offset of symbol itself from GOT }
|
||||||
aitconst_gotoff_symbol,
|
aitconst_gotoff_symbol,
|
||||||
|
{ offset in TLS block }
|
||||||
|
aitconst_dtpoff,
|
||||||
{ ARM TLS code }
|
{ ARM TLS code }
|
||||||
aitconst_gottpoff,
|
aitconst_gottpoff,
|
||||||
aitconst_tpoff,
|
aitconst_tpoff,
|
||||||
@ -2108,6 +2110,8 @@ implementation
|
|||||||
result:=4;
|
result:=4;
|
||||||
aitconst_tlsdesc:
|
aitconst_tlsdesc:
|
||||||
result:=4;
|
result:=4;
|
||||||
|
aitconst_dtpoff:
|
||||||
|
result:=4;
|
||||||
else
|
else
|
||||||
internalerror(200603253);
|
internalerror(200603253);
|
||||||
end;
|
end;
|
||||||
|
@ -1010,6 +1010,21 @@ implementation
|
|||||||
writer.Asmln;
|
writer.Asmln;
|
||||||
end;
|
end;
|
||||||
{$endif cpu64bitaddr}
|
{$endif cpu64bitaddr}
|
||||||
|
aitconst_dtpoff:
|
||||||
|
begin
|
||||||
|
{$ifdef arm}
|
||||||
|
writer.AsmWrite(#9'.word'#9+tai_const(hp).sym.name+'(tlsldo)');
|
||||||
|
writer.Asmln;
|
||||||
|
{$endif arm}
|
||||||
|
{$ifdef x86_64}
|
||||||
|
writer.AsmWrite(#9'.long'#9+tai_const(hp).sym.name+'@dtpoff');
|
||||||
|
writer.Asmln;
|
||||||
|
{$endif x86_64}
|
||||||
|
{$ifdef i386}
|
||||||
|
writer.AsmWrite(#9'.word'#9+tai_const(hp).sym.name+'@tdpoff');
|
||||||
|
writer.Asmln;
|
||||||
|
{$endif i386}
|
||||||
|
end;
|
||||||
aitconst_got:
|
aitconst_got:
|
||||||
begin
|
begin
|
||||||
if tai_const(hp).symofs<>0 then
|
if tai_const(hp).symofs<>0 then
|
||||||
|
@ -350,6 +350,8 @@ implementation
|
|||||||
result:=R_ARM_TLS_CALL;
|
result:=R_ARM_TLS_CALL;
|
||||||
RELOC_ARM_CALL:
|
RELOC_ARM_CALL:
|
||||||
result:=R_ARM_CALL;
|
result:=R_ARM_CALL;
|
||||||
|
RELOC_DTPOFF:
|
||||||
|
result:=R_ARM_TLS_LDO32;
|
||||||
else
|
else
|
||||||
InternalError(2012110602);
|
InternalError(2012110602);
|
||||||
end;
|
end;
|
||||||
|
@ -2080,6 +2080,9 @@ Implementation
|
|||||||
ObjData.writereloc(Tai_const(hp).value,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_TLSDESC);
|
ObjData.writereloc(Tai_const(hp).value,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_TLSDESC);
|
||||||
end;
|
end;
|
||||||
{$endif arm}
|
{$endif arm}
|
||||||
|
aitconst_dtpoff:
|
||||||
|
{ so far, the size of dtpoff is fixed to 4 bytes }
|
||||||
|
ObjData.writereloc(Tai_const(hp).symofs,4,Objdata.SymbolRef(tai_const(hp).sym),RELOC_DTPOFF);
|
||||||
aitconst_gotoff_symbol:
|
aitconst_gotoff_symbol:
|
||||||
ObjData.writereloc(Tai_const(hp).symofs,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_GOTOFF);
|
ObjData.writereloc(Tai_const(hp).symofs,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_GOTOFF);
|
||||||
aitconst_uleb128bit,
|
aitconst_uleb128bit,
|
||||||
|
@ -2653,15 +2653,43 @@ implementation
|
|||||||
case sym.typ of
|
case sym.typ of
|
||||||
staticvarsym:
|
staticvarsym:
|
||||||
begin
|
begin
|
||||||
if (vo_is_thread_var in sym.varoptions) then
|
if vo_is_thread_var in sym.varoptions then
|
||||||
begin
|
begin
|
||||||
{ TODO: !!! FIXME: dwarf for thread vars !!!}
|
if tf_section_threadvars in target_info.flags then
|
||||||
{ This is only a minimal change to at least be able to get a value
|
begin
|
||||||
|
case sizeof(puint) of
|
||||||
|
2:
|
||||||
|
templist.concat(tai_const.create_8bit(ord(DW_OP_const2u)));
|
||||||
|
4:
|
||||||
|
templist.concat(tai_const.create_8bit(ord(DW_OP_const4u)));
|
||||||
|
8:
|
||||||
|
templist.concat(tai_const.create_8bit(ord(DW_OP_const8u)));
|
||||||
|
else
|
||||||
|
Internalerror(2019100501);
|
||||||
|
end;
|
||||||
|
{$push}
|
||||||
|
{$warn 6018 off} { Unreachable code due to compile time evaluation }
|
||||||
|
templist.concat(tai_const.Create_type_name(aitconst_dtpoff,sym.mangledname,0));
|
||||||
|
{ so far, aitconst_dtpoff is solely 32 bit }
|
||||||
|
if (sizeof(puint)=8) and (target_info.endian=endian_little) then
|
||||||
|
templist.concat(tai_const.create_32bit(0));
|
||||||
|
templist.concat(tai_const.create_8bit(ord(DW_OP_GNU_push_tls_address)));
|
||||||
|
if (sizeof(puint)=8) and (target_info.endian=endian_big) then
|
||||||
|
templist.concat(tai_const.create_32bit(0));
|
||||||
|
{$pop}
|
||||||
|
|
||||||
|
blocksize:=2+sizeof(puint);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{ TODO: !!! FIXME: dwarf for thread vars !!!}
|
||||||
|
{ This is only a minimal change to at least be able to get a value
|
||||||
in only one thread is present PM 2014-11-21, like for stabs format }
|
in only one thread is present PM 2014-11-21, like for stabs format }
|
||||||
templist.concat(tai_const.create_8bit(ord(DW_OP_addr)));
|
templist.concat(tai_const.create_8bit(ord(DW_OP_addr)));
|
||||||
templist.concat(tai_const.Create_type_name(aitconst_ptr_unaligned,sym.mangledname,
|
templist.concat(tai_const.Create_type_name(aitconst_ptr_unaligned,sym.mangledname,
|
||||||
offset+sizeof(pint)));
|
offset+sizeof(pint)));
|
||||||
blocksize:=1+sizeof(puint);
|
blocksize:=1+sizeof(puint);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -119,6 +119,8 @@ implementation
|
|||||||
InternalError(2019092101);
|
InternalError(2019092101);
|
||||||
RELOC_TLSGD:
|
RELOC_TLSGD:
|
||||||
result:=R_386_TLS_GD;
|
result:=R_386_TLS_GD;
|
||||||
|
RELOC_DTPOFF:
|
||||||
|
result:=R_386_TLS_DTPOFF32;
|
||||||
else
|
else
|
||||||
result:=0;
|
result:=0;
|
||||||
InternalError(2012082301);
|
InternalError(2012082301);
|
||||||
|
@ -115,7 +115,9 @@ interface
|
|||||||
{ Relative to GOT/gp }
|
{ Relative to GOT/gp }
|
||||||
RELOC_GOTOFF,
|
RELOC_GOTOFF,
|
||||||
{ Untranslated target-specific value }
|
{ Untranslated target-specific value }
|
||||||
RELOC_RAW
|
RELOC_RAW,
|
||||||
|
{ offset in TLS block }
|
||||||
|
RELOC_DTPOFF
|
||||||
);
|
);
|
||||||
|
|
||||||
{$if defined(x86_64)}
|
{$if defined(x86_64)}
|
||||||
|
@ -180,6 +180,13 @@ implementation
|
|||||||
InternalError(2019091701);
|
InternalError(2019091701);
|
||||||
RELOC_TLSGD:
|
RELOC_TLSGD:
|
||||||
result:=R_X86_64_TLSGD;
|
result:=R_X86_64_TLSGD;
|
||||||
|
RELOC_DTPOFF:
|
||||||
|
if objrel.size=8 then
|
||||||
|
result:=R_X86_64_DTPOFF64
|
||||||
|
else if objrel.size=4 then
|
||||||
|
result:=R_X86_64_DTPOFF32
|
||||||
|
else
|
||||||
|
InternalError(2019091701);
|
||||||
else
|
else
|
||||||
result:=0;
|
result:=0;
|
||||||
InternalError(2012082302);
|
InternalError(2012082302);
|
||||||
|
Loading…
Reference in New Issue
Block a user