On Wed, 20 Nov 2024 07:53:45 GMT, Patrick Zhang <qpzh...@openjdk.org> wrote:
> > > > Ah, it'll only be the redirect library that's compiled with > > > > -march=armv8-a+sve Forget that. > > > > > > > > > But that raises an interesting question. What happens if you try to load > > > a library compiled with `-march=armv8-a+sve` on a non-SVE system? Is the > > > ELF flagged to require SVE so it will fail to load? I'm hoping this is > > > the case -- if so, everything will work as it should in this PR, but I > > > honestly don't know. (After spending like 10 years working with building, > > > I still discover things I need to learn...). > > > > > > I think we can handle it, when a jdk built with sve support runs on a > > non-sve machine, the sve related code will not be executed with the > > protection of UseSVE vm flag which is detected at runtime startup. > > I think we should not have specified any `-march=Xxx` option here in > `make/autoconf/flags-cflags.m4` under > `AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP]`. It generates conflicts when a user > builds JDK with relevant flags in `--with-extra-cflags=-march=Xxx`. Moreover, > above `-march=armv8-a+sve` can accidentally overwrite things specified by > `-mcpu=Xxx` or indirectly impact `-mtune=Xxx` if a user specified them in > configure cmdline, `-march` is of higher priority than `-mcpu` for a > toolchain deciding what isa/cost-model would be used. > > @Hamlin-Li @magicus @theRealAph Removed my previous incorrect comments with regards to the configure sequence on flags. SVE_CFLAGS is only used for sleef library building, so the impact would be limited. While the conflicting concern of `-march=armv8-a+sve` and other `-march=` or `-mcpu` from user inputs is still there. For example, what I captured is: Creating support/modules_libs/jdk.incubator.vector/libsleef.so from 3 file(s) cc1: warning: switch ‘-mcpu=ampere1a’ conflicts with ‘-march=armv8-a+sve’ switch A degradation overriding would happen according to https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu ------------- PR Comment: https://git.openjdk.org/jdk/pull/18294#issuecomment-2487899668