[PATCH] Call sys::fs::remove for options::OT_DISABLE

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Feb 12 06:15:56 PST 2015


I assume this shows up with bfd ld.

Is this already covered by some test when run with bfd ld instead of gold?

Thanks,
Rafael


On 12 February 2015 at 08:29, H.J. Lu <hjl.tools at gmail.com> wrote:
> Gold plugin calls exit(0) for options::OT_DISABLE to avoid generating
> output.  But it isn't very reliable.  This patch calls sys::fs::remove
> directly to remove output.
>
> H.J.
> ---
>  tools/gold/gold-plugin.cpp | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
> index dd6d47f..a068c22 100644
> --- a/tools/gold/gold-plugin.cpp
> +++ b/tools/gold/gold-plugin.cpp
> @@ -869,8 +869,11 @@ static ld_plugin_status all_symbols_read_hook(void) {
>    llvm_shutdown();
>
>    if (options::TheOutputType == options::OT_BC_ONLY ||
> -      options::TheOutputType == options::OT_DISABLE)
> +      options::TheOutputType == options::OT_DISABLE) {
> +    if (options::TheOutputType == options::OT_DISABLE)
> +      sys::fs::remove(output_name);
>      exit(0);
> +  }
>
>    return Ret;
>  }
> --
> 2.1.0
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list