Commit graph

29 commits

Author SHA1 Message Date
Franz Pletz 514a478e61 cc-wrapper: Fix if syntax 2016-03-09 10:08:07 +01:00
Robin Gloster 9a5b070b45 hardening: debug with NIX_DEBUG 2016-03-08 20:51:35 +00:00
Franz Pletz baee91ec60 cc-wrapper: Check if ld supports -z, fixes darwin 2016-03-07 21:40:20 +01:00
Franz Pletz b2b499e6c4 cc-wrapper: Increase number of functions for stackprotector 2016-03-07 01:30:40 +01:00
Franz Pletz ab1092875a cc-wrapper: Disable pie for linking static libs 2016-03-07 01:30:39 +01:00
Franz Pletz 63f60b6a13 cc-wrapper: Disable pie when linking shared libraries 2016-03-07 01:30:39 +01:00
Franz Pletz 05a02c53a0 cc-wrapper: -pie is a ldflag 2016-03-06 00:14:55 +01:00
Franz Pletz aff1f4ab94 Use general hardening flag toggle lists
The following parameters are now available:

  * hardeningDisable
    To disable specific hardening flags
  * hardeningEnable
    To enable specific hardening flags

Only the cc-wrapper supports this right now, but these may be reused by
other wrappers, builders or setup hooks.

cc-wrapper supports the following flags:

  * fortify
  * stackprotector
  * pie (disabled by default)
  * pic
  * strictoverflow
  * format
  * relro
  * bindnow
2016-03-05 18:55:26 +01:00
Vladimír Čunát 96cbdc70f2 cc-wrapper: fix #10574: old gcc -> cc fallout
The part with gcc-wrapper-old changes is rather unimportant,
as it's almost unused but I still tested that the sole user `gnat` builds.
2016-02-05 14:05:14 +01:00
Vladimír Čunát 8f48a9756b cc-wrapper: quote when saving $PATH 2016-01-25 09:54:10 +01:00
Anthony Cowley d96893647d cc-wrapper: fix on darwin
The ld-wrapper.sh script calls `readlink` in some circumstances. We need
to ensure that this is the `readlink` from the `coreutils` package so
that flag support is as expected.

This is accomplished by explicitly setting PATH at the top of each shell
script.

Without doing this, the following happens with a trivial `main.c`:

```
nix-env -f "<nixpkgs>" -iA pkgs.clang
$ clang main.c -L /nix/../nix/store/2ankvagznq062x1gifpxwkk7fp3xwy63-xnu-2422.115.4/Library -o a.out
readlink: illegal option -- f
usage: readlink [-n] [file ...]
```

The key element is the `..` in the path supplied to the linker via a
`-L` flag. With this patch, the above invocation works correctly on
darwin, whose native `/usr/bin/readlink` does not support the `-f` flag.

The explicit path also ensures that the `grep` called by `cc-wrapper.sh`
is the one from Nix.

Fixes #6447
2016-01-19 17:47:11 -05:00
Eelco Dolstra 2b5ed58099 cc-wrapper: Don't mess with __DATE__ and __TIME__
This is handled by $SOURCE_DATE_EPOCH now.
2016-01-05 17:21:48 +01:00
Danny Wilson f17dea3b3d Fix compilation of GCC 4.9 on SmartOS.
Fix ld-solaris-wrapper never calling ld (since gcc->cc-wrapper refactor).
2015-11-16 17:20:16 +01:00
Jude Taylor 80e09678f7 darwin: use system dyld
see https://github.com/NixOS/nixpkgs/issues/9432
2015-08-25 11:12:09 -07:00
Jude Taylor ef95107ddc make isClang work the way a user might expect 2015-08-12 11:27:54 -07:00
Vladimír Čunát 615f64dcbe gcc_multi: disable the hook moving lib64 to lib
This was preventing wine from build, and we typically don't want it
anyway in multilib builds. /cc #8706.
2015-07-20 13:43:52 +02:00
Eelco Dolstra 553abf71ba Merge remote-tracking branch 'origin/staging' into gcc-4.9
Conflicts:
	pkgs/build-support/cc-wrapper/default.nix
	pkgs/development/libraries/wayland/default.nix
	pkgs/development/tools/build-managers/cmake/default.nix
	pkgs/top-level/all-packages.nix
2015-06-01 20:08:43 +02:00
Eelco Dolstra 6671bb8be4 Remove gccStdInc
This reverts d927da8dae. Having a copy
of gcc-wrapper/setup-hook.sh is bad for maintainability - it had
already started to diverge. Also, gccStdInc gave a nix-env conflict
with the standard gcc. And it wasn't actually used in Nixpkgs.

Instead, if you really need to change "-isystem" to "-I", you can now
set ccIncludeFlag to "-I".
2015-05-13 18:17:25 +02:00
Eric Seidel 395829686d add is{GNU,Clang} attrs to cc-wrapper.
These will be more pleasant to use than the existing

    (cc.cc.isClang or false)

nonsense we currently do.
2015-05-11 14:39:36 -07:00
Alexander V. Nikolaev 3311513df6 Rename ccgo back to gccgo
I believe this is result of typo, introduced in 48f63c2f.
2015-03-27 12:45:32 +02:00
Shea Levy f91dea4c0b cc-wrapper: Set default system include flags for non-gcc c++ on Linux
Without this, clang can't find libstdc++. This needs to happen in the wrapper
so that the libc++ setup hook can still override it
2015-03-06 19:04:43 +00:00
Dan Peebles 7bea6aafae Some cc-wrapper changes to better support darwin and clang:
- Add a conditional flag for the c++ std lib
- Build binaries that get linked by our own dyld (someday)
- Automatically add framework directories in the setup hook
2015-02-08 21:15:22 -05:00
Eric Seidel 6f7632a7bd update libcxx[abi] to 3.5 2015-02-03 14:02:59 -08:00
Shea Levy aea1254f96 cc-wrapper merge fixes 2015-02-02 21:30:05 -05:00
Shea Levy c45372f038 Merge commit 'cfb29ab882323d379aba20a95020c7c24f883eae'
Partial staging merge, including cc-wrapper fixes

Conflicts:
	pkgs/applications/audio/spotify/default.nix
	pkgs/build-support/cc-wrapper/default.nix
	pkgs/development/compilers/cryptol/1.8.x.nix
2015-02-02 21:14:28 -05:00
Shea Levy 9bccb95a82 cc-wrapper: Fix for cross-compiling
Fixes #5949

Suggested by @ambrop72
2015-01-25 23:29:06 -05:00
Shea Levy f326b7995c Remove libc++ stuff from cc-wrapper
This is now part of the libc++ setup hook
2015-01-16 11:30:51 -05:00
Shea Levy 7dc57a389e cc-wrapper: Set CC/CXX more specifically if possible 2015-01-16 10:50:53 -05:00
Eric Seidel 48f63c2f2e rename gcc-wrapper to cc-wrapper.
also makes cc-wrapper compatible with clang in the darwin fork.
2015-01-14 20:26:56 -08:00