Release Cosmopolitan v3.3

This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.

This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.

Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.

OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().

This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.

We no longer use hex constants to define math.h symbols like M_PI.
This commit is contained in:
Justine Tunney 2024-02-20 11:12:09 -08:00
parent d3ff48c63f
commit 957c61cbbf
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
736 changed files with 13726 additions and 9445 deletions

View file

@ -39,28 +39,29 @@
#include "libc/sysv/consts/sig.h"
#include "third_party/awk/awk.h"
asm(".ident\t\"\\n\\n\
Copyright (C) Lucent Technologies 1997\\n\
All Rights Reserved\\n\
\\n\
Permission to use, copy, modify, and distribute this software and\\n\
its documentation for any purpose and without fee is hereby\\n\
granted, provided that the above copyright notice appear in all\\n\
copies and that both that the copyright notice and this\\n\
permission notice and warranty disclaimer appear in supporting\\n\
documentation, and that the name Lucent Technologies or any of\\n\
its entities not be used in advertising or publicity pertaining\\n\
to distribution of the software without specific, written prior\\n\
permission.\\n\
\\n\
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\\n\
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.\\n\
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY\\n\
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\\n\
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\\n\
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\\n\
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\\n\
THIS SOFTWARE.\"");
__notice(awk_notice, "\
The One True Awk\n\
Copyright (C) Lucent Technologies 1997\n\
All Rights Reserved\n\
\n\
Permission to use, copy, modify, and distribute this software and\n\
its documentation for any purpose and without fee is hereby\n\
granted, provided that the above copyright notice appear in all\n\
copies and that both that the copyright notice and this\n\
permission notice and warranty disclaimer appear in supporting\n\
documentation, and that the name Lucent Technologies or any of\n\
its entities not be used in advertising or publicity pertaining\n\
to distribution of the software without specific, written prior\n\
permission.\n\
\n\
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\n\
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.\n\
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY\n\
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n\
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\n\
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n\
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n\
THIS SOFTWARE.");
const char *version = "version 20220530";
extern int nfields;