Add pthread support
authorMatt Caswell <matt@openssl.org>
Thu, 19 Nov 2015 14:55:09 +0000 (14:55 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 20 Nov 2015 23:19:16 +0000 (23:19 +0000)
The forthcoming async code needs to use pthread thread local variables. This
updates the various Configurations to add the necessary flags. In many cases
this is an educated guess as I don't have access to most of these
environments! There is likely to be some tweaking needed.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Configurations/10-main.conf

index 426fbfa..a24b992 100644 (file)
@@ -46,7 +46,7 @@
         cflags           => "-march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3 -fomit-frame-pointer",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-lsocket -lnsl -ldl",
         bn_ops           => "BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}",
         dso_scheme       => "dlfcn",
@@ -69,7 +69,7 @@
         cflags           => "-m64 -Wall -DL_ENDIAN",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-lsocket -lnsl -ldl",
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL",
         perlasm_scheme   => "elf",
@@ -88,7 +88,7 @@
         debug_cflags     => "-g",
         release_cflags   => "-xO5 -xregs=frameptr -xdepend -xbuiltin",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-lsocket -lnsl -ldl",
+        lflags           => "-lsocket -lnsl -ldl -mt -lpthread",
         bn_ops           => "BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR",
         dso_scheme       => "dlfcn",
         shared_target    => "solaris-shared",
         debug_cflags     => "-g",
         release_cflags   => "-xO5 -xdepend -xbuiltin",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-lsocket -lnsl -ldl",
+        lflags           => "-lsocket -lnsl -ldl -mt -lpthread",
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL",
         perlasm_scheme   => "elf",
         dso_scheme       => "dlfcn",
         cflags           => "-Wall -DB_ENDIAN -DBN_DIV2W",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-lsocket -lnsl -ldl",
         bn_ops           => "BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR",
         dso_scheme       => "dlfcn",
         debug_cflags     => "-g -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL",
         release_cflags   => "-xO5 -xdepend",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-lsocket -lnsl -ldl",
+        lflags           => "-lsocket -lnsl -ldl -mt -lpthread",
         bn_ops           => "BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR",
         dso_scheme       => "dlfcn",
         shared_target    => "solaris-shared",
         cflags           => "-mabi=n32 -DB_ENDIAN -DBN_DIV3W",
         debug_cflags     => "-g -O0",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_SGI_MP_SOURCE",
+        thread_cflag     => "-D_SGI_MP_SOURCE -pthread",
         bn_ops           => "MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT",
         perlasm_scheme   => "n32",
         dso_scheme       => "dlfcn",
         debug_cflags     => "-g -O0",
         release_cflags   => "-O2",
         thread_cflag     => "-D_SGI_MP_SOURCE",
+        lflags           => "-lpthread",
         bn_ops           => "DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT",
         perlasm_scheme   => "n32",
         dso_scheme       => "dlfcn",
         debug_cflags     => "-g -O0",
         release_cflags   => "-O2",
         thread_cflag     => "-D_SGI_MP_SOURCE",
+        lflags           => "-lpthread",
         bn_ops           => "RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "64",
         dso_scheme       => "dlfcn",
         cflags           => "-DB_ENDIAN -DBN_DIV2W",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-Wl,+s -ldld",
         bn_ops           => "BN_LLONG DES_PTR DES_UNROLL DES_RISC1",
         dso_scheme       => "dl",
         debug_cflags      => "+O0 +d -g",
         release_cflags   => "+O3",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-Wl,+s -ldld",
+        lflags           => "-Wl,+s -ldld -lpthread",
         bn_ops           => "MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dl",
         shared_target    => "hpux-shared",
         debug_cflags      => "+O0 +d -g",
         release_cflags   => "+O3",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-ldl",
+        lflags           => "-ldl -lpthread",
         bn_ops           => "SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         debug_cflags     => "+O0 +d -g",
         release_cflags   => "+O2",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-ldl",
+        lflags           => "-ldl -lpthread",
         bn_ops           => "SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         debug_cflags     => "+O0 +d -g",
         release_cflags   => "+O3",
         thread_cflag     => "-D_REENTRANT",
-        lflags           => "-ldl",
+        lflags           => "-ldl -lpthread",
         bn_ops           => "SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         cflags           => "-DB_ENDIAN",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-ldl",
         bn_ops           => "SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dlfcn",
         cflags           => "-mlp64 -DB_ENDIAN",
         debug_cflags     => "-O0 -g",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-ldl",
         bn_ops           => "SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT",
         dso_scheme       => "dlfcn",
         cflags           => "-Wall",
         debug_cflags     => "-O0 -g -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG",
         release_cflags   => "-O3",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-ldl",
         bn_ops           => "BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR",
         dso_scheme       => "dlfcn",
     "linux64-s390x" => {
         inherit_from     => [ "linux-generic64", asm("s390x_asm") ],
         cflags           => "-m64 -Wall -DB_ENDIAN",
-        thread_cflag     => "-D_REENTRANT",
         perlasm_scheme   => "64",
         shared_ldflag    => "-m64",
         multilib         => "64",
         inherit_from     => [ asm("x86_elf_asm") ],
         cc               => "gcc",
         cflags           => "-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall",
-        thread_cflag     => "-D_REENTRANT",
+        thread_cflag     => "-pthread",
         lflags           => "-ldl",
         bn_ops           => "BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}",
         dso_scheme       => "dlfcn",