Bug 19172 - gold is missing emulations, at least on aarch64-linux, arm-linux-gnueabi, powerpc-linux
Summary: gold is missing emulations, at least on aarch64-linux, arm-linux-gnueabi, pow...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
: 19200 (view as bug list)
Depends on:
Blocks: 19119
  Show dependency treegraph
 
Reported: 2015-10-26 00:24 UTC by Matthias Klose
Modified: 2015-11-05 22:11 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
A patch (283 bytes, patch)
2015-10-26 16:22 UTC, H.J. Lu
Details | Diff
A different patch (298 bytes, patch)
2015-10-26 18:11 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-10-26 00:24:08 UTC
see
https://sourceware.org/ml/binutils/2015-10/msg00227.html
Comment 1 H.J. Lu 2015-10-26 16:22:04 UTC
Created attachment 8743 [details]
A patch

This patch matches emulation "foo" with "foo_XXX".
Comment 2 Cary Coutant 2015-10-26 17:42:35 UTC
> This patch matches emulation "foo" with "foo_XXX".

I don't think that will solve the problem for the aarch64 emulations. He's asking for "aarch64-linux", and gold wants "aarch64_elf(32|64)_[bl]e_vec".
Comment 3 H.J. Lu 2015-10-26 18:11:26 UTC
Created attachment 8744 [details]
A different patch
Comment 4 Cary Coutant 2015-10-26 19:45:05 UTC
> Created attachment 8744 [details]
> A different patch

How about just printing a warning instead when we ignore the -m option?

diff --git a/gold/parameters.cc b/gold/parameters.cc
index 15df42a..5f5dae0 100644
--- a/gold/parameters.cc
+++ b/gold/parameters.cc
@@ -301,11 +301,8 @@ set_parameters_target(Target* target)
     {
       const char* emulation = parameters->options().m();
       Target* output = select_target_by_emulation(emulation);
-      if (!output)
-	gold_error(_("unrecognised output emulation: %s"), emulation);
-      else if (output != target)
-	gold_error(_("input file is incompatible with %s output emulation"),
-		   emulation);
+      if (output != target)
+	gold_warning(_("ignoring requested emulation %s"), emulation);
     }
   static_parameters.set_target(target);
 }
Comment 5 H.J. Lu 2015-10-26 20:24:17 UTC
(In reply to Cary Coutant from comment #4)
> > Created attachment 8744 [details]
> > A different patch
> 
> How about just printing a warning instead when we ignore the -m option?
> 
> diff --git a/gold/parameters.cc b/gold/parameters.cc
> index 15df42a..5f5dae0 100644
> --- a/gold/parameters.cc
> +++ b/gold/parameters.cc
> @@ -301,11 +301,8 @@ set_parameters_target(Target* target)
>      {
>        const char* emulation = parameters->options().m();
>        Target* output = select_target_by_emulation(emulation);
> -      if (!output)
> -	gold_error(_("unrecognised output emulation: %s"), emulation);
> -      else if (output != target)
> -	gold_error(_("input file is incompatible with %s output emulation"),
> -		   emulation);
> +      if (output != target)
> +	gold_warning(_("ignoring requested emulation %s"), emulation);
>      }
>    static_parameters.set_target(target);
>  }

It is wrong to ignore the unrecognised output emulation.
Comment 6 H.J. Lu 2015-11-03 20:14:28 UTC
*** Bug 19200 has been marked as a duplicate of this bug. ***
Comment 7 Sourceware Commits 2015-11-05 21:19:14 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=96f9814df23564e16909bb5ba00de4a202c63417

commit 96f9814df23564e16909bb5ba00de4a202c63417
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Thu Nov 5 12:59:02 2015 -0800

    Revert patch for PR 19119, which led to PR 19172 and 19197.
    
    Gold does not support all the emulations that Gnu ld does, and supports
    only one spelling per target. The -m option is used only in the rare case
    where there are no ELF input files, and we produce an empty output file.
    In those cases, users are expected to supply a -m option naming one of
    the supported emulations. In the many cases where a build script provides
    an unnecessary -m option naming an emulation that gold does not support,
    we will simply ignore the option, as we did before the reverted patch.
    
    gold/
    	PR gold/19119
    	PR gold/19172
    	PR gold/19197
    	Revert commit 6457197210144f50a696097c0d308d81d46d5510:
    
    	2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    		* options.h (General_options): Remove "obsolete" from -m.
    		* parameters.cc (set_parameters_target): Check if input target
    		is compatible with output emulation set by "-m emulation".
Comment 8 Cary Coutant 2015-11-05 22:11:14 UTC
I have reverted the patch that caused gold to print an error message. Now, as before, gold will ignore the -m option unless there are no ELF input files.