From: Jonathan Wakely <jwakely@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Ensure __glibcxx_assert_fail has default visibility
Date: Mon, 7 Mar 2022 15:14:56 +0000 [thread overview]
Message-ID: <CACb0b4njyT0zn7Z1Pp2jAEymMk1-bRchZyuVK-h5xcKODCsAUg@mail.gmail.com> (raw)
In-Reply-To: <20220305203433.1301089-1-jwakely@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
On Sat, 5 Mar 2022 at 20:34, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Tested powerpc64le-linux, pushed to trunk.
>
> -- >8 --
>
> This ensures there's no linker error if libstdc++ headers are included
> following a pragma that sets hidden visibility.
>
> Similarly for std::__terminate, which is always-inline so shouldn't
> matter, but it's not wrong to do this anyway.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/c++config (__glibcxx_assert_fail): Add visibility
> attribute.
> (__terminate): Likewise.
This broke mingw targets. Fixed like so.
Tested x86_64-linux, pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2575 bytes --]
commit 4cb935cb69f12088975fa7f6907c6ace0580e2dd
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Mar 7 15:07:05 2022
libstdc++: Use visibility pragmas instead of attributes [PR104807]
The _GLIBCXX_PSEUDO_VISIBILITY macro isn't defined until after including
os_defines.h, so we can't use _GLIBCXX_VISIBILITY early in c++config.
Replace the uses of that macro with #pragma visibility push(default)
instead.
libstdc++-v3/ChangeLog:
PR libstdc++/104807
* include/bits/c++config (__terminate, __glibcxx_assert_fail):
Replace _GLIBCXX_VISIBILITY on function with visibility pragma.
(__is_constant_evaluated): Add visibility pragma.
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 6c134f13509..2798b9786dc 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -302,15 +302,16 @@ namespace std
typedef decltype(nullptr) nullptr_t;
#endif
+#pragma GCC visibility push(default)
// This allows the library to terminate without including all of <exception>
// and without making the declaration of std::terminate visible to users.
extern "C++" __attribute__ ((__noreturn__, __always_inline__))
- _GLIBCXX_VISIBILITY(default)
inline void __terminate() _GLIBCXX_USE_NOEXCEPT
{
void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
terminate();
}
+#pragma GCC visibility pop
}
#define _GLIBCXX_USE_DUAL_ABI
@@ -506,6 +507,7 @@ namespace std
namespace std
{
+#pragma GCC visibility push(default)
// Internal version of std::is_constant_evaluated().
// This can be used without checking if the compiler supports the feature.
// The macro _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED can be used to check if
@@ -523,6 +525,7 @@ namespace std
return false;
#endif
}
+#pragma GCC visibility pop
}
// Debug Mode implies checking assertions.
@@ -553,13 +556,15 @@ namespace std
# ifdef _GLIBCXX_VERBOSE_ASSERT
namespace std
{
+#pragma GCC visibility push(default)
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
- extern "C++" _GLIBCXX_NORETURN _GLIBCXX_VISIBILITY(default)
+ extern "C++" _GLIBCXX_NORETURN
void
__glibcxx_assert_fail(const char* __file, int __line,
const char* __function, const char* __condition)
_GLIBCXX_NOEXCEPT;
+#pragma GCC visibility pop
}
#define __glibcxx_assert_impl(_Condition) \
if (__builtin_expect(!bool(_Condition), false)) \
prev parent reply other threads:[~2022-03-07 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-05 20:34 Jonathan Wakely
2022-03-07 15:14 ` Jonathan Wakely [this message]
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=CACb0b4njyT0zn7Z1Pp2jAEymMk1-bRchZyuVK-h5xcKODCsAUg@mail.gmail.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.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).