This is the mail archive of the 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]

[PATCH] Fix creating of non svr4 libraries


ar.c:open_inarch sets the target from plugin_target too early.  Therefore by
default, archives are created using the 'plugin' format instead of the archive
format corresponding to .o.

This isn't a problem on many targets (such as linux) because the format is the
same, but on targets having a different format (such as AIX), the created
archives are using a wrong format.

Please, be careful when reviewing that patch, I haven't tested it with a plugin
setup.  But for sure, the current behaviour isn't correct.

Ok for trunk ?  Will be ported on the 2.25 branch.


2014-10-17  Tristan Gingold  <>

	PR binutils/14698
	* ar.c (open_inarch): Move code that set target from plugin_target.

diff --git a/binutils/ar.c b/binutils/ar.c
index ebd9528..d5b1e01 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__)
@@ -919,6 +916,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)

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