diff options
| author | Andreas Müller <schnitzeltony@gmail.com> | 2021-08-17 16:32:55 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-18 17:01:06 +0100 |
| commit | 8fe33c72154984c7339dc2545d8d3cf4c0817822 (patch) | |
| tree | 9ebae98875a87e3e2d2f1063aecff7d745e2287b /meta | |
| parent | 5f39beb7cc55a67ada24ce68fbbed6f164e435f1 (diff) | |
| download | poky-8fe33c72154984c7339dc2545d8d3cf4c0817822.tar.gz | |
binutils: Apply upstream patch to fix 'too many open files' on qtwebengine
Since upgrade of binutils to 2.37 builds of qtwebengine failed to link even
with ulimits -n 1000000 (!!).
Fix that by applying a patch from stable 'binutils-2_37-branch'.
(From OE-Core rev: 9f4660e1c6b251c55f9e7e8072b602edf843b952)
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.37.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch | 234 |
2 files changed, 235 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.37.inc b/meta/recipes-devtools/binutils/binutils-2.37.inc index 4218c0a616..6093558e4b 100644 --- a/meta/recipes-devtools/binutils/binutils-2.37.inc +++ b/meta/recipes-devtools/binutils/binutils-2.37.inc | |||
| @@ -35,5 +35,6 @@ SRC_URI = "\ | |||
| 35 | file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ | 35 | file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ |
| 36 | file://0015-sync-with-OE-libtool-changes.patch \ | 36 | file://0015-sync-with-OE-libtool-changes.patch \ |
| 37 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ | 37 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ |
| 38 | file://0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch \ | ||
| 38 | " | 39 | " |
| 39 | S = "${WORKDIR}/git" | 40 | S = "${WORKDIR}/git" |
diff --git a/meta/recipes-devtools/binutils/binutils/0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch b/meta/recipes-devtools/binutils/binutils/0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch new file mode 100644 index 0000000000..9becee39a2 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch | |||
| @@ -0,0 +1,234 @@ | |||
| 1 | From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "H.J. Lu" <hjl.tools@gmail.com> | ||
| 3 | Date: Mon, 26 Jul 2021 05:59:55 -0700 | ||
| 4 | Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd | ||
| 5 | |||
| 6 | Close the file descriptor if there is no archive plugin file descriptor | ||
| 7 | to avoid running out of file descriptors on thin archives with many | ||
| 8 | archive members. | ||
| 9 | |||
| 10 | bfd/ | ||
| 11 | |||
| 12 | PR ld/28138 | ||
| 13 | * plugin.c (bfd_plugin_close_file_descriptor): Close the file | ||
| 14 | descriptor there is no archive plugin file descriptor. | ||
| 15 | |||
| 16 | ld/ | ||
| 17 | |||
| 18 | PR ld/28138 | ||
| 19 | * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for | ||
| 20 | native build. | ||
| 21 | |||
| 22 | PR ld/28138 | ||
| 23 | * testsuite/ld-plugin/lto.exp: Run ld/28138 tests. | ||
| 24 | * testsuite/ld-plugin/pr28138.c: New file. | ||
| 25 | * testsuite/ld-plugin/pr28138-1.c: Likewise. | ||
| 26 | * testsuite/ld-plugin/pr28138-2.c: Likewise. | ||
| 27 | * testsuite/ld-plugin/pr28138-3.c: Likewise. | ||
| 28 | * testsuite/ld-plugin/pr28138-4.c: Likewise. | ||
| 29 | * testsuite/ld-plugin/pr28138-5.c: Likewise. | ||
| 30 | * testsuite/ld-plugin/pr28138-6.c: Likewise. | ||
| 31 | * testsuite/ld-plugin/pr28138-7.c: Likewise. | ||
| 32 | |||
| 33 | (cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742) | ||
| 34 | (cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2) | ||
| 35 | |||
| 36 | Upstream-Status: Accepted[https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0] | ||
| 37 | --- | ||
| 38 | bfd/plugin.c | 8 +++++++ | ||
| 39 | ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++ | ||
| 40 | ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++ | ||
| 41 | ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++ | ||
| 42 | ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++ | ||
| 43 | ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++ | ||
| 44 | ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++ | ||
| 45 | ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++ | ||
| 46 | ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++ | ||
| 47 | ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++ | ||
| 48 | 10 files changed, 104 insertions(+) | ||
| 49 | create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c | ||
| 50 | create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c | ||
| 51 | create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c | ||
| 52 | create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c | ||
| 53 | create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c | ||
| 54 | create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c | ||
| 55 | create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c | ||
| 56 | create mode 100644 ld/testsuite/ld-plugin/pr28138.c | ||
| 57 | |||
| 58 | diff --git a/bfd/plugin.c b/bfd/plugin.c | ||
| 59 | index 6cfa2b66470..3bab8febe88 100644 | ||
| 60 | --- a/bfd/plugin.c | ||
| 61 | +++ b/bfd/plugin.c | ||
| 62 | @@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd) | ||
| 63 | && !bfd_is_thin_archive (abfd->my_archive)) | ||
| 64 | abfd = abfd->my_archive; | ||
| 65 | |||
| 66 | + /* Close the file descriptor if there is no archive plugin file | ||
| 67 | + descriptor. */ | ||
| 68 | + if (abfd->archive_plugin_fd == -1) | ||
| 69 | + { | ||
| 70 | + close (fd); | ||
| 71 | + return; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | abfd->archive_plugin_fd_open_count--; | ||
| 75 | /* Dup the archive plugin file descriptor for later use, which | ||
| 76 | will be closed by _bfd_archive_close_and_cleanup. */ | ||
| 77 | diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp | ||
| 78 | index def69e43ab3..999d911ce6a 100644 | ||
| 79 | --- a/ld/testsuite/ld-plugin/lto.exp | ||
| 80 | +++ b/ld/testsuite/ld-plugin/lto.exp | ||
| 81 | @@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } { | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | +run_cc_link_tests [list \ | ||
| 86 | + [list \ | ||
| 87 | + "Build pr28138.a" \ | ||
| 88 | + "-T" "" \ | ||
| 89 | + {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \ | ||
| 90 | + pr28138-6.c pr28138-7.c} {} "pr28138.a" \ | ||
| 91 | + ] \ | ||
| 92 | + [list \ | ||
| 93 | + "Build pr28138.o" \ | ||
| 94 | + "" "" \ | ||
| 95 | + {pr28138.c} {} \ | ||
| 96 | + ] \ | ||
| 97 | +] | ||
| 98 | + | ||
| 99 | +set exec_output [run_host_cmd "sh" \ | ||
| 100 | + "-c \"ulimit -n 20; \ | ||
| 101 | + $CC -Btmpdir/ld -o tmpdir/pr28138 \ | ||
| 102 | + tmpdir/pr28138.o tmpdir/pr28138.a\""] | ||
| 103 | +set exec_output [prune_warnings $exec_output] | ||
| 104 | +if [string match "" $exec_output] then { | ||
| 105 | + if { [isnative] } { | ||
| 106 | + set exec_output [run_host_cmd "tmpdir/pr28138" ""] | ||
| 107 | + if [string match "PASS" $exec_output] then { | ||
| 108 | + pass "PR ld/28138" | ||
| 109 | + } else { | ||
| 110 | + fail "PR ld/28138" | ||
| 111 | + } | ||
| 112 | + } else { | ||
| 113 | + pass "PR ld/28138" | ||
| 114 | + } | ||
| 115 | +} else { | ||
| 116 | + fail "PR ld/28138" | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | set testname "Build liblto-11.a" | ||
| 120 | remote_file host delete "tmpdir/liblto-11.a" | ||
| 121 | set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"] | ||
| 122 | diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c | ||
| 123 | new file mode 100644 | ||
| 124 | index 00000000000..51d119e1642 | ||
| 125 | --- /dev/null | ||
| 126 | +++ b/ld/testsuite/ld-plugin/pr28138-1.c | ||
| 127 | @@ -0,0 +1,6 @@ | ||
| 128 | +extern int a0(void); | ||
| 129 | +int | ||
| 130 | +a1(void) | ||
| 131 | +{ | ||
| 132 | + return 1 + a0(); | ||
| 133 | +} | ||
| 134 | diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c | ||
| 135 | new file mode 100644 | ||
| 136 | index 00000000000..1120cd797e9 | ||
| 137 | --- /dev/null | ||
| 138 | +++ b/ld/testsuite/ld-plugin/pr28138-2.c | ||
| 139 | @@ -0,0 +1,6 @@ | ||
| 140 | +extern int a1(void); | ||
| 141 | +int | ||
| 142 | +a2(void) | ||
| 143 | +{ | ||
| 144 | + return 1 + a1(); | ||
| 145 | +} | ||
| 146 | diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c | ||
| 147 | new file mode 100644 | ||
| 148 | index 00000000000..ec464947ee6 | ||
| 149 | --- /dev/null | ||
| 150 | +++ b/ld/testsuite/ld-plugin/pr28138-3.c | ||
| 151 | @@ -0,0 +1,6 @@ | ||
| 152 | +extern int a2(void); | ||
| 153 | +int | ||
| 154 | +a3(void) | ||
| 155 | +{ | ||
| 156 | + return 1 + a2(); | ||
| 157 | +} | ||
| 158 | diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c | ||
| 159 | new file mode 100644 | ||
| 160 | index 00000000000..475701b2c5c | ||
| 161 | --- /dev/null | ||
| 162 | +++ b/ld/testsuite/ld-plugin/pr28138-4.c | ||
| 163 | @@ -0,0 +1,6 @@ | ||
| 164 | +extern int a3(void); | ||
| 165 | +int | ||
| 166 | +a4(void) | ||
| 167 | +{ | ||
| 168 | + return 1 + a3(); | ||
| 169 | +} | ||
| 170 | diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c | ||
| 171 | new file mode 100644 | ||
| 172 | index 00000000000..e24f86c363e | ||
| 173 | --- /dev/null | ||
| 174 | +++ b/ld/testsuite/ld-plugin/pr28138-5.c | ||
| 175 | @@ -0,0 +1,6 @@ | ||
| 176 | +extern int a4(void); | ||
| 177 | +int | ||
| 178 | +a5(void) | ||
| 179 | +{ | ||
| 180 | + return 1 + a4(); | ||
| 181 | +} | ||
| 182 | diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c | ||
| 183 | new file mode 100644 | ||
| 184 | index 00000000000..b5b938bdb21 | ||
| 185 | --- /dev/null | ||
| 186 | +++ b/ld/testsuite/ld-plugin/pr28138-6.c | ||
| 187 | @@ -0,0 +1,6 @@ | ||
| 188 | +extern int a5(void); | ||
| 189 | +int | ||
| 190 | +a6(void) | ||
| 191 | +{ | ||
| 192 | + return 1 + a5(); | ||
| 193 | +} | ||
| 194 | diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c | ||
| 195 | new file mode 100644 | ||
| 196 | index 00000000000..4ef75bf0f0c | ||
| 197 | --- /dev/null | ||
| 198 | +++ b/ld/testsuite/ld-plugin/pr28138-7.c | ||
| 199 | @@ -0,0 +1,6 @@ | ||
| 200 | +extern int a6(void); | ||
| 201 | +int | ||
| 202 | +a7(void) | ||
| 203 | +{ | ||
| 204 | + return 1 + a6(); | ||
| 205 | +} | ||
| 206 | diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c | ||
| 207 | new file mode 100644 | ||
| 208 | index 00000000000..68252c9f382 | ||
| 209 | --- /dev/null | ||
| 210 | +++ b/ld/testsuite/ld-plugin/pr28138.c | ||
| 211 | @@ -0,0 +1,20 @@ | ||
| 212 | +#include <stdio.h> | ||
| 213 | + | ||
| 214 | +extern int a7(void); | ||
| 215 | + | ||
| 216 | +int | ||
| 217 | +a0(void) | ||
| 218 | +{ | ||
| 219 | + return 0; | ||
| 220 | +} | ||
| 221 | + | ||
| 222 | +int | ||
| 223 | +main() | ||
| 224 | +{ | ||
| 225 | + if (a7() == 7) | ||
| 226 | + { | ||
| 227 | + printf ("PASS\n"); | ||
| 228 | + return 0; | ||
| 229 | + } | ||
| 230 | + return 1; | ||
| 231 | +} | ||
| 232 | -- | ||
| 233 | 2.31.1 | ||
| 234 | |||
