Re: [PATCH] LoongArch: Reimplement multilib build option handling.
Hi! On Sat, 2023-10-07 15:08:34 +0800, Xi Ruoyao wrote: > On Sat, 2023-10-07 at 11:41 +0800, Yang Yujie wrote: > > Thanks for the testing! > > > > This error seems to be difficult to reproduce since it is a makefile > > dependency > > problem. I think appending loongarch-multilib.h to $(GTM_H) instead of > > $(TM_H) > > could help. > > FWIW such issues are easier to reproduce with a high -j number. I can > easily reproduce it with -j32 on a 3C5000-based server. That's interesting. It showed up on all of my CI builds and I don't do parallel builds at all (as I'd like to be able to `diff` the build logs after sanitizing eg. timestamps and the build path.) MfG, JBG -- signature.asc Description: PGP signature
Re: [PATCH] LoongArch: Reimplement multilib build option handling.
On Sat, 2023-10-07 at 11:41 +0800, Yang Yujie wrote: > Thanks for the testing! > > This error seems to be difficult to reproduce since it is a makefile > dependency > problem. I think appending loongarch-multilib.h to $(GTM_H) instead of > $(TM_H) > could help. FWIW such issues are easier to reproduce with a high -j number. I can easily reproduce it with -j32 on a 3C5000-based server. > > And when this is fixed, it might be a nice idea to have a > > --with-multilib-list config in ./contrib/config-list.mk . > > Thanks, will add this later too. > > P.S. Currently support for "f32" is not active, and it should probably be > avoided if you want to build a working rootfs. -- Xi Ruoyao School of Aerospace Science and Technology, Xidian University
Re: [PATCH] LoongArch: Reimplement multilib build option handling.
On Wed, Oct 04, 2023 at 02:13:46PM +0200, Jan-Benedict Glaw wrote: > Seems this breaks for me with > > ../gcc/configure [...] --enable-werror-always --enable-languages=all > --disable-gcov --disable-shared --disable-threads > --target=loongarch64-linux-gnuf32 --without-headers > make V=1 all-gcc > > > See eg. > http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf32/44 : > > /var/lib/laminar/run/gcc-loongarch64-linux-gnuf32/44/local-toolchain-install/bin/g++ > -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions > -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing > -Wwrite-strings -Wcast-qual -Wmissing-format-attribute > -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long > -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common > -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc > -I../../gcc/gcc/build -I../../gcc/gcc/../include > -I../../gcc/gcc/../libcpp/include \ > -o build/genpreds.o ../../gcc/gcc/genpreds.cc > In file included from ../../gcc/gcc/config/loongarch/loongarch.h:53, > from ./tm.h:50, > from ../../gcc/gcc/genpreds.cc:26: > ../../gcc/gcc/config/loongarch/loongarch-driver.h:82:10: fatal error: > loongarch-multilib.h: No such file or directory >82 | #include "loongarch-multilib.h" > | ^~ > compilation terminated. > make[1]: *** [Makefile:2966: build/genpreds.o] Error 1 > make[1]: Leaving directory > '/var/lib/laminar/run/gcc-loongarch64-linux-gnuf32/44/toolchain-build/gcc' > make: *** [Makefile:4659: all-gcc] Error 2 > > > So it failed to execute the t-multilib fragment? Happens for all my > loongarch compilation tests: > > http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux/45 > http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf32/44 > http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf64/44 > http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnusf/44 > Thanks for the testing! This error seems to be difficult to reproduce since it is a makefile dependency problem. I think appending loongarch-multilib.h to $(GTM_H) instead of $(TM_H) could help. > And when this is fixed, it might be a nice idea to have a > --with-multilib-list config in ./contrib/config-list.mk . Thanks, will add this later too. P.S. Currently support for "f32" is not active, and it should probably be avoided if you want to build a working rootfs. Yujie
Re: [PATCH] LoongArch: Reimplement multilib build option handling.
Hi! On Wed, 2023-09-13 17:52:14 +0800, Yang Yujie wrote: > Library build options from --with-multilib-list used to be processed with > *self_spec, which missed the driver's initial canonicalization. This > caused limitations on CFLAGS override and the use of driver-only options > like -m[no]-lsx. > > The problem is solved by promoting the injection rules of --with-multilib-list > options to the first element of DRIVER_SELF_SPECS, to make them execute before > the canonialization. The library-build options are also hard-coded in > the driver and can be used conveniently by the builders of other non-gcc > libraries via the use of -fmultiflags. > > Bootstrapped and tested on loongarch64-linux-gnu. Seems this breaks for me with ../gcc/configure [...] --enable-werror-always --enable-languages=all --disable-gcov --disable-shared --disable-threads --target=loongarch64-linux-gnuf32 --without-headers make V=1 all-gcc See eg. http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf32/44 : /var/lib/laminar/run/gcc-loongarch64-linux-gnuf32/44/local-toolchain-install/bin/g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc -I../../gcc/gcc/build -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include \ -o build/genpreds.o ../../gcc/gcc/genpreds.cc In file included from ../../gcc/gcc/config/loongarch/loongarch.h:53, from ./tm.h:50, from ../../gcc/gcc/genpreds.cc:26: ../../gcc/gcc/config/loongarch/loongarch-driver.h:82:10: fatal error: loongarch-multilib.h: No such file or directory 82 | #include "loongarch-multilib.h" | ^~ compilation terminated. make[1]: *** [Makefile:2966: build/genpreds.o] Error 1 make[1]: Leaving directory '/var/lib/laminar/run/gcc-loongarch64-linux-gnuf32/44/toolchain-build/gcc' make: *** [Makefile:4659: all-gcc] Error 2 So it failed to execute the t-multilib fragment? Happens for all my loongarch compilation tests: http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux/45 http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf32/44 http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnuf64/44 http://toolchain.lug-owl.de/laminar/jobs/gcc-loongarch64-linux-gnusf/44 And when this is fixed, it might be a nice idea to have a --with-multilib-list config in ./contrib/config-list.mk . MfG, JBG -- signature.asc Description: PGP signature
Re: [pushed][PATCH] LoongArch: Reimplement multilib build option handling.
Pushed to r14-4009. 在 2023/9/13 下午5:52, Yang Yujie 写道: Library build options from --with-multilib-list used to be processed with *self_spec, which missed the driver's initial canonicalization. This caused limitations on CFLAGS override and the use of driver-only options like -m[no]-lsx. The problem is solved by promoting the injection rules of --with-multilib-list options to the first element of DRIVER_SELF_SPECS, to make them execute before the canonialization. The library-build options are also hard-coded in the driver and can be used conveniently by the builders of other non-gcc libraries via the use of -fmultiflags. Bootstrapped and tested on loongarch64-linux-gnu. ChangeLog: * config-ml.in: Remove unneeded loongarch clause. * configure.ac: Register custom makefile fragments mt-loongarch-* for loongarch targets. * configure: Regenerate. config/ChangeLog: * mt-loongarch-mlib: New file. Pass -fmultiflags when building target libraries (FLAGS_FOR_TARGET). * mt-loongarch-elf: New file. * mt-loongarch-gnu: New file. gcc/ChangeLog: * config.gcc: Pass the default ABI via TM_MULTILIB_CONFIG. * config/loongarch/loongarch-driver.h: Invoke MLIB_SELF_SPECS before the driver canonicalization routines. * config/loongarch/loongarch.h: Move definitions of CC1_SPEC etc. to loongarch-driver.h * config/loongarch/t-linux: Move multilib-related definitions to t-multilib. * config/loongarch/t-multilib: New file. Inject library build options obtained from --with-multilib-list. * config/loongarch/t-loongarch: Same. --- config-ml.in| 10 config/mt-loongarch-elf | 1 + config/mt-loongarch-gnu | 2 + config/mt-loongarch-mlib| 1 + configure | 6 +++ configure.ac| 6 +++ gcc/config.gcc | 6 +-- gcc/config/loongarch/loongarch-driver.h | 42 +++ gcc/config/loongarch/loongarch.h| 50 -- gcc/config/loongarch/t-linux| 66 +++- gcc/config/loongarch/t-loongarch| 2 +- gcc/config/loongarch/t-multilib | 68 + 12 files changed, 137 insertions(+), 123 deletions(-) create mode 100644 config/mt-loongarch-elf create mode 100644 config/mt-loongarch-gnu create mode 100644 config/mt-loongarch-mlib create mode 100644 gcc/config/loongarch/t-multilib diff --git a/config-ml.in b/config-ml.in index ad0db078171..68854a4f16c 100644 --- a/config-ml.in +++ b/config-ml.in @@ -301,16 +301,6 @@ arm-*-*) done fi ;; -loongarch*-*) - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - `${CC-gcc} --print-multi-directory`) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - ;; m68*-*-*) if [ x$enable_softfloat = xno ] then diff --git a/config/mt-loongarch-elf b/config/mt-loongarch-elf new file mode 100644 index 000..bbf29bb578a --- /dev/null +++ b/config/mt-loongarch-elf @@ -0,0 +1 @@ +include $(srcdir)/config/mt-loongarch-mlib diff --git a/config/mt-loongarch-gnu b/config/mt-loongarch-gnu new file mode 100644 index 000..dfefb44ede3 --- /dev/null +++ b/config/mt-loongarch-gnu @@ -0,0 +1,2 @@ +include $(srcdir)/config/mt-gnu +include $(srcdir)/config/mt-loongarch-mlib diff --git a/config/mt-loongarch-mlib b/config/mt-loongarch-mlib new file mode 100644 index 000..4cfe568f1fc --- /dev/null +++ b/config/mt-loongarch-mlib @@ -0,0 +1 @@ +FLAGS_FOR_TARGET += -fmultiflags diff --git a/configure b/configure index 28f0913bdd4..8fc163d36bd 100755 --- a/configure +++ b/configure @@ -9683,6 +9683,12 @@ case "${target}" in spu-*-*) target_makefile_frag="config/mt-spu" ;; + loongarch*-*linux* | loongarch*-*gnu*) +target_makefile_frag="config/mt-loongarch-gnu" +;; + loongarch*-*elf*) +target_makefile_frag="config/mt-loongarch-elf" +;; mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*) target_makefile_frag="config/mt-sde" ;; diff --git a/configure.ac b/configure.ac index 5d25dc864c3..1d16530140a 100644 --- a/configure.ac +++ b/configure.ac @@ -2810,6 +2810,12 @@ case "${target}" in spu-*-*) target_makefile_frag="config/mt-spu" ;; + loongarch*-*linux* | loongarch*-*gnu*) +target_makefile_frag="config/mt-loongarch-gnu" +;; + loongarch*-*elf*) +target_makefile_frag="config/mt-loongarch-elf" +;; mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*) target_makefile_frag="config/mt-sde" ;; diff --git a/gcc/config.gcc b/gcc/config.gcc index b2fe7c7ceef..3a70e64ccd2 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2482,7 +2482,7 @@ loongarch*-*-linux*)
[PATCH] LoongArch: Reimplement multilib build option handling.
Library build options from --with-multilib-list used to be processed with *self_spec, which missed the driver's initial canonicalization. This caused limitations on CFLAGS override and the use of driver-only options like -m[no]-lsx. The problem is solved by promoting the injection rules of --with-multilib-list options to the first element of DRIVER_SELF_SPECS, to make them execute before the canonialization. The library-build options are also hard-coded in the driver and can be used conveniently by the builders of other non-gcc libraries via the use of -fmultiflags. Bootstrapped and tested on loongarch64-linux-gnu. ChangeLog: * config-ml.in: Remove unneeded loongarch clause. * configure.ac: Register custom makefile fragments mt-loongarch-* for loongarch targets. * configure: Regenerate. config/ChangeLog: * mt-loongarch-mlib: New file. Pass -fmultiflags when building target libraries (FLAGS_FOR_TARGET). * mt-loongarch-elf: New file. * mt-loongarch-gnu: New file. gcc/ChangeLog: * config.gcc: Pass the default ABI via TM_MULTILIB_CONFIG. * config/loongarch/loongarch-driver.h: Invoke MLIB_SELF_SPECS before the driver canonicalization routines. * config/loongarch/loongarch.h: Move definitions of CC1_SPEC etc. to loongarch-driver.h * config/loongarch/t-linux: Move multilib-related definitions to t-multilib. * config/loongarch/t-multilib: New file. Inject library build options obtained from --with-multilib-list. * config/loongarch/t-loongarch: Same. --- config-ml.in| 10 config/mt-loongarch-elf | 1 + config/mt-loongarch-gnu | 2 + config/mt-loongarch-mlib| 1 + configure | 6 +++ configure.ac| 6 +++ gcc/config.gcc | 6 +-- gcc/config/loongarch/loongarch-driver.h | 42 +++ gcc/config/loongarch/loongarch.h| 50 -- gcc/config/loongarch/t-linux| 66 +++- gcc/config/loongarch/t-loongarch| 2 +- gcc/config/loongarch/t-multilib | 68 + 12 files changed, 137 insertions(+), 123 deletions(-) create mode 100644 config/mt-loongarch-elf create mode 100644 config/mt-loongarch-gnu create mode 100644 config/mt-loongarch-mlib create mode 100644 gcc/config/loongarch/t-multilib diff --git a/config-ml.in b/config-ml.in index ad0db078171..68854a4f16c 100644 --- a/config-ml.in +++ b/config-ml.in @@ -301,16 +301,6 @@ arm-*-*) done fi ;; -loongarch*-*) - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - `${CC-gcc} --print-multi-directory`) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - ;; m68*-*-*) if [ x$enable_softfloat = xno ] then diff --git a/config/mt-loongarch-elf b/config/mt-loongarch-elf new file mode 100644 index 000..bbf29bb578a --- /dev/null +++ b/config/mt-loongarch-elf @@ -0,0 +1 @@ +include $(srcdir)/config/mt-loongarch-mlib diff --git a/config/mt-loongarch-gnu b/config/mt-loongarch-gnu new file mode 100644 index 000..dfefb44ede3 --- /dev/null +++ b/config/mt-loongarch-gnu @@ -0,0 +1,2 @@ +include $(srcdir)/config/mt-gnu +include $(srcdir)/config/mt-loongarch-mlib diff --git a/config/mt-loongarch-mlib b/config/mt-loongarch-mlib new file mode 100644 index 000..4cfe568f1fc --- /dev/null +++ b/config/mt-loongarch-mlib @@ -0,0 +1 @@ +FLAGS_FOR_TARGET += -fmultiflags diff --git a/configure b/configure index 28f0913bdd4..8fc163d36bd 100755 --- a/configure +++ b/configure @@ -9683,6 +9683,12 @@ case "${target}" in spu-*-*) target_makefile_frag="config/mt-spu" ;; + loongarch*-*linux* | loongarch*-*gnu*) +target_makefile_frag="config/mt-loongarch-gnu" +;; + loongarch*-*elf*) +target_makefile_frag="config/mt-loongarch-elf" +;; mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*) target_makefile_frag="config/mt-sde" ;; diff --git a/configure.ac b/configure.ac index 5d25dc864c3..1d16530140a 100644 --- a/configure.ac +++ b/configure.ac @@ -2810,6 +2810,12 @@ case "${target}" in spu-*-*) target_makefile_frag="config/mt-spu" ;; + loongarch*-*linux* | loongarch*-*gnu*) +target_makefile_frag="config/mt-loongarch-gnu" +;; + loongarch*-*elf*) +target_makefile_frag="config/mt-loongarch-elf" +;; mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*) target_makefile_frag="config/mt-sde" ;; diff --git a/gcc/config.gcc b/gcc/config.gcc index b2fe7c7ceef..3a70e64ccd2 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2482,7 +2482,7 @@ loongarch*-*-linux*) tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}"