Ver Fonte

* renamed tls model switches and symbols to match gcc

git-svn-id: trunk@43122 -
florian há 5 anos atrás
pai
commit
03f7ef4c63
7 ficheiros alterados com 31 adições e 19 exclusões
  1. 1 1
      Makefile
  2. 1 1
      Makefile.fpc
  3. 8 3
      compiler/arm/cpuelf.pas
  4. 10 3
      compiler/globtype.pas
  5. 1 1
      compiler/i386/cpupi.pas
  6. 6 6
      compiler/options.pas
  7. 4 4
      compiler/x86/nx86ld.pas

+ 1 - 1
Makefile

@@ -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)

+ 1 - 1
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),)
-override OPTNEW+=-CVgeneral
+override OPTNEW+=-CVgeneral-dynamic
 endif
 endif
 

+ 8 - 3
compiler/arm/cpuelf.pas

@@ -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;

+ 10 - 3
compiler/globtype.pas

@@ -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

+ 1 - 1
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]) 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

+ 6 - 6
compiler/options.pas

@@ -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 }

+ 4 - 4
compiler/x86/nx86ld.pas

@@ -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,[]);