Hello, Segher,

On Jul  9, 2020, Segher Boessenkool <seg...@kernel.crashing.org> wrote:

>> The problem it addresses is that the current checking only tests for 
>> existence not for an incompatible/compatible setting.

>> Currently both are reported as incompatible.

https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549760.html

> Put that
>   ((rs6000_isa_flags & OPTION_MASK_MINIMAL_TOC) != 0)
> check inside the block please, together with the CMODEL_SMALL check?

We're trying to make sense of this suggestion of yours, and I confess
I'm quite confused as to the intended effects of this piece of code, and
similar ones in aix, freebsd64 and rtems rs6000 headers.

Clearly, we wish to issue an error message if -mminimal-toc and -mcmodel
other than small.

But should we silently force the code model to small if -mno-minimal-toc
is specified?  (I believe that would be a consequence of the change you
propose)

Upon first reading your suggestion, I thought it was a think, and that
you meant to move the rs6000_isa_flags_explicit test into the block, for
that would:

- set cmodel to small whenever -mminimal-toc is enabled, explicit or by
  default

- error iff -mminimal-toc and non-small -mcmodel are explicitly given


However, this could change behavior for the various headers that have an
else block for the if that currently tests rs6000_isa_flags_explicit,
which might be undesirable, and that's where things get confusing.

It's not at all clear to me what's expected if e.g.:

- -mminimal-toc is enabled by default (is it ever?) and a non-small code
model is selected (explicitly or by default): error, silent change to
small cmodel, silent disabling of minimal-toc, or something else?

- -mno-minimal-toc is explicitly given along with some non-small code
model: any reason to error out, force small cmode, force-enable
minimal-toc, or something else?


Could you please shed any light as to the intent, so that we can sort
out the logic that will implement it?


The logic in this code seems to be unchanged since it was first
introduced by Alan Modra along with -mcmodel back in 2010, despite the
many spelling changes as internal representation of flags and state and
whatnot changed.  I'm copying Alan as well, just in case he can recall
or figure out what the intent was.  AFAICT it first made linux64.h, and
other headers got copies or variants thereof as the -mcmodel option got
adopted by other systems.


Thanks in advance,

-- 
Alexandre Oliva, happy hacker
https://FSFLA.org/blogs/lxo/
Free Software Activist
GNU Toolchain Engineer

Reply via email to