This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix creating of non svr4 libraries
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Tristan Gingold <gingold at adacore dot com>, "binutils at sourceware dot org Development" <binutils at sourceware dot org>
- Date: Sat, 18 Oct 2014 13:32:19 +0200
- Subject: Re: [PATCH] Fix creating of non svr4 libraries
- Authentication-results: sourceware.org; auth=none
- References: <B4D4CA33-3A05-4F30-8F81-3EEF6102E13B at adacore dot com> <20141018083115 dot GQ4267 at bubble dot grove dot modra dot org>
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);
}
}
--
Markus