summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjperkin <jperkin>2014-09-06 16:57:51 +0000
committerjperkin <jperkin>2014-09-06 16:57:51 +0000
commit9251a8a6d0f141401e26ccb0f070f389227d8650 (patch)
treeb6998635dfc0347d8d3c7d2cbd83da619c1fa135
parent5a3ee93a2236f47b141713deb3a0b3280dbcaa99 (diff)
downloadpkgsrc-9251a8a6d0f141401e26ccb0f070f389227d8650.tar.gz
Ensure we iterate over the RPATH in search order, rather than relying on
awk array iteration which could result in the wrong library being chosen. Fixes issue seen with GCC 4.9 where the libgcc from the main GCC package was found first and caused errors, even though the RPATH correctly had the gcc49-libs version listed first.
-rw-r--r--mk/check/check-shlibs-elf.awk10
1 files changed, 5 insertions, 5 deletions
diff --git a/mk/check/check-shlibs-elf.awk b/mk/check/check-shlibs-elf.awk
index f73e4b98258..ed9db636b73 100644
--- a/mk/check/check-shlibs-elf.awk
+++ b/mk/check/check-shlibs-elf.awk
@@ -1,4 +1,4 @@
-# $NetBSD: check-shlibs-elf.awk,v 1.6 2013/10/25 14:11:13 joerg Exp $
+# $NetBSD: check-shlibs-elf.awk,v 1.7 2014/09/06 16:57:51 jperkin Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
@@ -96,16 +96,16 @@ function check_pkg(DSO, pkg, found) {
close(depends_file)
}
-function checkshlib(DSO, needed, rpath, found, dso_rath, got_rpath) {
+function checkshlib(DSO, needed, rpath, found, dso_rath, got_rpath, nrpath) {
cmd = readelf " -Wd " shquote(DSO) " 2> /dev/null"
while ((cmd | getline) > 0) {
if ($2 == "(RPATH)" || $2 == "(RUNPATH)") {
sub("^[[:space:]]*0[xX][[:xdigit:]]+[[:space:]]+\\(RU?N?PATH\\)[[:space:]]+Library ru?n?path: \\[", "")
dso_rpath = substr($0, 1, length($0) - 1)
if (length(system_rpath) > 0)
- split(dso_rpath ":" system_rpath, rpath, ":")
+ nrpath = split(dso_rpath ":" system_rpath, rpath, ":")
else
- split(dso_rpath, rpath, ":")
+ nrpath = split(dso_rpath, rpath, ":")
got_rpath = 1
}
if ($2 == "(NEEDED)") {
@@ -123,7 +123,7 @@ function checkshlib(DSO, needed, rpath, found, dso_rath, got_rpath) {
}
}
for (lib in needed) {
- for (p in rpath) {
+ for (p = 1; p <= nrpath; p++) {
if (!system("test -f " shquote(cross_destdir rpath[p] "/" lib))) {
check_pkg(rpath[p] "/" lib)
found = 1