mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
34636efced
Without this change cross-built gcc fails to detect stack protector style: $ nix log -f pkgs/stdenv/linux/make-bootstrap-tools-cross.nix powerpc64le.bootGCC | fgrep __stack_chk_fail checking __stack_chk_fail in target C library... no checking __stack_chk_fail in target C library... no It happens because gcc treats search paths differently: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=446747311a6aec3c810ad6aa4190f7bd383b94f7;hb=HEAD#l2458 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || test x$build != x$host || test "x$with_build_sysroot" != x; then ... if test "x$with_build_sysroot" != "x"; then target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else target_header_dir="${with_sysroot}${native_system_header_dir}" fi else target_header_dir=${native_system_header_dir} fi By passing --with-build-sysroot=/ we trick cross-case to use `target_header_dir="${with_sysroot}${native_system_header_dir}"` which makes it equivalent to non-cross `target_header_dir="${with_build_sysroot}${native_system_header_dir}"` Tested the following setups: - cross-compiler without libc headers (powerpc64le-static) - cross-compiler with libc headers (powerpc64le-debug) - cross-build compiler with libc headers (powerpc64le bootstrapTools) Before the change only 2 of 3 compilers detected libc headers. After the change all 3 compilers detected libc headers. For darwin we silently ignore '-syslibroot //' argument as it does not introduce impurities. While at it dropped mingw special case for no-libc build. Before the change we passed both '--without-headers --with-native-system-headers-dir' for no-libc gcc-static builds. This tricked darwin builds to find sys/sdt.h and fail inhibid_libc builds. Now all targets avoid passing native headers for gcc-static builds. While at it fixed correct headers passing to --with-native-system-headers-dir= in host != target case: we were passing host's headers where intention was to pass target's headers. Noticed the mismatch as a build failure on pkgsCross.powernv.stdenv.cc on darwin where `sys/sdt.h` is present in host's headers (libSystem) but not target's headers (`glibc`). Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> |
||
---|---|---|
.. | ||
add-opengl-runpath | ||
agda | ||
alternatives | ||
appimage | ||
bintools-wrapper | ||
build-bazel-package | ||
build-fhs-userenv | ||
build-fhs-userenv-bubblewrap | ||
build-graalvm-native-image | ||
build-setupcfg | ||
buildenv | ||
cc-wrapper | ||
coq | ||
dhall | ||
docker | ||
dotnet | ||
emacs | ||
expand-response-params | ||
fake-nss | ||
fetchbitbucket | ||
fetchbower | ||
fetchbzr | ||
fetchcvs | ||
fetchdarcs | ||
fetchdocker | ||
fetchfirefoxaddon | ||
fetchfossil | ||
fetchgit | ||
fetchgitea | ||
fetchgithub | ||
fetchgitiles | ||
fetchgitlab | ||
fetchgitlocal | ||
fetchgx | ||
fetchhg | ||
fetchipfs | ||
fetchmavenartifact | ||
fetchmtn | ||
fetchnextcloudapp | ||
fetchpatch | ||
fetchrepoorcz | ||
fetchrepoproject | ||
fetchs3 | ||
fetchsavannah | ||
fetchsourcehut | ||
fetchsvn | ||
fetchsvnrevision | ||
fetchsvnssh | ||
fetchurl | ||
fetchzip | ||
flutter | ||
go | ||
icon-conv-tools | ||
install-shell-files | ||
java | ||
kernel | ||
libredirect | ||
make-darwin-bundle | ||
make-desktopitem | ||
make-startupitem | ||
make-symlinks | ||
mkshell | ||
mono-dll-fixer | ||
nix-gitignore | ||
node/fetch-yarn-deps | ||
nuke-references | ||
ocaml | ||
oci-tools | ||
pkg-config-wrapper | ||
prefer-remote-fetch | ||
references-by-popularity | ||
release | ||
remove-references-to | ||
replace-secret | ||
rust | ||
setup-hooks | ||
singularity-tools | ||
skaware | ||
snap | ||
src-only | ||
substitute | ||
substitute-files | ||
templaterpm | ||
testers | ||
trivial-builders | ||
vm | ||
wrapper-common | ||
writers | ||
build-maven.nix | ||
build-pecl.nix | ||
closure-info.nix | ||
plugins.nix | ||
replace-dependency.nix | ||
setup-systemd-units.nix | ||
source-from-head-fun.nix | ||
trivial-builders.nix |