vendor/BINUTILS227: Accept character '+' in filename for AR/MRI scripts
This fixes the bug that AR/MRI scripts would reject any filenames with
a '+' character, which is not uncommon and is actually used by GCC's
libstdc++ source. To work around this limitation, we're renaming the
source files and libraries with '++' to replace '++' with 'xx'; see
gnu/lib/gcc120/libstdcxx/product/Makefile for details.
The official documentation [1] says:
> ‘+’ is used as a line continuation character; if ‘+’ appears at the
> end of a line, the text on the following line is considered part of
> the current command.
This bug fix is obtained from the upstream [2]. It landed in bintuils
between 2.38 (2022-02-09) and 2.39 (2022-08-05).
[1] https://sourceware.org/binutils/docs-2.27/binutils/ar-scripts.html#ar-scripts
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=add0eb9d6e731e08a0bc2463d8c1f0acb02894a0
vendor/BINUTILS234: Accept character '+' in filename for AR/MRI scripts
This fixes the bug that AR/MRI scripts would reject any filenames with
a '+' character, which is not uncommon and is actually used by GCC's
libstdc++ source. To work around this limitation, we're renaming the
source files and libraries with '++' to replace '++' with 'xx'; see
gnu/lib/gcc120/libstdcxx/product/Makefile for details.
The official documentation [1] says:
> ‘+’ is used as a line continuation character; if ‘+’ appears at the
> end of a line, the text on the following line is considered part of
> the current command.
This bug fix is obtained from the upstream [2]. It landed in bintuils
between 2.38 (2022-02-09) and 2.39 (2022-08-05).
[1] https://sourceware.org/binutils/docs-2.34/binutils/ar-scripts.html#ar-scripts
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=add0eb9d6e731e08a0bc2463d8c1f0acb02894a0
gcc120: Remove unneeded 'supcxx' group from libstdcxx/libconv_2011
The '-I${SRCDIR}/libsupc++' parameter is already added via
libstdcxx/Makefile.inc, so the 'supcxx' flags group is not needed.
kmod.mk: Remove redundant '-fno-omit-frame-pointer' CFLAGS
This flag is already added by platform/{pc64,vkernel64}/conf/kern.mk, so
no need to add it again.
amdgpu: Improve makefile for sources that require double floats
* Use a '.for' loop expression to reduce duplicate.
* Remove the unported/unavailable sources: dcn20_resource.o,
dcn21_resource.o
* Remove the unneeded '-mpreferred-stack-boundary=4' compiler flag,
which is the default on x86_64. (Linux's amdgpu requires this because
the kernel sets '-mpreferred-stack-boundary=3' as the global default.)
* Add '-msse2' to enable SSE2 and thus better generate double precision
FP instructions. [1][2]
[1] drm/amd/display: readd -msse2 to prevent Clang from emitting
libcalls to undefined SW FP routines
https://github.com/torvalds/linux/commit/0f0727d971f6fdf8f1077180d495ddb9928f0c8b
[2] drm/amdgpu: enable -msse2 for GCC 7.1+ users
https://github.com/torvalds/linux/commit/e8a170ff9a3576730e43c0dbdd27b7cd3dc56848
kern.mk: Simplify and improve FPU/SIMD compiler flags
* Simplify and modernize the global kernel compiler flags for disabling
FPU/SIMD to be:
-mno-mmx -mno-sse -msoft-float -mno-fp-ret-in-387
while the various -mno-* flags are removed as they are already implied
by the above flags. This reduces maintenance burden and is similarly
adopted by FreeBSD and Linux kernel.
* Drop '-mfpmath=387' to allow the compiler to choose the 'sse' backend
when SSE/SSE2 is explicitly enabled. (further explained below for
amdgpu sources)
* Also remove the redundant '-mpreferred-stack-boundary=4' option, which
is the default on x86_64.
To validate correctness, all kernel objects were rebuilt and compared
[23 lines not shown]
pc64: Replace SMSW/LMSW with MOV CR0
The SMSW and LMSW instructions are deprecated and provided for
compatibility with 80286.
Intel SDM Volume 2 Section 4.3:
> This instruction is provided for compatibility with the Intel 286
> processor; programs and procedures intended to run on IA-32 and Intel
> 64 processors beginning with Intel386 processors should use the MOV
> (control registers) instruction to load the whole CR0 register.
Obtained-from: FreeBSD (commit d706ec297a60775e242168eecbb5160cc692c9a6)
Discussed-with: dillon
kernel - Fix console access by non-root
* Fix console access via /dev/tty or /dev/ttyv* via a user login,
when logged in as that user.
The priv check was only allowing root access and needed a flag to
also allow matching users access.
* Note that console access from a restricted root "root" user such
as from a jail is not allowed (intentionally), because console ioctls
can be dangerous.
Reported-by: aly, peeterm
fsck_hammer2 - Print recursion stack with error message
* Print the full blockref spec (that can be used in a "hammer2 show")
* Print the recursion stack leading up to and including the error block.
* Errored blocks and stack are printed without needing any -d options.
Note that two -d opts will dump the full stack during the scan, which
could end up being terrabytes of text so... maybe don't do that.
etc/Makefile: Skip directories in 'check-deprecated-files'
Skip directories so we don't list the directories containing the
deprecated files in the end.
For example, the line `/usr/lib/gcc47 is deprecated` will not appear
after this change:
```
===> Checking for deprecated files
(harmless ELF linker warnings may appear here)
/lib/libprivate_crypto.so.45 is deprecated
/lib/libprivate_crypto.so.46 is deprecated
/lib/libprivate_ssl.so.47 is deprecated
/lib/libprivate_ssl.so.48 is deprecated
/usr/lib/gcc47/libgomp.so.1 is deprecated
/usr/lib/gcc47/libssp.so.0 is deprecated
/usr/lib/gcc47/libstdc++.so.9 is deprecated
/usr/lib/gcc47 is deprecated
==================================================================
[2 lines not shown]
gcc47: Unhook build and remove makefiles
We had been keeping GCC 4.7.4 for a long time because it's the last GCC
that was written in pure C and thus can be bootstrapped with a C
compiler. However, GCC 4.7.4 only has experimental C++11 support, so
it's unable to compile the newly imported GCC 12.5.
There are too many missing pieces in GCC 4.7.4 for it to be able to
compile GCC 12.5. A more feasible method would be to patch GCC 12.5
sources to avoid the unsupported C++11 features. Even we could tweak
the GCC 12.5 source to make it compilable by GCC 4.7.4, it's a big
burden to maintain it and to import a newer GCC like 14.x/15.x.
In conclusion, there is really no much point in keeping GCC 4.7.4
anymore given that it cannot build the world now.
Discussed-with: swildner
gcc80: Add MKDEPCC=${CXX} for drivers/{c++,cc,cpp,gcov}
The four drivers define ${SRCS} of .c files but actually use/require a
C++ compiler to compile them, so add MKDEPCC=${CXX} to ensure "mkdep"
working correctly for future-proof.
Meanwhile, add the 'hack to force c++ compiler' comment to libcommon and
libcommon-target makefiles as they're already doing so.
Suggested-by: swildner
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.