> Am 06.04.2025 um 09:42 schrieb Iain Sandoe <iains....@gmail.com>:
> 
> Tested on x86_64, aarch64, powerpc64le - Linux; x86_64, aarch64 Darwin,
> OK for trunk?

Ok

Richard 

> thanks
> Iain
> 
> --- 8< ---
> 
> As discussed in the PR, the options had been added during development
> to handle specific cases, they are no longer needed (and if they should
> become necessary, we will need to guard them such that individual
> platforms get the correct handling).
> 
>    PR cobol/119414
> 
> gcc/cobol/ChangeLog:
> 
>    * gcobolspec.cc (append_rdynamic,
>    append_allow_multiple_definition, append_fpic): Remove.
>    (lang_specific_driver): Remove platform-specific command
>    line option handling.
> 
> Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>
> ---
> gcc/cobol/gcobolspec.cc | 90 ++---------------------------------------
> 1 file changed, 3 insertions(+), 87 deletions(-)
> 
> diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc
> index 083223115ad..4df9f8dc37e 100644
> --- a/gcc/cobol/gcobolspec.cc
> +++ b/gcc/cobol/gcobolspec.cc
> @@ -126,41 +126,6 @@ add_arg_lib(const char *library, bool force_static 
> ATTRIBUTE_UNUSED)
> #endif
>   }
> 
> -static void
> -append_rdynamic()
> -  {
> -  // This is a bit ham-handed, but I was in a hurry.
> -  struct cl_decoded_option decoded = {};
> -  decoded.opt_index = OPT_rdynamic;
> -  decoded.orig_option_with_args_text = "-rdynamic";
> -  decoded.canonical_option[0] = "-rdynamic";
> -  decoded.canonical_option_num_elements = 1;
> -  decoded.value = 1;
> -  append_arg(decoded);
> -  return;
> -  }
> -
> -static void
> -append_allow_multiple_definition()
> -  {
> -  append_option (OPT_Wl_, "--allow-multiple-definition", 1);
> -  return;
> -  }
> -
> -static void
> -append_fpic()
> -  {
> -  // This is a bit ham-handed, but I was in a hurry.
> -  struct cl_decoded_option decoded = {};
> -  decoded.opt_index = OPT_rdynamic;
> -  decoded.orig_option_with_args_text = "-fPIC";
> -  decoded.canonical_option[0] = "-fPIC";
> -  decoded.canonical_option_num_elements = 1;
> -  decoded.value = 1;
> -  append_arg(decoded);
> -  return;
> -  }
> -
> void
> lang_specific_driver (struct cl_decoded_option **in_decoded_options,
>                       unsigned int *in_decoded_options_count,
> @@ -188,8 +153,6 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
> 
>   bool saw_OPT_c = false;
>   bool saw_OPT_shared = false;
> -  bool saw_OPT_pic = false;
> -  bool saw_OPT_PIC = false;
> 
>   bool verbose = false;
> 
> @@ -197,9 +160,6 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
> 
>   bool need_libdl       = (DL_LIBRARY[0] != '\0');
>   bool need_libstdc     = (STDCPP_LIBRARY[0] != '\0');
> -  // bool need_libquadmath = (QUADMATH_LIBRARY[0] != '\0');
> -  bool need_rdynamic    = true;
> -  bool need_allow_multiple_definition = true;
> 
>   // Separate flags for a couple of static libraries
>   bool static_libgcobol  = false;
> @@ -290,36 +250,10 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
>         saw_OPT_shared = true;
>         break;
> 
> -      case OPT_fpic:
> -        saw_OPT_pic = true;
> -        break;
> -
> -      case OPT_fPIC:
> -        saw_OPT_PIC = true;
> -        break;
> -
> -      case OPT_c:
> -        // With this option, no libraries need be loaded
> +    case OPT_c:
> +        // Note -c specially.
>         saw_OPT_c = true;
> -        need_libgcobol   = false;
> -        need_libdl       = false;
> -        need_libstdc     = false;
> -        // need_libquadmath = false;
> -        need_rdynamic    = false;
> -        break;
> -
> -      case OPT_rdynamic:
> -        need_rdynamic  = false;
> -        break;
> -
> -      case OPT_Wl_:
> -        if( strstr(decoded_options[i].orig_option_with_args_text,
> -            "--allow-multiple-definitions") )
> -          {
> -          need_allow_multiple_definition = false;
> -          }
> -        break;
> -
> +        // FALLTHROUGH
>       case OPT_nostdlib:
>       case OPT_nodefaultlibs:
>       case OPT_r:
> @@ -330,8 +264,6 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
>         need_libgcobol   = false;
>         need_libdl       = false;
>         need_libstdc     = false;
> -        // need_libquadmath = false;
> -        need_rdynamic    = false;
>         break;
> 
>       case OPT_static_libgcobol:
> @@ -449,7 +381,6 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
>     need_libgcobol   = false;
>     need_libdl       = false;
>     need_libstdc     = false;
> -    // need_libquadmath = false;
>     }
> 
>   /* Second pass through arglist, transforming arguments as appropriate.  */
> @@ -588,21 +519,6 @@ lang_specific_driver (struct cl_decoded_option 
> **in_decoded_options,
>     add_arg_lib(STDCPP_LIBRARY, static_in_general);
>     }
> 
> -  if( saw_OPT_shared && !saw_OPT_pic && !saw_OPT_PIC )
> -    {
> -    append_fpic();
> -    }
> -
> -  if( need_rdynamic )
> -    {
> -    append_rdynamic();
> -    }
> -
> -  if( need_allow_multiple_definition && (n_infiles || n_outfiles) )
> -    {
> -    append_allow_multiple_definition();
> -    }
> -
>   if( prior_main )
>     {
>     char ach[] = "\"-main\" without a source file";
> --
> 2.39.2 (Apple Git-143)
> 

Reply via email to