Commit Graph

258 Commits

Author SHA1 Message Date
Matthew Bauer
f496357585 cc-wrapper: use -iframework instead of -F
This avoids dumping -Wall warnings when they appear in framework
headers. As a result, we are closer to how regular headers are
included (via -isystem).

Also remove ccIncludeFlag lookup, this was unused & not very useful.
2019-06-28 16:27:27 -04:00
Matthew Bauer
23c520d95e cc-wrapper: only set -march when platform.gcc.arch is specified
We want to make sure this value is explicitly set. Infering it for
every arch leads to annoying failures like:

https://hydra.nixos.org/build/92583832/

Perhaps we can enable it in the future with some smarter handling of
cc-wrapper.sh.
2019-04-26 22:30:45 -04:00
volth
dba65df034 kernel: fix cross-build
Fix for #59225 regression proposed by @matthewbauer
https://github.com/NixOS/nixpkgs/pull/59225#issuecomment-486398003

(cherry picked from commit a6ea72a77d1f8e794244b063a7e9780c1b47486d)
2019-04-25 14:14:48 -04:00
Matthew Bauer
7488a367af
Merge pull request #56555 from matthewbauer/wasm
Initial WebAssembly/WASI cross-compilation support
2019-04-23 22:44:33 -04:00
Matthew Bauer
6948ffd398 wasilibc: use .imports file for lld
instead of passing in the --allow-undefined-file, we can just let lld
find the file.
2019-04-23 21:48:58 -04:00
Matthew Bauer
9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
volth
5d87bc2650 fix bootstrap when platform.gcc.arch=="skylake" 2019-04-21 16:37:49 +00:00
Matthew Bauer
d180cb9850 cc-wrapper: make machine configuration configurable
It is useful to make these dynamic and not bake them into gcc. This
means we don’t have to rebuild gcc to change these values. Instead, we
will pass cflags to gcc based on platform values. This was already
done hackily for android gcc (which is multi-target), but not for our
own gccs which are single target.

To accomplish this, we need to add a few things:

- add ‘arch’ to cpu
- add NIX_CFLAGS_COMPILE_BEFORE flag (goes before args)
- set -march everywhere
- set mcpu, mfpu, mmode, and mtune based on targetPlatform.gcc flags

cc-wrapper: only set -march when it is in the cpu type

Some architectures don’t have a good mapping of -march. For instance
POWER architecture doesn’t support the -march flag at all!

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
2019-04-20 20:05:51 -04:00
Matthew Bauer
d453273fbf llvm8: support c++ in cross case
this adds libc++ to the LLVM cross, giving us access to the full
Nixpkgs set. This requires 4 stages of wrapped compilers:

- Clang with no libraries
- Clang with just compiler-rt
- Clang with Libc, and compiler-rt
- Clang with Libc++, Libc, and compiler-rt
2019-04-11 21:28:51 -04:00
Matthew Bauer
aab8c7ba43 netbsd: add cross target 2019-02-26 15:55:47 -05:00
Vladimír Čunát
8ba516664b
Merge branch 'staging-next' into staging 2019-02-01 09:42:53 +01:00
Matthew Bauer
830879d4c4
cc-wrapper: set priority to 10 2019-01-31 20:07:55 -05:00
Matthew Bauer
77550df8e6 cc-wrapper: add libcxx for libcxxClang
clang needs to find headers + libraries for compiling with libc++. We
need to add a libcxx argument to cc-wrapper. This means you do not
have to pass in c++ headers directly.

This resolves the last case remaining of #30670. Darwin clang++ now
works properly.

Fixes #30670
2019-01-26 22:45:15 -05:00
Michael Raskin
ad1abb2824
Merge pull request #46115 from oxij/stdenv/bintools-cc-symlink
cc-wrapper, bintools-wrapper: simply symlink man and info outputs
2018-11-22 08:58:28 +00:00
Jan Malakhovski
d32f51c618 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
With the previous commit `propagateDoc` is now always given the correct value
(i.e. it is never set to `true` when there are no `man` and `info` outputs).
Hence, we can simply symlink the original outputs to the wrapper outputs.

Pros:

- simpler, less indirection compared to `propagated-user-env-packages`,
- uses less inodes (1 symlink, which nix then simply automatically resolves
  and removes, vs. two directories and a file),
- makes direct references like "export MANPATH=${stdenv.cc.man}/share/man"
  simply work.

Cons:

- I'm not aware of any.

This and the previous commit together almost completely revert commits
fde7296a47,
fa41297209, and
c981787db9.
2018-11-07 08:37:51 +00:00
Matthew Bauer
412093994b gcc: support avr
- respect libc’s incdir and libdir
- make non-unix systems single threaded
- set LIMITS_H_TEST to false for avr
- misc updates to support new libc’s
- use multilib with avr

For threads we want to use:
- posix on unix systems
- win32 on windows
- single on everything else

For avr:
- add library directories for avrlibc
- to disable relro and bind
- avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
2018-10-29 14:34:09 -05:00
Jan Malakhovski
b2c7a5a271 bintools-wrapper, cc-wrapper, stdenv: infer propagateDoc automatically
02c09e0171 (NixOS/nixpkgs#44558) was reverted in
c981787db9 but, as it turns out, it fixed an issue
I didn't know about at the time: the values of `propagateDoc` options were
(and now again are) inconsistent with the underlying things those wrappers wrap
(see NixOS/nixpkgs#46119), which was (and now is) likely to produce more instances
of NixOS/nixpkgs#43547, if not now, then eventually as stdenv changes.

This patch (which is a simplified version of the original reverted patch) is the
simplest solution to this whole thing: it forces wrappers to directly inspect the
outputs of the things they are wrapping instead of making stdenv guess the correct
values.
2018-09-23 17:29:56 +00:00
Jan Malakhovski
4092708261 treewide: cleanup some references to bash 2018-09-04 22:05:02 +00:00
Matthew Bauer
13c8acc3db Revert "Merge pull request #44767 from obsidiansystems/wrapper-env-var-path"
This reverts commit 89efc27f57, reversing
changes made to d0f11020ca.
2018-08-22 01:14:53 +02:00
John Ericson
89efc27f57
Merge pull request #44767 from obsidiansystems/wrapper-env-var-path
{cc,bintools}-wrapper, ghc, libgcc: Define wrapper env vars as full paths
2018-08-17 16:12:26 -04:00
Eelco Dolstra
fa41297209
Revert "cc-wrapper: propagate man and info to propagated-build-inputs"
This reverts commit 28ad0703f3.
2018-08-09 12:58:16 +02:00
Eelco Dolstra
c981787db9
Revert "cc-wrapper, bintools-wrapper: simply symlink man and info outputs"
This reverts commit 02c09e0171.
2018-08-09 12:57:38 +02:00
John Ericson
1dc0404d6e cc-wrapper: Define env vars with full path 2018-08-06 20:38:13 -04:00
Jan Malakhovski
02c09e0171 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
See discussion in #44516.
2018-08-06 20:50:16 +00:00
Jan Malakhovski
28ad0703f3 cc-wrapper: propagate man and info to propagated-build-inputs 2018-08-05 19:20:02 +00:00
Vladimír Čunát
73959b68c2
Re-Revert "Merge #44221: default for NIX_CXXSTDLIB_COMPILE"
This reverts commit fd81a2ecb6.
Moved from master to staging.
2018-07-31 09:48:16 +02:00
Vladimír Čunát
fd81a2ecb6
Revert "Merge #44221: default for NIX_CXXSTDLIB_COMPILE"
This reverts commit 034c9816d5, reversing
changes made to 5afe87ed7a.
Huge rebuild, moving to staging.
2018-07-31 09:43:52 +02:00
Eduard-Mihai Burtescu
35e0ca9b24
Use the default for NIX_CXXSTDLIB_COMPILE even if defined (but empty). 2018-07-30 10:50:55 +03:00
Matthew Bauer
96ce1e03a4 {cc,bintools}-wrapper: also replace . in config
Some configs will have dots for version numbers. To normalize we can
just use _ again.
2018-07-28 19:54:09 -04:00
Matthew Bauer
4f6d61e5cf cc-wrapper: disable stackprotector for mingw
It seems to break things.
2018-06-23 22:05:26 -04:00
Vladimír Čunát
31530c185e
Merge a subset of staging (security)
In particular, this contains Firefox-related and libgcrypt updates.
Other larger rebuilds would apparently need lots of time to catch up
on Hydra, due to nontrivial rebuilds in other branches than staging.
2018-06-15 08:48:02 +02:00
Matthew Bauer
ad55409266 cc-wrapper: fix eval error on mac
When doing cross to linux, we will not have a GCC compiler (yet). We
can hopefully skip the cxx stdlib stuff for now.
2018-06-14 19:29:30 -04:00
Ben Wolsieffer
645f03b949 cc-wrapper, bintools-wrapper: use getHostRoleEnvHook instead of getTargetRoleEnvHook
Fixes include and link paths when cross compiling.
2018-06-03 10:54:32 -04:00
Benjamin Saunders
b0d0b1adfe clang_6: fix sanitizers under libstdc++ 2018-05-24 15:04:30 -07:00
John Ericson
205fc55ea2 Merge remote-tracking branch 'upstream/staging' into compiler-rt 2018-05-24 02:58:00 -04:00
Benjamin Saunders
46eeef1898 tests.cc-wrapper: verify building with sanitizers 2018-05-24 02:57:44 -04:00
John Ericson
5e17335bd7 Merge remote-tracking branch 'upstream/staging' into strictDeps 2018-05-14 23:33:03 -04:00
John Ericson
330ca731e8 treewide: Get rid of all uses of crossConfig
The hack of using `crossConfig` to enforce stricter handling of
dependencies is replaced with a dedicated `strictDeps` for that purpose.
(Experience has shown that my punning was a terrible idea that made more
difficult and embarrising to teach teach.)

Now that is is clear, a few packages now use `strictDeps`, to fix
various bugs:

 - bintools-wrapper and cc-wrapper
2018-05-14 23:30:37 -04:00
John Ericson
4f7cdd35d5
Merge pull request #40139 from obsidiansystems/modular-setup-hooks
treewide: Modular setup hooks
2018-05-07 15:32:10 -04:00
John Ericson
8b0fce8cb1 {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
John Ericson
2110c0bd30 treewide: Use pkgs/build-support/roles.bash to remove copy pasta
Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
2018-05-07 15:10:37 -04:00
Jan Malakhovski
82dd4501f4 bintools-wrapper, cc-wrapper: don't add targetPrefix the second time
... binutils and gcc add it already anyway.

Without this it's easy to get cross-toolchain paths longer than 256
chars and nix-daemon will then fail to commit them to /nix/store on XFS.
2018-04-26 15:06:52 +00:00
Piotr Bogdan
4707dc6454 {cc,bintools}-wrapper: fix removal of unsupported hardening flags 2018-04-14 15:16:34 +01:00
John Ericson
0884027ef5 Revert "Revert "Merge pull request #28029 from cstrahan/hardening-fix""
This reverts commit 6c064e6b1f, reapplying
PR #28029 which was supposed to have gone to staging all along.
2018-04-11 14:00:13 -04:00
Matthew Bauer
6c064e6b1f Revert "Merge pull request #28029 from cstrahan/hardening-fix"
This reverts commit 0dbc006760, reversing
changes made to cb7f774265.

Should go into staging.
2018-04-10 19:07:27 -05:00
John Ericson
0dbc006760
Merge pull request #28029 from cstrahan/hardening-fix
hardening: fix #18995
2018-04-10 19:48:02 -04:00
John Ericson
ac4d74b6d9 hardening: Reindent 2018-04-10 16:33:47 -04:00
John Ericson
21818ae592 hardening: Tiny reindent 2018-04-10 16:33:47 -04:00
John Ericson
2364c22ec9 hardening: line order, spacing, and pointless quoting for consistency 2018-04-10 16:33:47 -04:00
John Ericson
4c76d87871 hardenning: Rejigger ifs and explicit declare and unset -v 2018-04-10 16:33:47 -04:00