about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-03-19 09:13:54 +0000
committerAlyssa Ross <hi@alyssa.is>2022-03-19 09:13:54 +0000
commit220273ccc689041667ab5ff55fe5b1e93689227a (patch)
treed1c95664832920b476ab48ab5dd9ad09ec67d82d /nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh
parent68bab940e926ec7ae7380947a78c581e6aadcd18 (diff)
parent6e3ee8957637a60f5072e33d78e05c0f65c54366 (diff)
downloadnixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar.gz
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar.bz2
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar.lz
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar.xz
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.tar.zst
nixlib-220273ccc689041667ab5ff55fe5b1e93689227a.zip
Merge commit '6e3ee8957637a60f5072e33d78e05c0f65c54366'
Conflicts:
	nixpkgs/pkgs/applications/networking/browsers/firefox/packages.nix
Diffstat (limited to 'nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh')
-rw-r--r--nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh b/nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh
index a6e991914e6b..c59118d6c09e 100644
--- a/nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh
+++ b/nixpkgs/pkgs/build-support/cc-wrapper/add-flags.sh
@@ -33,6 +33,20 @@ NIX_CFLAGS_COMPILE_@suffixSalt@="-B@out@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@"
 # Export and assign separately in order that a failing $(..) will fail
 # the script.
 
+# Currently bootstrap-tools does not split glibc, and gcc files into
+# separate directories. As a workaround we want resulting cflags to be
+# ordered as: crt1-cflags libc-cflags cc-cflags. Otherwise we mix crt/libc.so
+# from different libc as seen in
+#   https://github.com/NixOS/nixpkgs/issues/158042
+#
+# Note that below has reverse ordering as we prepend flags one-by-one.
+# Once bootstrap-tools is split into different directories we can stop
+# relying on flag ordering below.
+
+if [ -e @out@/nix-support/cc-cflags ]; then
+    NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@"
+fi
+
 if [[ "$cInclude" = 1 ]] && [ -e @out@/nix-support/libc-cflags ]; then
     NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@"
 fi
@@ -49,10 +63,6 @@ if [ -e @out@/nix-support/libcxx-ldflags ]; then
     NIX_CXXSTDLIB_LINK_@suffixSalt@+=" $(< @out@/nix-support/libcxx-ldflags)"
 fi
 
-if [ -e @out@/nix-support/cc-cflags ]; then
-    NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@"
-fi
-
 if [ -e @out@/nix-support/gnat-cflags ]; then
     NIX_GNATFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE_@suffixSalt@"
 fi