elf: Build dl-tls.o with early startup symbol redirections

Message ID 87o6zk9xsg.fsf@oldenburg.str.redhat.com (mailing list archive)
State Committed
Commit 68c9ef4419b8a4574dacc8e96296ec24bdc01da8
Headers
Series elf: Build dl-tls.o with early startup symbol redirections |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

Florian Weimer Feb. 2, 2025, 3:22 p.m. UTC
  This is required when building for powerpc64le POWER8 with GCC 8
at least.

Fixes commit cbd9fd236981717d3d4ee942986ea912e9707c32 ("Consolidate
TLS block allocation for static binaries with ld.so").

---
 csu/libc-tls.c | 1 +
 elf/dl-tls.c   | 6 ++++++
 2 files changed, 7 insertions(+)
  

Comments

Adhemerval Zanella Netto Feb. 3, 2025, 2:11 p.m. UTC | #1
On 02/02/25 12:22, Florian Weimer wrote:
> This is required when building for powerpc64le POWER8 with GCC 8
> at least.
> 
> Fixes commit cbd9fd236981717d3d4ee942986ea912e9707c32 ("Consolidate
> TLS block allocation for static binaries with ld.so").

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
>  csu/libc-tls.c | 1 +
>  elf/dl-tls.c   | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/csu/libc-tls.c b/csu/libc-tls.c
> index 07c37f3af9..0da39b72b4 100644
> --- a/csu/libc-tls.c
> +++ b/csu/libc-tls.c
> @@ -30,6 +30,7 @@
>  #include <dl-extra_tls.h>
>  #include <array_length.h>
>  #include <elf/dl-tls_block_align.h>
> +#include <dl-symbol-redir-ifunc.h>
>  
>  #ifdef SHARED
>   #error makefile bug, this file is for static only
> diff --git a/elf/dl-tls.c b/elf/dl-tls.c
> index a4a826e6a4..5fd435f18b 100644
> --- a/elf/dl-tls.c
> +++ b/elf/dl-tls.c
> @@ -39,6 +39,12 @@
>  
>  #include <dl-extra_tls.h>
>  
> +/* This code is used during early startup when statically linked,
> +   via __libc_setup_tls in csu/libc-tls.c.  */
> +#ifndef SHARED
> +# include <dl-symbol-redir-ifunc.h>
> +#endif
> +
>  /* Surplus static TLS, GLRO(dl_tls_static_surplus), is used for
>  
>     - IE TLS in libc.so for all dlmopen namespaces except in the initial
>
  

Patch

diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 07c37f3af9..0da39b72b4 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -30,6 +30,7 @@ 
 #include <dl-extra_tls.h>
 #include <array_length.h>
 #include <elf/dl-tls_block_align.h>
+#include <dl-symbol-redir-ifunc.h>
 
 #ifdef SHARED
  #error makefile bug, this file is for static only
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index a4a826e6a4..5fd435f18b 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -39,6 +39,12 @@ 
 
 #include <dl-extra_tls.h>
 
+/* This code is used during early startup when statically linked,
+   via __libc_setup_tls in csu/libc-tls.c.  */
+#ifndef SHARED
+# include <dl-symbol-redir-ifunc.h>
+#endif
+
 /* Surplus static TLS, GLRO(dl_tls_static_surplus), is used for
 
    - IE TLS in libc.so for all dlmopen namespaces except in the initial