[PATCH 21/21] Fix gold linker build issues for mingw

Andreas Schwab schwab@suse.de
Wed Apr 2 13:19:24 GMT 2025


On Apr 02 2025, Jovan Dmitrovic wrote:

> diff --git a/gold/plugin.cc b/gold/plugin.cc
> index 89f2e3bb182..545c0d96e16 100644
> --- a/gold/plugin.cc
> +++ b/gold/plugin.cc
> @@ -509,8 +509,12 @@ Plugin_recorder::init()
>    // copies of replacement files.
>    char dir_template[] = "gold-recording-XXXXXX";
>  #ifdef HAVE_MKDTEMP
> -  if (mkdtemp(dir_template) == NULL)
> -    return false;
> +  #ifdef __MINGW32__
> +    if (mkdir (tmpnam(dir_template)) == 0)
> +  #else
> +    if (mkdtemp(dir_template) == NULL)
> +  #endif
> +  return false;

Why is HAVE_MKDTEMP defined if it's not available?

> @@ -574,7 +578,7 @@ link_or_copy_file(const char* inname, const char* outname)
>  {
>    static char buf[4096];
>  
> -#ifdef HAVE_LINK
> +#if defined(HAVE_LINK) && !defined(__MINGW32__)

Why is HAVE_LINK defined if it's not available?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Binutils mailing list