summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Chapuis <chris.chapuis@gmail.com>2016-07-31 18:52:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-10-06 14:09:42 +0100
commite93596fe74927e2e2f4dd7f671994ccb9744cff8 (patch)
tree40fab574020cb260b5c3d2f835ca96e093fcb18e
parent56a27c9aada72d50db898e5bbe170f190606503c (diff)
downloadpoky-e93596fe74927e2e2f4dd7f671994ccb9744cff8.tar.gz
binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
* this patch is backported from 2.26.1 which is already in oe-core/master since this patch: commit 37e8b6ecf9f9163d7b5b3becdc2feba57df4838f Author: Khem Raj <raj.khem@gmail.com> Date: Thu Jul 7 11:08:29 2016 -0700 Subject: binutils: Upgrade to 2.26.1 -SRCREV = "71fa566a9cf2597b60a58c1d7c148bab637454a6" +SRCREV = "c29838e7f484e0b5714b02e7feb9a88d3a045dd2" * verified that the patch exists in this SRCREV range: ~/projects/binutils $ git log --oneline 71fa566a9cf2597b60a58c1d7c148bab637454a6..c29838e7f484e0b5714b02e7feb9a88d3a045dd2^C ... 343a405 Allow zero length archive elements ... so it isn't needed in master branch (From OE-Core rev: a8f44dff13481feaa97e494a3aeafb5b63d40f3f) Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.26.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch130
2 files changed, 131 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.26.inc b/meta/recipes-devtools/binutils/binutils-2.26.inc
index 06ce245ba5..4b33b04238 100644
--- a/meta/recipes-devtools/binutils/binutils-2.26.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.26.inc
@@ -34,6 +34,7 @@ SRC_URI = "\
34 file://0012-Add-support-for-Netlogic-XLP.patch \ 34 file://0012-Add-support-for-Netlogic-XLP.patch \
35 file://0013-Fix-GOT-address-computations-in-initial-PLT-entries-.patch \ 35 file://0013-Fix-GOT-address-computations-in-initial-PLT-entries-.patch \
36 file://0014-Correct-nios2-_gp-address-computation.patch \ 36 file://0014-Correct-nios2-_gp-address-computation.patch \
37 file://0015-allow-zero-length-elements.patch \
37 file://aarch64-tls.patch \ 38 file://aarch64-tls.patch \
38" 39"
39S = "${WORKDIR}/git" 40S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch b/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch
new file mode 100644
index 0000000000..3a19fcaea6
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch
@@ -0,0 +1,130 @@
1From 343a405c03ce478634d8ce5a38faae832d39b361 Mon Sep 17 00:00:00 2001
2From: Alan Modra <amodra@gmail.com>
3Date: Wed, 9 Mar 2016 17:01:54 +1030
4Subject: [PATCH] Allow zero length archive elements
5
6bfd/
7 PR binutils/19775
8 * archive.c (bfd_generic_openr_next_archived_file): Allow zero
9 length elements in the archive.
10 * coff-alpha.c (alpha_ecoff_openr_next_archived_file): Likewise.
11
12binutils/
13 PR binutils/19775
14 * testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
15 Run the new proc.
16 * testsuite/binutils-all/empty: New, empty, file.
17---
18 bfd/ChangeLog | 8 ++++++
19 bfd/archive.c | 2 +-
20 bfd/coff-alpha.c | 2 +-
21 binutils/ChangeLog | 7 +++++
22 binutils/testsuite/binutils-all/ar.exp | 40 ++++++++++++++++++++++++++++++++
23 5 files changed, 57 insertions(+), 2 deletions(-)
24 create mode 100644 binutils/testsuite/binutils-all/empty
25
26diff --git a/bfd/archive.c b/bfd/archive.c
27index b3d03d3..1fc3a94 100644
28--- a/bfd/archive.c
29+++ b/bfd/archive.c
30@@ -802,7 +802,7 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
31 Note that last_file->origin can be odd in the case of
32 BSD-4.4-style element with a long odd size. */
33 filestart += filestart % 2;
34- if (filestart <= last_file->proxy_origin)
35+ if (filestart < last_file->proxy_origin)
36 {
37 /* Prevent looping. See PR19256. */
38 bfd_set_error (bfd_error_malformed_archive);
39diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
40index 7478f2f..fffb9f7 100644
41--- a/bfd/coff-alpha.c
42+++ b/bfd/coff-alpha.c
43@@ -2208,7 +2208,7 @@ alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
44 BSD-4.4-style element with a long odd size. */
45 filestart = last_file->proxy_origin + size;
46 filestart += filestart % 2;
47- if (filestart <= last_file->proxy_origin)
48+ if (filestart < last_file->proxy_origin)
49 {
50 /* Prevent looping. See PR19256. */
51 bfd_set_error (bfd_error_malformed_archive);
52diff --git a/binutils/ChangeLog b/binutils/ChangeLog
53index 4648d93..b04c745 100644
54--- a/binutils/ChangeLog
55+++ b/binutils/ChangeLog
56@@ -1,3 +1,10 @@
57+2016-03-09 Nick Clifton <nickc@redhat.com>
58+
59+ PR binutils/19775
60+ * testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
61+ Run the new proc.
62+ * testsuite/binutils-all/empty: New, empty, file.
63+
64 2016-02-12 H.J. Lu <hongjiu.lu@intel.com>
65
66 Backport from master
67diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
68index 4c33874..e971350 100644
69--- a/binutils/testsuite/binutils-all/ar.exp
70+++ b/binutils/testsuite/binutils-all/ar.exp
71@@ -555,6 +555,45 @@ proc move_an_element { } {
72 pass $testname
73 }
74
75+# PR 19775: Test creating and listing archives with an empty element.
76+
77+proc empty_archive { } {
78+ global AR
79+ global srcdir
80+ global subdir
81+
82+ set testname "archive with empty element"
83+
84+ # FIXME: There ought to be a way to dynamically create an empty file.
85+ set empty $srcdir/$subdir/empty
86+
87+ if [is_remote host] {
88+ set archive artest.a
89+ set objfile [remote_download host $empty]
90+ remote_file host delete $archive
91+ } else {
92+ set archive tmpdir/artest.a
93+ set objfile $empty
94+ }
95+
96+ remote_file build delete tmpdir/artest.a
97+
98+ set got [binutils_run $AR "-r -c $archive ${objfile}"]
99+ if ![string match "" $got] {
100+ fail $testname
101+ return
102+ }
103+
104+ # This commmand used to fail with: "Malformed archive".
105+ set got [binutils_run $AR "-t $archive"]
106+ if ![string match "empty " $got] {
107+ fail $testname
108+ return
109+ }
110+
111+ pass $testname
112+}
113+
114 # Run the tests.
115
116 # Only run the bfdtest checks if the programs exist. Since these
117@@ -574,6 +613,7 @@ argument_parsing
118 deterministic_archive
119 delete_an_element
120 move_an_element
121+empty_archive
122
123 if { [is_elf_format]
124 && ![istarget "*-*-hpux*"]
125diff --git a/binutils/testsuite/binutils-all/empty b/binutils/testsuite/binutils-all/empty
126new file mode 100644
127index 0000000..e69de29
128--
1291.7.1
130