* renamed tls model switches and symbols to match gcc

git-svn-id: trunk@43122 -
This commit is contained in:
florian 2019-10-05 20:48:20 +00:00
parent daa746243a
commit 03f7ef4c63
7 changed files with 31 additions and 19 deletions

View File

@ -472,7 +472,7 @@ OPTNEW+=$(OPT)
endif
ifneq ($(findstring $(OS_TARGET),linux),)
ifneq ($(findstring $(CPU_TARGET),i386),)
override OPTNEW+=-CVgeneral
override OPTNEW+=-CVgeneral-dynamic
endif
endif
CLEANOPTS=FPC=$(PPNEW)

View File

@ -202,7 +202,7 @@ endif
# the general threading model when compiling the final versions of rtl and packages
ifneq ($(findstring $(OS_TARGET),linux),)
ifneq ($(findstring $(CPU_TARGET),i386),)
override OPTNEW+=-CVgeneral
override OPTNEW+=-CVgeneral-dynamic
endif
endif

View File

@ -28,7 +28,7 @@ interface
implementation
uses
globtype,cutils,cclasses,
globtype,globals,cutils,cclasses,
verbose, elfbase,
systems,aasmbase,ogbase,ogelf,assemble;
@ -335,9 +335,14 @@ implementation
result:=R_ARM_THM_CALL;
RELOC_GOT32:
result:=R_ARM_GOT_BREL;
RELOC_TPOFF:
if current_settings.tlsmodel=tlsm_initial_exec then
result:=R_ARM_TLS_IE32
else if current_settings.tlsmodel=tlsm_local_exec then
result:=R_ARM_TLS_LE32
else
Internalerror(2019092901);
else
result:=0;
writeln(objrel.typ);
InternalError(2012110602);
end;
end;

View File

@ -744,15 +744,22 @@ interface
{ subroutine uses threadvars }
pi_uses_threadvar,
{ set if the procedure has generated data which shall go in an except table }
pi_has_except_table_data
pi_has_except_table_data,
{ subroutine needs to load and maintain a tls register }
pi_needs_tls
);
tprocinfoflags=set of tprocinfoflag;
ttlsmodel = (tlsm_none,
{ elf tls model: works for all kind of code and thread vars }
tlsm_general,
tlsm_general_dynamic,
{ elf tls model: works only if the thread vars are declared and used in the same module,
regardless when the module is loaded }
tlsm_local_dynamic,
{ elf tls model: works only if the thread vars are declared and used in modules and executables loaded at startup }
tlsm_initial_exec,
{ elf tls model: works only if the thread vars are declared and used in the same executable }
tlsm_local
tlsm_local_exec
);
type

View File

@ -98,7 +98,7 @@ unit cpupi;
procedure tcpuprocinfo.allocate_got_register(list: tasmlist);
begin
if (pi_uses_threadvar in flags) and (tf_section_threadvars in target_info.flags) and (current_settings.tlsmodel in [tlsm_general]) then
if (pi_uses_threadvar in flags) and (tf_section_threadvars in target_info.flags) and (current_settings.tlsmodel in [tlsm_general_dynamic]) then
begin
{ FIXME: It is better to use an imaginary register for GOT and
if EBX is needed for some reason just allocate EBX and

View File

@ -1485,10 +1485,10 @@ begin
'V':
begin
s:=upper(copy(more,j+1,length(more)-j));
if s='GENERAL' then
init_settings.tlsmodel:=tlsm_general
else if s='LOCAL' then
init_settings.tlsmodel:=tlsm_local
if s='GENERAL-DYNAMIC' then
init_settings.tlsmodel:=tlsm_general_dynamic
else if s='LOCAL-EXEC' then
init_settings.tlsmodel:=tlsm_local_exec
else
IllegalPara(opt);
break;
@ -4155,9 +4155,9 @@ begin
if (tf_section_threadvars in target_info.flags) and (init_settings.tlsmodel=tlsm_none) then
begin
if cs_create_pic in init_settings.moduleswitches then
init_settings.tlsmodel:=tlsm_general
init_settings.tlsmodel:=tlsm_general_dynamic
else
init_settings.tlsmodel:=tlsm_local;
init_settings.tlsmodel:=tlsm_local_exec;
end;
{ set Mac OS X version default macros if not specified explicitly }

View File

@ -93,12 +93,12 @@ implementation
system_i386_linux,system_i386_android:
begin
case current_settings.tlsmodel of
tlsm_local:
tlsm_local_exec:
begin
location.reference.segment:=NR_GS;
location.reference.refaddr:=addr_ntpoff;
end;
tlsm_general:
tlsm_general_dynamic:
begin
include(current_procinfo.flags,pi_needs_got);
reference_reset(href,0,[]);
@ -127,12 +127,12 @@ implementation
system_x86_64_linux:
begin
case current_settings.tlsmodel of
tlsm_local:
tlsm_local_exec:
begin
location.reference.segment:=NR_FS;
location.reference.refaddr:=addr_tpoff;
end;
tlsm_general:
tlsm_general_dynamic:
begin
current_asmdata.CurrAsmList.concat(tai_const.Create_8bit($66));
reference_reset(href,0,[]);