From: Peter Bergner <bergner@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>,
jeevitha <jeevitha@linux.vnet.ibm.com>
Cc: segher@kernel.crashing.org, gcc-patches@gcc.gnu.org,
Michael Meissner <meissner@linux.ibm.com>
Subject: Re: [PATCH] rs6000: Disable PCREL for unsupported targets [PR111045]
Date: Wed, 23 Aug 2023 21:07:58 -0500 [thread overview]
Message-ID: <e04615bc-e723-1278-f08a-1995ffef470e@linux.ibm.com> (raw)
In-Reply-To: <2c4fb77c-4cc9-dce8-b25f-4c3a463d348c@linux.ibm.com>
On 8/21/23 8:51 PM, Kewen.Lin wrote:
>> The following patch has been bootstrapped and regtested on powerpc64-linux.
>
> I think we should test this on powerpc64le-linux P8 or P9 (no P10) as well.
That's a good idea!
> I think this should be moved to be with the hunk on PCREL:
>
> /* If the ABI has support for PC-relative relocations, enable it by default.
> This test depends on the sub-target tests above setting the code model to
> medium for ELF v2 systems. */
> if (PCREL_SUPPORTED_BY_OS
> && (rs6000_isa_flags_explicit & OPTION_MASK_PCREL) == 0)
> rs6000_isa_flags |= OPTION_MASK_PCREL;
>
> /* -mpcrel requires -mcmodel=medium, but we can't check TARGET_CMODEL until
> after the subtarget override options are done. */
> else if (TARGET_PCREL && TARGET_CMODEL != CMODEL_MEDIUM)
> {
> if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
> error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium");
>
> rs6000_isa_flags &= ~OPTION_MASK_PCREL;
> }
Agreed on the location, but...
Looking at this closer, I don't think I'm happy with the current code.
We seem to have duplicated tests for whether the target supports pcrel
or not in both PCREL_SUPPORTED_BY_OS and rs6000_pcrel_p(). That means
if another target were to add support for pcrel, they'd have to update
multiple locations of the code, and that seems error prone.
I think we should standardize our tests for whether the target/OS
supports pcrel (irrespective of the -mpcrel or -mcmodel=medium options)
and have that in PCREL_SUPPORTED_BY_OS. Ie, a one-stop-shop for testing
whether the current target/OS can support pcrel. Then we should modify
rs6000_pcrel_p() use PCREL_SUPPORTED_BY_OS rather than its own
semi-duplicated target/OS tests, plus any other tests for options that
might disqualify the current target/OS from supporting pcrel, when it
normally can (ie, -mmodel != medium for ELFv2).
I think then, that should allow simplifying the code in
rs6000_option_override_internal.
Thoughts?
Peter
next prev parent reply other threads:[~2023-08-24 2:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 10:32 jeevitha
2023-08-22 1:51 ` Kewen.Lin
2023-08-24 2:07 ` Peter Bergner [this message]
2023-08-24 5:56 ` Kewen.Lin
2023-08-25 3:20 ` Peter Bergner
2023-08-25 11:20 ` Kewen.Lin
2023-08-25 22:04 ` Peter Bergner
2023-08-28 2:06 ` Kewen.Lin
2023-11-10 23:51 ` Peter Bergner
2023-11-13 18:24 ` jeevitha
2023-11-14 2:33 ` Kewen.Lin
2023-11-14 21:40 ` Peter Bergner
2023-11-11 0:03 ` Peter Bergner
2023-11-27 23:11 ` Michael Meissner
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=e04615bc-e723-1278-f08a-1995ffef470e@linux.ibm.com \
--to=bergner@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeevitha@linux.vnet.ibm.com \
--cc=linkw@linux.ibm.com \
--cc=meissner@linux.ibm.com \
--cc=segher@kernel.crashing.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).