public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] libstdc++, Darwin: Fix weak attribute to use __weak__ instead of weak.
@ 2022-12-04 10:53 Iain Sandoe
  2022-12-04 12:34 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2022-12-04 10:53 UTC (permalink / raw)
  To: libstdc++, gcc-patches

As pointed out on irc by Jonathan, the Darwin os_defines contains a "weak"
attribute where we should use '__weak__'.  Fixed thus, tested on i686, x86_64
Darwin and x86_64 Linux, pushed to master, thanks,
Iain

-- >8 --

The text for _GLIBCXX_WEAK_DEFINITION has used 'weak' for the attribute name,
since its intoduction.  Amend to use the implementation namespace '__weak__'
version.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libstdc++-v3/ChangeLog:

	* config/os/bsd/darwin/os_defines.h (_GLIBCXX_WEAK_DEFINITION): Use the
	implementation namespace for the weak attribute.
---
 libstdc++-v3/config/os/bsd/darwin/os_defines.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
index a8b6d4fa324..38fdfb5f6f0 100644
--- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
@@ -33,11 +33,11 @@
    links to, so there's no need for weak-ness for that.  */
 #define _GLIBCXX_GTHREAD_USE_WEAK 0
 
-// On Darwin, in order to enable overriding of operator new and delete,
-// GCC makes the definition of these functions weak, relies on the
-// loader to implement weak semantics properly, and uses
-// -flat_namespace to work around the way that it doesn't.
-#define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
+// On Darwin, in order to enable overriding of operator new and delete, the
+// ABI library exports a weak definition. The static linker will override this
+// iff a user-provided implementation is given (providing that the user
+// implementation is not itself a weak definition).
+#define _GLIBCXX_WEAK_DEFINITION __attribute__ ((__weak__))
 
 // Static initializer macro is buggy in darwin, see libstdc++/51906
 #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pushed] libstdc++, Darwin: Fix weak attribute to use __weak__ instead of weak.
  2022-12-04 10:53 [pushed] libstdc++, Darwin: Fix weak attribute to use __weak__ instead of weak Iain Sandoe
@ 2022-12-04 12:34 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2022-12-04 12:34 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: libstdc++, gcc-patches, Iain Sandoe

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

On Sun, 4 Dec 2022, 10:54 Iain Sandoe via Libstdc++, <libstdc++@gcc.gnu.org>
wrote:

> As pointed out on irc by Jonathan, the Darwin os_defines contains a "weak"
> attribute where we should use '__weak__'.  Fixed thus, tested on i686,
> x86_64
> Darwin and x86_64 Linux, pushed to master, thanks,
> Iain


> -- >8 --
>

I wanted to be sure this wouldn't conflict with the __weak keyword for
obj-C so thanks for taking care of it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-04 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-04 10:53 [pushed] libstdc++, Darwin: Fix weak attribute to use __weak__ instead of weak Iain Sandoe
2022-12-04 12:34 ` Jonathan Wakely

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).