Inline optionalAttrs for Go passthru attrs and fallback_sdk.
Replace mapAttrs+optionalString for Darwin env vars with direct
optionalString calls, eliminating intermediate attrset and // merge.
The libc++ headers are expected to be found in the sysroot when `clang`
is invoked for C++ code.
Always making them available improves compatibility with build systems
like Bazel and SwiftPM, which try to compile C++ code with `clang`.
as with glibcxxassertions, we don't yet have a nice mechanism
for deferring support decisions to the c++ library in use, so
for now at least enabling this hardening flag will cause
_LIBCPP_HARDENING_MODE to be defined on all compilers
All hardening options have identical spelling to their names except the
`stack-clash-protection`. As a result just copying it to `hardeningDisable`
from the warning log does not work. Let's fix the discrepancy.
go1: warning: command-line option '-Wformat=1' is valid for C/C++/ObjC/ObjC++ but not for Go
go1: warning: command-line option '-Wformat-security' is valid for C/C++/ObjC/ObjC++ but not for Go
go1: warning: '-Werror=' argument '-Werror=format-security' is not valid for Go
no platforms "unsupported" because we don't have a nice
mechanism for determining a platform's c++ lib and the flag
should be harmlessly ignored by a other c++ libs
GDC 11 was the last version that could bootstrap without a D compiler,
and GDC don’t offer their own binaries any more. GCC 11 is now
end‐of‐life and being removed (as is GCC 12, even).
It’s possible that we could use another distribution’s binary
packages to bootstrap this, or go via our DMD package (it’s
apparently not possible to bootstrap GDC with LDC, but I’m not sure
about DMD), but as nobody has worked on it in the three years since
GCC 12 came out, it seems like interest is limited, and it’s more
of a yak shave than I’m up for right now.
A full from‐source bootstrap chain would of course be nice, but is
more the realm of the minimal bootstrap work than something we’d
want to keep GCC 11 around in the main package set indefinitely for.
Without the change both `s390` and `s390x` `glibc` builds fail as
https://hydra.nixos.org/build/303208799:
In file included from ../sysdeps/s390/utf16-utf32-z9.c:501,
from ../sysdeps/s390/multiarch/utf16-utf32-z9.c:20:
../iconv/loop.c: In function '__from_utf16_loop_vx_cu':
../iconv/loop.c:274:1: error: %r11 cannot be used in 'asm' here
274 | }
| ^
Disable the `-fno-omit-frame-pointer` for now.
Because we're building things separately, we don't need the fancy
lib/... namespacing tricks that GCC normally does to squeeze itself in
the FHS. We can just use the normal autotools libdir and include dir,
and the nixpkgs infra will sort everything out.
Where possible I submitted patches to the mailing list, and fetched
those. The ones I am vendoring are the residuals which I don't think are
ready for upstreaming yet. (I can imagine a further reworking upstream
such that we wouldn't need our own patches of that sort, but it would be
good to get the first crop merged first before discussing that.)
Clang cannot handle the gnuabielfv{1,2} ABI specification in the triplet properly. It used to parse it as just "gnu", disregarding the ABI version in it and defaulting to ELFv1. Now, it completely fails to parse such target triplet:
> clang: error: version 'abielfv1' in target triple 'powerpc64-unknown-linux-gnuabielfv1' is invalid
So when it comes time to passing the target triplet to Clang, handle this support deficiency:
1. If the triplet ends in gnuabielfv*, shorten it to just gnu. This makes it get parsed properly.
2. After the above, re-add the ABI via the separate -mabi option. This makes it use the correct ABI for the platform.
Allow easy system-level profiling with e.g. Linux perf or bpf(trace).
Profiling applications in NixOS is quite expensive due to the size of
closures of basic but widely-used libraries. Full-system profiling is
even harder as it effectively requires re-compiling the world with ~0
caching.
By enabling it by default, we make this trivially possible (except for
the packages that explicitly specify -fomit-frame-pointers, of course)
Make an exception for 32bit x86 since it only has 8 general purpose
registers.
Frame pointers are enabled by default in Fedora, Ubuntu, and Arch Linux.
After #400734 we modify gcc's $PATH in add-flags.sh which means that
we now need to export it if it was not set originally, otherwise gcc's
environment will not include the modification.