From a2d3522812a74b2715191f9d447407582fda6951 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 5 Oct 2019 20:48:29 +0000 Subject: [PATCH] * general-dynamic -> global-dynamic git-svn-id: trunk@43132 - --- Makefile | 2 +- Makefile.fpc | 2 +- compiler/arm/aoptcpu.pas | 6 +++++- compiler/arm/narmld.pas | 2 +- compiler/globtype.pas | 2 +- compiler/i386/cpupi.pas | 2 +- compiler/options.pas | 6 +++--- compiler/x86/nx86ld.pas | 4 ++-- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 204672433b..42337ce057 100644 --- a/Makefile +++ b/Makefile @@ -472,7 +472,7 @@ OPTNEW+=$(OPT) endif ifneq ($(findstring $(OS_TARGET),linux),) ifneq ($(findstring $(CPU_TARGET),i386 arm),) -override OPTNEW+=-CVgeneral-dynamic +override OPTNEW+=-CVglobal-dynamic endif endif CLEANOPTS=FPC=$(PPNEW) diff --git a/Makefile.fpc b/Makefile.fpc index d4fc7f3174..b7beb32e2b 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -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 arm),) -override OPTNEW+=-CVgeneral-dynamic +override OPTNEW+=-CVglobal-dynamic endif endif diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index ac7212261d..487fe349ab 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -2657,7 +2657,11 @@ Implementation ) and GetNextInstruction(hp1,hp2) and (hp2.typ=ait_instruction) and - { loaded register used by next instruction? } + { loaded register used by next instruction? + + if we ever support labels (they could be skipped in theory) here, the gnu2 tls general-dynamic code could get broken (the ldr before + the bl may not be scheduled away from the bl) and it needs to be taken care of this case + } (RegInInstruction(taicpu(hp1).oper[0]^.reg,hp2)) and { loaded register not used by previous instruction? } not(RegInInstruction(taicpu(hp1).oper[0]^.reg,p)) and diff --git a/compiler/arm/narmld.pas b/compiler/arm/narmld.pas index 8194a2a1e4..5db7be9b34 100644 --- a/compiler/arm/narmld.pas +++ b/compiler/arm/narmld.pas @@ -68,7 +68,7 @@ implementation if not(pi_uses_threadvar in current_procinfo.flags) then internalerror(2012012101); case current_settings.tlsmodel of - tlsm_general_dynamic: + tlsm_global_dynamic: begin {$ifdef use_tls_dialect_gnu} current_asmdata.getjumplabel(l); diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 47b1771c37..26dcbb9d43 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -752,7 +752,7 @@ interface ttlsmodel = (tlsm_none, { elf tls model: works for all kind of code and thread vars } - tlsm_general_dynamic, + tlsm_global_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, diff --git a/compiler/i386/cpupi.pas b/compiler/i386/cpupi.pas index b4c3478e3e..d4391d73b0 100644 --- a/compiler/i386/cpupi.pas +++ b/compiler/i386/cpupi.pas @@ -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_dynamic]) then + if (pi_uses_threadvar in flags) and (tf_section_threadvars in target_info.flags) and (current_settings.tlsmodel in [tlsm_global_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 diff --git a/compiler/options.pas b/compiler/options.pas index 09c7dad61b..a479658d9a 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -1485,8 +1485,8 @@ begin 'V': begin s:=upper(copy(more,j+1,length(more)-j)); - if s='GENERAL-DYNAMIC' then - init_settings.tlsmodel:=tlsm_general_dynamic + if s='GLOBAL-DYNAMIC' then + init_settings.tlsmodel:=tlsm_global_dynamic else if s='LOCAL-EXEC' then init_settings.tlsmodel:=tlsm_local_exec else @@ -4155,7 +4155,7 @@ 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_dynamic + init_settings.tlsmodel:=tlsm_global_dynamic else init_settings.tlsmodel:=tlsm_local_exec; end; diff --git a/compiler/x86/nx86ld.pas b/compiler/x86/nx86ld.pas index c0e9da0d32..50800ead3a 100644 --- a/compiler/x86/nx86ld.pas +++ b/compiler/x86/nx86ld.pas @@ -98,7 +98,7 @@ implementation location.reference.segment:=NR_GS; location.reference.refaddr:=addr_ntpoff; end; - tlsm_general_dynamic: + tlsm_global_dynamic: begin include(current_procinfo.flags,pi_needs_got); reference_reset(href,0,[]); @@ -132,7 +132,7 @@ implementation location.reference.segment:=NR_FS; location.reference.refaddr:=addr_tpoff; end; - tlsm_general_dynamic: + tlsm_global_dynamic: begin current_asmdata.CurrAsmList.concat(tai_const.Create_8bit($66)); reference_reset(href,0,[]);