musl-cross-make icon indicating copy to clipboard operation
musl-cross-make copied to clipboard

GCC 12.1 support

Open tlaurion opened this issue 2 years ago • 15 comments

-Oz looks really promising for embedded devices!

Optimize aggressively for size rather than speed. This may increase the number of instructions executed if those instructions require fewer bytes to encode. -Oz behaves similarly to -Os including enabling most -O2 optimizations.

src:https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Optimize-Options.html

tlaurion avatar Aug 31 '22 04:08 tlaurion

And now I'm confused. Is Oz Apple related?

https://gcc.gnu.org/legacy-ml/gcc/2017-08/msg00281.html

tlaurion avatar Aug 31 '22 04:08 tlaurion

I just made a build with 12.1 and was able to compile with -Oz and run on x86-64.

It's difficult to find history on -Oz, but it may be that this was originally for Apple only and more recently expanded to more platforms/architectures.

aka-mj avatar Sep 16 '22 14:09 aka-mj

Hi @aka-mj, how did you built with gcc 12.1? The musl.cc download page offers GCC: 11.2.1

AlexKordic avatar Oct 07 '23 00:10 AlexKordic

@aka-mj ping

tlaurion avatar Feb 23 '24 08:02 tlaurion

http://port70.net/~nsz/musl/gcc-12.2.0/ ?

@richfelker ?

tlaurion avatar Mar 13 '24 17:03 tlaurion

@tlaurion, @AlexKordic, I built this via gcc 12.1 by modifying the Makefile to use GCC 12.1.

- GCC_VER = 9.4.0
+ GCC_VER = 12.1.0

aka-mj avatar Apr 01 '24 13:04 aka-mj

@aka-mj not sure how that would work

  • patches missing
  • checksum validation missing

My last post was about patches having been done downstream.

I guess my question is if it would be OK if a or was made with that content even if I'm not the original author, referencing to whare it was found.

tlaurion avatar Apr 16 '24 03:04 tlaurion

@tlaurion , I didn't add patches but I did add the package checksum.

https://github.com/aka-mj/musl-cross-make/commit/c7b0311a179f167583dce8306b9953edf37d08e2

aka-mj avatar Apr 16 '24 14:04 aka-mj

We've encountered a gcc 11 crash bug with std::regex_match that is fixed with gcc 12.

sean-mcmanus avatar May 07 '24 01:05 sean-mcmanus

@sean-mcmanus gcc 11 was just updated to 11.4. does the bug still exist there ? if so please provide a link to the bugtracker issue report so we can backport the patch.

rofl0r avatar May 07 '24 01:05 rofl0r

@rofl0r The bug repros with MUSL gcc 11.4, but not when I switch to the non-musl gcc 12, but I wasn't able to locate a bug report on the gcc site, but it could be a duplicate of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61601, which isn't fixed, since the crash call stack is very big, but maybe something in gcc 12 causes the stack to not overflow, or maybe building non-musl is affecting the stack size. I'll check if non-musl gcc 11 still repros it later today, or if the crash can be made to occur with gcc 12 with an even larger call stack repro.

sean-mcmanus avatar May 07 '24 14:05 sean-mcmanus

if it's related to stack size, it may well be that musl's default thread stack of 128 (or was it enlarged to 180?) KB isn't sufficient for your application - that is if you encounter this from a thread that's not the main thread. in that case you can request a bigger stack with pthread_attr_setstacksize(3p).

rofl0r avatar May 07 '24 15:05 rofl0r

@rofl0r Yeah, increasing the thread stack size fixed it. Thanks. We had already done that for other scenarios, but this case went over our previous increase.

sean-mcmanus avatar May 07 '24 17:05 sean-mcmanus

@rofl0r may I ask why musl-cross doesn't intent to provide 12.x support?

tlaurion avatar May 07 '24 18:05 tlaurion

There's no intent that it not be provided; it's just not something I have tested patches for, and as maintainer I'm not going to merge something for which I have no idea whether it works or (in the case of some of the PRs) that's making other random wrong changes alongside adding support for new versions.

12.x and 13.x are coming at some point, once I get to them. Well-documented PRs that make no extraneous changes and that cite where the patches are from and why any that have been dropped are no longer needed would probably help move this along.

richfelker avatar May 07 '24 19:05 richfelker