[bfd/ChangeLog]

2009-03-11  Chris Demetriou  <cgd@google.com>

	* bfd.c (BFD_DETERMINISTIC_OUTPUT): New flag.
	* bfd-in2.h: Regenerate.
	* archive.c (bfd_ar_hdr_from_filesystem): If BFD_DETERMINISTIC_OUTPUT
	flag is set, use 0 for uid, gid, and timestamp, and use 0644 for file
	mode.
	(bsd_write_armap): Likewise.
	(_bfd_archive_bsd_update_armap_timestamp): If BFD_DETERMINISTIC_OUTPUT
	flag is set, do nothing.
	(coff_write_armap): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0
	for timestamp.

[binutils/ChangeLog]
2009-03-11  Chris Demetriou  <cgd@google.com>

	* ar.c (deterministic): New global variable.
	(main): Recognize new 'D' option, which enables 'deterministic mode'.
	(usage): Document new 'D' option.
	(write_archive): Set BFD_DETERMINISTIC_OUTPUT in output archive's
	flags if deterministic mode was requested.
	* doc/binutils.texi (ar): Document deterministic mode ('D' option).

[binutils/testsuite/ChangeLog]
2009-03-11  Chris Demetriou  <cgd@google.com>

	* binutils-all/ar.exp (deterministic_archive): New test.
This commit is contained in:
Chris Demetriou
2009-03-11 04:36:40 +00:00
parent a07dbd482b
commit 36e4dce69d
9 changed files with 144 additions and 5 deletions

View File

@@ -354,6 +354,50 @@ proc argument_parsing { } {
pass $testname
}
# Test building a deterministic archive.
proc deterministic_archive { } {
global AR
global AS
global NM
global srcdir
global subdir
set testname "ar deterministic archive"
if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
unresolved $testname
return
}
if [is_remote host] {
set archive artest.a
set objfile [remote_download host tmpdir/bintest.o]
remote_file host delete $archive
} else {
set archive tmpdir/artest.a
set objfile tmpdir/bintest.o
}
remote_file build delete tmpdir/artest.a
set got [binutils_run $AR "rcD $archive ${objfile}"]
if ![string match "" $got] {
fail $testname
return
}
set got [binutils_run $AR "tv $archive"]
# This only checks the file mode and uid/gid. We can't easily match
# date because it's printed with the user's timezone.
if ![string match "rw-r--r-- 0/0 *bintest.o*" $got] {
fail $testname
return
}
pass $testname
}
# Run the tests.
long_filenames
@@ -361,3 +405,4 @@ symbol_table
thin_archive
thin_archive_with_nested
argument_parsing
deterministic_archive