public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ar: fix deterministic usage of ar with mri scripts
@ 2013-09-29  6:24 Cory Fields
  2013-10-01 13:46 ` nick clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Cory Fields @ 2013-09-29  6:24 UTC (permalink / raw)
  To: binutils; +Cc: Cory Fields

This non-deterministic behavior was observed when building Qt 4.8.5.
The patch below provides (what I believe to be) the expected behavior.

Before:
  $ ~/dev/binutils/binutils/ar -DM < object_script.libQtCore.Release
  $ md5sum ../../lib/libQtCore.a
  2f3b883bc11350a53257ee7438862a6c  ../../lib/libQtCore.a

  $ ~/dev/binutils/binutils/ar -DM < object_script.libQtCore.Release
  $ md5sum ../../lib/libQtCore.a
  73d6138790896193795e4fdbf053c954  ../../lib/libQtCore.a

After:
  $ ~/dev/binutils/binutils/ar -DM < object_script.libQtCore.Release
    md5sum ../../lib/libQtCore.a
  96300bc8954d36043bc4ca9a7442a0c2  ../../lib/libQtCore.a

  $ ~/dev/binutils/binutils/ar -DM < object_script.libQtCore.Release
    md5sum ../../lib/libQtCore.a
  96300bc8954d36043bc4ca9a7442a0c2  ../../lib/libQtCore.a

The unspecified default (as set by --enable-deterministic-archives) is
respected as well.

I'm unsure if any documentation updates are needed here. By my reading of the
current docs, -M now behaves as i would expect it to wrt -D, -U, and
--enable-deterministic-archives.

This is my first binutils submission, please let me know if there's anything
wrong/missing.

binutils/Changelog
09-29-2013  Cory Fields  <cory@coryfields.com>

  * arsup.c: respect the deterministic setting when reading from an mri script.
  * ar.c: set the default deterministic mode when reading from an mri script
---
 binutils/ar.c    | 1 +
 binutils/arsup.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/binutils/ar.c b/binutils/ar.c
index 987b46c..a11ed15 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -737,6 +737,7 @@ main (int argc, char **argv)
 
   if (mri_mode)
     {
+      default_deterministic ();
       mri_emul ();
     }
   else
diff --git a/binutils/arsup.c b/binutils/arsup.c
index 9ddc55d..5e8a40a 100644
--- a/binutils/arsup.c
+++ b/binutils/arsup.c
@@ -39,6 +39,7 @@ static void ar_directory_doer (bfd *, bfd *);
 static void ar_addlib_doer (bfd *, bfd *);
 
 extern int verbose;
+extern int deterministic;
 
 static bfd *obfd;
 static char *real_name;
@@ -334,6 +335,9 @@ ar_save (void)
     {
       char *ofilename = xstrdup (bfd_get_filename (obfd));
 
+      if (deterministic > 0)
+        obfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
       bfd_close (obfd);
 
       smart_rename (ofilename, real_name, 0);
-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ar: fix deterministic usage of ar with mri scripts
  2013-09-29  6:24 [PATCH] ar: fix deterministic usage of ar with mri scripts Cory Fields
@ 2013-10-01 13:46 ` nick clifton
  2013-10-01 18:06   ` Cory Fields
  0 siblings, 1 reply; 3+ messages in thread
From: nick clifton @ 2013-10-01 13:46 UTC (permalink / raw)
  To: Cory Fields, binutils

Hi Cory,

> binutils/Changelog
> 09-29-2013  Cory Fields  <cory@coryfields.com>
>
>    * arsup.c: respect the deterministic setting when reading from an mri script.
>    * ar.c: set the default deterministic mode when reading from an mri script

Approved and applied.

Note - changelog entries are generally formatted as sentences and 
include the function name where the change took place (if relevant).  So 
the actual changelog entry that I checked in looked like this:

2013-10-01  Cory Fields  <cory@coryfields.com>

	* arsup.c (ar_save): Respect the deterministic setting when
	reading from an mri script.
	* ar.c (main): Set the default deterministic mode when reading
	from an mri script.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ar: fix deterministic usage of ar with mri scripts
  2013-10-01 13:46 ` nick clifton
@ 2013-10-01 18:06   ` Cory Fields
  0 siblings, 0 replies; 3+ messages in thread
From: Cory Fields @ 2013-10-01 18:06 UTC (permalink / raw)
  To: nick clifton; +Cc: binutils

Thanks, Nick.

Regards,
Cory

On Tue, Oct 1, 2013 at 9:44 AM, nick clifton <nickc@redhat.com> wrote:
> Hi Cory,
>
>
>> binutils/Changelog
>> 09-29-2013  Cory Fields  <cory@coryfields.com>
>>
>>    * arsup.c: respect the deterministic setting when reading from an mri
>> script.
>>    * ar.c: set the default deterministic mode when reading from an mri
>> script
>
>
> Approved and applied.
>
> Note - changelog entries are generally formatted as sentences and include
> the function name where the change took place (if relevant).  So the actual
> changelog entry that I checked in looked like this:
>
> 2013-10-01  Cory Fields  <cory@coryfields.com>
>
>         * arsup.c (ar_save): Respect the deterministic setting when
>
>         reading from an mri script.
>         * ar.c (main): Set the default deterministic mode when reading
>         from an mri script.
>
> Cheers
>   Nick
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-01 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-29  6:24 [PATCH] ar: fix deterministic usage of ar with mri scripts Cory Fields
2013-10-01 13:46 ` nick clifton
2013-10-01 18:06   ` Cory Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).