diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 517a7296afd..5cd203efc4a 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -35,6 +35,7 @@ let "msp430-none" "riscv64-none" "riscv32-none" "vc4-none" + "or1k-none" "js-ghcjs" @@ -58,6 +59,7 @@ in { mips = filterDoubles predicates.isMips; riscv = filterDoubles predicates.isRiscV; vc4 = filterDoubles predicates.isVc4; + or1k = filterDoubles predicates.isOr1k; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 87c05a0b052..9a813b14cc2 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -124,6 +124,12 @@ rec { platform = {}; }; + or1k = { + config = "or1k-elf"; + libc = "newlib"; + platform = {}; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 8fa63057250..ac483941dd2 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -24,6 +24,7 @@ rec { isVc4 = { cpu = { family = "vc4"; }; }; isAvr = { cpu = { family = "avr"; }; }; isAlpha = { cpu = { family = "alpha"; }; }; + isOr1k = { cpu = { family = "or1k"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 6bd44a00746..eadeb38c723 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -114,6 +114,8 @@ rec { vc4 = { bits = 32; significantByte = littleEndian; family = "vc4"; }; + or1k = { bits = 32; significantByte = bigEndian; family = "or1k"; }; + js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 786f0f9c598..b9cdd0b1b2e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -185,6 +185,7 @@ stdenv.mkDerivation { else if targetPlatform.isAvr then "avr" else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isVc4 then "vc4" + else if targetPlatform.isOr1k then "or1k" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); diff --git a/pkgs/development/libraries/libbfd/default.nix b/pkgs/development/libraries/libbfd/default.nix index 75db780b7bb..e622cc6be68 100644 --- a/pkgs/development/libraries/libbfd/default.nix +++ b/pkgs/development/libraries/libbfd/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { outputs = [ "out" "dev" ]; patches = binutils-unwrapped.patches ++ [ - ../../tools/misc/binutils/build-components-separately.patch + (binutils-unwrapped.patchesDir + "/build-components-separately.patch") (fetchpatch { url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch"; sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q"; diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix index 8db034683dc..f596ddfafc4 100644 --- a/pkgs/development/libraries/libopcodes/default.nix +++ b/pkgs/development/libraries/libopcodes/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { outputs = [ "out" "dev" ]; patches = binutils-unwrapped.patches ++ [ - ../../tools/misc/binutils/build-components-separately.patch + (binutils-unwrapped.patchesDir + "/build-components-separately.patch") ]; # We just want to build libopcodes diff --git a/pkgs/development/misc/or1k/newlib.nix b/pkgs/development/misc/or1k/newlib.nix new file mode 100644 index 00000000000..92829896a27 --- /dev/null +++ b/pkgs/development/misc/or1k/newlib.nix @@ -0,0 +1,36 @@ +{ stdenv, texinfo, flex, bison, fetchFromGitHub, crossLibcStdenv, buildPackages }: + +crossLibcStdenv.mkDerivation { + name = "newlib"; + src = fetchFromGitHub { + owner = "openrisc"; + repo = "newlib"; + rev = "8ac94ca7bbe4ceddafe6583ee4766d3c15b18ac8"; + sha256 = "0hzhijmry5slpp6x12pgng8v7jil3mn18ahrhnw431lqrs1cma0s"; + }; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # newlib expects CC to build for build platform, not host platform + preConfigure = '' + export CC=cc + ''; + + configurePlatforms = [ "build" "target" ]; + configureFlags = [ + "--host=${stdenv.buildPlatform.config}" + + "--disable-newlib-supplied-syscalls" + "--disable-nls" + "--enable-newlib-io-long-long" + "--enable-newlib-register-fini" + "--enable-newlib-retargetable-locking" + ]; + + dontDisableStatic = true; + + passthru = { + incdir = "/${stdenv.targetPlatform.config}/include"; + libdir = "/${stdenv.targetPlatform.config}/lib"; + }; +} diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index b352e63a27c..c0846fce45c 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -8,6 +8,7 @@ , bison ? null , flex , texinfo +, perl }: # Note: this package is used for bootstrapping fetchurl, and thus @@ -21,7 +22,10 @@ let # Remove gold-symbol-visibility patch when updating, the proper fix # is now upstream. # https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=330b90b5ffbbc20c5de6ae6c7f60c40fab2e7a4f;hp=99181ccac0fc7d82e7dabb05dc7466e91f1645d3 - version = "2.31.1"; + version = "${minorVersion}${patchVersion}"; + minorVersion = if stdenv.targetPlatform.isOr1k then "2.34" else "2.31"; + patchVersion = if stdenv.targetPlatform.isOr1k then "" else ".1"; + basename = "binutils"; # The targetPrefix prepended to binary names to allow multiple binuntils on the # PATH to both be usable. @@ -33,33 +37,49 @@ let rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36"; sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"; }; - # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM - normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl { + + # binutils sources not part of the bootstrap. + non-boot-src = (fetchurl { url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2"; - sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"; + sha256 = { + "2.31.1" = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"; + "2.34" = "1rin1f5c7wm4n3piky6xilcrpf2s0n3dd5vqq8irrxkcic3i1w49"; + }.${version}; }); + + # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM + normal-src = stdenv.__bootPackages.binutils-unwrapped.src or non-boot-src; + + # Platforms where we directly use the final source. + # Generally for cross-compiled platforms, where the boot source won't compile. + skipBootSrc = stdenv.targetPlatform.isOr1k; + + # Select the specific source according to the platform in use. + src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src + else if skipBootSrc then non-boot-src + else normal-src; + + patchesDir = ./patches + "/${minorVersion}"; in stdenv.mkDerivation { pname = targetPrefix + basename; - inherit version; - - src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src; + inherit src version; patches = [ # Make binutils output deterministic by default. - ./deterministic.patch + "${patchesDir}/deterministic.patch" # Bfd looks in BINDIR/../lib for some plugins that don't # exist. This is pointless (since users can't install plugins # there) and causes a cycle between the lib and bin outputs, so # get rid of it. - ./no-plugins.patch + "${patchesDir}/no-plugins.patch" # Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and # elf32-littlearm-vxworks in favor of the first. # https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766 - ./disambiguate-arm-targets.patch + "${patchesDir}/disambiguate-arm-targets.patch" # For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's # not clear why this behavior was decided upon but it has the unfortunate @@ -67,25 +87,30 @@ stdenv.mkDerivation { # shared objects when cross-compiling. Consequently, we are forced to # override this behavior, forcing ld to search DT_RPATH even when # cross-compiling. - ./always-search-rpath.patch - - ] ++ lib.optionals (!stdenv.targetPlatform.isVc4) - [ + "${patchesDir}/always-search-rpath.patch" + ] + # For version 2.31 exclusively + ++ lib.optionals (!stdenv.targetPlatform.isVc4 && minorVersion == "2.31") [ # https://sourceware.org/bugzilla/show_bug.cgi?id=22868 - ./gold-symbol-visibility.patch + ./patches/2.31/gold-symbol-visibility.patch # https://sourceware.org/bugzilla/show_bug.cgi?id=23428 # un-break features so linking against musl doesn't produce crash-only binaries - ./0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch - ./0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch - ./0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch - ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch; + ./patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch + ./patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch + ./patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch + ] + ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch + ; outputs = [ "out" "info" "man" ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ bison + ] ++ lib.optionals (lib.versionAtLeast version "2.34") [ + perl + texinfo ] ++ (lib.optionals stdenv.targetPlatform.isiOS [ autoreconfHook ]) ++ lib.optionals stdenv.targetPlatform.isVc4 [ texinfo flex ]; @@ -149,7 +174,7 @@ stdenv.mkDerivation { enableParallelBuilding = true; passthru = { - inherit targetPrefix; + inherit targetPrefix patchesDir; }; meta = with lib; { diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch diff --git a/pkgs/development/tools/misc/binutils/always-search-rpath.patch b/pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/always-search-rpath.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch diff --git a/pkgs/development/tools/misc/binutils/build-components-separately.patch b/pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/build-components-separately.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch diff --git a/pkgs/development/tools/misc/binutils/deterministic.patch b/pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/deterministic.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch diff --git a/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch b/pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch diff --git a/pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch b/pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch diff --git a/pkgs/development/tools/misc/binutils/no-plugins.patch b/pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/no-plugins.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch diff --git a/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch b/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch new file mode 100644 index 00000000000..2e9956e6b6e --- /dev/null +++ b/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch @@ -0,0 +1,14 @@ +diff --git a/ld/genscripts.sh b/ld/genscripts.sh +index b6940d376d..0feb1adfd0 100755 +--- a/ld/genscripts.sh ++++ b/ld/genscripts.sh +@@ -125,6 +125,9 @@ if test "x$NATIVE" = "xyes" ; then + USE_LIBPATH=yes + fi + ++# TODO: why is this needed? ++USE_LIBPATH=yes ++ + # Set the library search path, for libraries named by -lfoo. + # If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used. + # Otherwise, the default is set here. diff --git a/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch b/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch new file mode 100644 index 00000000000..38fa4934a28 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch @@ -0,0 +1,164 @@ +diff --git a/bfd/configure.ac b/bfd/configure.ac +index c5bfbd5d..45ad4c26 100644 +--- a/bfd/configure.ac ++++ b/bfd/configure.ac +@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, + + LT_LIB_M + +-# When building a shared libbfd, link against the pic version of libiberty +-# so that apps that use libbfd won't need libiberty just to satisfy any +-# libbfd references. +-# We can't do that if a pic libiberty is unavailable since including non-pic +-# code would insert text relocations into libbfd. + SHARED_LIBADD= +-SHARED_LDFLAGS= ++SHARED_LDFLAGS=-liberty + if test "$enable_shared" = "yes"; then +-changequote(,)dnl +- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` +-changequote([,])dnl +- if test -n "$x"; then +- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" +- fi +- + case "${host}" in + # More hacks to build DLLs on Windows. + *-*-cygwin*) + SHARED_LDFLAGS="-no-undefined" +- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32" ++ SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32" + ;; + + # Use built-in libintl on macOS, since it is not provided by libc. + *-*-darwin*) +- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl" ++ SHARED_LIBADD="-liberty -lintl" + ;; + esac + +diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am +index 4f06074a..6836c589 100644 +--- a/opcodes/Makefile.am ++++ b/opcodes/Makefile.am +@@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir) + endif + + # This is where bfd.h lives. +-BFD_H = ../bfd/bfd.h ++BFD_H = $(BFDDIR)/bfd.h + + BUILD_LIBS = @BUILD_LIBS@ + BUILD_LIB_DEPS = @BUILD_LIB_DEPS@ +@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@ + # development.sh is used to determine -Werror default. + CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh + +-AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@ ++AM_CPPFLAGS = -I. -I$(srcdir) -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@ + + disassemble.lo: disassemble.c + if am__fastdepCC +@@ -322,12 +322,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c + # old version of libbfd, or to pick up libbfd for the wrong architecture + # if host != build. So for building with shared libraries we use a + # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la. +-libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ ++libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ libtool-soversion + libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@ +-libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@ ++libopcodes_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@ + # Allow dependency tracking to work on all the source files. + EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES) + ++libtool-soversion: ++ @echo "creating $@" ++ bfd_soversion="$(VERSION)" ;\ ++ . $(BFDDIR)/development.sh ;\ ++ if test "$$development" = true ; then \ ++ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ ++ fi ;\ ++ echo "$${bfd_soversion}" > $@ ++ + # libtool will build .libs/libopcodes.a. We create libopcodes.a in + # the build directory so that we don't have to convert all the + # programs that use libopcodes.a simultaneously. This is a hack which +diff --git a/opcodes/configure.ac b/opcodes/configure.ac +index 00be9c88..6e589ae4 100644 +--- a/opcodes/configure.ac ++++ b/opcodes/configure.ac +@@ -86,6 +86,7 @@ AC_PROG_INSTALL + + AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h) + ACX_HEADER_STRING ++GCC_HEADER_STDINT(bfd_stdint.h) + + AC_CHECK_DECLS([basename, stpcpy]) + +@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, + + LT_LIB_M + +-#Libs for generator progs +-if test "x$cross_compiling" = "xno"; then +- BUILD_LIBS=../libiberty/libiberty.a +- BUILD_LIB_DEPS=$BUILD_LIBS +-else +- # if cross-compiling, assume that the system provides -liberty +- # and that the version is compatible with new headers. +- BUILD_LIBS=-liberty +- BUILD_LIB_DEPS= +-fi +-BUILD_LIBS="$BUILD_LIBS $LIBINTL" +-BUILD_LIB_DEPS="$BUILD_LIB_DEPS $LIBINTL_DEP" ++BUILD_LIBS="-liberty $LIBINTL" ++BUILD_LIB_DEPS="$LIBINTL_DEP" + + AC_SUBST(BUILD_LIBS) + AC_SUBST(BUILD_LIB_DEPS) + + # Horrible hacks to build DLLs on Windows and a shared library elsewhere. + SHARED_LDFLAGS= +-SHARED_LIBADD= ++SHARED_LIBADD=-liberty + SHARED_DEPENDENCIES= + if test "$enable_shared" = "yes"; then +-# When building a shared libopcodes, link against the pic version of libiberty +-# so that apps that use libopcodes won't need libiberty just to satisfy any +-# libopcodes references. +-# We can't do that if a pic libiberty is unavailable since including non-pic +-# code would insert text relocations into libopcodes. + # Note that linking against libbfd as we do here, which is itself linked + # against libiberty, may not satisfy all the libopcodes libiberty references + # since libbfd may not pull in the entirety of libiberty. +-changequote(,)dnl +- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` +-changequote([,])dnl +- if test -n "$x"; then +- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" +- fi +- + case "${host}" in + *-*-cygwin*) + SHARED_LDFLAGS="-no-undefined" +- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin" ++ SHARED_LIBADD="-lbfd -liberty -lintl -lcygwin" + ;; +- *-*-darwin*) +- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}" +- SHARED_DEPENDENCIES="../bfd/libbfd.la" +- ;; + *) +- case "$host_vendor" in +- hp) +- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}" +- ;; +- *) +- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}" +- ;; +- esac +- SHARED_DEPENDENCIES="../bfd/libbfd.la" ++ SHARED_LIBADD="-lbfd ${SHARED_LIBADD}" + ;; + esac + diff --git a/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch b/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch new file mode 100644 index 00000000000..736e0aca6ce --- /dev/null +++ b/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch @@ -0,0 +1,12 @@ +diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c +--- orig/ld/ldlang.c ++++ new/ld/ldlang.c +@@ -3095,6 +3095,8 @@ + ldfile_output_machine)) + einfo (_("%P%F:%s: can not set architecture: %E\n"), name); + ++ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT; ++ + link_info.hash = bfd_link_hash_table_create (link_info.output_bfd); + if (link_info.hash == NULL) + einfo (_("%P%F: can not create hash table: %E\n")); diff --git a/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch b/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch new file mode 100644 index 00000000000..abbfa73da05 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch @@ -0,0 +1,23 @@ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index 9f956d3..f5b61f1 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -19585,7 +19585,10 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) + #undef ELF_MAXPAGESIZE + #define ELF_MAXPAGESIZE 0x1000 + ++/* Prioritize elf32-*arm (priority 1) over elf32-*arm-vxworks (priority 2) */ ++#define elf_match_priority 2 + #include "elf32-target.h" ++#undef elf_match_priority + + + /* Merge backend specific data from an object file to the output +@@ -19974,4 +19977,7 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt, + #undef ELF_MAXPAGESIZE + #define ELF_MAXPAGESIZE 0x8000 + ++/* Prioritize elf32-*arm (priority 1) over elf32-*arm-symbian (priority 2) */ ++#define elf_match_priority 2 + #include "elf32-target.h" ++#undef elf_match_priority diff --git a/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch b/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch new file mode 100644 index 00000000000..68cf51b7dd3 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch @@ -0,0 +1,21 @@ +diff --git a/bfd/plugin.c b/bfd/plugin.c +index 537ab60311..bfe7957f96 100644 +--- a/bfd/plugin.c ++++ b/bfd/plugin.c +@@ -386,6 +386,7 @@ load_plugin (bfd *abfd) + if (plugin_program_name == NULL) + return found; + ++#if 0 + /* Try not to search the same dir twice, by looking at st_dev and + st_ino for the dir. If we are on a file system that always sets + st_ino to zero or the actual st_ino is zero we might waste some +@@ -437,7 +438,7 @@ load_plugin (bfd *abfd) + if (found) + break; + } +- ++#endif + return found; + } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f7a03558920..23ec68ce04b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10672,6 +10672,8 @@ in vc4-newlib = callPackage ../development/misc/vc4/newlib.nix {}; resim = callPackage ../misc/emulators/resim {}; + or1k-newlib = callPackage ../development/misc/or1k/newlib.nix {}; + rappel = callPackage ../development/misc/rappel/default.nix { }; pharo-vms = callPackage ../development/pharo/vm { }; @@ -12849,6 +12851,7 @@ in else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross else if name == "newlib" && stdenv.targetPlatform.isMsp430 then targetPackages.msp430NewlibCross or msp430NewlibCross else if name == "newlib" && stdenv.targetPlatform.isVc4 then targetPackages.vc4-newlib or vc4-newlib + else if name == "newlib" && stdenv.targetPlatform.isOr1k then targetPackages.or1k-newlib or or1k-newlib else if name == "newlib" then targetPackages.newlibCross or newlibCross else if name == "musl" then targetPackages.muslCross or muslCross else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64