File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
pkgs/build-support/cc-wrapper Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,20 @@ NIX_CFLAGS_COMPILE_@suffixSalt@="-B@out@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@"
3333# Export and assign separately in order that a failing $(..) will fail
3434# the script.
3535
36+ # Currently bootstrap-tools does not split glibc, and gcc files into
37+ # separate directories. As a workaround we want resulting cflags to be
38+ # ordered as: crt1-cflags libc-cflags cc-cflags. Otherwise we mix crt/libc.so
39+ # from different libc as seen in
40+ # https://github.com/NixOS/nixpkgs/issues/158042
41+ #
42+ # Note that below has reverse ordering as we prepend flags one-by-one.
43+ # Once bootstrap-tools is split into different directories we can stop
44+ # relying on flag ordering below.
45+
46+ if [ -e @out@/nix-support/cc-cflags ]; then
47+ NIX_CFLAGS_COMPILE_@suffixSalt@=" $( < @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_ @suffixSalt@"
48+ fi
49+
3650if [[ " $cInclude " = 1 ]] && [ -e @out@/nix-support/libc-cflags ]; then
3751 NIX_CFLAGS_COMPILE_@suffixSalt@=" $( < @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE_ @suffixSalt@"
3852fi
@@ -49,10 +63,6 @@ if [ -e @out@/nix-support/libcxx-ldflags ]; then
4963 NIX_CXXSTDLIB_LINK_@suffixSalt@+=" $( < @out@/nix-support/libcxx-ldflags) "
5064fi
5165
52- if [ -e @out@/nix-support/cc-cflags ]; then
53- NIX_CFLAGS_COMPILE_@suffixSalt@=" $( < @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_ @suffixSalt@"
54- fi
55-
5666if [ -e @out@/nix-support/gnat-cflags ]; then
5767 NIX_GNATFLAGS_COMPILE_@suffixSalt@=" $( < @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE_ @suffixSalt@"
5868fi
You can’t perform that action at this time.
0 commit comments