public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/31655] clang can't build glibc with stack protector
Date: Thu, 18 Apr 2024 18:10:31 +0000	[thread overview]
Message-ID: <bug-31655-131-nqkc0DbO6O@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31655-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31655

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I think we make explicit the constraints in the code, where we can't call
external symbols in static build.  Something like:

diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index 5a98f70364..1943dc7db6 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -98,6 +98,12 @@ static const struct intel_02_cache_info

 #define nintel_02_known (sizeof (intel_02_known) / sizeof (intel_02_known
[0]))

+/* The bsearch is called early during process initialization before TCB has
+   been set up; and if the compiler does not enable __extern_inline it might
call
+   the symbol which might use an invalid thread-pointer.  */
+#define bsearch bsearch_inline
+#include <bits/stdlib-bsearch.h>
+
 static int
 intel_02_known_compare (const void *p1, const void *p2)
 {
@@ -214,8 +220,8 @@ intel_check_word (int name, unsigned int value, bool
*has_level_2,
          struct intel_02_cache_info search;

          search.idx = byte;
-         found = bsearch (&search, intel_02_known, nintel_02_known,
-                          sizeof (intel_02_known[0]), intel_02_known_compare);
+         found = bsearch_inline (&search, intel_02_known, nintel_02_known,
+                                 sizeof (intel_02_known[0]),
intel_02_known_compare);
          if (found != NULL)
            {
              if (found->rel_name == folded_rel_name)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-04-18 18:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 15:00 [Bug libc/31655] New: " hjl.tools at gmail dot com
2024-04-18 15:08 ` [Bug libc/31655] " adhemerval.zanella at linaro dot org
2024-04-18 17:43 ` skpgkp1 at gmail dot com
2024-04-18 17:45 ` hjl.tools at gmail dot com
2024-04-18 18:10 ` adhemerval.zanella at linaro dot org [this message]
2024-04-18 18:13 ` skpgkp1 at gmail dot com
2024-04-18 19:31 ` adhemerval.zanella at linaro dot org
2024-04-18 19:37 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31655-131-nqkc0DbO6O@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).