diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-03 16:48:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-05 12:26:36 +0000 |
commit | a242274d98e6f0f8d2aa21f778df690de7b42144 (patch) | |
tree | ff784d0fb2d5ca91387da92db7379cf18ab54707 /meta/recipes-devtools/prelink/prelink_git.bb | |
parent | c98fc3933142783db2ed735d971a8c5b8408344c (diff) | |
download | poky-a242274d98e6f0f8d2aa21f778df690de7b42144.tar.gz |
prelink: Drop support for it
Prelink is being dropped by glibc in 2.36. It already causes issues with
binary corruption, has a number of open bugs and is of questionable benefit
without disabling load address randomization and PIE executables.
We disabled it by default a while back but left people able to use it.
We would be unable to maintain it alone without glibc support so remove
the remaining pieces.
(From OE-Core rev: 23c0be78106f1d1e2bb9c724174a1bb8c56c2469)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/prelink/prelink_git.bb')
-rw-r--r-- | meta/recipes-devtools/prelink/prelink_git.bb | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/meta/recipes-devtools/prelink/prelink_git.bb b/meta/recipes-devtools/prelink/prelink_git.bb deleted file mode 100644 index 24713b61f8..0000000000 --- a/meta/recipes-devtools/prelink/prelink_git.bb +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | SECTION = "devel" | ||
2 | # Need binutils for libiberty.a | ||
3 | # Would need transfig-native for documentation if it wasn't disabled | ||
4 | DEPENDS = "elfutils binutils" | ||
5 | SUMMARY = "An ELF prelinking utility" | ||
6 | HOMEPAGE = "http://git.yoctoproject.org/cgit.cgi/prelink-cross/about/" | ||
7 | DESCRIPTION = "The prelink package contains a utility which modifies ELF shared libraries \ | ||
8 | and executables, so that far fewer relocations need to be resolved at \ | ||
9 | runtime and thus programs come up faster." | ||
10 | LICENSE = "GPLv2" | ||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b" | ||
12 | SRCREV = "f9975537dbfd9ade0fc813bd5cf5fcbe41753a37" | ||
13 | PV = "1.0+git${SRCPV}" | ||
14 | |||
15 | # | ||
16 | # The cron script attempts to re-prelink the system daily -- on | ||
17 | # systems where users are adding applications, this might be reasonable | ||
18 | # but for embedded, we should be re-running prelink -a after an update. | ||
19 | # | ||
20 | # Default is prelinking is enabled. | ||
21 | # | ||
22 | SUMMARY:${PN}-cron = "Cron scripts to control automatic prelinking" | ||
23 | DESCRIPTION:${PN}-cron = "Cron scripts to control automatic prelinking. \ | ||
24 | See: ${sysconfdir}/cron.daily/prelink for configuration information." | ||
25 | |||
26 | FILES:${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default" | ||
27 | |||
28 | PACKAGES =+ "${PN}-cron" | ||
29 | |||
30 | SRC_URI = "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink_staging \ | ||
31 | file://0001-Add-MIPS-gnu-hash-support.patch \ | ||
32 | file://prelink.conf \ | ||
33 | file://prelink.cron.daily \ | ||
34 | file://prelink.default \ | ||
35 | file://macros.prelink \ | ||
36 | " | ||
37 | UPSTREAM_CHECK_COMMITS = "1" | ||
38 | |||
39 | # error: error.h: No such file or directory | ||
40 | COMPATIBLE_HOST:libc-musl = 'null' | ||
41 | |||
42 | TARGET_OS_ORIG := "${TARGET_OS}" | ||
43 | OVERRIDES:append = ":${TARGET_OS_ORIG}" | ||
44 | |||
45 | S = "${WORKDIR}/git" | ||
46 | |||
47 | inherit autotools | ||
48 | |||
49 | BBCLASSEXTEND = "native" | ||
50 | |||
51 | EXTRA_OECONF = "--with-pkgversion=${PV}-${PR} \ | ||
52 | --with-bugurl=http://bugzilla.yoctoproject.org/" | ||
53 | |||
54 | PACKAGECONFIG ??= "" | ||
55 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" | ||
56 | |||
57 | # | ||
58 | # For target prelink we need to ensure paths match the lib path layout | ||
59 | # including for any configured multilibs | ||
60 | # | ||
61 | python do_linkerpaths () { | ||
62 | values = all_multilib_tune_list(["TUNE_ARCH", "baselib", "ABIEXTENSION"], d) | ||
63 | |||
64 | arches = values["TUNE_ARCH"] | ||
65 | baselibs = values["baselib"] | ||
66 | abis = values["ABIEXTENSION"] | ||
67 | |||
68 | def replace_lines(f, search, replacement, d, firstonly = False, secondonly = False): | ||
69 | f = d.expand(f) | ||
70 | if search == replacement: | ||
71 | return | ||
72 | bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f)) | ||
73 | with open(f, "r") as data: | ||
74 | lines = data.readlines() | ||
75 | with open(f, "w") as data: | ||
76 | for line in lines: | ||
77 | if not secondonly and not firstonly: | ||
78 | line = line.replace(search, replacement) | ||
79 | elif secondonly and search in line: | ||
80 | secondonly = False | ||
81 | elif firstonly and search and search in line: | ||
82 | line = line.replace(search, replacement) | ||
83 | search = None | ||
84 | data.write(line) | ||
85 | |||
86 | def replace_lines_rtld(f, search, replacement, section, d): | ||
87 | f = d.expand(f) | ||
88 | bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f)) | ||
89 | with open(f, "r") as data: | ||
90 | lines = data.readlines() | ||
91 | found = False | ||
92 | found2 = False | ||
93 | with open(f, "w") as data: | ||
94 | for line in lines: | ||
95 | if section in line: | ||
96 | if section == "else" and "if" in line: | ||
97 | found = False | ||
98 | else: | ||
99 | found = True | ||
100 | if found and "dst_LIB =" in line: | ||
101 | found2 = True | ||
102 | elif "}" in line: | ||
103 | found = False | ||
104 | found2 = False | ||
105 | if found2: | ||
106 | line = line.replace(search, replacement) | ||
107 | data.write(line) | ||
108 | |||
109 | for i, arch in enumerate(arches): | ||
110 | tune_baselib = baselibs[i] | ||
111 | abi = abis[i] | ||
112 | |||
113 | bits = 32 | ||
114 | if arch == "powerpc": | ||
115 | replace_lines("${S}/src/arch-ppc.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
116 | elif arch == "powerpc64": | ||
117 | replace_lines("${S}/src/arch-ppc64.c", "/lib64/ld64.so.1", "/" + tune_baselib + "/ld64.so.1", d) | ||
118 | bits = 64 | ||
119 | elif arch == "x86_64": | ||
120 | if abi == "x32": | ||
121 | replace_lines("${S}/src/arch-x86_64.c", "/libx32/ld-linux-x32.so.2", "/" + tune_baselib + "/ld-linux-x32.so.2", d) | ||
122 | else: | ||
123 | replace_lines("${S}/src/arch-x86_64.c", "/lib64/ld-linux-x86-64.so.2", "/" + tune_baselib + "/ld-linux-x86-64.so.2", d) | ||
124 | bits = 64 | ||
125 | elif arch == "arm": | ||
126 | replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux.so.3", "/" + tune_baselib + "/ld-linux.so.3", d) | ||
127 | replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux-armhf.so.3", "/" + tune_baselib + "/ld-linux-armhf.so.3", d) | ||
128 | elif arch == "mips" or arch == "mipsel": | ||
129 | replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, firstonly=True) | ||
130 | replace_lines("${S}/src/arch-mips.c", "/lib32/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
131 | elif arch == "mips64" or arch == "mips64el": | ||
132 | replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, secondonly=True) | ||
133 | replace_lines("${S}/src/arch-mips.c", "/lib64/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
134 | bits = 64 | ||
135 | elif arch.endswith("86"): | ||
136 | replace_lines("${S}/src/arch-i386.c", "/lib/ld-linux.so.2", "/" + tune_baselib + "/ld-linux.so.2", d) | ||
137 | if bits == 32 and tune_baselib != "lib": | ||
138 | replace_lines_rtld("${S}/src/rtld/rtld.c", "lib", tune_baselib, "else", d) | ||
139 | if bits == 64 and tune_baselib != "lib64": | ||
140 | replace_lines_rtld("${S}/src/rtld/rtld.c", "lib64", tune_baselib, "use_64bit", d) | ||
141 | } | ||
142 | |||
143 | python () { | ||
144 | overrides = d.getVar("OVERRIDES").split(":") | ||
145 | if "class-target" in overrides: | ||
146 | bb.build.addtask('do_linkerpaths', 'do_configure', 'do_patch', d) | ||
147 | } | ||
148 | |||
149 | do_configure:prepend () { | ||
150 | # Disable documentation! | ||
151 | echo "all:" > ${S}/doc/Makefile.am | ||
152 | } | ||
153 | |||
154 | do_install:append () { | ||
155 | install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default ${D}${sysconfdir}/rpm | ||
156 | install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf | ||
157 | install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink | ||
158 | install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink | ||
159 | install -m 0644 ${WORKDIR}/macros.prelink ${D}${sysconfdir}/rpm/macros.prelink | ||
160 | } | ||
161 | |||
162 | # If we ae doing a cross install, we want to avoid prelinking. | ||
163 | # Prelinking during a cross install should be handled by the image-prelink | ||
164 | # bbclass. If the user desires this to run on the target at first boot | ||
165 | # they will need to create a custom boot script. | ||
166 | pkg_postinst:prelink() { | ||
167 | #!/bin/sh | ||
168 | |||
169 | if [ "x$D" != "x" ]; then | ||
170 | exit 0 | ||
171 | fi | ||
172 | |||
173 | prelink -a | ||
174 | } | ||
175 | |||
176 | pkg_prerm:prelink() { | ||
177 | #!/bin/sh | ||
178 | |||
179 | if [ "x$D" != "x" ]; then | ||
180 | exit 1 | ||
181 | fi | ||
182 | |||
183 | prelink -au | ||
184 | } | ||
185 | |||