This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, darwin] repost of a patch to make "-static-libgfortan" work.


>> If it works you can also use (static_lib && !static_linking ?
>> find_file ("libgfortran.a") : "-lgfortran") for FORTRAN_LIBRARY.
>
> FORTRAN_LIBRARY is already manipulated with -Bstatic/-Bynamic wrappers (for
> target linkers that support it) and the args list is searched and
> re-arranged to ensure that the library is positioned correctly.
>
> Whatever you put in FORTRAN_LIBRARY will just be substituted verbatim into
> the driver's re-written args.

Yes, and you can use the same condition used for -Bstatic in
config/darwin.h, so that libgfortran.a is used instead of -Bstatic.
But...

>   %{static|static-libgfortran:%:replace-outfile(-lgfortran
> libgfortran.a%s)}\

... yes, that's also a nice solution, and it extends well to libgomp.

> (a) it doesn't work for the test-suite which doesn't set
> -B/path/to/fortran/libs

Yes, the testsuite relies on LD_LIBRARY_PATH and -L, see
gcc/testsuite/lib/gfortran.exp:

    if { $gccpath != "" } {
      if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] {
          append flags "-L${gccpath}/libgfortran/.libs "
          append ld_library_path ":${gccpath}/libgfortran/.libs"
      }
      if [file exists "${gccpath}/libgfortran/.libs/libgfortran.${shlib_ext}"] {
          append flags "-L${gccpath}/libgfortran/.libs "
          append ld_library_path ":${gccpath}/libgfortran/.libs"
      }
      if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
          append flags "-L${gccpath}/libgfortran "
      }
      if [file exists "${gccpath}/libiberty/libiberty.a"] {
          append flags "-L${gccpath}/libiberty "
      }
      append ld_library_path \
        [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
    }

But that's easy to fix in the testsuite.  It's not anymore a one-line
fix, but no more than a dozen lines.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]