Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Fri, Apr 28, 2023 at 09:37:57AM +0200, Marek Behún wrote: > On Thu, 27 Apr 2023 13:34:53 -0400 > Tom Rini wrote: > > > On Thu, Apr 27, 2023 at 10:25:13AM -0600, Simon Glass wrote: > > > Hi Pali, > > > > > > On Wed, 26 Apr 2023 at 01:07, Pali Rohár wrote: > > > > > > > > On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > > > > > Hi Pali, > > > > > > > > > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > > > > > > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > > > > > This creates a lot of errors of the form: > > > > > > > > > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: > > > > > > > defined > > > > > > >in discarded section `.text' of common/stackprot.o (symbol > > > > > > > from plugin) > > > > > > > > > > > > This issue should be rather fixed... > > > > > > > > > > > > > Drop LTO for now. > > > > > > > > > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > > > > > > > > > LTO does not work for more other boards / platforms and it is just > > > > > > _not_ > > > > > > enabled via CONFIG_LTO in those cases... > > > > > > > > > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > > > > > is just the MSYS2 platform where there are problems. > > > > > > > > So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? > > > > > > But that would require creating a new board. I am trying to use the > > > same board, just building it in a different environment. > > > > I think we need to make CONFIG_LTO depend on CC_IS_GCC for now as it > > also doesn't work (but could be addressed) for CC_IS_CLANG. > > It got broken? It should work at least for sandbox... Ah right, we do clang + sandbox (so + LTO). In my clang for arm experiments, I could only get LTO to almost-link if I also used lld instead of GNU ld (on the platform I was checking there's some _other_ problem that causes clang's SPL build to be something like 40kB larger than gcc, so even with LTO it was still overflowing). -- Tom signature.asc Description: PGP signature
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Thu, 27 Apr 2023 13:34:53 -0400 Tom Rini wrote: > On Thu, Apr 27, 2023 at 10:25:13AM -0600, Simon Glass wrote: > > Hi Pali, > > > > On Wed, 26 Apr 2023 at 01:07, Pali Rohár wrote: > > > > > > On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > > > > Hi Pali, > > > > > > > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > > > > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > > > > This creates a lot of errors of the form: > > > > > > > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: > > > > > > defined > > > > > >in discarded section `.text' of common/stackprot.o (symbol from > > > > > > plugin) > > > > > > > > > > This issue should be rather fixed... > > > > > > > > > > > Drop LTO for now. > > > > > > > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > > > > > > > LTO does not work for more other boards / platforms and it is just > > > > > _not_ > > > > > enabled via CONFIG_LTO in those cases... > > > > > > > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > > > > is just the MSYS2 platform where there are problems. > > > > > > So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? > > > > But that would require creating a new board. I am trying to use the > > same board, just building it in a different environment. > > I think we need to make CONFIG_LTO depend on CC_IS_GCC for now as it > also doesn't work (but could be addressed) for CC_IS_CLANG. > It got broken? It should work at least for sandbox... Marek
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Thu, Apr 27, 2023 at 10:25:13AM -0600, Simon Glass wrote: > Hi Pali, > > On Wed, 26 Apr 2023 at 01:07, Pali Rohár wrote: > > > > On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > > > Hi Pali, > > > > > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > > > This creates a lot of errors of the form: > > > > > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: > > > > > defined > > > > >in discarded section `.text' of common/stackprot.o (symbol from > > > > > plugin) > > > > > > > > This issue should be rather fixed... > > > > > > > > > Drop LTO for now. > > > > > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > > > > > LTO does not work for more other boards / platforms and it is just _not_ > > > > enabled via CONFIG_LTO in those cases... > > > > > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > > > is just the MSYS2 platform where there are problems. > > > > So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? > > But that would require creating a new board. I am trying to use the > same board, just building it in a different environment. I think we need to make CONFIG_LTO depend on CC_IS_GCC for now as it also doesn't work (but could be addressed) for CC_IS_CLANG. -- Tom signature.asc Description: PGP signature
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Thursday 27 April 2023 10:25:13 Simon Glass wrote: > Hi Pali, > > On Wed, 26 Apr 2023 at 01:07, Pali Rohár wrote: > > > > On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > > > Hi Pali, > > > > > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > > > This creates a lot of errors of the form: > > > > > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: > > > > > defined > > > > >in discarded section `.text' of common/stackprot.o (symbol from > > > > > plugin) > > > > > > > > This issue should be rather fixed... > > > > > > > > > Drop LTO for now. > > > > > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > > > > > LTO does not work for more other boards / platforms and it is just _not_ > > > > enabled via CONFIG_LTO in those cases... > > > > > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > > > is just the MSYS2 platform where there are problems. > > > > So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? > > But that would require creating a new board. I am trying to use the > same board, just building it in a different environment. Sorry, but I do not understand why you need a new board. Just introduce a new Kconfig symbol CONFIG_MSYS2 which value is by default assigned from the detected compiler and then set default value for CONFIG_LTO symbol to "n" when CONFIG_MSYS2 is "y". This does not require a new board and neither menuconfig user changes of (default) symbols. > > > > > > I am not sure how to fix it, since I don't know what discarded section > > > it is referring to. > > Regards, > Simon
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
Hi Pali, On Wed, 26 Apr 2023 at 01:07, Pali Rohár wrote: > > On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > > Hi Pali, > > > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > > This creates a lot of errors of the form: > > > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined > > > >in discarded section `.text' of common/stackprot.o (symbol from > > > > plugin) > > > > > > This issue should be rather fixed... > > > > > > > Drop LTO for now. > > > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > > > LTO does not work for more other boards / platforms and it is just _not_ > > > enabled via CONFIG_LTO in those cases... > > > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > > is just the MSYS2 platform where there are problems. > > So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? But that would require creating a new board. I am trying to use the same board, just building it in a different environment. > > > I am not sure how to fix it, since I don't know what discarded section > > it is referring to. Regards, Simon
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Tuesday 25 April 2023 19:04:10 Simon Glass wrote: > Hi Pali, > > On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > > This creates a lot of errors of the form: > > > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined > > >in discarded section `.text' of common/stackprot.o (symbol from plugin) > > > > This issue should be rather fixed... > > > > > Drop LTO for now. > > > > ... and until it happens is not CONFIG_LTO for disabling enough? > > > > LTO does not work for more other boards / platforms and it is just _not_ > > enabled via CONFIG_LTO in those cases... > > The thing is, LTO is enabled for sandbox normally (clang and gcc). It > is just the MSYS2 platform where there are problems. So what about having CONFIG_LTO by default 'n' for CONFIG_MSYS2? > I am not sure how to fix it, since I don't know what discarded section > it is referring to. > > Regards, > Simon
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
Hi Pali, On Tue, 25 Apr 2023 at 10:28, Pali Rohár wrote: > > On Monday 24 April 2023 17:08:32 Simon Glass wrote: > > This creates a lot of errors of the form: > > > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined > >in discarded section `.text' of common/stackprot.o (symbol from plugin) > > This issue should be rather fixed... > > > Drop LTO for now. > > ... and until it happens is not CONFIG_LTO for disabling enough? > > LTO does not work for more other boards / platforms and it is just _not_ > enabled via CONFIG_LTO in those cases... The thing is, LTO is enabled for sandbox normally (clang and gcc). It is just the MSYS2 platform where there are problems. I am not sure how to fix it, since I don't know what discarded section it is referring to. Regards, Simon
Re: [PATCH 27/31] Makefile: Disable LTO when building with MSYS2
On Monday 24 April 2023 17:08:32 Simon Glass wrote: > This creates a lot of errors of the form: > > `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined >in discarded section `.text' of common/stackprot.o (symbol from plugin) This issue should be rather fixed... > Drop LTO for now. ... and until it happens is not CONFIG_LTO for disabling enough? LTO does not work for more other boards / platforms and it is just _not_ enabled via CONFIG_LTO in those cases... > Signed-off-by: Simon Glass > --- > > Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Makefile b/Makefile > index 08eab87d0a11..3a35d14a4497 100644 > --- a/Makefile > +++ b/Makefile > @@ -658,9 +658,11 @@ export EFI_TARGET# binutils target if EFI is > natively supported > export LTO_ENABLE > > # This is y if LTO is enabled for this build. See NO_LTO=1 to disable LTO > +ifeq ($(MSYS_VERSION),0) > ifeq ($(NO_LTO),) > LTO_ENABLE=$(if $(CONFIG_LTO),y) > endif > +endif > > # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use > # that (or fail if absent). Otherwise, search for a linker script in a > -- > 2.40.0.634.g4ca3ef3211-goog >
[PATCH 27/31] Makefile: Disable LTO when building with MSYS2
This creates a lot of errors of the form: `__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined in discarded section `.text' of common/stackprot.o (symbol from plugin) Drop LTO for now. Signed-off-by: Simon Glass --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 08eab87d0a11..3a35d14a4497 100644 --- a/Makefile +++ b/Makefile @@ -658,9 +658,11 @@ export EFI_TARGET # binutils target if EFI is natively supported export LTO_ENABLE # This is y if LTO is enabled for this build. See NO_LTO=1 to disable LTO +ifeq ($(MSYS_VERSION),0) ifeq ($(NO_LTO),) LTO_ENABLE=$(if $(CONFIG_LTO),y) endif +endif # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use # that (or fail if absent). Otherwise, search for a linker script in a -- 2.40.0.634.g4ca3ef3211-goog