stand: Fix zf_open() by providing 'zalloc' and 'zfree' hooks
When Z_SOLO is defined, zlib is built for a standalone environment,
where there is no host memory management, so the caller must provides
the 'zalloc' and 'zfree' hooks. Otherwise, inflateInit2() would return
-2 (Z_STREAM_ERROR).
This fixes the failure of booting into rescue mode because loader failed
to decompress 'initrd.img.gz':
```
zf_open: inflateInit returned -2 : (null)
Unable to load /kernel/initrd.img
```
gcc120: Adjust LDADD and add DPADD for libstdcxx/product
* Adjust LDADD to move '-lm' out of --whole-archive scope, aligning with
the GCC's own Makefile rules.
* Add DPADD to define the necessary library dependencies.
gcc120: Add '.ORDER' to fix race in libstdcxx/headers
Add '.ORDER' rules to create directories before generating the header
files. I observed the race failure on my 3700X desktop with -j16.
share/mk: Allow per-group flags to override default compile flags
Per-group flags support was introduced in commit
6d68f83fef807ce255df27c2482db0d58ff71744, but the per-group flags (i.e.,
${${_FG}_FLAGS} and ${_${.IMPSRC}_FLAGS}) were listed *before* the
default/common compile flags (e.g., ${CFLAGS}). As a result, there was
no way for per-group flags to override the default compile flags, which
was counter-intuitive and made the feature less useful.
This commit splits the per-group flags into '-I' flags and non-'-I'
flags, and reorders the non-'-I' flags *after* the default compile flags,
allowing them to be overridden on a per-group basis as needed.
An immediate beneficiary will be gnu/lib/gccXX/libstdcxx, which requires
multiple file groups to override the default compile flags.
gcc120: Clean up libstdcxx/libconv_supc's Makefile
The 'gnu11', 'gnu14', and 'gnu1z' flags groups were inherited from gcc80
and are not needed for gcc120, so just remove them.
gcc120: Simplify libstdcxx makefiles
With the last commit allowing the per-group flags to override the
default flags, the libstdcxx makefiles can be simplified a lot.
gcc80: Fix libstdcxx/product/Makefile similar to gcc120's
Similar to the same adjustments to gcc120's, apply the same LDADD and
DPADD changes to gcc80's libstdcxx/product/Makefile. In addition,
remove the unused ARADD, because we're using custom AR script to create
the static archive.
vendor/GCC80: Bring in two fixes from upstream.
These fix -Wmissing-template-keyword and -Wregister warnings we were
getting when building gcc-8.3 with gcc-12.5.
commit 642dc602f89b2c11d5d833a52f37b04427a27cab
Author: Marek Polacek <polacek at redhat.com>
Date: Fri May 15 17:54:05 2020 -0400
c++: Regenerate cp/cfns.h.
Current cfns.h includes register-qualified variables and that wouldn't
play well when bootstrapping with GCC that uses the C++17 dialect,
because 'register' was removed in C++17. Regenerating it using the
command specified in cfns.h luckily cleaned this up.
* cfns.h: Regenerated.
commit fccd5b48adf568f0aabe5d5f51206a9d42da095a
[12 lines not shown]
Fix the two -Wdangling-pointer warnings in world.
Move line[] to function scope.
-Wdangling-pointer was introduced in GCC 12 and is part of -Wall.
Taken-from: FreeBSD
gcc120: Fix compatibility.So building in libstdcxx
My previous commit 1f0bbf647d9751967ce37b93246695bb2c7e819c actually
fixed the building of the extra .So objects for libstdcxx by adding the
missing '-D_GLIBCXX_SHARED' CXXFLAGS. However, the 'compatibility.So'
object failed to build after the commit because of the two reasons:
- The <bits/compatibility.h> header was missing. It was even removed on
the vendor branch.
- The '-std=gnu++98' was missing on the compilation command.
This commit prepares the needed <bits/compatibility.h> header, and adds
the 'gnu98' flags group for the ${cxx98_sources}.
vendor/GCC120: Add back libstdc++-v3/config/abi/compatibility.h
It's required to build 'libstdc++-v3/src/c++98/compatibility.cc' in
shared mode (-D_GLIBCXX_SHARED).
make.conf(5): Remove legacy obsolete MAKE_SHELL description
The MAKE_SHELL variable is unused in our bmake framework. I guess it's
a legacy from the FreeBSD fmake framework.
<sys.mk>: Fix ${SHELL} to ignore the environment
From the POSIX standard [1]:
> The SHELL macro shall be treated specially. It shall be provided by
> make and set to the pathname of the shell command language interpreter
> (see sh). The SHELL environment variable shall not affect the value of
> the SHELL macro. If SHELL is defined in the makefile or is specified
> on the command line, it shall replace the original value of the SHELL
> macro, but shall not affect the SHELL environment variable. Other
> effects of defining SHELL in the makefile or on the command line are
> implementation-defined.
So fix ${SHELL} to be ${.SHELL:Ush}, making it a Bourne/POSIX shell
regardless of the user's interactive shell, so that it's suitable for
use in the makefiles. This is obtained from 'contrib/bmake/mk/sys.mk'.
[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html#tag_20_76_13_05
<bsd.dep.mk>: Always create the depend file in the end
In case that the custom ${MKDEPCMD} does not create the depend file for
empty dependency.
While there, tweak '${_ALL_DEPENDS}' to use the ':N*.[csS]' modifier to
align with the subsequent '.if' expressions filtering on the files.
Suggested-by: swildner
<sys.mk>: Fix ${NXCXXFLAGS} to base on ${CXXFLAGS}
${CXXFLAGS} is already defined above in <sys.mk>, so it's better and
more correct to define ${NXCXXFLAGS} based on ${CXXFLAGS}.
Actually, this fixes ${NXCXXFLAGS} to obtain the correct '-std' flag
from ${CXXFLAGS}.
kernel: Ignore GCC 12.5's -Winfinite-recursion for stack_guard_panic2().
It's a function that we actually want to recurse infinitely (to force
a kernel stack guard panic).
-Winfinite-recursion was introduced in GCC 12 and is part of -Wall.
Tested-by: aly
Sync ACPICA with Intel's version 20251212 (from previously 20211217).
Numerous changes, too many to list.
For a detailed list, please see sys/contrib/dev/acpica/changes.txt.
It also fixes a few of GCC 12.5's -Wdangling-pointer warnings.
<bsd.dep.mk>: Several tweaks and style cleanups
* Remove duplicate ':N*.cpp' from ${_ALL_DEPENDS}.
* Simplify '!empty(${_FG:M_})' to be '${_FG} == "_"'.
* Replace `cmd` with $(cmd), which is clearer in expressing nested
command substitution.
* Adjust indentations and add comments to help read the complex flow.
<bsd.subdir.mk>: Fix SUBDIR ordering for non-parallel mode
As documented in make(1) man page as well as my tests, the '.ORDER'
directive only applies to the parallel mode (even -j1), so the
${SUBDIR_ORDERED} is actually ignored in the non-parallel mode. As a
result, the build ordering for the subdirectories is their order in
${SUBDIR}, which may be different from ${SUBDIR_ORDERED}, and this can
lead to build failures. For example, gnu/lib/gcc120/libstd++fs failed
to build because it was built before the dependent libstdcxx/headers.
Discussed-with: swildner
gcc120: Fix "make depend" failure in libgcc_eh
libgcc_eh pulled the 'FLAGS_GROUPS=sse2' from libgcc/Makefile.src and
thus "make depend" would call mkdep(1) on the 'sse2' group, but it would
fail because the 'sfp-machine.h' header was not generated.
Fix the problem by moving the 'FLAGS_GROUPS=sse2' and related variables
from libgcc/Makefile.src to {libgcc,libgcc_pic}/Makefile, where they're
actually used.
Discussed-with: swildner
<bsd.dep.mk>: Apply .NOPATH to .depend_${group} files as well
Each group defined in ${FLAGS_GROUPS} will have its own depend file
named '.depend_${group}'. Apply the '.NOPATH' attribute to them as well
as the main '.depend'.
Meanwhile, tweak the '.NOPATH' syntax as source/attribute to align
better with the make(1) man page.
<bsd.dep.mk>: Fix issues in generating depend files
* Remove the '> ${.TARGET}' command so that a repeat 'make depend' would
not falsely succeed.
Before this change, an empty '.depend' file would be created even if
the mkdep(1) fails, and then another 'make depend' (e.g., from
'make quickworld') would skip creating the depend files and thus
falsely succeed.
* Remove the '-' prefix from the 'rm -f ${.TARGET}' command. This fixes
that the mkdep(1) failure was ignored in the jobs mode (i.e., make -jN).
In the jobs mode, all the commands of a target is executed by one
single shell instance. When the shell does not have ErrCtl enabled
(which is the default), the '-' prefix affects the entire job rather
than specific commands prefixed with '-'. See make(1) for more
details.
[4 lines not shown]