https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78097
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is due to libtool. the make file passes the correct -rpath for linking libstdc++.so to libtool but that does not pass it down to gcc. /bin/bash ../libtool --tag CXX --mode=link /home/apinski/src/local/objdir/./gcc/xgcc -shared-libgcc -B/home/apinski/src/local/objdir/./gcc -nostdinc++ -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/bin/ -B/home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/lib/ -isystem /home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/include -isystem /home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/sys-include -Wl,-O1 -Wl,-z,relro -Wl,--gc-sections -std=gnu++98 -fPIC -DPIC -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=libstdc++.la -o libstdc++.la -version-info 6:23:0 -Wl,--version-script=libstdc++-symbols.ver -lm -rpath /home/apinski/src/local/objdir/../tools/lib/../lib64 compatibility.lo compatibility-debug_list.lo compatibility-debug_list-2.lo compatibility-c++0x.lo compatibility-atomic-c++0x.lo compatibility-thread-c++0x.lo compatibility-chrono.lo compatibility-condvar.lo ../libsupc++/libsupc++convenience.la ../src/c++98/libc++98convenience.la ../src/c++11/libc++11convenience.la libtool: link: /home/apinski/src/local/objdir/./gcc/xgcc -shared-libgcc -B/home/apinski/src/local/objdir/./gcc -nostdinc++ -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/bin/ -B/home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/lib/ -isystem /home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/include -isystem /home/apinski/src/local/objdir/../tools/aarch64-unknown-linux-gnu/sys-include -fPIC -DPIC -D_GLIBCXX_SHARED -shared -nostdlib /usr/lib/aarch64-linux-gnu/crti.o /home/apinski/src/local/objdir/./gcc/crtbeginS.o .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o .libs/compatibility-condvar.o -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src -L/home/apinski/src/local/objdir/aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs -lm -L/home/apinski/src/local/objdir/./gcc -L/lib/aarch64-linux-gnu -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib64 -lc -lgcc_s /home/apinski/src/local/objdir/./gcc/crtendS.o /usr/lib/aarch64-linux-gnu/crtn.o -Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver -Wl,-soname -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.23