[arch-commits] Commit in glibc/trunk (PKGBUILD reenable_DT_HASH.patch)

Frederik Schwan freswa at gemini.archlinux.org
Thu Aug 11 17:49:39 UTC 2022


    Date: Thursday, August 11, 2022 @ 17:49:39
  Author: freswa
Revision: 452589

re-add DT_HASH to glibc shared objects removed in 2.36

An anti cheat tool from EPIC still relies on DT_HASH.
This is supposed to give upstream some time to adapt to
DT_GNU_HASH.

Added:
  glibc/trunk/reenable_DT_HASH.patch
Modified:
  glibc/trunk/PKGBUILD

------------------------+
 PKGBUILD               |    9 ++
 reenable_DT_HASH.patch |  145 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 153 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-08-11 17:37:23 UTC (rev 452588)
+++ PKGBUILD	2022-08-11 17:49:39 UTC (rev 452589)
@@ -22,6 +22,7 @@
         lib32-glibc.conf
         sdt.h sdt-config.h
         disable-clone3.diff
+        reenable_DT_HASH.patch
 )
 validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell
               BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar
@@ -31,7 +32,8 @@
         '7c265e6d36a5c0dff127093580827d15519b6c7205c2e1300e82f0fb5b9dd00b6accb40c56581f18179c4fbbc95bd2bf1b900ace867a83accde0969f7b609f8a'
         'a6a5e2f2a627cc0d13d11a82458cfd0aa75ec1c5a3c7647e5d5a3bb1d4c0770887a3909bfda1236803d5bc9801bfd6251e13483e9adf797e4725332cd0d91a0e'
         '214e995e84b342fe7b2a7704ce011b7c7fc74c2971f98eeb3b4e677b99c860addc0a7d91b8dc0f0b8be7537782ee331999e02ba48f4ccc1c331b60f27d715678'
-        'edef5f724f68ea95c6b0127bd13a10245f548afc381b2d0a6d1d06ee9f87b7dd89c6becd35d5ae722bf838594eb870a747f67f07f46e7d63f8c8d1a43cce4a52')
+        'edef5f724f68ea95c6b0127bd13a10245f548afc381b2d0a6d1d06ee9f87b7dd89c6becd35d5ae722bf838594eb870a747f67f07f46e7d63f8c8d1a43cce4a52'
+        '5fdd133c367af2f5454ea1eea7907de12166fb95eb59dbe33eae16aa9e26209b6585972bc1c80e36a0af4bfb04296acaf940ee78cd624cdcbab9669dff46c051')
 
 prepare() {
   mkdir -p glibc-build lib32-glibc-build
@@ -44,6 +46,11 @@
   # https://github.com/electron/electron/commit/993ecb5bdd5c57024c8718ca6203a8f924d6d574
   # Patch src: https://patchwork.ozlabs.org/project/glibc/patch/87eebkf8ph.fsf@oldenburg.str.redhat.com/
   patch -Np1 -i "${srcdir}"/disable-clone3.diff
+
+  # re-enable `--hash-style=both` for building shared objects due to issues with EPIC's EAC
+  # which relies on DT_HASH to be present in these libs.
+  # reconsider 2023-01
+  patch -Np1 -i "${srcdir}"/reenable_DT_HASH.patch
 }
 
 build() {

Added: reenable_DT_HASH.patch
===================================================================
--- reenable_DT_HASH.patch	                        (rev 0)
+++ reenable_DT_HASH.patch	2022-08-11 17:49:39 UTC (rev 452589)
@@ -0,0 +1,145 @@
+From e47de5cb2d4dbecb58f569ed241e8e95c568f03c Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at redhat.com>
+Date: Fri, 29 Apr 2022 16:37:51 +0200
+Subject: [PATCH] Do not use --hash-style=both for building glibc shared
+ objects
+
+The comment indicates that --hash-style=both was used to maintain
+compatibility with static dlopen, but we had many internal ABI
+changes since then, so this compatiblity does not add value anymore.
+
+Reviewed-by: Carlos O'Donell <carlos at redhat.com>
+---
+ Makeconfig     |  9 +++++++++
+ Makerules      |  7 +++++++
+ config.make.in |  1 +
+ configure      | 28 ++++++++++++++++++++++++++++
+ configure.ac   | 16 ++++++++++++++++
+ 5 files changed, 61 insertions(+)
+
+diff --git b/Makeconfig a/Makeconfig
+index 760f14e92f..0aa5fb0099 100644
+--- b/Makeconfig
++++ a/Makeconfig
+@@ -362,6 +362,15 @@ relro-LDFLAGS = -Wl,-z,relro
+ LDFLAGS.so += $(relro-LDFLAGS)
+ LDFLAGS-rtld += $(relro-LDFLAGS)
+ 
++ifeq (yes,$(have-hash-style))
++# For the time being we unconditionally use 'both'.  At some time we
++# should declare statically linked code as 'out of luck' and compile
++# with --hash-style=gnu only.
++hashstyle-LDFLAGS = -Wl,--hash-style=both
++LDFLAGS.so += $(hashstyle-LDFLAGS)
++LDFLAGS-rtld += $(hashstyle-LDFLAGS)
++endif
++
+ ifeq (no,$(build-pie-default))
+ pie-default = $(no-pie-ccflag)
+ else # build-pie-default
+diff --git b/Makerules a/Makerules
+index 354528b8c7..428464f092 100644
+--- b/Makerules
++++ a/Makerules
+@@ -557,6 +557,13 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
+ 		  -Wl,--verbose 2>/dev/null | \
+ 	  sed > $@T \
+ 	      -e '/^=========/,/^=========/!d;/^=========/d' \
++	      $(if $(filter yes,$(have-hash-style)), \
++		   -e 's/^.*\.gnu\.hash[ 	]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
++		   -e '/^[ 	]*\.hash[ 	]*:.*$$/{h;d;}' \
++		   -e '/DATA_SEGMENT_ALIGN/{H;g}' \
++		, \
++		   -e 's/^.*\.hash[ 	]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
++	       ) \
+ 	      -e 's/^.*\*(\.dynbss).*$$/& \
+ 		 PROVIDE(__start___libc_freeres_ptrs = .); \
+ 		 *(__libc_freeres_ptrs) \
+diff --git b/config.make.in a/config.make.in
+index fff4c78dd0..bf728c71c0 100644
+--- b/config.make.in
++++ a/config.make.in
+@@ -70,6 +70,7 @@ have-libcap = @have_libcap@
+ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
+ fno-unit-at-a-time = @fno_unit_at_a_time@
+ bind-now = @bindnow@
++have-hash-style = @libc_cv_hashstyle@
+ use-default-link = @use_default_link@
+ have-cxx-thread_local = @libc_cv_cxx_thread_local@
+ have-loop-to-function = @libc_cv_cc_loop_to_function@
+diff --git b/configure a/configure
+index 716dc041b6..5a730dc5fc 100755
+--- b/configure
++++ a/configure
+@@ -622,6 +622,7 @@ libc_cv_cc_nofma
+ libc_cv_mtls_dialect_gnu2
+ fno_unit_at_a_time
+ libc_cv_has_glob_dat
++libc_cv_hashstyle
+ libc_cv_fpie
+ libc_cv_z_execstack
+ ASFLAGS_config
+@@ -6193,6 +6194,33 @@ $as_echo "$libc_cv_fpie" >&6; }
+ 
+ 
+ 
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --hash-style option" >&5
++$as_echo_n "checking for --hash-style option... " >&6; }
++if ${libc_cv_hashstyle+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat > conftest.c <<EOF
++int _start (void) { return 42; }
++EOF
++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
++			    -fPIC -shared -o conftest.so conftest.c
++			    -Wl,--hash-style=both -nostdlib 1>&5'
++  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }
++then
++  libc_cv_hashstyle=yes
++else
++  libc_cv_hashstyle=no
++fi
++rm -f conftest*
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hashstyle" >&5
++$as_echo "$libc_cv_hashstyle" >&6; }
++
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
+ $as_echo_n "checking for GLOB_DAT reloc... " >&6; }
+ if ${libc_cv_has_glob_dat+:} false; then :
+diff --git b/configure.ac a/configure.ac
+index d08ad4d64e..a045f6608e 100644
+--- b/configure.ac
++++ a/configure.ac
+@@ -1360,6 +1360,22 @@ LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
+ 
+ AC_SUBST(libc_cv_fpie)
+ 
++AC_CACHE_CHECK(for --hash-style option,
++	       libc_cv_hashstyle, [dnl
++cat > conftest.c <<EOF
++int _start (void) { return 42; }
++EOF
++if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
++			    -fPIC -shared -o conftest.so conftest.c
++			    -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
++then
++  libc_cv_hashstyle=yes
++else
++  libc_cv_hashstyle=no
++fi
++rm -f conftest*])
++AC_SUBST(libc_cv_hashstyle)
++
+ AC_CACHE_CHECK(for GLOB_DAT reloc,
+ 	       libc_cv_has_glob_dat, [dnl
+ cat > conftest.c <<EOF
+-- 
+2.37.1
+



More information about the arch-commits mailing list