public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/ibuclaw/heads/darwin)] libphobos: Checkpoint in darwin runtime support
Date: Sat, 10 Apr 2021 17:00:36 +0000 (GMT)	[thread overview]
Message-ID: <20210410170036.BF503395C82E@sourceware.org> (raw)

https://gcc.gnu.org/g:c4a997f78b409eed36eb6ca476b5c3ceaefacf21

commit c4a997f78b409eed36eb6ca476b5c3ceaefacf21
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Nov 29 14:44:28 2020 +0100

    libphobos: Checkpoint in darwin runtime support

Diff:
---
 libphobos/configure                              | 22 ++++++++++++++++++----
 libphobos/libdruntime/config/x86/switchcontext.S |  8 ++++++++
 libphobos/libdruntime/gcc/deh.d                  |  5 -----
 libphobos/libdruntime/gcc/sections/common.d      |  2 +-
 libphobos/m4/druntime/os.m4                      | 22 ++++++++++++++++++----
 libphobos/testsuite/lib/libphobos.exp            |  4 ++++
 6 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/libphobos/configure b/libphobos/configure
index fe7cd9c11ff..bbdcb409562 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -14422,6 +14422,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -14430,17 +14432,29 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minfo section bracketing" >&5
 $as_echo_n "checking for minfo section bracketing... " >&6; }
+  case "$druntime_cv_target_os" in
+      darwin*)
+	section="__DATA,__minfodata"
+	start="section\$start\$__DATA\$__minfodata"
+	stop="section\$end\$__DATA\$__minfodata"
+	;;
+      *)
+	section="minfo"
+	start="__start_minfo"
+	stop="__stop_minfo"
+	;;
+  esac
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-    void* module_info_ptr __attribute__((section ("minfo")));
-    extern void* __start_minfo __attribute__((visibility ("hidden")));
-    extern void* __stop_minfo __attribute__((visibility ("hidden")));
+    void* module_info_ptr __attribute__((section ("$section")));
+    extern void* start_minfo __asm__("$start") __attribute__((visibility ("hidden")));
+    extern void* stop_minfo __asm__("$stop") __attribute__((visibility ("hidden")));
 
     int main()
     {
         // Never run, just to prevent compiler from optimizing access
-        return &__start_minfo == &__stop_minfo;
+        return (int)(&stop_minfo - &start_minfo);
     }
 
 _ACEOF
diff --git a/libphobos/libdruntime/config/x86/switchcontext.S b/libphobos/libdruntime/config/x86/switchcontext.S
index 82420c6159c..8af3f5488ba 100644
--- a/libphobos/libdruntime/config/x86/switchcontext.S
+++ b/libphobos/libdruntime/config/x86/switchcontext.S
@@ -33,7 +33,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
     .text
     .globl CSYM(fiber_switchContext)
+#if defined(__ELF__)
     .type CSYM(fiber_switchContext), @function
+#endif
     .align 16
 CSYM(fiber_switchContext):
     .cfi_startproc
@@ -61,13 +63,17 @@ CSYM(fiber_switchContext):
     // 'return' to complete switch
     ret
     .cfi_endproc
+#if defined(__ELF__)
     .size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)
+#endif
 
 #elif defined(__x86_64__) && !defined(__ILP32__) && !defined(__CET__)
 
     .text
     .globl CSYM(fiber_switchContext)
+#if defined(__ELF__)
     .type CSYM(fiber_switchContext), @function
+#endif
     .align 16
 CSYM(fiber_switchContext):
     .cfi_startproc
@@ -96,6 +102,8 @@ CSYM(fiber_switchContext):
     // 'return' to complete switch
     ret
     .cfi_endproc
+#if defined(__ELF__)
    .size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)
+#endif
 
 #endif
diff --git a/libphobos/libdruntime/gcc/deh.d b/libphobos/libdruntime/gcc/deh.d
index 2e679320c38..8df5ac63d81 100644
--- a/libphobos/libdruntime/gcc/deh.d
+++ b/libphobos/libdruntime/gcc/deh.d
@@ -34,11 +34,6 @@ extern(C)
 {
     int _d_isbaseof(ClassInfo, ClassInfo);
     void _d_createTrace(Object, void*);
-
-    // Not used in GDC but declaration required by rt/sections.d
-    struct FuncTable
-    {
-    }
 }
 
 /**
diff --git a/libphobos/libdruntime/gcc/sections/common.d b/libphobos/libdruntime/gcc/sections/common.d
index 85fdc0efd48..411f58ac548 100644
--- a/libphobos/libdruntime/gcc/sections/common.d
+++ b/libphobos/libdruntime/gcc/sections/common.d
@@ -1,5 +1,5 @@
 // Contains various utility functions used by the runtime implementation.
-// Copyright (C) 2019-2021 Free Software Foundation, Inc.
+// Copyright (C) 2021 Free Software Foundation, Inc.
 
 // GCC is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
index ed93e30f1e9..351558dbcda 100644
--- a/libphobos/m4/druntime/os.m4
+++ b/libphobos/m4/druntime/os.m4
@@ -149,17 +149,31 @@ AC_DEFUN([DRUNTIME_OS_ARM_EABI_UNWINDER],
 # substitute DCFG_MINFO_BRACKETING.
 AC_DEFUN([DRUNTIME_OS_MINFO_BRACKETING],
 [
+  AC_REQUIRE([DRUNTIME_OS_DETECT])
+
   AC_LANG_PUSH([C])
   AC_MSG_CHECKING([for minfo section bracketing])
+  case "$druntime_cv_target_os" in
+      darwin*)
+	section="__DATA,__minfodata"
+	start="section\$start\$__DATA\$__minfodata"
+	stop="section\$end\$__DATA\$__minfodata"
+	;;
+      *)
+	section="minfo"
+	start="__start_minfo"
+	stop="__stop_minfo"
+	;;
+  esac
   AC_LINK_IFELSE([AC_LANG_SOURCE([
-    void* module_info_ptr __attribute__((section ("minfo")));
-    extern void* __start_minfo __attribute__((visibility ("hidden")));
-    extern void* __stop_minfo __attribute__((visibility ("hidden")));
+    void* module_info_ptr __attribute__((section ("$section")));
+    extern void* start_minfo __asm__("$start") __attribute__((visibility ("hidden")));
+    extern void* stop_minfo __asm__("$stop") __attribute__((visibility ("hidden")));
 
     int main()
     {
         // Never run, just to prevent compiler from optimizing access
-        return &__start_minfo == &__stop_minfo;
+        return (int)(&stop_minfo - &start_minfo);
     }
   ])],
     [AC_MSG_RESULT([yes])
diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp
index 3be2092b12e..ad323d761b9 100644
--- a/libphobos/testsuite/lib/libphobos.exp
+++ b/libphobos/testsuite/lib/libphobos.exp
@@ -90,6 +90,10 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } {
 }
 
 proc libphobos-dg-prune { system text } {
+
+    # Ignore warnings from cctools.
+    regsub -all "(^|\n)clang: warning: argument unused during compilation:\[^\n\]*" $text "" text
+
     return $text
 }


             reply	other threads:[~2021-04-10 17:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10 17:00 Iain Buclaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-17 14:33 Iain Buclaw
2021-04-19 18:05 Iain Buclaw
2021-04-10 15:04 Iain Buclaw
2021-03-14 22:00 Iain Buclaw
2021-03-07 17:01 Iain Buclaw
2021-01-30 19:08 Iain Buclaw
2021-01-28 17:31 Iain Buclaw
2021-01-11 11:39 Iain Buclaw
2020-12-22 13:40 Iain Buclaw
2020-12-09  9:50 Iain Buclaw
2020-12-05 23:47 Iain Buclaw
2020-12-03 22:57 Iain Buclaw
2020-11-30 14:38 Iain Buclaw
2020-11-29 13:45 Iain Buclaw

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=20210410170036.BF503395C82E@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@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).