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.


Thanks Paolo for your helpful comments and suggestions,

I think the attached patch is the minimum [3 lines + comments] that can be done to achieve this... and much better than my original post.

reg-tested on powerpc-apple-darwin8 m32/m64 (built with dwarf2 as preferred debug format to allow m64)

checked that the installed version produces working executables m32/ m64 w/wout -static-libgfortran
checked that the static lib is actually used (otool/otool64).


changes:
gcc/config/darwin.h substitute static library when -static- libgfortran is invoked
gcc/testsuite/lib/gfortran.exp provide -B/path/to/fortran/libs for targets that require this
libgomp/testsuite/lib/libgomp.exp ditto


On 30 Dec 2008, at 10:32, Paolo Bonzini wrote:
That's why I had suggested setting FORTRAN_LIBRARY to (static_lib &&
!static_linking ? find_file ("libgfortran.a") : "-lgfortran"),

I had another look at this and my conclusions are:
(a) find_file is not available in this context (static definition in gcc.c)
(b) the following works for gcc <> <> <> -lgfortranbegin - lgfortran as well as gfortran ...


Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h (revision 142951)
+++ gcc/config/darwin.h (working copy)
@@ -258,6 +258,7 @@
#define LINK_SPEC \
"%{static}%{!static:-dynamic} \
%{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)}\
+ %{static|static-libgfortran:%:replace-outfile(-lgfortran libgfortran.a%s)}\
%{!Zdynamiclib: \
%{Zforce_cpusubtype_ALL:-arch %(darwin_arch) - force_cpusubtype_ALL} \
%{!Zforce_cpusubtype_ALL:-arch %(darwin_subarch)} \



to complete we only need two more lines: your change:

Index: gcc/testsuite/lib/gfortran.exp
===================================================================
--- gcc/testsuite/lib/gfortran.exp	(revision 142951)
+++ gcc/testsuite/lib/gfortran.exp	(working copy)
@@ -88,6 +88,9 @@

if { $gccpath != "" } {
if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] {
+ # Some targets use libgfortran.a%s in their specs, so they need a -B option
+ # for uninstalled testing.
+ append flags "-B${gccpath}/libgfortran/.libs "
append flags "-L${gccpath}/libgfortran/.libs "
append ld_library_path ":${gccpath}/libgfortran/.libs"
}


and for libgomp a similar one:
Index: libgomp/testsuite/lib/libgomp.exp
===================================================================
--- libgomp/testsuite/lib/libgomp.exp	(revision 142951)
+++ libgomp/testsuite/lib/libgomp.exp	(working copy)
@@ -171,6 +180,9 @@

if { [info exists lang_test_file] } {
if { $blddir != "" } {
+ # Some targets use libgfortran.a%s in their specs, so they need a -B option
+ # for uninstalled testing.
+ lappend options "additional_flags=-B${blddir}/$ {lang_library_path}"
lappend options "ldflags=-L${blddir}/${lang_library_path}"
}
lappend options "ldflags=${lang_link_flags}"


cheers & Happy New Year,
Iain

Attachment: static-libgfortran-simplified.diff.txt
Description: Text document




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