diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-04 08:44:29 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-04 08:44:29 +0000 |
commit | 76875ccba880127fc80d845c9926c298a4f49446 (patch) | |
tree | 2baeb30ac5f592018a46140e8a34f178598a67b6 /libgfortran | |
parent | 5f1220947c1397909f7faa88331c7875c6e03810 (diff) | |
download | gcc-76875ccba880127fc80d845c9926c298a4f49446.tar.gz |
PR libfortran/22298
* runtime/main.c (stupid_function_name_for_static_linking): New
function.
* runtime/error.c (internal_error): Call
stupid_function_name_for_static_linking.
* libgfortran.h: Add prototype for
stupid_function_name_for_static_linking.
* gcc/testsuite/lib/target-supports.exp
(check_effective_target_static_libgfortran): New
static_libgfortran effective target.
* gcc/testsuite/gfortran.dg/static_linking_1.f: New test.
* gcc/testsuite/gfortran.dg/static_linking_1.c: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106484 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 14 | ||||
-rw-r--r-- | libgfortran/libgfortran.h | 3 | ||||
-rw-r--r-- | libgfortran/runtime/error.c | 7 | ||||
-rw-r--r-- | libgfortran/runtime/main.c | 8 |
4 files changed, 30 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fe10fb9cb65..c3c5a9ecb6f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,13 @@ +2005-11-04 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/22298 + * runtime/main.c (stupid_function_name_for_static_linking): New + function. + * runtime/error.c (internal_error): Call + stupid_function_name_for_static_linking. + * libgfortran.h: Add prototype for + stupid_function_name_for_static_linking. + 2005-11-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/14994 @@ -6,8 +16,8 @@ 2005-10-31 Jerry DeLisle <jvdelisle@verizon.net> - PR libgfortran/24584 - * io/list_read.c (free_saved): Set saved_used to zero. + PR libgfortran/24584 + * io/list_read.c (free_saved): Set saved_used to zero. 2005-10-30 Francois-Xavier Coudert <coudert@clipper.ens.fr> diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index b1e9afd9277..791a6f899a0 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -434,6 +434,9 @@ iexport_data_proto(filename); /* main.c */ +extern void stupid_function_name_for_static_linking (void); +internal_proto(stupid_function_name_for_static_linking); + extern void library_start (void); internal_proto(library_start); diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index cdaa54255c2..64a062ab330 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -353,6 +353,13 @@ internal_error (const char *message) recursion_check (); show_locus (); st_printf ("Internal Error: %s\n", message); + + /* This function call is here to get the main.o object file included + when linking statically. This works because error.o is supposed to + be always linked in (and the function call is in internal_error + because hopefully it doesn't happen too often). */ + stupid_function_name_for_static_linking(); + sys_exit (3); } diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c index 1186a304930..cfd77f29be9 100644 --- a/libgfortran/runtime/main.c +++ b/libgfortran/runtime/main.c @@ -35,6 +35,14 @@ Boston, MA 02110-1301, USA. */ #include "libgfortran.h" +/* Stupid function to be sure the constructor is always linked in, even + in the case of static linking. See PR libfortran/22298 for details. */ +void +stupid_function_name_for_static_linking (void) +{ + return; +} + /* This is the offset (in bytes) required to cast from logical(8)* to logical(4)*. and still get the same result. Will be 0 for little-endian machines and 4 for big-endian machines. */ |