diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2025-03-15 22:47:47 +0000 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2025-04-05 14:24:33 +0100 |
commit | 63f7285e76d24da51160cbdd87536185cf83f708 (patch) | |
tree | 5c123ac7f064054b546a7dbf23b174a666c6bf8b /gcc | |
parent | b90364ee1c09f00fda374260c723800fb52dc7ed (diff) | |
download | gcc-63f7285e76d24da51160cbdd87536185cf83f708.zip gcc-63f7285e76d24da51160cbdd87536185cf83f708.tar.gz gcc-63f7285e76d24da51160cbdd87536185cf83f708.tar.bz2 |
cobol, driver, libgcobol: Add support for libgcobol.spec.
Ads support for using a library spec file (e.g. to include the
target requirements for non-standard libraries - or even libm
which we can now configure at the target side).
gcc/cobol/ChangeLog:
* gcobolspec.cc (SPEC_FILE): New.
(lang_specific_driver): Make the 'need libgcobol' flag global
so that the prelink callback can use it. Libm use is now handled
via the library spec.
(lang_specific_pre_link): Include libgcobol.spec where needed.
libgcobol/ChangeLog:
* Makefile.am: Add libgcobol.spec and dependency.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add libgcobol.spec handling.
* libgcobol.spec.in: New file.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cobol/gcobolspec.cc | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc index 63f48aa..0832231 100644 --- a/gcc/cobol/gcobolspec.cc +++ b/gcc/cobol/gcobolspec.cc @@ -57,10 +57,6 @@ along with GCC; see the file COPYING3. If not see int lang_specific_extra_outfiles = 0; -#ifndef MATH_LIBRARY -#define MATH_LIBRARY "m" -#endif - #ifndef DL_LIBRARY #define DL_LIBRARY "dl" #endif @@ -73,12 +69,16 @@ int lang_specific_extra_outfiles = 0; #define COBOL_LIBRARY "gcobol" #endif +#define SPEC_FILE "libgcobol.spec" + /* The original argument list and related info is copied here. */ static const struct cl_decoded_option *original_options; /* The new argument list will be built here. */ static std::vector<cl_decoded_option>new_opt; +static bool need_libgcobol = true; + // #define NOISY 1 static void @@ -195,8 +195,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, // These flags indicate whether we need various libraries - bool need_libgcobol = true; - bool need_libmath = (MATH_LIBRARY[0] != '\0'); bool need_libdl = (DL_LIBRARY[0] != '\0'); bool need_libstdc = (STDCPP_LIBRARY[0] != '\0'); // bool need_libquadmath = (QUADMATH_LIBRARY[0] != '\0'); @@ -304,7 +302,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, // With this option, no libraries need be loaded saw_OPT_c = true; need_libgcobol = false; - need_libmath = false; need_libdl = false; need_libstdc = false; // need_libquadmath = false; @@ -331,7 +328,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, case OPT_E: // With these options, no libraries need be loaded need_libgcobol = false; - need_libmath = false; need_libdl = false; need_libstdc = false; // need_libquadmath = false; @@ -345,11 +341,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, case OPT_l: n_infiles += 1; - if(strcmp(decoded_options[i].arg, MATH_LIBRARY) == 0) - { - need_libmath = false; - } - else if(strcmp(decoded_options[i].arg, DL_LIBRARY) == 0) + if(strcmp(decoded_options[i].arg, DL_LIBRARY) == 0) { need_libdl = false; } @@ -455,7 +447,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, if( n_infiles == 0 ) { need_libgcobol = false; - need_libmath = false; need_libdl = false; need_libstdc = false; // need_libquadmath = false; @@ -588,11 +579,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, { add_arg_lib(COBOL_LIBRARY, static_libgcobol); } - if( need_libmath) - { - add_arg_lib(MATH_LIBRARY, static_in_general); - } - if( need_libdl ) + if( need_libdl ) { add_arg_lib(DL_LIBRARY, static_in_general); } @@ -654,14 +641,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, *in_decoded_options = new_options; } -/* - * Called before linking. - * Returns 0 on success and -1 on failure. - * Unused. - */ +/* Called before linking. Returns 0 on success and -1 on failure. */ int -lang_specific_pre_link( void ) - { - return 0; - } +lang_specific_pre_link (void) +{ + if (need_libgcobol) + do_spec ("%:include(libgcobol.spec)"); + return 0; +} |