aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-03-07 17:29:25 +0000
committerNick Clifton <nickc@redhat.com>2016-03-07 17:29:25 +0000
commit4fc874242f8f1bf17cf6e65b159dd804e793e6cd (patch)
tree270a038005096bd4ee9f8522926be270cfece2be /binutils
parent23a4bd22c75862fdbaa5faef59b9094ec738f675 (diff)
downloadgdb-4fc874242f8f1bf17cf6e65b159dd804e793e6cd.zip
gdb-4fc874242f8f1bf17cf6e65b159dd804e793e6cd.tar.gz
gdb-4fc874242f8f1bf17cf6e65b159dd804e793e6cd.tar.bz2
Allow zero length archive elements.
bfd PR binutils/19775 * archive.c (bfd_generic_openr_next_archived_file): Allow zero length elements in the archive. binutils PR binutils/19775 * testsuite/binutils-all/ar.exp (proc empty_archive): New proc. Run the new proc. * testsuite/binutils-all/empty: New, empty, file.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/ar.exp40
-rw-r--r--binutils/testsuite/binutils-all/empty0
3 files changed, 47 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 7ba4aec..918299a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-07 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/19775
+ * testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
+ Run the new proc.
+ * testsuite/binutils-all/empty: New, empty, file.
+
2016-03-04 Matthew Wahab <matthew.wahab@arm.com>
* readelf.c (arm_attry_tag_FP_arch): Add "NEON for ARMv8.1".
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index 508ae9c..45be9b1 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -555,6 +555,45 @@ proc move_an_element { } {
pass $testname
}
+# PR 19775: Test creating and listing archives with an empty element.
+
+proc empty_archive { } {
+ global AR
+ global srcdir
+ global subdir
+
+ set testname "archive with empty element"
+
+ # FIXME: There ought to be a way to dynamically create an empty file.
+ set empty $srcdir/$subdir/empty
+
+ if [is_remote host] {
+ set archive artest.a
+ set objfile [remote_download host $empty]
+ remote_file host delete $archive
+ } else {
+ set archive tmpdir/artest.a
+ set objfile $empty
+ }
+
+ remote_file build delete tmpdir/artest.a
+
+ set got [binutils_run $AR "-r -c $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ # This commmand used to fail with: "Malformed archive".
+ set got [binutils_run $AR "-t $archive"]
+ if ![string match "empty " $got] {
+ fail $testname
+ return
+ }
+
+ pass $testname
+}
+
# Run the tests.
# Only run the bfdtest checks if the programs exist. Since these
@@ -574,6 +613,7 @@ argument_parsing
deterministic_archive
delete_an_element
move_an_element
+empty_archive
if { [is_elf_format]
&& ![istarget "*-*-hpux*"]
diff --git a/binutils/testsuite/binutils-all/empty b/binutils/testsuite/binutils-all/empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/binutils/testsuite/binutils-all/empty