This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [ARM] mno-pic-data-is-text-relative & msingle-pic-base
- From: "Joey Ye" <joey dot ye at foss dot arm dot com>
- To: "'Nathan Sidwell'" <nathan at acm dot org>, "Richard Earnshaw" <Richard dot Earnshaw at arm dot com>, "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 May 2016 18:15:45 +0100
- Subject: RE: [ARM] mno-pic-data-is-text-relative & msingle-pic-base
- Authentication-results: sourceware.org; auth=none
- References: <e2a1d71e-8643-ca06-099f-cca523237c09 at acm dot org>
Nathan,
This patch will do what you intend it to do. However, I am not sure in part related to VxWorks. The logic behind this patch is that -mno-pic-data-is-text-relative should enable -msingle-pic-base because otherwise it will be useless. The logic itself is orthogonal to OS. So I am not convinced the 'else if' shouldn't be just 'if'. It should not change VxWorks behaviour if VxWorks enables -msingle-pic-base explicitly. Or otherwise there is at least one use case that -mno-pic-data-is-text-relative can be used without -msingle-pic-base, which breaks the logic that this whole patch stands on.
Thanks,
Joey
> -----Original Message-----
> From: Nathan Sidwell [mailto:nathanmsidwell@gmail.com] On Behalf Of
> Nathan Sidwell
> Sent: 09 May 2016 15:07
> To: Richard Earnshaw; GCC Patches
> Cc: Joey Ye
> Subject: [ARM] mno-pic-data-is-text-relative & msingle-pic-base
>
> This patch comes from an off-list conversation between Joey & me. The
> context is with RTOSs not all singing & dancing dynamic objects and OSes.
>
> currently, the documentation for -mno-pic-data-is-text-relative (-mno-PDITR)
> says 'Assume that each data segments are relative to text segment at load
> time.
> Therefore, it permits addressing data using PC-relative operations.
> This option is on by default for targets other than VxWorks RTP.'
>
> However, if you use just this option, you still end up with a pic-register init
> sequence that presumes a fixed mapping. That's a surprise. Joey tells me
> its expected use is with -msingle-pic-base (-mSPB), which reserves a global
> register to point at the (single) GOT. That's what I had expected the -mno-
> PDITR option to have implied.
>
> Apparently there are legitimate reasons one might want the -mno-PDITR
> behaviour without -mSPB. I don't know what those are, perhaps Joey could
> clarify?
>
> Anyway, IMHO that is the rare case and the more common case is that one
> would want to have -mnoPDITR imply -mSPB. (The reverse probably doesn't
> apply.)
>
> This patch does 3 things.
> 1) have -mno-PDITR imply -mSPB, unless one has explictly provided -m[no-
> ]SPB.
> 2) clarified the -m[no-]PDITR documentation.
> 3) Added some testcases -- there didn't appear to be any.
>
> ok?
>
> nathan