tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
glibc: use patch from ArchLinux to re-enable DT_HASH
Maximilian Bosch
3 years ago
047f379d
667fac1b
+152
2 changed files
expand all
collapse all
unified
split
pkgs
development
libraries
glibc
common.nix
reenable_DT_HASH.patch
+7
pkgs/development/libraries/glibc/common.nix
···
88
88
./nix-nss-open-files.patch
89
89
90
90
./0001-Revert-Remove-all-usage-of-BASH-or-BASH-in-installed.patch
91
91
+
92
92
+
/* Patch derived from archlinux (at the time of adding they're at 2.37),
93
93
+
https://github.com/archlinux/svntogit-packages/blob/packages/glibc/trunk/reenable_DT_HASH.patch
94
94
+
95
95
+
See https://github.com/NixOS/nixpkgs/pull/188492#issuecomment-1233802991 for context.
96
96
+
*/
97
97
+
./reenable_DT_HASH.patch
91
98
]
92
99
++ lib.optional stdenv.hostPlatform.isMusl ./fix-rpc-types-musl-conflicts.patch
93
100
++ lib.optional stdenv.buildPlatform.isDarwin ./darwin-cross-build.patch;
+145
pkgs/development/libraries/glibc/reenable_DT_HASH.patch
···
1
1
+
From e47de5cb2d4dbecb58f569ed241e8e95c568f03c Mon Sep 17 00:00:00 2001
2
2
+
From: Florian Weimer <fweimer@redhat.com>
3
3
+
Date: Fri, 29 Apr 2022 16:37:51 +0200
4
4
+
Subject: [PATCH] Do not use --hash-style=both for building glibc shared
5
5
+
objects
6
6
+
7
7
+
The comment indicates that --hash-style=both was used to maintain
8
8
+
compatibility with static dlopen, but we had many internal ABI
9
9
+
changes since then, so this compatiblity does not add value anymore.
10
10
+
11
11
+
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
12
12
+
---
13
13
+
Makeconfig | 9 +++++++++
14
14
+
Makerules | 7 +++++++
15
15
+
config.make.in | 1 +
16
16
+
configure | 28 ++++++++++++++++++++++++++++
17
17
+
configure.ac | 16 ++++++++++++++++
18
18
+
5 files changed, 61 insertions(+)
19
19
+
20
20
+
diff --git b/Makeconfig a/Makeconfig
21
21
+
index 760f14e92f..0aa5fb0099 100644
22
22
+
--- b/Makeconfig
23
23
+
+++ a/Makeconfig
24
24
+
@@ -362,6 +362,15 @@ relro-LDFLAGS = -Wl,-z,relro
25
25
+
LDFLAGS.so += $(relro-LDFLAGS)
26
26
+
LDFLAGS-rtld += $(relro-LDFLAGS)
27
27
+
28
28
+
+ifeq (yes,$(have-hash-style))
29
29
+
+# For the time being we unconditionally use 'both'. At some time we
30
30
+
+# should declare statically linked code as 'out of luck' and compile
31
31
+
+# with --hash-style=gnu only.
32
32
+
+hashstyle-LDFLAGS = -Wl,--hash-style=both
33
33
+
+LDFLAGS.so += $(hashstyle-LDFLAGS)
34
34
+
+LDFLAGS-rtld += $(hashstyle-LDFLAGS)
35
35
+
+endif
36
36
+
+
37
37
+
ifeq (no,$(build-pie-default))
38
38
+
pie-default = $(no-pie-ccflag)
39
39
+
else # build-pie-default
40
40
+
diff --git b/Makerules a/Makerules
41
41
+
index 354528b8c7..428464f092 100644
42
42
+
--- b/Makerules
43
43
+
+++ a/Makerules
44
44
+
@@ -557,6 +557,13 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
45
45
+
-Wl,--verbose 2>/dev/null | \
46
46
+
sed > $@T \
47
47
+
-e '/^=========/,/^=========/!d;/^=========/d' \
48
48
+
+ $(if $(filter yes,$(have-hash-style)), \
49
49
+
+ -e 's/^.*\.gnu\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
50
50
+
+ -e '/^[ ]*\.hash[ ]*:.*$$/{h;d;}' \
51
51
+
+ -e '/DATA_SEGMENT_ALIGN/{H;g}' \
52
52
+
+ , \
53
53
+
+ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
54
54
+
+ ) \
55
55
+
-e 's/^.*\*(\.dynbss).*$$/& \
56
56
+
PROVIDE(__start___libc_freeres_ptrs = .); \
57
57
+
*(__libc_freeres_ptrs) \
58
58
+
diff --git b/config.make.in a/config.make.in
59
59
+
index fff4c78dd0..bf728c71c0 100644
60
60
+
--- b/config.make.in
61
61
+
+++ a/config.make.in
62
62
+
@@ -70,6 +70,7 @@ have-libcap = @have_libcap@
63
63
+
have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
64
64
+
fno-unit-at-a-time = @fno_unit_at_a_time@
65
65
+
bind-now = @bindnow@
66
66
+
+have-hash-style = @libc_cv_hashstyle@
67
67
+
use-default-link = @use_default_link@
68
68
+
have-cxx-thread_local = @libc_cv_cxx_thread_local@
69
69
+
have-loop-to-function = @libc_cv_cc_loop_to_function@
70
70
+
diff --git b/configure a/configure
71
71
+
index 716dc041b6..5a730dc5fc 100755
72
72
+
--- b/configure
73
73
+
+++ a/configure
74
74
+
@@ -622,6 +622,7 @@ libc_cv_cc_nofma
75
75
+
libc_cv_mtls_dialect_gnu2
76
76
+
fno_unit_at_a_time
77
77
+
libc_cv_has_glob_dat
78
78
+
+libc_cv_hashstyle
79
79
+
libc_cv_fpie
80
80
+
libc_cv_z_execstack
81
81
+
ASFLAGS_config
82
82
+
@@ -6193,6 +6194,33 @@ $as_echo "$libc_cv_fpie" >&6; }
83
83
+
84
84
+
85
85
+
86
86
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --hash-style option" >&5
87
87
+
+$as_echo_n "checking for --hash-style option... " >&6; }
88
88
+
+if ${libc_cv_hashstyle+:} false; then :
89
89
+
+ $as_echo_n "(cached) " >&6
90
90
+
+else
91
91
+
+ cat > conftest.c <<EOF
92
92
+
+int _start (void) { return 42; }
93
93
+
+EOF
94
94
+
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
95
95
+
+ -fPIC -shared -o conftest.so conftest.c
96
96
+
+ -Wl,--hash-style=both -nostdlib 1>&5'
97
97
+
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
98
98
+
+ (eval $ac_try) 2>&5
99
99
+
+ ac_status=$?
100
100
+
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
101
101
+
+ test $ac_status = 0; }; }
102
102
+
+then
103
103
+
+ libc_cv_hashstyle=yes
104
104
+
+else
105
105
+
+ libc_cv_hashstyle=no
106
106
+
+fi
107
107
+
+rm -f conftest*
108
108
+
+fi
109
109
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hashstyle" >&5
110
110
+
+$as_echo "$libc_cv_hashstyle" >&6; }
111
111
+
+
112
112
+
+
113
113
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
114
114
+
$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
115
115
+
if ${libc_cv_has_glob_dat+:} false; then :
116
116
+
diff --git b/configure.ac a/configure.ac
117
117
+
index d08ad4d64e..a045f6608e 100644
118
118
+
--- b/configure.ac
119
119
+
+++ a/configure.ac
120
120
+
@@ -1360,6 +1360,22 @@ LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
121
121
+
122
122
+
AC_SUBST(libc_cv_fpie)
123
123
+
124
124
+
+AC_CACHE_CHECK(for --hash-style option,
125
125
+
+ libc_cv_hashstyle, [dnl
126
126
+
+cat > conftest.c <<EOF
127
127
+
+int _start (void) { return 42; }
128
128
+
+EOF
129
129
+
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
130
130
+
+ -fPIC -shared -o conftest.so conftest.c
131
131
+
+ -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
132
132
+
+then
133
133
+
+ libc_cv_hashstyle=yes
134
134
+
+else
135
135
+
+ libc_cv_hashstyle=no
136
136
+
+fi
137
137
+
+rm -f conftest*])
138
138
+
+AC_SUBST(libc_cv_hashstyle)
139
139
+
+
140
140
+
AC_CACHE_CHECK(for GLOB_DAT reloc,
141
141
+
libc_cv_has_glob_dat, [dnl
142
142
+
cat > conftest.c <<EOF
143
143
+
--
144
144
+
2.37.1
145
145
+