[PATCH] Allow statically linking Flang support libraries when linking
  a library

---
 build-aux/ltmain.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 5f9af8c2..97810d08 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -7439,6 +7439,15 @@ func_mode_link ()
 			a_deplib=
 			break 2
 		      fi
+		      # Linking compiler provided static libraries into shared
+		      # libraries is allowed, but linking other static libraries is
+		      # non-portable.
+		      case $potlib in
+		        */libFortran*.$libext | */libflang_rt*.$libext)
+		          func_append newdeplibs " $potlib"
+		          a_deplib=
+		          ;;
+		      esac
 		  done
 		done
 	      fi
