-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path0001-Revert-Install-shared-objects-under-their-ABI-names.patch
137 lines (125 loc) · 4.7 KB
/
0001-Revert-Install-shared-objects-under-their-ABI-names.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
From 605a02a9152e832b56e7458bddcebf6da88e791f Mon Sep 17 00:00:00 2001
From: Thomas Crider <[email protected]>
Date: Thu, 2 Jun 2022 15:46:37 -0600
Subject: [PATCH 1/4] Revert "Install shared objects under their ABI names"
This reverts commit 8208be389bce84be0e1c35a3daa0c3467418f921.
---
Makefile | 6 ++++++
Makerules | 44 ++++++++++++++++++++++++++++++++++++++++----
elf/Makefile | 10 ++++++++--
3 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index b1454882bd..bde07cdf2a 100644
--- a/Makefile
+++ b/Makefile
@@ -109,6 +109,12 @@ elf/ldso_install:
# Ignore the error if we cannot update /etc/ld.so.cache.
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
+install: install-symbolic-link
+.PHONY: install-symbolic-link
+install-symbolic-link: subdir_install
+ $(symbolic-link-prog) $(symbolic-link-list)
+ rm -f $(symbolic-link-list)
+
install:
-test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
$(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
diff --git a/Makerules b/Makerules
index 5de2cec6be..d0931a3583 100644
--- a/Makerules
+++ b/Makerules
@@ -988,12 +988,14 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
-# For libraries whose soname have version numbers, we install two files:
+# For libraries whose soname have version numbers, we install three files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
-# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME
+# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
+# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
$(foreach L,$(install-lib.so-versioned),\
$(inst_libdir)/$L \
+ $(inst_slibdir)/$(L:.so=)-$(version).so \
$(inst_slibdir)/$L$($L-version))
# Install all the unversioned shared libraries.
@@ -1026,8 +1028,34 @@ ln -f $(objpfx)/$(@F) $@
endef
endif
+ifeq (yes,$(build-shared))
+ifeq (no,$(cross-compiling))
+symbolic-link-prog := $(elf-objpfx)sln
+symbolic-link-list := $(elf-objpfx)symlink.list
+define make-shlib-link
+echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
+endef
+else # cross-compiling
+# We need a definition that can be used by elf/Makefile's install rules.
+symbolic-link-prog = $(LN_S)
+endif
+endif
+ifndef make-shlib-link
+define make-shlib-link
+rm -f $@
+$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
+endef
+endif
+
ifdef libc.so-version
-$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force)
+# For a library specified to be version N, install three files:
+# libc.so -> libc.so.N (e.g. libc.so.6)
+# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)
+
+$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
+ $(+force)
+ $(make-shlib-link)
+$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
$(do-install-program)
install: $(inst_slibdir)/libc.so$(libc.so-version)
@@ -1097,7 +1125,15 @@ include $(o-iterator)
generated += $(foreach o,$(versioned),$o$($o-version))
define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force);
+$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
+ $(+force);
+ $$(make-shlib-link)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+
+define o-iterator-doit
+$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
$$(do-install-program)
endef
object-suffixes-left := $(versioned)
diff --git a/elf/Makefile b/elf/Makefile
index 3536b6af5e..67428f2de2 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1338,10 +1338,16 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
ifeq (yes,$(build-shared))
-$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
+$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
$(make-target-directory)
$(do-install-program)
+$(inst_rtlddir)/$(rtld-installed-name): \
+ $(inst_slibdir)/$(rtld-version-installed-name) \
+ $(inst_slibdir)/libc-$(version).so
+ $(make-target-directory)
+ $(make-shlib-link)
+
# Creates the relative /usr/bin/ld.so symbolic link.
$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
$(make-target-directory)
@@ -1350,7 +1356,7 @@ $(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
# Special target called by parent to install just the dynamic linker.
.PHONY: ldso_install
ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
-endif # $(build-shared)
+endif
# Workarounds for ${exec_prefix} expansion in configure variables.
--
2.36.1