From: Thomas Schwinge <thomas@codesourcery.com>
To: Jan Hubicka <hubicka@ucw.cz>, <gcc-patches@gcc.gnu.org>
Cc: Tom de Vries <tdevries@suse.de>
Subject: More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc. (was: [PATCH][v2] Introduce TARGET_SUPPORTS_ALIASES)
Date: Fri, 8 Sep 2023 14:02:50 +0200 [thread overview]
Message-ID: <87ledgzxcl.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <20170810134213.GB65902@kam.mff.cuni.cz>
[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]
Hi!
On 2017-08-10T15:42:13+0200, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On 07/31/2017 11:57 AM, Yuri Gribov wrote:
>> > On Mon, Jul 31, 2017 at 9:04 AM, Martin Liška <mliska@suse.cz> wrote:
>> >> Doing the transformation suggested by Honza.
... which was:
| On 2017-07-24T16:06:22+0200, Jan Hubicka <hubicka@ucw.cz> wrote:
| > we probably should turn ASM_OUTPUT_DEF ifdefs into a conditional compilation
| > incrementally.
>> >From 78ee08b25d22125cb1fa248bac98ef1e84504761 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Tue, 25 Jul 2017 13:11:28 +0200
>> Subject: [PATCH] Introduce TARGET_SUPPORTS_ALIASES
..., and got pushed as commit a8b522b483ebb8c972ecfde8779a7a6ec16aecd6
(Subversion r251048) "Introduce TARGET_SUPPORTS_ALIASES".
I don't know if that was actually intentional here, or just an
"accident", but such changes actually allow that a back end may or may
not provide symbol aliasing support ('TARGET_SUPPORTS_ALIASES')
independent of '#ifdef ASM_OUTPUT_DEF', and in particular, depending not
just on static but instead on dynamic (run-time) configuration. This is
relevant for the nvptx back end's '-malias' flag.
There did remain a few instances where we currently still assume that
from '#ifdef ASM_OUTPUT_DEF' follows 'TARGET_SUPPORTS_ALIASES', which I'm
adjusting in the attached (with '--ignore-space-change', for easy review)
"More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc.".
OK to push?
These changes are necessary to cure nvptx regressions raised in
<https://inbox.sourceware.org/87iliurqt1.fsf@euler.schwinge.homeip.net>
"[nvptx] Use .alias directive for mptx >= 6.3", addressing the comment:
"[...] remains to be analyzed".
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-More-ifdef-ASM_OUTPUT_DEF-if-TARGET_SUPPORTS_ALIASES.patch --]
[-- Type: text/x-diff, Size: 4737 bytes --]
From 4c725226c3657adb775af274876de5077b8fbf45 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 7 Sep 2023 22:15:08 +0200
Subject: [PATCH] More '#ifdef ASM_OUTPUT_DEF' -> 'if
(TARGET_SUPPORTS_ALIASES)' etc.
Per commit a8b522b483ebb8c972ecfde8779a7a6ec16aecd6 (Subversion r251048)
"Introduce TARGET_SUPPORTS_ALIASES", there is the idea that a back end may or
may not provide symbol aliasing support ('TARGET_SUPPORTS_ALIASES') independent
of '#ifdef ASM_OUTPUT_DEF', and in particular, depending not just on static but
instead on dynamic (run-time) configuration. There did remain a few instances
where we currently still assume that from '#ifdef ASM_OUTPUT_DEF' follows
'TARGET_SUPPORTS_ALIASES'. Change these to 'if (TARGET_SUPPORTS_ALIASES)',
similarly, or 'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'.
gcc/
* ipa-icf.cc (sem_item::target_supports_symbol_aliases_p):
'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);' before
'return true;'.
* ipa-visibility.cc (function_and_variable_visibility): Change
'#ifdef ASM_OUTPUT_DEF' to 'if (TARGET_SUPPORTS_ALIASES)'.
* varasm.cc (output_constant_pool_contents)
[#ifdef ASM_OUTPUT_DEF]:
'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'.
(do_assemble_alias) [#ifdef ASM_OUTPUT_DEF]:
'if (!TARGET_SUPPORTS_ALIASES)',
'gcc_checking_assert (seen_error ());'.
(assemble_alias): Change '#if !defined (ASM_OUTPUT_DEF)' to
'if (!TARGET_SUPPORTS_ALIASES)'.
(default_asm_output_anchor):
'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'.
---
gcc/ipa-icf.cc | 1 +
gcc/ipa-visibility.cc | 8 +++++---
gcc/varasm.cc | 13 ++++++++++---
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc
index 836d0914ded..bbdfd445397 100644
--- a/gcc/ipa-icf.cc
+++ b/gcc/ipa-icf.cc
@@ -218,6 +218,7 @@ sem_item::target_supports_symbol_aliases_p (void)
#if !defined (ASM_OUTPUT_DEF) || (!defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL))
return false;
#else
+ gcc_checking_assert (TARGET_SUPPORTS_ALIASES);
return true;
#endif
}
diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc
index 8ec82bb333e..8ce56114ee3 100644
--- a/gcc/ipa-visibility.cc
+++ b/gcc/ipa-visibility.cc
@@ -622,7 +622,8 @@ function_and_variable_visibility (bool whole_program)
/* All aliases should be processed at this point. */
gcc_checking_assert (!alias_pairs || !alias_pairs->length ());
-#ifdef ASM_OUTPUT_DEF
+ if (TARGET_SUPPORTS_ALIASES)
+ {
FOR_EACH_DEFINED_FUNCTION (node)
{
if (node->get_availability () != AVAIL_INTERPOSABLE
@@ -643,7 +644,8 @@ function_and_variable_visibility (bool whole_program)
if (!alias)
{
- alias = dyn_cast<cgraph_node *> (node->noninterposable_alias ());
+ alias
+ = dyn_cast<cgraph_node *> (node->noninterposable_alias ());
gcc_assert (alias && alias != node);
}
@@ -656,7 +658,7 @@ function_and_variable_visibility (bool whole_program)
}
}
}
-#endif
+ }
FOR_EACH_FUNCTION (node)
{
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 53f0cc61922..40d6081a3fa 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -4300,6 +4300,8 @@ output_constant_pool_contents (struct rtx_constant_pool *pool)
if (desc->mark < 0)
{
#ifdef ASM_OUTPUT_DEF
+ gcc_checking_assert (TARGET_SUPPORTS_ALIASES);
+
const char *name = XSTR (desc->sym, 0);
char label[256];
char buffer[256 + 32];
@@ -6225,6 +6227,10 @@ do_assemble_alias (tree decl, tree target)
IDENTIFIER_POINTER (id),
IDENTIFIER_POINTER (target));
# endif
+ /* If symbol aliases aren't actually supported... */
+ if (!TARGET_SUPPORTS_ALIASES)
+ /* ..., 'ASM_OUTPUT_DEF{,_FROM_DECLS}' better have raised an error. */
+ gcc_checking_assert (seen_error ());
#elif defined (ASM_OUTPUT_WEAK_ALIAS) || defined (ASM_WEAKEN_DECL)
{
const char *name;
@@ -6294,9 +6300,8 @@ assemble_alias (tree decl, tree target)
if (TREE_PUBLIC (decl))
error ("%qs symbol %q+D must have static linkage", "weakref", decl);
}
- else
+ else if (!TARGET_SUPPORTS_ALIASES)
{
-#if !defined (ASM_OUTPUT_DEF)
# if !defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL)
error_at (DECL_SOURCE_LOCATION (decl),
"alias definitions not supported in this configuration");
@@ -6317,7 +6322,7 @@ assemble_alias (tree decl, tree target)
return;
}
# endif
-#endif
+ gcc_unreachable ();
}
TREE_USED (decl) = 1;
@@ -7406,6 +7411,8 @@ default_strip_name_encoding (const char *str)
void
default_asm_output_anchor (rtx symbol)
{
+ gcc_checking_assert (TARGET_SUPPORTS_ALIASES);
+
char buffer[100];
sprintf (buffer, "*. + " HOST_WIDE_INT_PRINT_DEC,
--
2.34.1
next prev parent reply other threads:[~2023-09-08 12:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 7:22 [PATCHv2][PING^2][PR 56727] Bypass PLT for recursive calls Yuri Gribov
2017-07-17 9:27 ` Jan Hubicka
2017-07-18 8:27 ` Yuri Gribov
2017-07-24 12:52 ` [PATCH] Fix wrong condition in ipa-visibility.c (PR ipa/81520) Martin Liška
2017-07-24 14:06 ` Jan Hubicka
2017-07-31 8:04 ` [PATCH] Introduce TARGET_SUPPORTS_ALIASES Martin Liška
2017-07-31 9:58 ` Yuri Gribov
2017-07-31 11:22 ` [PATCH][v2] " Martin Liška
2017-08-10 13:49 ` Jan Hubicka
2023-09-08 12:02 ` Thomas Schwinge [this message]
2023-09-19 8:47 ` [PING] More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc. (was: [PATCH][v2] Introduce TARGET_SUPPORTS_ALIASES) Thomas Schwinge
2023-10-25 8:38 ` [PING^2] " Thomas Schwinge
2023-10-25 16:19 ` [PING^2] More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc Jeff Law
2017-07-25 4:20 ` [PATCH] Fix wrong condition in ipa-visibility.c (PR ipa/81520) Yuri Gribov
2017-08-02 9:47 ` [PATCHv2][PING^2][PR 56727] Bypass PLT for recursive calls Jan Hubicka
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=87ledgzxcl.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=tdevries@suse.de \
/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).