From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: Paul Burton <paulburton@kernel.org>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Arnd Bergmann <arnd@arndb.de>,
Christian Brauner <christian.brauner@canonical.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] MIPS: Avoid VDSO ABI breakage due to global register variable
Date: Fri, 3 Jan 2020 09:15:10 +0000 [thread overview]
Message-ID: <fce2be75-9a68-37eb-723a-99d010e77132@arm.com> (raw)
In-Reply-To: <20200103004229.lpbhocebuny6vxmf@lantea.localdomain>
Hi Paul,
On 1/3/20 12:42 AM, Paul Burton wrote:
> Using -ffixed-gp wouldn't be correct for the VDSO - the VDSO itself is
> position independent code, and will need to use $gp to access the GOT
> which is part of how position-independence is achieved (technically you
> could access the GOT using another register of course but you'd need
> some way to persuade the compiler to break with convention & you'd gain
> nothing meaningful since you'd need to use some other register anyway).
> If we use -ffixed-gp then we're telling GCC not to use $gp, and that
> doesn't make sense. If we consider -ffixed-gp as telling GCC not to use
> $gp as a general purpose register then it's meaningless because $gp
> already has a specific use & isn't used as a general purpose register.
> If we consider -ffixed-gp as telling GCC not to use $gp at all then it
> doesn't make sense because it needs to in order to access the GOT.
>
> In terms of GCC's flags we'd want to use -fcall-saved-gp, but that would
> just be telling GCC information it already knows about the n32 & n64
> ABIs & indeed it seems to have no effect at all on the way GCC handles
> the global register variable - it doesn't cause gcc to save & restore
> $gp with the global register variable present, so you gain nothing.
>
> We could use -ffixed-gp for the kernel proper (& not the VDSO), but:
>
> 1) The kernel builds as non-PIC code with no $gp-based optimizations
> enabled, and since this has been fine forever it seems safe to expect
> the compiler not to start using $gp in new ways.
>
> 2) It would be a separate issue to fixing the VDSO anyway.
Makes totally sense. Thanks for the explanation.
--
Regards,
Vincenzo
next prev parent reply other threads:[~2020-01-03 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-01 17:59 [PATCH] MIPS: Don't declare __current_thread_info globally Paul Burton
2020-01-01 20:51 ` Arnd Bergmann
2020-01-02 0:53 ` Arvind Sankar
2020-01-02 3:02 ` Nathan Chancellor
2020-01-02 4:50 ` [PATCH v2] MIPS: Avoid VDSO ABI breakage due to global register variable Paul Burton
2020-01-02 10:58 ` Jason A. Donenfeld
2020-01-02 16:56 ` Vincenzo Frascino
2020-01-03 0:42 ` Paul Burton
2020-01-03 9:15 ` Vincenzo Frascino [this message]
2020-01-03 0:42 ` Paul Burton
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=fce2be75-9a68-37eb-723a-99d010e77132@arm.com \
--to=vincenzo.frascino@arm.com \
--cc=Jason@zx2c4.com \
--cc=arnd@arndb.de \
--cc=christian.brauner@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paulburton@kernel.org \
--cc=stable@vger.kernel.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