From: Olivier Hainque <hainque@adacore.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Olivier Hainque <hainque@adacore.com>
Subject: [patch] Improve comments and INITFINI macro use in vxcrtsutff.c
Date: Thu, 29 Sep 2022 19:58:06 +0200 [thread overview]
Message-ID: <451A7F47-DAF6-4618-96CA-855FDC5B7FA9@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
Hello,
This change augments the comment attached to the use of auto-host.h
in vxcrtstuff.c to better describe the reason for including it and
for the associated series of #undef directives.
It also augments the comment on dso_handle and removes a redundant
guard on HAVE_INITFINI_ARRAY_SUPPORT for the shared version of the
objects, nested within a section guarded on USE_INITFINI_ARRAY.
We have been using this for a while in gcc-11 based production
toolchains and I have performed a few build+test sanity checks with
gcc-12 for powerpc64-vxworks7r2. This is supposedly a noop.
Will commit to mainline shortly.
Olivier
2022-03-06 Olivier Hainque <hainque@adacore.com>
libgcc/
* config/vxcrtstuff.c: Improve the comment attached to the use
of auto-host.h and of __dso_handle. Remove redundant guard on
HAVE_INITFINI_ARRAY_SUPPORT within a USE_INITFINI_ARRAY section.
[-- Attachment #2: 0017-Improve-comments-and-INITFINI-macro-use-in-vxcrtsutf.patch --]
[-- Type: application/octet-stream, Size: 3619 bytes --]
From 4ecad9c409c09f6108bbaaff1ee8805a076c45a6 Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Mon, 7 Mar 2022 11:50:27 +0000
Subject: [PATCH 17/18] Improve comments and INITFINI macro use in vxcrtsutff.c
This change augments the comment attached to the use of auto-host.h
in vxcrtstuff.c to better describe the reason for including it and
for the associated series of #undef directives.
It also augments the comment on dso_handle and removes a redundant
guard on HAVE_INITFINI_ARRAY_SUPPORT for the shared version of the
objects, nested within a section guarded on USE_INITFINI_ARRAY.
2022-03-06 Olivier Hainque <hainque@adacore.com>
libgcc/
* config/vxcrtstuff.c: Improve the comment attached to the use
of auto-host.h and of __dso_handle. Remove redundant guard on
HAVE_INITFINI_ARRAY_SUPPORT within a USE_INITFINI_ARRAY section.
---
libgcc/config/vxcrtstuff.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c
index 80f51f7399d..5045acfc6da 100644
--- a/libgcc/config/vxcrtstuff.c
+++ b/libgcc/config/vxcrtstuff.c
@@ -26,15 +26,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define IN_LIBGCC2
-/* FIXME: Including auto-host is incorrect, but until we have
- identified the set of defines that need to go into auto-target.h,
- this will have to do. */
+/* FIXME: Including auto-host is incorrect here (target library implementation
+ file), but we still need it for DEFAULT_USE_CXA_ATEXIT and most importantly
+ USE_INITFINI_ARRAY, guarded by HAVE_INITFINI_ARRAY_SUPPORT, not yet handled
+ by auto-target.h. Proceed as crtstuff.c, with the inclusion followed by a
+ few #undefs preventing build failures in configurations setup for Windows
+ hosts, including canadian builds. #define USED_FOR_TARGET would circumvent
+ this but would unfortunately also inhibit some of the definitions we
+ need. */
#include "auto-host.h"
#undef caddr_t
#undef pid_t
#undef rlim_t
#undef ssize_t
#undef vfork
+
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
@@ -58,17 +64,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifdef CRT_BEGIN
+/* Provide __dso_handle in RTP objects, which might be included in contexts
+ involving shared objects. This mimics the crtstuff.c behavior: dso_handle
+ should be NULL for the main program (in vx_crtbegin.o) and a unique value
+ for the shared libraries (in vx_crtbeginS.o). */
+
#if DEFAULT_USE_CXA_ATEXIT && defined(__RTP__)
-/* This mimics the crtstuff.c behavior. dso_handle should be NULL for the
- main program (in vx_crtbegin.o) and a unique value for the shared libraries
- (in vx_crtbeginS.o). */
extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
#ifdef CRTSTUFFS_O
void *__dso_handle = &__dso_handle;
#else
void *__dso_handle = 0;
#endif
-#endif /* DEFAULT_USE_CXA_ATEXIT */
+#endif
/* Determine what names to use for the constructor/destructor functions. */
@@ -103,7 +111,7 @@ void *__dso_handle = 0;
where we don't want to drag libc_internal contents blindly and which
provides functions with a slightly different name anyway. */
-#if HAVE_INITFINI_ARRAY_SUPPORT && defined(CRTSTUFFS_O)
+#if defined(CRTSTUFFS_O)
/* Run through the .init_array, .fini_array sections. The linker script
*must* provide __init_array_start, __init_array_end, __fini_array_start,
--
2.25.1
reply other threads:[~2022-09-29 17:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=451A7F47-DAF6-4618-96CA-855FDC5B7FA9@adacore.com \
--to=hainque@adacore.com \
--cc=gcc-patches@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).