Commit Graph

257 Commits

Author SHA1 Message Date
jackyliu16
930399d8cf binutils: mark gold as unavailable on loongarch64 2023-04-27 20:04:30 +03:00
Randy Eckenrode
5765d33f35
binutils: fix MinGW link failures with import libs 2023-03-05 22:23:06 -05:00
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Sergei Trofimovich
d381e51fb5
binutils: try to move headers around only when --host/--target differ (#215989)
Without the change `pkgsMusl.pkgsStatic.buildPackages.binutils.bintools`
build fails as:

    $ ln: failed to create symbolic link './include': File exists

This happens because both host and target are `x86_64-unknown-linux-musl`.
But `hostPlatform` differs from `targetPlatform` by `isStatic` value.

By `./configure`'s standard it's not yet a cross-compilation. The change
tries to move things around only when tuples change.
2023-02-12 14:40:29 +01:00
Sergei Trofimovich
b73942bc8e binutils: advertise binutils plugin API on darwin, it should just work 2023-01-31 18:30:30 +00:00
Sergei Trofimovich
726597c1a7 binutils: re-enable plugins support for wasi target
binutils plugins API does not depend on target. It depends only on host.
Tested the change to still be able to compile `firefox` which uses wasi
target and pulls in llvm with binutils plugin support.
2023-01-31 18:30:30 +00:00
Sergei Trofimovich
e86b3bbf2c binutils: symlink libraries and headers for "target" to lib/ and include/
`binutils` is inconsistent at installing it's headers to

    $dev/include

Instead it installs headers into two locations:

    $out/$host/$target/include
    $dev/include

There is no distinction between these two. Both headers are for HOST
libraries. Expetially for multitarget binutils builds.

This change fixes build of the following packages that build `binutils`
as a cross-compiler:

    pkgsCross.x86_64-freebsd.buildPackages.llvm_12
    pkgsCross.aarch64-multiplatform.buildPackages.llvm_12
2023-01-31 18:30:29 +00:00
Sergei Trofimovich
b9a9dfc3d4 binutils: consolidate plugin-api.h support in a single
I got the plugin API support at least once incorrect. Instead of
copying the deifnition let's consolidate it within binutils itself.

While at it forward-ported changes to llvm_{13,14,15}.
The change is a no-op from rebuild perspective.
2023-01-30 22:23:36 +00:00
Sergei Trofimovich
0ba9da441d
Merge pull request #211126 from trofi/binutils-update
binutils: 2.39 -> 2.40
2023-01-29 09:50:57 +00:00
Sergei Trofimovich
e1ef521cff binutils: 2.39 -> 2.40
A few potentially disruptive changes:

- binutils does not embed ${binutils-unwrapped}/lib as a default library
  search path anymore. This will cause link failures for -lbfd -lopcodes
  users that did not declare their dependency on those libraries. They
  will need to add `libbfd` and `libopcodes` attributes to build inputs.

- `libbfd` and `libopcodes` attributes now just reference
  `binutils-unwrapped.{dev,lib}` pair of attributes without patching
  `binutils` build system.

We don't patch build system anymore and use multiple outputs out of
existing `binutils` build. That makes the result more maintainable: no
need to handle ever growing list of dependencied of `libbfd`. This time
new addition was `libsframe`.

To accomodate `out` / `lib` output split I had to remove `lib` -> `bin`
backreference by removing legacy lookup path for plugins.

I also did not enable `zstd` just yet as `nixpkgs` version of `zstd`
package pulls in `cmake` into bootstrap sequence.

Changes: https://lists.gnu.org/archive/html/info-gnu/2023-01/msg00003.html
2023-01-27 23:16:45 +00:00
Sergei Trofimovich
1d5a8a5e43 binutils: avoid texinfo dependency during bootstrap
Normally binutils provides pregenerated manuals along with release
tarball. Manuals regeneration is needed every time we change
`configure.ac`. But usually there are no material changes in it.

This change instead inhibits manuals regeenration by keeping
man and info files up to date.

The diff of bootstrap tree before and after the change:

    $ nix-store --query --graph $(nix-instantiate -A stdenv) |
        fgrep ' -> ' | awk '{print $3}' | sort -u |
        sed 's/"[0-9a-z]\{32\}-/"/g' | sort > before

    $ nix-store --query --graph $(nix-instantiate -A stdenv) |
        fgrep ' -> ' | awk '{print $3}' | sort -u |
        sed 's/"[0-9a-z]\{32\}-/"/g' | sort > after

    $ diff -U0 before after
    --- before
    +++ after
    @@ -100 +99,0 @@
    -"texinfo-6.8.drv"

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2023-01-13 22:17:27 +00:00
Nick Cao
f12a7d932d binutils: gold is not available for riscv target 2022-12-30 23:38:13 +01:00
figsoda
ec8cb34358 treewide: fix typos 2022-12-17 19:39:44 -05:00
Emily Trau
6e980bc4f3 binutils: port AVR-specific options to "size" 2022-10-26 18:29:51 +11:00
Yureka
0deec20d46 binutils: drop R_ARM_COPY.patch
This reverts commit b3640e024f.

When applied, the patch causes some dynamic relocations to be missing,
even in cases where they are clearly needed.

This causes bugs such as https://github.com/NixOS/nixpkgs/issues/107386
where `fprintf(stderr, ...)` segfaults because the stderr relocation was
not added.
2022-10-03 18:58:29 +02:00
Sergei Trofimovich
fef040afae binutils: restore nm autodetection on darwin
The change restores the patch `nixpkgs` kept for `binutils-2.38`.
On top of that we revert the second `binutils-2.39`-specific commit
that attempted to fix it.

We can drop both reverts once https://sourceware.org/PR29547 is fixed.
2022-09-05 19:18:53 +01:00
Sergei Trofimovich
6a378e9c44 binutils: 2.38 -> 2.39
Changes: https://sourceware.org/pipermail/binutils/2022-August/122246.html
2022-09-02 07:41:31 +01:00
Minijackson
5d05bbed74
binutils: fix the kernel build for PowerPC 2022-07-25 16:20:30 +02:00
Asad Mehmood
be560224be
binutils: Reduce closure size when building for cross platform 2022-06-02 23:37:00 +01:00
Artturin
f002ffed9a treewide: enable strictDeps in bootstrap packages 2022-05-22 16:40:26 +03:00
Janne Heß
c911240e9c
Revert "Add mingwW64-llvm cross-system." 2022-05-18 13:50:23 +02:00
Shea Levy
0f68ed163c
Merge branch 'mingwW64-clang' into staging 2022-05-18 06:30:21 -04:00
Stefan Frijters
4b0f59afcc
binutils: add upstream patch to fix issue with parallel use of dlltool
https://sourceware.org/bugzilla/show_bug.cgi?id=28885

Patch taken from the upstream binutils-2_38-branch branch.
2022-05-12 12:45:11 +02:00
Shea Levy
dee9af9323
bintools: Add isXXX flags to check linker type 2022-05-09 10:03:48 -04:00
Sergei Trofimovich
27f20550b4 binutils-unwrapped-all-targets: fix libctf breakage
Before the change 'postFixup' was breaking binaries as it deleted `libctf.so`'s
dependency without fixing the links (https://hydra.nixos.org/build/173957444):

  objdump:
    symbol lookup error: ...-binutils-2.38/lib/libctf.so.0: undefined symbol: htab_eq_string

Instead of tying binutils and libbfd together let's stop replacing the
libraries and use local copies. They are not mechanically interchangeable.

Ideally binutils' upstream build system should allow linking external
`libbfd`/`libopcodes`/`libctf` but we are not there yet.
2022-04-23 08:13:09 +01:00
Andrew Childs
9568a7afef binutils: fix cross compilation from darwin
The libtool patch is required to correctly invoke the linker while
building, so it should depend on the build toolchain.
2022-04-20 00:03:01 +09:00
Vladimír Čunát
d5d94127fd
Merge branch 'staging-next' into staging
Minor conflicts; I hope I didn't mess up:
	pkgs/development/tools/misc/binutils/default.nix
	pkgs/games/openjk/default.nix
2022-04-14 09:53:21 +02:00
Adam Joseph
8305aa29c2 binutils: apply debian's patch if isMips64n64
Upstream binutils is missing sensible defaults for a few flags
(notably linker personality) when cross-compiling to
mips64el-*-*abi64.

Most of the time this isn't an issue because packages that invoke the
linker directly detect the flags from gcc's behavior (for example,
libtool does this) and gcc has good code for detecting the right
defaults.  However some do not; notably nix, itself lacks this.

Presumably Debian is working on upstreaming this, and has more clout
than we do.  I propose we carry their patch in the meantime.  The
patch is conditioned on stdenv.targetPlatform.isMips64n64 in order to
avoid mass-rebuilds.

Closes #164835.
2022-04-05 23:59:45 -07:00
Bernardo Meurer
c981094480
binutils: only autoconf on Darwin 2022-03-28 19:11:33 -07:00
Andrew Childs
022e81d7f1
binutils: revert libtool changes that break darwin 2022-03-28 18:51:55 -07:00
Bernardo Meurer
aa9448db2a
binutils: move src hack out of srcs attrset 2022-03-28 18:50:22 -07:00
Bernardo Meurer
ca02ea1e26
binutils: 2.37 -> 2.38 2022-03-28 18:50:20 -07:00
Bernardo Meurer
29e61371a7
binutils: add lovesegfault as a maintainer 2022-03-28 18:50:19 -07:00
Bernardo Meurer
737fe07136
binutils: take some suggestion from nixpkgs-fmt 2022-03-28 18:50:18 -07:00
Bernardo Meurer
8f7c9816aa
binutils: sort configureFlags 2022-03-28 18:50:17 -07:00
Bernardo Meurer
a3accfbea9
binutils: inline reuseLibs 2022-03-28 18:50:16 -07:00
Bernardo Meurer
e06d51d4c0
binutils: add tags to comments where relevant 2022-03-28 18:50:15 -07:00
Bernardo Meurer
c4913fb289
binutils: inherit {build,host,target}Platform to avoid repeating ourselves 2022-03-28 18:50:14 -07:00
Bernardo Meurer
3436886724
binutils: format and order patches section 2022-03-28 18:50:13 -07:00
Bernardo Meurer
008ce6610a
binutils: join srcs in an attrset 2022-03-28 18:50:12 -07:00
Bernardo Meurer
8e5d2ead61
binutils: rename gold to enableGold 2022-03-28 18:50:11 -07:00
Bernardo Meurer
c748ef4d1b
binutils: format input attrs 2022-03-28 18:50:10 -07:00
Bernardo Meurer
ce91080db2
binutils: add patch for ld file descriptor explosion 2022-03-28 18:50:06 -07:00
Bernardo Meurer
36aa3f6a09
binutils: 2.35.1 -> 2.37 2022-03-28 18:50:03 -07:00
marius david
293c55472a binutils: fix windres not finding the apprioate cross compiler 2022-02-01 10:41:36 +01:00
Robert Scott
6a6756ce7e
binutils: add patch for CVE-2021-45078 (#151658) 2021-12-25 17:02:00 -05:00
Fabián Heredia Montiel
745023e01a binutils: patch CVE-2021-3487 2021-10-17 16:25:25 -05:00
Fabián Heredia Montiel
f378420360 binutils: 2.35.1 → 2.35.2
CVEs:

- https://nvd.nist.gov/vuln/detail/CVE-2020-35448 (3.3 Low)
- https://nvd.nist.gov/vuln/detail/CVE-2021-20284 (5.5 Medium)
- https://nvd.nist.gov/vuln/detail/CVE-2021-20294 (7.8 High)
2021-10-17 16:25:25 -05:00
John Ericson
7195e6008a
Merge pull request #132538 from sternenseemann/has-gold
binutils-unwrapped: expose if built with ld.gold
2021-08-20 21:12:20 -04:00
sternenseemann
4c75874560 binutils-unwrapped: expose if built with ld.gold
ld.gold is “A new, faster, ELF only linker”. Thus we only should pass
the configure flag --with-gold if our target platform will actually
support gold (in which case binutil's configure script silently
disables it).

With this change, not only will configureFlags represent the actual
configuration more closely, but we can also expose if the binutils
derivation contains ld.gold via a passthru attr. Specifically this
means that:

    nix-repl> pkgsCross.mingwW64.stdenv.cc.bintools.bintools.hasGold
    false

The intended way to use this is to check
`stdenv.cc.bintools.bintools or false` which returns accurate results
regardless of the actual linker derivation.

TODO: maybe also add hasGold to binutils wrapper as it also symlinks
ld.gold in?
2021-08-18 01:21:44 +02:00