Revert commits on binutils for OpenRISC 1000
This reverts commitsebd89f6de1
c6f6db77ac
257fb62387
dbe556af9c
This commit is contained in:
parent
5a25e3e7e9
commit
3205b32bf6
|
@ -10,7 +10,7 @@ stdenv.mkDerivation {
|
|||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = binutils-unwrapped.patches ++ [
|
||||
(binutils-unwrapped.patchesDir + "/build-components-separately.patch")
|
||||
../../tools/misc/binutils/build-components-separately.patch
|
||||
(fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
|
||||
sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";
|
||||
|
|
|
@ -10,7 +10,7 @@ stdenv.mkDerivation {
|
|||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = binutils-unwrapped.patches ++ [
|
||||
(binutils-unwrapped.patchesDir + "/build-components-separately.patch")
|
||||
../../tools/misc/binutils/build-components-separately.patch
|
||||
];
|
||||
|
||||
# We just want to build libopcodes
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
, bison ? null
|
||||
, flex
|
||||
, texinfo
|
||||
, perl
|
||||
}:
|
||||
|
||||
# Note: this package is used for bootstrapping fetchurl, and thus
|
||||
|
@ -22,10 +21,7 @@ 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 = "${minorVersion}${patchVersion}";
|
||||
minorVersion = if stdenv.targetPlatform.isOr1k then "2.34" else "2.31";
|
||||
patchVersion = if stdenv.targetPlatform.isOr1k then "" else ".1";
|
||||
|
||||
version = "2.31.1";
|
||||
basename = "binutils";
|
||||
# The targetPrefix prepended to binary names to allow multiple binuntils on the
|
||||
# PATH to both be usable.
|
||||
|
@ -37,49 +33,33 @@ let
|
|||
rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
|
||||
sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
|
||||
};
|
||||
|
||||
# binutils sources not part of the bootstrap.
|
||||
non-boot-src = (fetchurl {
|
||||
url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2";
|
||||
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}";
|
||||
normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
|
||||
url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2";
|
||||
sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
|
||||
});
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = targetPrefix + basename;
|
||||
inherit src version;
|
||||
inherit version;
|
||||
|
||||
src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src;
|
||||
|
||||
patches = [
|
||||
# Make binutils output deterministic by default.
|
||||
"${patchesDir}/deterministic.patch"
|
||||
./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.
|
||||
"${patchesDir}/no-plugins.patch"
|
||||
./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
|
||||
"${patchesDir}/disambiguate-arm-targets.patch"
|
||||
./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
|
||||
|
@ -87,38 +67,33 @@ 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.
|
||||
"${patchesDir}/always-search-rpath.patch"
|
||||
]
|
||||
# For version 2.31 exclusively
|
||||
++ lib.optionals (!stdenv.targetPlatform.isVc4 && minorVersion == "2.31") [
|
||||
./always-search-rpath.patch
|
||||
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isVc4)
|
||||
[
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=22868
|
||||
./patches/2.31/gold-symbol-visibility.patch
|
||||
./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
|
||||
./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
|
||||
++ # This patch was suggested by Nick Clifton to fix
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
# It can be removed when that 7-year-old bug is closed.
|
||||
# This binutils bug causes GHC to emit broken binaries on armv7, and
|
||||
# indeed GHC will refuse to compile with a binutils suffering from it. See
|
||||
# this comment for more information:
|
||||
# https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
|
||||
lib.optional stdenv.targetPlatform.isAarch32 ./R_ARM_COPY.patch
|
||||
;
|
||||
./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
|
||||
++ # This patch was suggested by Nick Clifton to fix
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
# It can be removed when that 7-year-old bug is closed.
|
||||
# This binutils bug causes GHC to emit broken binaries on armv7, and
|
||||
# indeed GHC will refuse to compile with a binutils suffering from it. See
|
||||
# this comment for more information:
|
||||
# https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
|
||||
lib.optional stdenv.targetPlatform.isAarch32 ./R_ARM_COPY.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 ];
|
||||
|
@ -182,7 +157,7 @@ stdenv.mkDerivation {
|
|||
enableParallelBuilding = true;
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix patchesDir;
|
||||
inherit targetPrefix;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
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.
|
|
@ -1,164 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
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"));
|
|
@ -1,23 +0,0 @@
|
|||
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
|
|
@ -1,21 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
Loading…
Reference in a new issue