613 Commits

Author SHA1 Message Date
Aliaksandr
77d67d4b76 cc-wrapper: replace // optionalAttrs with nullable attr names
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.
2026-05-18 03:54:26 +03:00
Rasheeq Azad
29101432aa lib.systems.architectures: add rocketlake 2026-05-02 18:47:17 -04:00
Alyssa Ross
8c8a29182c cc-wrapper: remove some trailing and leading spaces (#485593) 2026-03-12 09:29:01 +00:00
Aliaksandr
37a2b8cacc cc-wrapper: remove trailing and leading spaces from flags 2026-03-02 15:49:14 +02:00
David McFarland
f5353dd50e cygwin-dll-link: improve search path order
The search order will now be:

1. link target path
2. output bin paths
3. explicit input paths (e.g. libc)
4. HOST_PATH
2026-02-08 19:47:26 -04:00
David McFarland
f2ac4eef52 gcc: move cygwin DLLs to $target/bin 2026-02-08 19:47:26 -04:00
David McFarland
f42d59445b cygwin-dll-link: move DLLs to $lib/bin by default
This allows us to remove LINK_DLL_FOLDERS and use HOST_PATH instead.
2026-02-08 19:47:25 -04:00
John Ericson
4f217cb085 {cc,bintools}-wrapper: use executable extension when set (#479741) 2026-01-24 18:02:36 +00:00
David McFarland
df12a53d55 {cc,bintools}-wrapper: use executable extension when set
On windows platforms we want links to executables to have the .exe
extension, but wrapper scripts shouldn't.
2026-01-13 12:44:10 -04:00
David McFarland
9bbc709586 cc-wrapper: set gl_cv_clean_version_stddef=yes on cygwin 2026-01-02 10:56:48 -04:00
David McFarland
d613d20a13 treewide: fix nix-env eval in cross 2025-12-04 19:44:19 -04:00
Sandro
5d48195eb4 cc-wrapper/add-hardening.sh: fix spelling of stackclashprotection hardening (#446243) 2025-10-23 19:08:06 +00:00
Randy Eckenrode
31cf83ad2c cc-wrapper: always include libc++ in the search path (#445095) 2025-10-09 17:49:18 -04:00
Randy Eckenrode
5c2b79edfa cc-wrapper: make availability warnings into errors (#445119) 2025-10-09 13:19:04 -04:00
Randy Eckenrode
76a8ffa6d8 cc-wrapper: use -cxx-isystem instead of -isystem on Clang
This allows Clang to always look for the libc++ headers when compling
C++ code (regardless of whether it is invoked with `clang` or `clang++`
while not exposing the headers when compiling plain C code.

See https://releases.llvm.org/21.1.0/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-cxx-isystem-directory
2025-10-09 07:12:15 -04:00
Randy Eckenrode
bd0dd33de1 cc-wrapper: always include libc++ in the search path
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`.
2025-10-09 07:12:15 -04:00
Robert Scott
2a45fd1039 cc-wrapper: add support for libcxxhardeningfast/extensive hardening flags
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
2025-10-08 18:53:17 +01:00
Philip Taron
33816365de {cc-wrapper,bintools-wrapper}: drop pie hardening flag (#442510) 2025-10-07 11:47:04 -07:00
K900
f8d669f413 Merge remote-tracking branch 'origin/master' into staging-next 2025-10-04 21:10:21 +03:00
NAHO
c8d4dabc43 pkgs: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --type file \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
K900
4999ae577c Merge remote-tracking branch 'origin/master' into staging-next 2025-09-30 21:47:55 +03:00
Luna Nova
0b3b48fb5f {cc-wrapper,bintools-wrapper}: drop pie hardening flag
We expect compilers to enable PIE by default via --enable-default-pie
or similar.
2025-09-30 09:21:41 -07:00
Randy Eckenrode
369cc5c66b cc-wrapper: make availability warnings into errors 2025-09-29 21:33:09 -04:00
David McFarland
145d9726f3 cc-wrapper: add cygwin libc to dll path
Co-authored-by: Brian McKenna <brian@brianmckenna.org>
2025-09-27 21:21:48 -03:00
David McFarland
cba263139f cc-wrapper: add w32api paths on cygwin
Co-authored-by: Brian McKenna <brian@brianmckenna.org>
2025-09-27 13:33:43 -03:00
Sergei Trofimovich
30a9401ba0 cc-wrapper/add-hardening.sh: fix spelling of stackclashprotection hardening
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.
2025-09-26 06:45:10 +01:00
nixpkgs-ci[bot]
43a3453b64 Merge staging-next into staging 2025-09-11 00:16:59 +00:00
Alyssa Ross
32a023ac5f cc-wrapper: Make gccgo look like go (#430137) 2025-09-10 18:33:46 +00:00
OPNA2608
335a0cc646 cc-wrapper: Disable format hardening for Go
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
2025-09-10 17:38:53 +02:00
OPNA2608
57223198e2 cc-wrapper: Add passthrus that make gccgo compatible with buildGoModules/Go assumptions 2025-09-10 16:57:44 +02:00
Ben Siraphob
010527b7d5 pkgs/build-support: fix typos 2025-09-09 13:15:19 +07:00
Robert Scott
3eec07ec59 cc-wrapper: add glibcxxassertions hardening flag
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
2025-08-24 11:56:04 +01:00
K900
e9a7500b70 Merge remote-tracking branch 'origin/master' into staging-next 2025-08-23 09:24:59 +03:00
Emily
b5a4a0a6cc {gdc,gdmd}: drop
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.
2025-08-22 23:01:59 +01:00
Emily
5376784348 cc-wrapper: remove dead code for langJava 2025-08-22 23:01:59 +01:00
Emily
feb38c0940 cc-wrapper: use -fmacro-prefix-map to scrub __FILE__ references (#429880) 2025-08-03 20:41:44 +01:00
Florian Klink
b7f958d5ab cc-wrapper: Workaround gnuabielfv{1,2} support deficiency on Clang (#297425) 2025-07-30 19:58:16 +02:00
Emily
a413c6f5b4 cc-wrapper: use -fmacro-prefix-map to scrub __FILE__ references
This accomplishes the same thing as `sanitiseHeaderPathsHook`, but
applies to every build input and should have fewer side effects.
2025-07-29 18:32:43 +01:00
Sergei Trofimovich
c331cfe544 cc-wrapper: don't set -fno-omit-frame-pointer on s390/x390x
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.
2025-07-26 12:49:42 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
John Ericson
424f8f2abb gccNGPackages: Force regular dirs
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.)
2025-07-21 15:40:34 -04:00
OPNA2608
07bce58d9c cc-wrapper: Workaround gnuabielfv{1,2} support deficiency on Clang
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.
2025-07-21 14:06:02 +02:00
John Ericson
d6d5e9a7c6 gccNGPackages_15: fix gfortran & libstdcxx (#424411) 2025-07-14 00:05:54 -04:00
Tristan Ross
6b03c5677a cc-wrapper: fix including libstdcxx from GCC NG 2025-07-11 13:02:51 -07:00
Robert Scott
f5efef2835 cc-wrapper: tidy logic for implied hardening flags
this can be done more neatly than my previous just-copy-the-blocks
approach
2025-06-07 11:28:39 +01:00
Eduard Bachmakov
726ba29941 cc-wrapper: limit no-omit-leaf-frame-pointer to supported platforms
Unlike omit-frame-pointer this flag is NOT globally defined and results
in `unrecognized command-line option` type errors.

See https://github.com/NixOS/nixpkgs/pull/399014#issuecomment-2933857698
and following for discussion.
2025-06-03 21:12:18 +02:00
Philip Taron
b76868988b cc-wrapper: add support for strictflexarrays1 & strictflexarrays3 hardening flags (#400408) 2025-05-26 10:46:00 -07:00
Eduard Bachmakov
c3afdec4e8 cc-wrapper: enable frame pointers by default.
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.
2025-05-25 13:52:38 +02:00
Peter Collingbourne
da136a6f42 cc-wrapper: ensure that $PATH is exported
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.
2025-05-25 12:32:46 +02:00
Robert Scott
3f1a00c79d cc-wrapper: add support for strictflexarrays1 & strictflexarrays3 hardening flags
adding strictflexarrays1 to pkgsExtraHardening
2025-05-24 11:10:20 +01:00