$OpenBSD: patch-gcc_f_g77spec_c,v 1.1 2017/10/15 16:43:23 espie Exp $
Explicitly append -L/usr/lib so that things may link even if the linker is ldd.

Index: gcc/f/g77spec.c
--- gcc/f/g77spec.c.orig
+++ gcc/f/g77spec.c
@@ -116,6 +116,13 @@ static const char **g77_newargv;
    to short ones, where available, has already been run.  */
 
 static void
+add_math_lib (void)
+{
+  append_arg ("-L/usr/lib");
+  append_arg (MATH_LIBRARY);
+}
+
+static void
 lookup_option (xopt, xskip, xarg, text)
      Option *xopt;
      int *xskip;
@@ -410,7 +417,7 @@ or type the command `info -f g77 Copying'.\n\
 	  /* Not a filename or library. */
 
 	 if (saw_library == 1 && need_math)    /* -l<library>. */
-	    append_arg (MATH_LIBRARY);
+	    add_math_lib ();
 
 	  saw_library = 0;
 
@@ -472,7 +479,7 @@ or type the command `info -f g77 Copying'.\n\
 	  else
 	    {		/* Other library, or filename. */
 	     if (saw_library == 1 && need_math)
-		append_arg (MATH_LIBRARY);
+		add_math_lib ();
 	      saw_library = 0;
 	    }
 	}
@@ -497,7 +504,7 @@ or type the command `info -f g77 Copying'.\n\
 	  append_arg (library);
 	case 1:
 	 if (need_math)
-	   append_arg (MATH_LIBRARY);
+	   add_math_lib ();
 	default:
 	  break;
 	}
