On Tue, 6 Oct 2020, Kito Cheng wrote:

> I think this patch is kind of major change for GCC RISC-V port, so I cc all
> RISC-V gcc maintainer to make sure this change is fine with you guys.
> 
>  - Motivation of this patch:
>    1. Sync behavior between clang/llvm.
>    2. Preparation for -mcpu option support, -mcpu will set -march
>       according the core default arch, however it would be awkward
>       if we only change arch: user need to know the default arch of
>       the core and then set the right ABI, of cause user still can
>       specify arch and abi via -march and -mabi.
> 
>  - This patch has change the behavior for default value of ABI, the ABI
>    will derive from -march if -mabi is not given, which is same behavior
>    as clang/llvm.

 Just to warn you: it used to be the case with the MIPS target and the 
`-mips[1234]' ISA level options originating from SGI's MIPSpro toolchain 
and it has turned out confusing and troublesome.  After many discussions 
we ended up with the current `-march='/`-mtune='/`-mabi=' scheme, for the 
instruction set, the DFA scheduling and the ABI respectively.  Defaults 
are set with `--with-arch='/`--with-tune='/`--with-abi=' respectively, and 
in the absence of an override `-mtune=' is derived from `-march=', which 
is derived from `-mabi='.  Defaults for different ABIs can be set with 
respective `--with-arch*=' and `--with-tune*=' options.

 This prevents the ABI from being changed unexpectedly, especially if 
different though link-compatible `-march=' options are used for individual 
objects in a compilation.

 The MIPS port used to have `-mcpu=' as well, which used to be roughly 
equivalent to modern `-mtune='; from your description I gather `-mcpu=' is 
going to be roughly equivalent to a combination of `-mtune=' and `-march=' 
setting DFA scheduling for a specific CPU and the instruction set to the 
underlying architecture (do we plan to allow vendor extensions?).  In 
which case to compile a set of CPU-specific modules to be linked together 
(e.g. individual platform support in a generic piece of software like an 
OS kernel or a bare metal library) you'll always have to specify the ABI 
explicitly (though maybe you want anyway, hmm).

 FWIW,

  Maciej

Reply via email to