diff options
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.26.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch | 130 |
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 | " |
| 39 | S = "${WORKDIR}/git" | 40 | S = "${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 @@ | |||
| 1 | From 343a405c03ce478634d8ce5a38faae832d39b361 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alan Modra <amodra@gmail.com> | ||
| 3 | Date: Wed, 9 Mar 2016 17:01:54 +1030 | ||
| 4 | Subject: [PATCH] Allow zero length archive elements | ||
| 5 | |||
| 6 | bfd/ | ||
| 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 | |||
| 12 | binutils/ | ||
| 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 | |||
| 26 | diff --git a/bfd/archive.c b/bfd/archive.c | ||
| 27 | index 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); | ||
| 39 | diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c | ||
| 40 | index 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); | ||
| 52 | diff --git a/binutils/ChangeLog b/binutils/ChangeLog | ||
| 53 | index 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 | ||
| 67 | diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp | ||
| 68 | index 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*"] | ||
| 125 | diff --git a/binutils/testsuite/binutils-all/empty b/binutils/testsuite/binutils-all/empty | ||
| 126 | new file mode 100644 | ||
| 127 | index 0000000..e69de29 | ||
| 128 | -- | ||
| 129 | 1.7.1 | ||
| 130 | |||
