From 7608e93ab97e8c33e3b14323d0cabc651926e403 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:29:11 +0400
Subject: [PATCH] libtool

libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
when running on am x86_64 build host.

This patch stops this speading to libdir in the libstdc++.la file within libtool.
Arguably, it shouldn't be passing this into libtool in the first place but
for now this resolves the nastiest problems this causes.

func_normal_abspath would resolve an empty path to `pwd` so we need
to filter the zero case.

RP 2012/8/24

Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2023-04/msg00000.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ltmain.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ltmain.sh b/ltmain.sh
index 70990740b6c..ee938056bef 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -6359,6 +6359,10 @@ func_mode_link ()
 	func_warning "ignoring multiple \`-rpath's for a libtool library"
 
       install_libdir="$1"
+      if test -n "$install_libdir"; then
+	func_normal_abspath "$install_libdir"
+	install_libdir=$func_normal_abspath_result
+      fi
 
       oldlibs=
       if test -z "$rpath"; then
