Commit Graph

228 Commits

Author SHA1 Message Date
misuzu
5aad70e8be binutils: apply R_ARM_COPY.patch only when cross-compiling to armv7l
Applying R_ARM_COPY.patch when not cross-compiling breaks native armv7l builds.
2021-06-23 11:37:40 +03:00
sternenseemann
ca9be0511b binutils-unwrapped: force targetPrefix if cross compiling
The binutils build system checks by itself if it is building a cross
toolchain or not and prepends or omits a targetPrefix accordingly. This
means that we can always pass target via configureTargets.

However the binutils build system and our bintools wrapper disagree over
whether we are building a cross toolchain or not sometimes since cross
compilation can be relatively subtle in nixpkgs. For example every use
of crossOverlays will make nixpkgs build a cross toolchain even though
localSystem == crossSystem. The cross infrastructure is also used to
build native binaries with a different stdenv (musl instead of glibc,
clang instead of gcc). In all of these cases stdenv.hostPlatform.config
== stdenv.targetPlatform.config, causing binutils to not prepend a
target prefix. At the same time stdenv.hostPlatform !=
stdenv.targetPlatform causing the bintools wrapper to expect a target
prefix, thus building an incomplete set of bintools. This is why
currently pkgsCross.gnu64 and pkgsCross.musl64 aren't working.

The solution is quite simple however: If we detect that we are building
a cross toolchain in the binutils-unwrapped expression, we force the
targetPrefix with --programprefix and fulfill the expectations of the
bintools wrapper at the same time.

Tested (on x86_64-linux):

* pkgsCross.musl64.hello
* pkgsCross.aarch64-multiplatform.hello
* pkgs.hello

Still not working is pkgsCross.gnu64, since
x86_64-unknown-linux-gnu-stage-final-gcc gets confused about targets
now, so bootstrapping the stdenv fails. Since this wasn't working
previously anyways, it's proably fine to fix this separately.
2021-04-16 17:12:45 +02:00
Andrew Childs
6605fadc68 bintools-wrapper: default platform versions for darwin
Instead of always supplying flags, apply the flags as defaults. Use
clang's native flags instead of lifting the linker flags from binutils
with `-Wl,`.

If a project is using clang to drive linking, make clang do the right
thing with MACOSX_DEPLOYMENT_TARGET. This can be overridden by command
line arguments. This will cause modern clang to pass
`-platform_version 10.12 0.0.0`, since it doesn't know about the SDK
settings. Older versions of clang will pass down `-macos_version_min`
flags with no sdk version.

At the linker layer, apply a default value for anything left
ambiguous. If nothing is specified, pass a full
`-platform_version`. If only `-macos_version_min` is specified, then
lock down the sdk_version explicitly with `-sdk_version`. If a min
version and sdk version is passed, do nothing.
2021-04-11 09:47:09 +09:00
Pamplemousse
8748154972 binutils, libbfd: Patch CVE-2020-35448
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
2021-03-22 07:22:33 -07:00
Dmitry Kalinkin
55e8a35caf
Merge pull request #109422 from veprbl/pr/binutils_use_gold_darwin_cross
binutils: enable gold when cross compiling on darwin
2021-01-21 18:47:25 -05:00
Dmitry Kalinkin
9120da4c4a
binutils: enable gold when cross compiling on darwin
This basically reverts:
 - 3c5188cc ('binutils: disable gold when building on darwin')
 - 457b48cc ('binutils: apply patch when cross compiling from darwin')

Tested by building:
 - nix build -f . pkgsCross.i686-embedded.buildPackages.binutils
 - nix build -f . pkgsCross.aarch64-embedded.buildPackages.binutils
2021-01-14 19:06:22 -05:00
Bernardo Meurer
306aefd9fc binutils: 2.34 -> 2.35.1 2021-01-10 16:09:25 +01:00
John Ericson
f52263ced0 treewide: Start to break up static overlay
We can use use `stdenv.hostPlatform.isStatic` instead, and move the
logic per package. The least opionated benefit of this is that it makes
it much easier to replace packages with modified ones, as there is no
longer any issue of overlay order.

CC @FRidh @matthewbauer
2021-01-03 19:18:16 +00:00
luc65r
968805c37b Revert "Revert "Revert "Revert "libbfd: fix build""""
This reverts commit 5c2b59d63a.
2020-12-28 08:43:32 +01:00
luc65r
dde943e535 Revert "Revert "Merge pull request #86954 from lovesegfault/binutils-2.34""
This reverts commit 24c96b9259.
2020-12-28 08:43:32 +01:00
luc65r
3205b32bf6 Revert commits on binutils for OpenRISC 1000
This reverts commits
    ebd89f6de1
    c6f6db77ac
    257fb62387
    dbe556af9c
2020-12-28 08:43:31 +01:00
Joe Hermaszewski
b3640e024f binutils: patch to fix https://sourceware.org/bugzilla/show_bug.cgi?id=16177
This bug was preventing one compiling Haskell programs from `pkgsMusl` for
armv7.

`nix-build --argstr crossSystem "armv7l-linux" -A pkgsMusl.haskellPackages.hello`
succeeds with this patch.

The patch is Nick Clifton's one, rebased by @ericson2314 here
https://sourceware.org/bugzilla/show_bug.cgi?id=16177#c6

Although there was some talk about the efficacy of the binutils patch
(https://sourceware.org/bugzilla/show_bug.cgi?id=16177#c9) the resulting
binary seems to run without issue on the target platform. Jessica's
patch there caused ld to fail linking some programs. Nick's proposed
patch has worked well in my testing so far (a Haskell project of some
small complexity cross compiled with musl to armv7).
2020-11-28 20:19:05 +08:00
Samuel Dionne-Riel
ebd89f6de1 binutils: Use 2.34 for OpenRISC 1000 2020-11-09 22:32:12 -05:00
Samuel Dionne-Riel
c6f6db77ac binutils: Prepare for concurrent versions 2020-11-09 22:32:12 -05:00
Samuel Dionne-Riel
257fb62387 binutils: Add patches for 2.34
From #89793
2020-11-09 22:32:12 -05:00
Samuel Dionne-Riel
dbe556af9c binutils: Move patches in versioned dir
We'll have multiple binutils to contend with.
2020-11-09 22:32:12 -05:00
Matthew Bauer
d0677e6d45 treewide: add warning comment to “boot” packages
This adds a warning to the top of each “boot” package that reads:

  Note: this package is used for bootstrapping fetchurl, and thus cannot
  use fetchpatch! All mutable patches (generated by GitHub or cgit) that
  are needed here should be included directly in Nixpkgs as files.

This makes it clear to maintainer that they may need to treat this
package a little differently than others. Importantly, we can’t use
fetchpatch here due to using <nix/fetchurl.nix>. To avoid having stale
hashes, we need to include patches that are subject to changing
overtime (for instance, gitweb’s patches contain a version number at
the bottom).
2020-07-31 08:56:53 +02:00
Frederik Rietdijk
5c2b59d63a Revert "Revert "Revert "libbfd: fix build"""
Reverting this change again because we're going back to binutils 2.31.

https://github.com/NixOS/nixpkgs/pull/86954#issuecomment-633006128

This reverts commit ade7faea72.
2020-05-23 10:20:28 +02:00
Frederik Rietdijk
24c96b9259 Revert "Merge pull request #86954 from lovesegfault/binutils-2.34"
Pythons find_library is broken with binutils 2.34, and numpy could not import libraries because of not properly aligned ELF's.

This is the second time binutils 2.34 got reverted. Next time, we should have a dedicated Hydra job for it.

This reverts commit 629fa8a2d4, reversing
changes made to 4ddd080d19.
2020-05-23 10:18:26 +02:00
John Ericson
ade7faea72 Revert "Revert "libbfd: fix build""
This reverts commit 237ef3095c.

Looks like we're trying to bump binutils again?
2020-05-14 09:38:14 +02:00
Bernardo Meurer
e1f4e0f03f binutils: 2.33.1 -> 2.34 2020-05-09 13:56:00 -07:00
Guillaume Bouchard
f1bada765e binutils: 2.31.1 -> 2.33.1
- I've removed the stack of patch linked to
https://sourceware.org/bugzilla/show_bug.cgi?id=23428 . The associated
issue says it is closed and targeted for 2.32.

- I've ugraded the "no_plugin" patch. The logic changed in
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=41f37a6fb71f2a3de388108f5cdfca9cbe6e9d51
and I tried to keep the same logic by disabling everything.

It closes https://github.com/NixOS/nixpkgs/issues/78197
2020-05-09 13:56:00 -07:00
Florian Klink
237ef3095c Revert "libbfd: fix build"
This reverts commit 7550ab98b0.
2020-04-29 16:48:50 +02:00
Florian Klink
607c4d8bb8 Revert "binutils: 2.31.1 -> 2.33.1"
This reverts commit efdb29597a.
2020-04-29 15:48:26 +02:00
Florian Klink
ff76d777fb Revert "binutils: 2.33.1 -> 2.34"
This reverts commit c5f602f5b7.
2020-04-29 15:48:24 +02:00
Maximilian Bosch
7550ab98b0
libbfd: fix build
The patch to separate it from `binutils` didn't apply anymore after
updating `binutils` to 2.34[1].

[1] #85951
2020-04-29 00:47:53 +02:00
Bernardo Meurer
c5f602f5b7 binutils: 2.33.1 -> 2.34 2020-04-26 15:17:13 -07:00
Guillaume Bouchard
efdb29597a binutils: 2.31.1 -> 2.33.1
- I've removed the stack of patch linked to
https://sourceware.org/bugzilla/show_bug.cgi?id=23428 . The associated
issue says it is closed and targeted for 2.32.

- I've ugraded the "no_plugin" patch. The logic changed in
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=41f37a6fb71f2a3de388108f5cdfca9cbe6e9d51
and I tried to keep the same logic by disabling everything.

It closes https://github.com/NixOS/nixpkgs/issues/78197
2020-04-26 15:17:12 -07:00
Michael Reilly
84cf00f980
treewide: Per RFC45, remove all unquoted URLs 2020-04-10 17:54:53 +01:00
John Ericson
f191360ad0 Merge remote-tracking branch 'upstream/staging-next' into staging 2019-11-25 15:59:05 -05:00
John Ericson
234446a447 binutils: Use pname 2019-11-24 18:32:26 +00:00
John Ericson
04f3bc518e binutils: Inherit version 2019-11-24 18:32:26 +00:00
Michael Bishop
4aa1ffae04
initial implementation of vc4 cross-compile 2019-11-19 22:19:15 -04:00
volth
08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Frederik Rietdijk
ef0dbef7f1 Merge master into staging-next 2019-05-12 19:59:09 +02:00
Matthew Bauer
3c5188ccb6 binutils: disable gold when building on darwin
Needed to build anything, otherwise get this error:

https://hydra.nixos.org/build/93192355/
2019-05-11 11:24:35 -04:00
Frederik Rietdijk
87a5d8fede Merge staging-next into staging 2019-05-07 19:30:14 +02:00
Matthew Bauer
02e9697471 binutils: add gettext dependency
Needed on libc without gettext bundled.

Fixes #11420
2019-04-30 22:50:21 -04:00
Matthew Bauer
457b48cc03 binutils: apply patch when cross compiling from darwin
Fixes #60546
2019-04-30 20:24:09 -04:00
Will Dietz
cd836b57ec binutils: and apply in right order 2019-01-22 06:36:16 -06:00
Will Dietz
aee77e66bb binutils: drop changelog portions of patches, so they apply 2019-01-22 06:36:15 -06:00
Will Dietz
bf0a0d424b binutils: patches from upstream to unbreak linking musl
https://sourceware.org/bugzilla/show_bug.cgi?id=23428
2019-01-22 06:36:13 -06:00
Tim Steinbach
53e1db960a
binutils: 2.30.0 -> 2.31.1 2019-01-20 13:03:00 -05:00
Jörg Thalheim
1b146a8c6f
treewide: remove paxutils from stdenv
More then one year ago we removed grsecurity kernels from nixpkgs:
https://github.com/NixOS/nixpkgs/pull/25277

This removes now also paxutils from stdenv.
2018-12-22 12:55:05 +01:00
Piotr Bogdan
c302474077 binutils: remove dtneeded.patch 2018-12-19 09:20:38 +01:00
Frederik Rietdijk
a510aa2672 Merge master into staging-next 2018-12-03 12:18:43 +01:00
c0bw3b
0498ccd076 Treewide: use HTTPS on GNU domains
HTTP -> HTTPS for :
- http://gnu.org/
- http://www.gnu.org/
- http://elpa.gnu.org/
- http://lists.gnu.org/
- http://gcc.gnu.org/
- http://ftp.gnu.org/ (except in fetchurl mirrors)
- http://bugs.gnu.org/
2018-12-02 15:51:59 +01:00
Léo Gaspard
8ecd555ded
Merge branch 'pr-46056' into staging
* pr-46056:
  binutils: use shared libs
  binutils: fix #44936 the huge size regression
2018-11-28 09:55:05 +09:00
Matthew Bauer
76c956be5c treewide: disable pie in more places
Some packages don’t work correctly with pie. Here I disable it for:

- busybox
- linux kernel
- kexectools

I also get rid of the Musl conditional for disabling pie in GCC and
Binutils. Some day we might want to enable PIE without Musl and it
will be useful to have the *just* work with our compiler and linkers.
2018-11-13 07:03:31 -06:00