parent
091fb8b29c
commit
70002fc7d9
@ -0,0 +1,54 @@
|
|||||||
|
Backported from LLVM upstream:
|
||||||
|
|
||||||
|
commit ef14b78d9a144ba81ba02083fe21eb286a88732b
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Tue Feb 8 12:46:41 2022 -0800
|
||||||
|
|
||||||
|
[sanitizer] Use _thread_db_sizeof_pthread to obtain struct pthread size
|
||||||
|
|
||||||
|
This symbol has been exported (as an internal GLIBC_PRIVATE symbol) from libc.so.6 starting with glibc 2.34. glibc uses it internally for its libthread_db implementation to enable thread debugging on GDB, so it is unlikely to go away for now.
|
||||||
|
|
||||||
|
Fixes #52989.
|
||||||
|
|
||||||
|
Reviewed By: #sanitizers, MaskRay, vitalybuka
|
||||||
|
|
||||||
|
Differential Revision: https://reviews.llvm.org/D119007
|
||||||
|
|
||||||
|
--- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
|
||||||
|
+++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
|
||||||
|
@@ -265,10 +265,8 @@ void InitTlsSize() { }
|
||||||
|
// sizeof(struct pthread) from glibc.
|
||||||
|
static atomic_uintptr_t thread_descriptor_size;
|
||||||
|
|
||||||
|
-uptr ThreadDescriptorSize() {
|
||||||
|
- uptr val = atomic_load_relaxed(&thread_descriptor_size);
|
||||||
|
- if (val)
|
||||||
|
- return val;
|
||||||
|
+static uptr ThreadDescriptorSizeFallback() {
|
||||||
|
+ uptr val = 0;
|
||||||
|
#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
@@ -323,8 +321,21 @@ uptr ThreadDescriptorSize() {
|
||||||
|
#elif defined(__s390__)
|
||||||
|
val = FIRST_32_SECOND_64(1152, 1776); // valid for glibc 2.22
|
||||||
|
#endif
|
||||||
|
+ return val;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+uptr ThreadDescriptorSize() {
|
||||||
|
+ uptr val = atomic_load_relaxed(&thread_descriptor_size);
|
||||||
|
if (val)
|
||||||
|
- atomic_store_relaxed(&thread_descriptor_size, val);
|
||||||
|
+ return val;
|
||||||
|
+ // _thread_db_sizeof_pthread is a GLIBC_PRIVATE symbol that is exported in
|
||||||
|
+ // glibc 2.34 and later.
|
||||||
|
+ if (unsigned *psizeof = static_cast<unsigned *>(
|
||||||
|
+ dlsym(RTLD_DEFAULT, "_thread_db_sizeof_pthread")))
|
||||||
|
+ val = *psizeof;
|
||||||
|
+ if (!val)
|
||||||
|
+ val = ThreadDescriptorSizeFallback();
|
||||||
|
+ atomic_store_relaxed(&thread_descriptor_size, val);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
2022-04-01 Jakub Jelinek <jakub@redhat.com>
|
|
||||||
|
|
||||||
PR target/105123
|
|
||||||
* config/i386/i386-expand.c (ix86_expand_vector_init_general): Avoid
|
|
||||||
using word as target for expand_simple_binop when doing ASHIFT and
|
|
||||||
IOR.
|
|
||||||
|
|
||||||
* gcc.target/i386/pr105123.c: New test.
|
|
||||||
|
|
||||||
--- gcc/config/i386/i386-expand.c.jj 2022-03-19 13:52:53.000000000 +0100
|
|
||||||
+++ gcc/config/i386/i386-expand.c 2022-04-01 16:51:27.253154191 +0200
|
|
||||||
@@ -14479,9 +14479,9 @@ quarter:
|
|
||||||
else
|
|
||||||
{
|
|
||||||
word = expand_simple_binop (word_mode, ASHIFT, word, shift,
|
|
||||||
- word, 1, OPTAB_LIB_WIDEN);
|
|
||||||
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
|
|
||||||
word = expand_simple_binop (word_mode, IOR, word, elt,
|
|
||||||
- word, 1, OPTAB_LIB_WIDEN);
|
|
||||||
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--- gcc/testsuite/gcc.target/i386/pr105123.c.jj 2022-04-01 16:56:44.549625810 +0200
|
|
||||||
+++ gcc/testsuite/gcc.target/i386/pr105123.c 2022-04-01 16:56:33.569782511 +0200
|
|
||||||
@@ -0,0 +1,22 @@
|
|
||||||
+/* PR target/105123 */
|
|
||||||
+/* { dg-do run { target sse2_runtime } } */
|
|
||||||
+/* { dg-options "-msse2" } */
|
|
||||||
+/* { dg-additional-options "-mtune=i686" { target ia32 } } */
|
|
||||||
+
|
|
||||||
+typedef unsigned short __attribute__((__vector_size__ (4 * sizeof (unsigned short)))) V;
|
|
||||||
+
|
|
||||||
+V
|
|
||||||
+foo (unsigned short u, V v)
|
|
||||||
+{
|
|
||||||
+ return __builtin_shuffle (u * v, v);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main ()
|
|
||||||
+{
|
|
||||||
+ V x = foo (1, (V) { 0, 1, 2, 3 });
|
|
||||||
+ for (unsigned i = 0; i < 4; i++)
|
|
||||||
+ if (x[i] != i)
|
|
||||||
+ __builtin_abort ();
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
Loading…
Reference in new issue