diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2021-04-08 18:01:38 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-19 12:55:20 +0100 |
commit | f1b820e368122ae64d78099fbe50b7a267ad9a67 (patch) | |
tree | 15e77299b1dc1b01c60bef959cde283bbd85dcc7 /meta | |
parent | a9b7ac5cf979ea93eeafa96fc759f4c5ce78013e (diff) | |
download | poky-f1b820e368122ae64d78099fbe50b7a267ad9a67.tar.gz |
binutils: backport fix for gold with theads enabled from 2.36.0
* building chromium with gold and threads triggers this issue:
[1/2] SOLINK ./libcbe.so
FAILED: libcbe.so libcbe.so.TOC
python "../../git/src/build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcbe.so" --tocfile="./libcbe.so.TOC" --output="./libcbe.so" -- i686-oe-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=chromium/84.0.4147.89-4-r41.1/recipe-sysroot -shared -Wl,-soname="libcbe.so" -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -fuse-ld=gold -Wl,--threads -Wl,--thread-count=4 -m32 -Wl,-O2 -Wl,--gc-sections -rdynamic --sysroot=../../recipe-sysroot -L../../recipe-sysroot/lib -L../../recipe-sysroot/usr/lib -Lchromium/84.0.4147.89-4-r41.1/recipe-sysroot -o "./libcbe.so" @"./libcbe.so.rsp"
collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
compilation terminated.
* removing threads/thread-count is one possible work around, but then
the use of gold for performance makes even less sense, that's why
chromium from meta-browser uses LLD by default:
https://github.com/OSSystems/meta-browser/commit/15228b01903d4ca801916e55c7618fa5a71019b7
https://lld.llvm.org/#performance
but lets backport this as other recipes might also reproduce this
issue
(From OE-Core rev: eaf4548a58d1b926b38beab28d75f8710c8b078a)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.35.1.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.35.1.inc b/meta/recipes-devtools/binutils/binutils-2.35.1.inc index 775af2b8f2..6290d5b191 100644 --- a/meta/recipes-devtools/binutils/binutils-2.35.1.inc +++ b/meta/recipes-devtools/binutils/binutils-2.35.1.inc | |||
@@ -44,5 +44,6 @@ SRC_URI = "\ | |||
44 | file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \ | 44 | file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \ |
45 | file://0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch \ | 45 | file://0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch \ |
46 | file://CVE-2020-35448.patch \ | 46 | file://CVE-2020-35448.patch \ |
47 | file://0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch \ | ||
47 | " | 48 | " |
48 | S = "${WORKDIR}/git" | 49 | S = "${WORKDIR}/git" |
diff --git a/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch new file mode 100644 index 0000000000..f46415f440 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From de24fc96bf24fca470a9ca13176ad9ad9cc4d5a9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nick Gasson <nick.gasson@arm.com> | ||
3 | Date: Mon, 2 Nov 2020 12:02:05 +0800 | ||
4 | Subject: [PATCH] gold: ensure file_counts_lock is initialized before using | ||
5 | |||
6 | Since upgrading to binutils 2.35 I've been experiencing random memory | ||
7 | corruption related crashes with ld.gold --threads. It's caused by | ||
8 | multiple threads concurrently pushing elements onto the shared | ||
9 | std::vector in File_read::record_file_read(). This vector is supposed to | ||
10 | be protected by file_counts_lock, but that is initialized lazily and | ||
11 | might be NULL when File_read::open() is called, in which case | ||
12 | Hold_optional_lock silently skips locking it. | ||
13 | |||
14 | Fix by calling the initialize() method before attempting to acquire the | ||
15 | lock, the same as other places that use file_counts_lock. | ||
16 | |||
17 | PR 26827 | ||
18 | * fileread.cc (File_read::open): Ensure file_counts_lock is | ||
19 | initialized. | ||
20 | * testsuite/Makefile.am (check_PROGRAMS): Add a test that passes | ||
21 | -Wl,--threads. | ||
22 | * testsuite/Makefile.in: Regenerate. | ||
23 | |||
24 | Upstream-Status: Backport [af61e84fd2d from 2.36.0] | ||
25 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
26 | --- | ||
27 | gold/fileread.cc | 1 + | ||
28 | 1 file changed, 1 insertion(+) | ||
29 | |||
30 | diff --git a/gold/fileread.cc b/gold/fileread.cc | ||
31 | index f5ca719360d..0b5228e2afd 100644 | ||
32 | --- a/gold/fileread.cc | ||
33 | +++ b/gold/fileread.cc | ||
34 | @@ -212,6 +212,7 @@ File_read::open(const Task* task, const std::string& name) | ||
35 | gold_debug(DEBUG_FILES, "Attempt to open %s succeeded", | ||
36 | this->name_.c_str()); | ||
37 | this->token_.add_writer(task); | ||
38 | + file_counts_initialize_lock.initialize(); | ||
39 | Hold_optional_lock hl(file_counts_lock); | ||
40 | record_file_read(this->name_); | ||
41 | } | ||