From: Cupertino Miranda <cupertino.miranda@oracle.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: gcc-patches@gcc.gnu.org, jose.marchesi@oracle.com
Subject: Re: [PATCH 2/2] Corrected pr25521.c target matching.
Date: Tue, 24 Jan 2023 12:24:58 +0000 [thread overview]
Message-ID: <87h6wg15np.fsf@oracle.com> (raw)
In-Reply-To: <db9c79b4-c28a-b36b-2b73-0ed25239fd6b@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
Thank you for the comments and suggestions.
I have changed the patch.
Unfortunately in case of rx target I could not make
scan-assembler-symbol-section to match. I believe it is because the
.section and .global entries order is reversed in this target.
Patch in inlined below. looking forward to your comments.
Cupertino
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: a.patch --]
[-- Type: text/x-diff, Size: 1240 bytes --]
diff --git a/gcc/testsuite/gcc.dg/pr25521.c b/gcc/testsuite/gcc.dg/pr25521.c
index 63363a03b9f..82b4cd88ec0 100644
--- a/gcc/testsuite/gcc.dg/pr25521.c
+++ b/gcc/testsuite/gcc.dg/pr25521.c
@@ -2,9 +2,10 @@
sections.
{ dg-require-effective-target elf }
- { dg-do compile } */
+ { dg-do compile }
+ { dg-skip-if "" { ! const_volatile_readonly_section } } */
const volatile int foo = 30;
-
-/* { dg-final { scan-assembler "\\.s\?rodata" } } */
+/* { dg-final { scan-assembler {.section C,} { target { rx-*-* } } } } */
+/* { dg-final { scan-assembler-symbol-section {^_?foo$} {^\.(const|s?rodata)} { target { ! "rx-*-*" } } } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c0694af2338..91aafd89909 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -12295,3 +12295,13 @@ proc check_is_prog_name_available { prog } {
return 1
}
+
+# returns 1 if target does selects a readonly section for const volatile variables.
+proc check_effective_target_const_volatile_readonly_section { } {
+
+ if { [istarget powerpc-*-*]
+ || [check-flags { "" { powerpc64-*-* } { -m32 } }] } {
+ return 0
+ }
+ return 1
+}
[-- Attachment #3: Type: text/plain, Size: 1762 bytes --]
Jeff Law writes:
> On 12/7/22 08:45, Cupertino Miranda wrote:
>>
>>> On 12/2/22 10:52, Cupertino Miranda via Gcc-patches wrote:
>>>> This commit is a follow up of bugzilla #107181.
>>>> The commit /a0aafbc/ changed the default implementation of the
>>>> SELECT_SECTION hook in order to match clang/llvm behaviour w.r.t the
>>>> placement of `const volatile' objects.
>>>> However, the following targets use target-specific selection functions
>>>> and they choke on the testcase pr25521.c:
>>>> *rx - target sets its const variables as '.section C,"a",@progbits'.
>>> That's presumably a constant section. We should instead twiddle the test to
>>> recognize that section.
>> Although @progbits is indeed a constant section, I believe it is
>> more interesting to detect if the `rx' starts selecting more
>> standard sections instead of the current @progbits.
>> That was the reason why I opted to XFAIL instead of PASSing it.
>> Can I keep it as such ?
> I'm not aware of any ongoing development for that port, so I would not let
> concerns about the rx port changing behavior dominate how we approach this
> problem.
>
> The rx port is using a different name for the section. That's valid thing to
> do and to the extent we can, we should support that in the test rather than
> (incorrectly IMHO) xfailing the test just becuase the name isn't what we
> expected.
>
> To avoid over-eagerly matching, I would probably search for "C," I wouldn't do
> that for the const or rodata sections as they often have a suffix like 1, 2, 4,
> 8 for different sized rodata sections.
>
> PPC32 is explicitly doing something different and placing those objects into an
> RW section. So for PPC32 it makes more sense to skip the test rather than xfail
> it.
>
> Jeff
next prev parent reply other threads:[~2023-01-24 12:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 17:52 [PATCH] `const volatile' sections selection - bugzilla #107181 Cupertino Miranda
2022-12-02 17:52 ` [PATCH 1/2] select .rodata for const volatile variables Cupertino Miranda
2022-12-05 18:06 ` Jeff Law
2022-12-07 15:12 ` Cupertino Miranda
2022-12-15 10:13 ` Cupertino Miranda
2022-12-22 17:21 ` [PING] " Cupertino Miranda
2023-01-02 10:42 ` Cupertino Miranda
2023-01-09 7:57 ` Richard Biener
2023-01-13 15:06 ` Cupertino Miranda
2023-01-19 9:59 ` Cupertino Miranda
2023-01-22 18:43 ` Jeff Law
2023-01-22 18:49 ` Jeff Law
2022-12-02 17:52 ` [PATCH 2/2] Corrected pr25521.c target matching Cupertino Miranda
2022-12-05 18:47 ` Jeff Law
2022-12-07 15:45 ` Cupertino Miranda
2022-12-15 10:14 ` Cupertino Miranda
2022-12-22 17:22 ` [PING] " Cupertino Miranda
2023-01-02 10:43 ` Cupertino Miranda
2023-01-13 15:13 ` Cupertino Miranda
2023-01-22 19:04 ` Jeff Law
2023-01-24 12:24 ` Cupertino Miranda [this message]
2023-01-31 9:10 ` [PING] " Cupertino Miranda
2023-02-07 9:53 ` Cupertino Miranda
2023-02-17 14:33 ` Cupertino Miranda
2023-02-27 10:17 ` Cupertino Miranda
2023-03-09 9:51 ` [PING, PING] " Cupertino Miranda
2023-03-11 16:25 ` Jeff Law
2023-03-13 17:52 ` Cupertino Miranda
2023-03-13 17:57 ` Cupertino Miranda
2023-04-03 4:16 ` Jeff Law
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=87h6wg15np.fsf@oracle.com \
--to=cupertino.miranda@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=jose.marchesi@oracle.com \
/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).