This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix creating of non svr4 libraries


On 2014.10.18 at 13:32 +0200, Markus Trippelsdorf wrote:
> On 2014.10.18 at 19:01 +1030, Alan Modra wrote:
> > On Fri, Oct 17, 2014 at 02:04:11PM +0200, Tristan Gingold wrote:
> > > 	PR binutils/14698
> > > 	* ar.c (open_inarch): Move code that set target from plugin_target.
> > 
> > This will break ar for lto objects (or require you to specify
> > --target=plugin).  The problem is that archive elements must be loaded
> > under control of the lto plugin to see the real symbols, those that
> > you want to put into the archive symbol table.
> 
> I wonder if something like the following pseudo code would work:
> 
> diff --git a/binutils/ar.c b/binutils/ar.c
> index ebd9528b837f..8020770674fc 100644
> --- a/binutils/ar.c
> +++ b/binutils/ar.c
> @@ -865,9 +865,6 @@ open_inarch (const char *archive_filename, const char *file)
>  
>    bfd_set_error (bfd_error_no_error);
>  
> -  if (target == NULL)
> -    target = plugin_target;
> -
>    if (stat (archive_filename, &sbuf) != 0)
>      {
>  #if !defined(__GO32__) || defined(__DJGPP__)
> @@ -901,7 +898,12 @@ open_inarch (const char *archive_filename, const char *file)
>  	  if (obj != NULL)
>  	    {
>  	      if (bfd_check_format (obj, bfd_object))
> -		target = bfd_get_target (obj);
> +		{
> +		  if (is in list of supported targets)
> +		    target = plugin_target;
> +		  else
> +		    target = bfd_get_target (obj);
> +		}
>  	      (void) bfd_close (obj);
>  	    }
>  	}
Plus the additional hunk:

@@ -919,6 +921,9 @@ open_inarch (const char *archive_filename, const char *file)
       output_filename = archive_filename;
     }
 
+  if (target == NULL)
+    target = plugin_target;
+
   arch = bfd_openr (archive_filename, target);
   if (arch == NULL)
     {
-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]