[clang] [z/OS] Set the default arch for z/OS to be arch10 (PR #89854)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 22:00:10 PDT 2024


MaskRay wrote:

> > @MaskRay Got it.
> > The problem with that solution is that if you use --target you won't get the correct arch. This would be a problem for any cross compilation. For example, say you cross compile from zLinux (which wouldn't have the config file), the arch would be arch8. And if you cross compiled from z/OS (with the config file) to zLinux then the default arch would be arch10. Both of these would be incorrect.
> > We also use the config files for installation specific information. It is common for users to have their own config files. If we require that the option be in the config file then we would be creating a very error prone situation.
> > We need to be able to change the arch default based on the target triple.
> 
> Sorry for the late reply. Such driver defaults via cmake variable would make testing brittle. Users expect that `check-clang` pass regardless of the cmake variable setting. If a test changes behavior due to different `-march=`, there are a few choices:
> 
> * add a `REQUIRES: zos-new-default-march` directive
> * hard code a `-march=`
> 
> Neither is immediately noticeable. In the past clang/test/Driver has had many such tests that require fixup. We have tried removing some unnecessary `CLANG_DEFAULT_*`.

I just realized that https://reviews.llvm.org/D75914 added `CLANG_SYSTEMZ_DEFAULT_ARCH` for Ubuntu. @xnox @uweigand 

I think we want to avoid such CMake options/clang `config.h`

As an alternative, if the clang executable is at `/tmp/Rel/bin/clang`, you can add `/tmp/Rel/bin/s390x-unknown-linux-gnu.cfg` with content `-march=z13`.

https://github.com/llvm/llvm-project/pull/89854


More information about the cfe-commits mailing list