1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

binutils: Upgrade to 2.33.1

Drop CVE patches which are already available on binutils-2_33-branch
Forward port rest of the patches

(From OE-Core rev: 7bcfce05045fb7e10456aa1f5301e70c178f20d7)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2019-12-08 00:37:59 -08:00
committed by Richard Purdie
parent 50fec7cce5
commit cf872ba730
32 changed files with 719 additions and 1434 deletions
@@ -16,15 +16,15 @@ def binutils_branch_version(d):
# When upgrading to 2.33, please make sure there is no trailing .0, so
# that upstream version check can work correctly.
PV = "2.32.0"
CVE_VERSION = "2.32"
PV = "2.33.1"
CVE_VERSION = "2.33"
BINUPV = "${@binutils_branch_version(d)}"
#BRANCH = "binutils-${BINUPV}-branch"
BRANCH ?= "binutils-2_32-branch"
BRANCH ?= "binutils-2_33-branch"
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
SRCREV ?= "b8c1f608db9ef3edd483d21a921d1fbedc71df6f"
SRCREV ?= "c656f9a430636a6a7fc7a08c0e08f0098a729a02"
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git"
SRC_URI = "\
${BINUTILS_GIT_URI} \
@@ -41,14 +41,6 @@ SRC_URI = "\
file://0013-Detect-64-bit-MIPS-targets.patch \
file://0014-sync-with-OE-libtool-changes.patch \
file://0015-binutils-enable-x86_64-pep-for-producing-EFI-binarie.patch \
file://CVE-2019-9074.patch \
file://CVE-2019-9075.patch \
file://CVE-2019-9076.patch \
file://CVE-2019-9077.patch \
file://CVE-2019-9071.patch \
file://CVE-2019-12972.patch \
file://CVE-2019-14250.patch \
file://CVE-2019-14444.patch \
file://CVE-2019-17450.patch \
file://CVE-2019-17451.patch \
"
@@ -1,7 +1,7 @@
From 5bcd884f8af5106d0fa380c42cffe07f3c993ed2 Mon Sep 17 00:00:00 2001
From c9aed4cb3c02715b2ba1fc70949043849f202f46 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:58:54 +0000
Subject: [PATCH 01/15] binutils-crosssdk: Generate relocatable SDKs
Date: Sun, 8 Dec 2019 00:31:35 -0800
Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs
This patch will modify the ELF linker scripts so that the crosssdk
linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries
@@ -18,35 +18,35 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 77ddbbc8f8..d789e77943 100755
index cb2b081e9e..db2e9fd569 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -310,6 +310,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
@@ -325,6 +325,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
LD_FLAG=r
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
+PARTIAL_LINKING=" "
( echo "/* Script for ld -r: link without relocation */"
. ${CUSTOMIZER_SCRIPT}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
@@ -318,10 +319,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
@@ -333,10 +334,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
LD_FLAG=u
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
CONSTRUCTING=" "
+PARTIAL_LINKING=" "
( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */"
. ${CUSTOMIZER_SCRIPT}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
+unset PARTIAL_LINKING
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
RELOCATING=" "
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index bd7584120e..8bbe052d4b 100644
index f9f0f7d402..9e469dca86 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -139,8 +139,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
@@ -140,8 +140,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
fi
fi
@@ -57,6 +57,3 @@ index bd7584120e..8bbe052d4b 100644
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
--
2.20.1
@@ -1,8 +1,7 @@
From 11927913560fc5a5d51af3bc5eb8ad62a86c9840 Mon Sep 17 00:00:00 2001
From 9fe5a2dd03fdf2986c89dd58ae48c0095f1c0411 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Mar 2017 23:37:05 -0800
Subject: [PATCH 02/15] binutils-cross: Do not generate linker script
directories
Subject: [PATCH] binutils-cross: Do not generate linker script directories
We don't place target libraries within ${exec_prefix}, we'd always place these
within the target sysroot within the standard library directories. Worse, the
@@ -23,10 +22,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 25 deletions(-)
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index d789e77943..144e2e8736 100755
index c90f38a63c..97ad1a24d6 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -220,31 +220,6 @@ append_to_lib_path()
@@ -235,31 +235,6 @@ append_to_lib_path()
fi
}
@@ -58,6 +57,3 @@ index d789e77943..144e2e8736 100755
if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
libs=${NATIVE_LIB_DIRS}
if [ "x${NATIVE}" = "xyes" ] ; then
--
2.20.1
@@ -1,7 +1,7 @@
From da3939de6fb36da2c6484f14f08a37be195d9dc3 Mon Sep 17 00:00:00 2001
From aecded290b2ec0b469c70fc6b062bd5ee6ba5e3a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:07:33 +0000
Subject: [PATCH 03/15] configure: widen the regexp for SH architectures
Subject: [PATCH] configure: widen the regexp for SH architectures
gprof needs to know about uclibc
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 3747645961..78b5240101 100755
index 6a9719f609..001523eebf 100755
--- a/configure
+++ b/configure
@@ -3861,7 +3861,7 @@ case "${target}" in
@@ -3865,7 +3865,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
@@ -27,7 +27,7 @@ index 3747645961..78b5240101 100755
sh*-*-elf)
;;
diff --git a/gprof/configure b/gprof/configure
index f84efaba20..ab32bab2b6 100755
index cbb3aced46..b5eabceb77 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -6162,6 +6162,11 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
@@ -42,6 +42,3 @@ index f84efaba20..ab32bab2b6 100755
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
--
2.20.1
@@ -1,7 +1,7 @@
From fc1ff860fd88fa2d0584bd19181c880a76331a8d Mon Sep 17 00:00:00 2001
From a9332107872ada73e72e92872ea2998a4e1495e0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:09:58 +0000
Subject: [PATCH 04/15] Point scripts location to libdir
Subject: [PATCH] Point scripts location to libdir
Upstream-Status: Inappropriate [debian patch]
@@ -12,10 +12,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index c2c798b4fe..d7faf19271 100644
index ddc7a78368..6fa7bf2583 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -57,7 +57,7 @@ endif
@@ -63,7 +63,7 @@ endif
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
@@ -25,10 +25,10 @@ index c2c798b4fe..d7faf19271 100644
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index fc687fc516..8b14f5236c 100644
index fdf06128b2..5c108b9e05 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
@@ -572,7 +572,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
@@ -37,6 +37,3 @@ index fc687fc516..8b14f5236c 100644
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
--
2.20.1
@@ -1,8 +1,7 @@
From 66861bff389434e3454c7650ee29fade7a1cc5ed Mon Sep 17 00:00:00 2001
From 65fb7a33aba30dec8690e0a237efaa3b9649154c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:27:17 +0000
Subject: [PATCH 05/15] Only generate an RPATH entry if LD_RUN_PATH is not
empty
Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
for cases where -rpath isn't specified. debian (#151024)
@@ -14,20 +13,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ld/emultempl/elf32.em | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index f4f7ad6b4e..cfd787ff28 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1471,6 +1471,8 @@ fragment <<EOF
@@ -1470,6 +1470,8 @@ fragment <<EOF
&& command_line.rpath == NULL)
{
path = (const char *) getenv ("LD_RUN_PATH");
+ if ((path) && (strlen (path) == 0))
+ path = NULL;
+ path = NULL;
if (path
&& gld${EMULATION_NAME}_search_needed (path, &n, force))
break;
@@ -1746,6 +1748,8 @@ gld${EMULATION_NAME}_before_allocation (void)
@@ -1745,6 +1747,8 @@ gld${EMULATION_NAME}_before_allocation (
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
@@ -36,6 +33,3 @@ index f4f7ad6b4e..cfd787ff28 100644
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
--
2.20.1
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,8 @@
From 8cb013106c379e81fe40cfdf486d9805c9e276ad Mon Sep 17 00:00:00 2001
From cd6151c8423a0550fd5758ce17664e34560a103c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:39:01 +0000
Subject: [PATCH 07/15] don't let the distro compiler point to the wrong
installation location
Subject: [PATCH] don't let the distro compiler point to the wrong installation
location
Thanks to RP for helping find the source code causing the issue.
@@ -30,6 +30,3 @@ index 0be45b4ae8..4817616bb2 100644
install_to_libdir: all
if test -n "${target_header_dir}"; then \
${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \
--
2.20.1
@@ -1,7 +1,7 @@
From 98f68c0892ba4bbd53b0a0a4cbbdf0b7197e0320 Mon Sep 17 00:00:00 2001
From 8ee1a4986ea35bd1e8ab867c5639d5fdbd944d9f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 15 Jan 2016 06:31:09 +0000
Subject: [PATCH 08/15] warn for uses of system directories when cross linking
Subject: [PATCH] warn for uses of system directories when cross linking
2008-07-02 Joseph Myers <joseph@codesourcery.com>
@@ -62,8 +62,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ld/lexsup.c | 16 ++++++++++++++++
9 files changed, 86 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index d93c9b0830..5da2742bea 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -31,6 +31,9 @@
@@ -76,11 +74,9 @@ index d93c9b0830..5da2742bea 100644
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index 43c391c2b3..ff9f6b3c02 100755
--- a/ld/configure
+++ b/ld/configure
@@ -826,6 +826,7 @@ with_lib_path
@@ -827,6 +827,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
@@ -88,7 +84,7 @@ index 43c391c2b3..ff9f6b3c02 100755
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1490,6 +1491,8 @@ Optional Features:
@@ -1491,6 +1492,8 @@ Optional Features:
--disable-largefile omit support for large files
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
@@ -97,7 +93,7 @@ index 43c391c2b3..ff9f6b3c02 100755
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -16618,6 +16621,19 @@ fi
@@ -16619,6 +16622,19 @@ fi
@@ -117,8 +113,6 @@ index 43c391c2b3..ff9f6b3c02 100755
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
enableval=$enable_gold; case "${enableval}" in
diff --git a/ld/configure.ac b/ld/configure.ac
index d335f21091..7f692d9387 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
@@ -138,8 +132,6 @@ index d335f21091..7f692d9387 100644
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index b97d977f37..f3bbd2d55d 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -180,6 +180,14 @@ typedef struct
@@ -157,11 +149,9 @@ index b97d977f37..f3bbd2d55d 100644
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index 5179af3e0e..f78bf74682 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2524,6 +2524,18 @@ string identifying the original linked file does not change.
@@ -2557,6 +2557,18 @@ string identifying the original linked f
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
@@ -180,11 +170,9 @@ index 5179af3e0e..f78bf74682 100644
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index fcadc08c73..63e295ce8a 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *nam
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
@@ -208,24 +196,20 @@ index fcadc08c73..63e295ce8a 100644
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 32853debe4..8135361c49 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -148,6 +148,8 @@ enum option_values
OPTION_REQUIRE_DEFINED_SYMBOL,
OPTION_ORPHAN_HANDLING,
@@ -150,6 +150,8 @@ enum option_values
OPTION_FORCE_GROUP_ALLOCATION,
OPTION_PRINT_MAP_DISCARDED,
OPTION_NO_PRINT_MAP_DISCARDED,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 77cdbd0dd2..725512f126 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -269,6 +269,8 @@ main (int argc, char **argv)
@@ -270,6 +270,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = TRUE;
command_line.warn_search_mismatch = TRUE;
command_line.check_section_addresses = -1;
@@ -234,13 +218,11 @@ index 77cdbd0dd2..725512f126 100644
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 88e85c73f4..eed1b71456 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -543,6 +543,14 @@ static const struct ld_option ld_options[] =
{ {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
'\0', N_("=MODE"), N_("Control how orphan sections are handled."),
@@ -549,6 +549,14 @@ static const struct ld_option ld_options
{ {"no-print-map-discarded", no_argument, NULL, OPTION_NO_PRINT_MAP_DISCARDED},
'\0', NULL, N_("Do not show discarded sections in map file output"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
@@ -253,10 +235,10 @@ index 88e85c73f4..eed1b71456 100644
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -1577,6 +1585,14 @@ parse_args (unsigned argc, char **argv)
einfo (_("%F%P: invalid argument to option"
" \"--orphan-handling\"\n"));
break;
@@ -1590,6 +1598,13 @@ parse_args (unsigned argc, char **argv)
case OPTION_PRINT_MAP_DISCARDED:
config.print_map_discarded = TRUE;
+
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = FALSE;
@@ -264,10 +246,6 @@ index 88e85c73f4..eed1b71456 100644
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = TRUE;
+ break;
break;
}
}
--
2.20.1
@@ -1,7 +1,7 @@
From 2cd5613a86f8772f9d7f188532718363668ed99d Mon Sep 17 00:00:00 2001
From 903a43f07b7229adadff0f01d560646eb4b0e200 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:42:38 +0000
Subject: [PATCH 09/15] Fix rpath in libtool when sysroot is enabled
Subject: [PATCH] Fix rpath in libtool when sysroot is enabled
Enabling sysroot support in libtool exposed a bug where the final
library had an RPATH encoded into it which still pointed to the
@@ -47,6 +47,3 @@ index 70e856e065..11ee684ccc 100644
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
--
2.20.1
@@ -1,7 +1,7 @@
From 958a49749b772660d3bafb80748829cba6bed065 Mon Sep 17 00:00:00 2001
From 84349ede307f61d624e5d97397074f5177a5bdc9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:44:14 +0000
Subject: [PATCH 10/15] Change default emulation for mips64*-*-linux
Subject: [PATCH] Change default emulation for mips64*-*-linux
we change the default emulations to be N64 instead of N32
@@ -13,11 +13,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ld/configure.tgt | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 0e1ddb659c..d4f50f0a8d 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -919,12 +919,12 @@ case "${targ}" in
@@ -915,12 +915,12 @@ case "${targ}" in
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
mips64*el-*-linux*)
@@ -30,15 +28,13 @@ index 0e1ddb659c..d4f50f0a8d 100644
- targ_defvec=mips_elf32_ntrad_be_vec
- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+ targ_defvec=mips_elf64_trad_be_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_be_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
;;
mips*el-*-linux*)
targ_defvec=mips_elf32_trad_le_vec
diff --git a/ld/configure.tgt b/ld/configure.tgt
index beba17ef51..917be6f8eb 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -468,11 +468,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmipvxworks
@@ -468,11 +468,11 @@ mips*el-*-vxworks*) targ_emul=elf32elmip
mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
targ_extra_emuls="elf32elmipvxworks" ;;
mips*-*-windiss) targ_emul=elf32mipswindiss ;;
@@ -1,7 +1,7 @@
From e4a0cd30c7e9334ed507c93014a8b2d1315ff937 Mon Sep 17 00:00:00 2001
From 97e0fdbf8e85a7e690ac09d01a2ae93ba00cfb5d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 14 Feb 2016 17:06:19 +0000
Subject: [PATCH 11/15] Add support for Netlogic XLP
Subject: [PATCH] Add support for Netlogic XLP
Patch From: Nebu Philips <nphilips@netlogicmicro.com>
@@ -28,16 +28,14 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
gas/configure | 3 +++
include/elf/mips.h | 1 +
include/opcode/mips.h | 6 ++++++
ld/configure.tgt | 2 ++
ld/configure.tgt | 3 +++
opcodes/mips-dis.c | 12 +++++-------
opcodes/mips-opc.c | 31 ++++++++++++++++++++-----------
14 files changed, 61 insertions(+), 21 deletions(-)
14 files changed, 62 insertions(+), 21 deletions(-)
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index e5d8dcf390..2cc74a2d61 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -799,6 +799,7 @@ NAME (aout, machine_type) (enum bfd_architecture arch,
@@ -799,6 +799,7 @@ NAME (aout, machine_type) (enum bfd_arch
case bfd_mach_mipsisa64r6:
case bfd_mach_mips_sb1:
case bfd_mach_mips_xlr:
@@ -45,8 +43,6 @@ index e5d8dcf390..2cc74a2d61 100644
/* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
arch_flags = M_MIPS2;
break;
diff --git a/bfd/archures.c b/bfd/archures.c
index 647cf0d8d4..7e1d0c810f 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -185,6 +185,7 @@ DESCRIPTION
@@ -57,11 +53,9 @@ index 647cf0d8d4..7e1d0c810f 100644
.#define bfd_mach_mipsisa32 32
.#define bfd_mach_mipsisa32r2 33
.#define bfd_mach_mipsisa32r3 34
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index e25da50aaf..e251d7e7aa 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2084,6 +2084,7 @@ enum bfd_architecture
@@ -2125,6 +2125,7 @@ enum bfd_architecture
#define bfd_mach_mips_octeon3 6503
#define bfd_mach_mips_xlr 887682 /* decimal 'XLR'. */
#define bfd_mach_mips_interaptiv_mr2 736550 /* decimal 'IA2'. */
@@ -69,11 +63,9 @@ index e25da50aaf..e251d7e7aa 100644
#define bfd_mach_mipsisa32 32
#define bfd_mach_mipsisa32r2 33
#define bfd_mach_mipsisa32r3 34
diff --git a/bfd/config.bfd b/bfd/config.bfd
index cc65547588..3614ff79d4 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -902,6 +902,11 @@ case "${targ}" in
@@ -898,6 +898,11 @@ case "${targ}" in
targ_defvec=mips_elf32_le_vec
targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec"
;;
@@ -85,8 +77,6 @@ index cc65547588..3614ff79d4 100644
mips*-*-elf* | mips*-*-rtems* | mips*-*-windiss | mips*-*-none)
targ_defvec=mips_elf32_be_vec
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec"
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index b359491305..61a3e7aaca 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -107,7 +107,8 @@ enum
@@ -99,21 +89,19 @@ index b359491305..61a3e7aaca 100644
};
#define NN(index) (&arch_info_struct[(index) + 1])
@@ -162,7 +163,8 @@ static const bfd_arch_info_type arch_info_struct[] =
@@ -162,7 +163,8 @@ static const bfd_arch_info_type arch_inf
N (64, 64, bfd_mach_mips_xlr, "mips:xlr", FALSE, NN(I_xlr)),
N (32, 32, bfd_mach_mips_interaptiv_mr2, "mips:interaptiv-mr2", FALSE,
NN(I_interaptiv_mr2)),
- N (64, 64, bfd_mach_mips_micromips,"mips:micromips",FALSE,0)
+ N (64, 64, bfd_mach_mips_micromips,"mips:micromips",FALSE,NN(I_micromips)),
+ N (64, 64, bfd_mach_mips_xlp, "mips:xlp", FALSE, 0)
+ N (64, 64, bfd_mach_mips_micromips, "mips:micromips", FALSE, NN(I_micromips)),
+ N (64, 64, bfd_mach_mips_xlp, "mips:xlp", FALSE, NULL)
};
/* The default architecture is mips:3000, but with a machine number of
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 5998bc43a8..0d5795222b 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -6919,6 +6919,9 @@ _bfd_elf_mips_mach (flagword flags)
@@ -6999,6 +6999,9 @@ _bfd_elf_mips_mach (flagword flags)
case E_MIPS_MACH_IAMR2:
return bfd_mach_mips_interaptiv_mr2;
@@ -123,7 +111,7 @@ index 5998bc43a8..0d5795222b 100644
default:
switch (flags & EF_MIPS_ARCH)
{
@@ -12199,6 +12202,10 @@ mips_set_isa_flags (bfd *abfd)
@@ -12360,6 +12363,10 @@ mips_set_isa_flags (bfd *abfd)
val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON2;
break;
@@ -134,7 +122,7 @@ index 5998bc43a8..0d5795222b 100644
case bfd_mach_mipsisa32:
val = E_MIPS_ARCH_32;
break;
@@ -14214,6 +14221,7 @@ static const struct mips_mach_extension mips_mach_extensions[] =
@@ -14394,6 +14401,7 @@ static const struct mips_mach_extension
{ bfd_mach_mips_gs264e, bfd_mach_mips_gs464e },
{ bfd_mach_mips_gs464e, bfd_mach_mips_gs464 },
{ bfd_mach_mips_gs464, bfd_mach_mipsisa64r2 },
@@ -142,11 +130,9 @@ index 5998bc43a8..0d5795222b 100644
/* MIPS64 extensions. */
{ bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 },
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b13eb6a43b..9df3742682 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -3412,6 +3412,7 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine)
@@ -3446,6 +3446,7 @@ get_machine_flags (Filedata * filedata,
case E_MIPS_MACH_OCTEON3: strcat (buf, ", octeon3"); break;
case E_MIPS_MACH_XLR: strcat (buf, ", xlr"); break;
case E_MIPS_MACH_IAMR2: strcat (buf, ", interaptiv-mr2"); break;
@@ -154,11 +140,9 @@ index b13eb6a43b..9df3742682 100644
case 0:
/* We simply ignore the field in this case to avoid confusion:
MIPS ELF does not specify EF_MIPS_MACH, it is a GNU
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index ae55904229..d6882712f5 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -554,6 +554,7 @@ static int mips_32bitmode = 0;
@@ -568,6 +568,7 @@ static int mips_32bitmode = 0;
|| mips_opts.arch == CPU_RM7000 \
|| mips_opts.arch == CPU_VR5500 \
|| mips_opts.micromips \
@@ -166,7 +150,7 @@ index ae55904229..d6882712f5 100644
)
/* Whether the processor uses hardware interlocks to protect reads
@@ -583,6 +584,7 @@ static int mips_32bitmode = 0;
@@ -597,6 +598,7 @@ static int mips_32bitmode = 0;
&& mips_opts.isa != ISA_MIPS3) \
|| mips_opts.arch == CPU_R4300 \
|| mips_opts.micromips \
@@ -174,20 +158,18 @@ index ae55904229..d6882712f5 100644
)
/* Whether the processor uses hardware interlocks to protect reads
@@ -19867,7 +19869,7 @@ static const struct mips_cpu_info mips_cpu_info_table[] =
@@ -20138,7 +20140,7 @@ static const struct mips_cpu_info mips_c
/* Broadcom XLP.
XLP is mostly like XLR, with the prominent exception that it is
MIPS64R2 rather than MIPS64. */
- { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLR },
+ { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLP },
/* MIPS 64 Release 6 */
{ "i6400", 0, ASE_MSA, ISA_MIPS64R6, CPU_MIPS64R6},
diff --git a/gas/configure b/gas/configure
index a82fde7fa8..afc77c347a 100755
/* MIPS 64 Release 6. */
{ "i6400", 0, ASE_VIRT | ASE_MSA, ISA_MIPS64R6, CPU_MIPS64R6},
--- a/gas/configure
+++ b/gas/configure
@@ -13364,6 +13364,9 @@ _ACEOF
@@ -13377,6 +13377,9 @@ _ACEOF
mipsisa64r6 | mipsisa64r6el)
mips_cpu=mips64r6
;;
@@ -197,8 +179,6 @@ index a82fde7fa8..afc77c347a 100755
mipstx39 | mipstx39el)
mips_cpu=r3900
;;
diff --git a/include/elf/mips.h b/include/elf/mips.h
index b76d450ae2..7cddb365ad 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -290,6 +290,7 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
@@ -209,11 +189,9 @@ index b76d450ae2..7cddb365ad 100644
#define E_MIPS_MACH_OCTEON2 0x008d0000
#define E_MIPS_MACH_OCTEON3 0x008e0000
#define E_MIPS_MACH_5400 0x00910000
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index abd52c8980..53b6752a1c 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -1260,6 +1260,8 @@ static const unsigned int mips_isa_table[] = {
@@ -1260,6 +1260,8 @@ static const unsigned int mips_isa_table
#define INSN_XLR 0x00000020
/* Imagination interAptiv MR2. */
#define INSN_INTERAPTIV_MR2 0x04000000
@@ -222,7 +200,7 @@ index abd52c8980..53b6752a1c 100644
/* DSP ASE */
#define ASE_DSP 0x00000001
@@ -1381,6 +1383,7 @@ static const unsigned int mips_isa_table[] = {
@@ -1384,6 +1386,7 @@ static const unsigned int mips_isa_table
#define CPU_OCTEON3 6503
#define CPU_XLR 887682 /* decimal 'XLR' */
#define CPU_INTERAPTIV_MR2 736550 /* decimal 'IA2' */
@@ -230,7 +208,7 @@ index abd52c8980..53b6752a1c 100644
/* Return true if the given CPU is included in INSN_* mask MASK. */
@@ -1458,6 +1461,9 @@ cpu_is_member (int cpu, unsigned int mask)
@@ -1461,6 +1464,9 @@ cpu_is_member (int cpu, unsigned int mas
return ((mask & INSN_ISA_MASK) == INSN_ISA32R6)
|| ((mask & INSN_ISA_MASK) == INSN_ISA64R6);
@@ -240,11 +218,9 @@ index abd52c8980..53b6752a1c 100644
default:
return FALSE;
}
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 917be6f8eb..347df6c3f6 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -454,6 +454,8 @@ mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
@@ -454,6 +454,8 @@ mips*el-sde-elf* | mips*el-mti-elf* | mi
mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
targ_emul=elf32btsmip
targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" ;;
@@ -253,11 +229,9 @@ index 917be6f8eb..347df6c3f6 100644
mips64*el-ps2-elf*) targ_emul=elf32lr5900n32
targ_extra_emuls="elf32lr5900"
targ_extra_libpath=$targ_extra_emuls ;;
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 0dd85e3779..1ea708dde7 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -673,13 +673,11 @@ const struct mips_arch_choice mips_arch_choices[] =
@@ -673,13 +673,11 @@ const struct mips_arch_choice mips_arch_
mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr),
mips_cp1_names_mips3264, mips_hwr_names_numeric },
@@ -276,8 +250,6 @@ index 0dd85e3779..1ea708dde7 100644
/* This entry, mips16, is here only for ISA/processor selection; do
not print its name. */
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 837da6bd99..d3ea5b8877 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -328,6 +328,7 @@ decode_mips_operand (const char *p)
@@ -288,7 +260,7 @@ index 837da6bd99..d3ea5b8877 100644
#define IVIRT ASE_VIRT
#define IVIRT64 ASE_VIRT64
@@ -989,6 +990,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -990,6 +991,7 @@ const struct mips_opcode mips_builtin_op
{"clo", "U,s", 0x70000021, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, I37 },
{"clz", "d,s", 0x00000050, 0xfc1f07ff, WR_1|RD_2, 0, I37, 0, 0 },
{"clz", "U,s", 0x70000020, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, I37 },
@@ -296,7 +268,7 @@ index 837da6bd99..d3ea5b8877 100644
/* ctc0 is at the bottom of the table. */
{"ctc1", "t,G", 0x44c00000, 0xffe007ff, RD_1|WR_CC|CM, 0, I1, 0, 0 },
{"ctc1", "t,S", 0x44c00000, 0xffe007ff, RD_1|WR_CC|CM, 0, I1, 0, 0 },
@@ -1021,12 +1023,13 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1022,12 +1024,13 @@ const struct mips_opcode mips_builtin_op
{"daddiu", "t,r,j", 0x64000000, 0xfc000000, WR_1|RD_2, 0, I3, 0, 0 },
{"daddu", "d,v,t", 0x0000002d, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I3, 0, 0 },
{"daddu", "t,r,I", 0, (int) M_DADDU_I, INSN_MACRO, 0, I3, 0, 0 },
@@ -311,7 +283,7 @@ index 837da6bd99..d3ea5b8877 100644
/* dctr and dctw are used on the r5000. */
{"dctr", "o(b)", 0xbc050000, 0xfc1f0000, RD_2, 0, I3, 0, 0 },
{"dctw", "o(b)", 0xbc090000, 0xfc1f0000, RD_2, 0, I3, 0, 0 },
@@ -1098,6 +1101,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1099,6 +1102,7 @@ const struct mips_opcode mips_builtin_op
{"dmfc0", "t,G,H", 0x40200000, 0xffe007f8, WR_1|RD_C0|LC, 0, I64, 0, 0 },
{"dmfgc0", "t,G", 0x40600100, 0xffe007ff, WR_1|RD_C0|LC, 0, 0, IVIRT64, 0 },
{"dmfgc0", "t,G,H", 0x40600100, 0xffe007f8, WR_1|RD_C0|LC, 0, 0, IVIRT64, 0 },
@@ -319,7 +291,7 @@ index 837da6bd99..d3ea5b8877 100644
{"dmt", "", 0x41600bc1, 0xffffffff, TRAP, 0, 0, MT32, 0 },
{"dmt", "t", 0x41600bc1, 0xffe0ffff, WR_1|TRAP, 0, 0, MT32, 0 },
{"dmtc0", "t,G", 0x40a00000, 0xffe007ff, RD_1|WR_C0|WR_CC|CM, 0, I3, 0, EE },
@@ -1113,6 +1117,8 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1114,6 +1118,8 @@ const struct mips_opcode mips_builtin_op
/* dmfc3 is at the bottom of the table. */
/* dmtc3 is at the bottom of the table. */
{"dmuh", "d,s,t", 0x000000dc, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I69, 0, 0 },
@@ -328,7 +300,7 @@ index 837da6bd99..d3ea5b8877 100644
{"dmul", "d,s,t", 0x0000009c, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I69, 0, 0 },
{"dmul", "d,v,t", 0x70000003, 0xfc0007ff, WR_1|RD_2|RD_3|WR_HILO, 0, IOCT, 0, 0 },
{"dmul", "d,v,t", 0, (int) M_DMUL, INSN_MACRO, 0, I3, 0, M32|I69 },
@@ -1266,9 +1272,9 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1267,9 +1273,9 @@ const struct mips_opcode mips_builtin_op
{"ld", "s,-b(+R)", 0xec180000, 0xfc1c0000, WR_1, RD_pc, I69, 0, 0 },
{"ld", "t,A(b)", 0, (int) M_LD_AB, INSN_MACRO, 0, I1, 0, 0 },
{"ld", "t,o(b)", 0xdc000000, 0xfc000000, WR_1|RD_3|LM, 0, I3, 0, 0 },
@@ -341,7 +313,7 @@ index 837da6bd99..d3ea5b8877 100644
{"ldc1", "T,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF },
{"ldc1", "E,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF },
{"ldc1", "T,A(b)", 0, (int) M_LDC1_AB, INSN_MACRO, INSN2_M_FP_D, I2, 0, SF },
@@ -1433,7 +1439,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1438,7 +1444,7 @@ const struct mips_opcode mips_builtin_op
{"mflo", "d,9", 0x00000012, 0xff9f07ff, WR_1|RD_LO, 0, 0, D32, 0 },
{"mflo1", "d", 0x70000012, 0xffff07ff, WR_1|RD_LO, 0, EE, 0, 0 },
{"mflhxu", "d", 0x00000052, 0xffff07ff, WR_1|MOD_HILO, 0, 0, SMT, 0 },
@@ -350,7 +322,7 @@ index 837da6bd99..d3ea5b8877 100644
{"mfsa", "d", 0x00000028, 0xffff07ff, WR_1, 0, EE, 0, 0 },
{"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, SB1, MX, 0 },
{"min.ob", "D,S,Q", 0x48000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, N54, 0, 0 },
@@ -1478,10 +1484,13 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1483,10 +1489,13 @@ const struct mips_opcode mips_builtin_op
/* move is at the top of the table. */
{"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, 0, MX, 0 },
{"msgsnd", "t", 0, (int) M_MSGSND, INSN_MACRO, 0, XLR, 0, 0 },
@@ -366,7 +338,7 @@ index 837da6bd99..d3ea5b8877 100644
{"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, WR_1|RD_2|RD_3|RD_4|FP_D, 0, I4_33, 0, I37 },
{"msub.d", "D,S,T", 0x46200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2E, 0, 0 },
{"msub.d", "D,S,T", 0x72200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2F, 0, 0 },
@@ -1531,7 +1540,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1536,7 +1545,7 @@ const struct mips_opcode mips_builtin_op
{"mtlo", "s,7", 0x00000013, 0xfc1fe7ff, RD_1|WR_LO, 0, 0, D32, 0 },
{"mtlo1", "s", 0x70000013, 0xfc1fffff, RD_1|WR_LO, 0, EE, 0, 0 },
{"mtlhx", "s", 0x00000053, 0xfc1fffff, RD_1|MOD_HILO, 0, 0, SMT, 0 },
@@ -375,7 +347,7 @@ index 837da6bd99..d3ea5b8877 100644
{"mtm0", "s", 0x70000008, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 },
{"mtm0", "s,t", 0x70000008, 0xfc00ffff, RD_1|RD_2, 0, IOCT3, 0, 0 },
{"mtm1", "s", 0x7000000c, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 },
@@ -1968,9 +1977,9 @@ const struct mips_opcode mips_builtin_opcodes[] =
@@ -1978,9 +1987,9 @@ const struct mips_opcode mips_builtin_op
{"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, RD_1|RD_2|RD_3|SM|FP_D, 0, I5_33|N55, 0, I37},
{"sw", "t,o(b)", 0xac000000, 0xfc000000, RD_1|RD_3|SM, 0, I1, 0, 0 },
{"sw", "t,A(b)", 0, (int) M_SW_AB, INSN_MACRO, 0, I1, 0, 0 },
@@ -388,6 +360,3 @@ index 837da6bd99..d3ea5b8877 100644
{"swc0", "E,o(b)", 0xe0000000, 0xfc000000, RD_3|RD_C0|SM, 0, I1, 0, IOCT|IOCTP|IOCT2|I37 },
{"swc0", "E,A(b)", 0, (int) M_SWC0_AB, INSN_MACRO, 0, I1, 0, IOCT|IOCTP|IOCT2|I37 },
{"swc1", "T,o(b)", 0xe4000000, 0xfc000000, RD_1|RD_3|SM|FP_S, 0, I1, 0, 0 },
--
2.20.1
@@ -1,7 +1,7 @@
From e48767a0298e6ccf53d83fecc93bb6d26b595897 Mon Sep 17 00:00:00 2001
From f34aac4314b821396fe745013dc8ec8683ea2598 Mon Sep 17 00:00:00 2001
From: Zhenhua Luo <zhenhua.luo@nxp.com>
Date: Sat, 11 Jun 2016 22:08:29 -0500
Subject: [PATCH 12/15] fix the incorrect assembling for ppc wait mnemonic
Subject: [PATCH] fix the incorrect assembling for ppc wait mnemonic
Signed-off-by: Zhenhua Luo <zhenhua.luo@nxp.com>
@@ -11,10 +11,10 @@ Upstream-Status: Pending
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 3032631d4e..142f096ef4 100644
index b56fe3e21a..696fe83a7b 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -5325,7 +5325,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
@@ -5709,7 +5709,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"ldepx", X(31,29), X_MASK, E500MC|PPCA2, 0, {RT, RA0, RB}},
{"waitasec", X(31,30), XRTRARB_MASK, POWER8, POWER9, {0}},
@@ -22,7 +22,7 @@ index 3032631d4e..142f096ef4 100644
{"lwepx", X(31,31), X_MASK, E500MC|PPCA2, 0, {RT, RA0, RB}},
@@ -5379,7 +5378,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
@@ -5763,7 +5762,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, 0, {0}},
{"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, 0, {0}},
@@ -31,6 +31,3 @@ index 3032631d4e..142f096ef4 100644
{"dcbstep", XRT(31,63,0), XRT_MASK, E500MC|PPCA2, 0, {RA0, RB}},
--
2.20.1
@@ -1,7 +1,7 @@
From 6587e7b8e7730dda20d8c47cabe9f7f8397efa3c Mon Sep 17 00:00:00 2001
From ebb74c39acb171fd24c2698646134ce88dd96a15 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 31 Mar 2017 11:42:03 -0700
Subject: [PATCH 13/15] Detect 64-bit MIPS targets
Subject: [PATCH] Detect 64-bit MIPS targets
Add mips64 target triplets and default to N64
@@ -45,6 +45,3 @@ index 3e066edaa8..caf130ceda 100644
mips*-*-*)
targ_obj=mips
targ_machine=EM_MIPS
--
2.20.1
@@ -1,7 +1,7 @@
From b7729343206fa196b9a11747a92b3cf563277056 Mon Sep 17 00:00:00 2001
From 6bc49e9a581eb46265935ea2756a99faa7d0562e Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Mon, 6 Mar 2017 23:33:27 -0800
Subject: [PATCH 14/15] sync with OE libtool changes
Subject: [PATCH] sync with OE libtool changes
Apply these patches from our libtool patches as not only are redundant RPATHs a
waste of space but they can cause incorrect linking when native packages are
@@ -84,6 +84,3 @@ index 11ee684ccc..3b19ac1532 100644
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
--
2.20.1
@@ -1,8 +1,8 @@
From d5d783903e335302e562bac8da1a083338d75b25 Mon Sep 17 00:00:00 2001
From a326a8feb445a5713ff3d17c55f43d5681e26585 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 29 Nov 2018 17:46:40 -0800
Subject: [PATCH 15/15] binutils : enable x86_64-pep for producing EFI binaries
on x86-64
Subject: [PATCH] binutils : enable x86_64-pep for producing EFI binaries on
x86-64
Add x86_64-pep emulation support to the set enabled for x86_64 targets
to enable the linker to produce Portable Executables for EFI binaries.
@@ -19,8 +19,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ld/configure.tgt | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 3614ff79d4..aef144803a 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -694,7 +694,7 @@ case "${targ}" in
@@ -32,11 +30,9 @@ index 3614ff79d4..aef144803a 100644
want64=true
;;
x86_64-*-nacl*)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 347df6c3f6..1e37d747a9 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -257,8 +257,9 @@ x86_64-*-linux-gnux32) targ_emul=elf32_x86_64
@@ -258,8 +258,9 @@ x86_64-*-linux-gnux32) targ_emul=elf32_x
tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'` ;;
x86_64-*-linux-*) targ_emul=elf_x86_64
@@ -48,6 +44,3 @@ index 347df6c3f6..1e37d747a9 100644
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
i[3-7]86-*-redox*) targ_emul=elf_i386
targ_extra_emuls=elf_x86_64 ;;
--
2.20.1
@@ -1,51 +0,0 @@
From 30bcc01478433a1cb05b36dc5c4beef7d2c89b5b Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Fri, 21 Jun 2019 11:51:38 +0930
Subject: [PATCH] PR24689, string table corruption
The testcase in the PR had a e_shstrndx section of type SHT_GROUP.
hdr->contents were initialized by setup_group rather than being read
from the file, thus last byte was not zero and string dereference ran
off the end of the buffer.
PR 24689
* elfcode.h (elf_object_p): Check type of e_shstrndx section.
Upstream-Status: Backport
CVE: CVE-2019-12972
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
bfd/ChangeLog | 5 +++++
bfd/elfcode.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 91f09e6346..e66fb40a2c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-21 Alan Modra <amodra@gmail.com>
+
+ PR 24689
+ * elfcode.h (elf_object_p): Check type of e_shstrndx section.
+
2019-02-20 Alan Modra <amodra@gmail.com>
PR 24236
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index ec5ea766de..a35a629087 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -755,7 +755,8 @@ elf_object_p (bfd *abfd)
/* A further sanity check. */
if (i_ehdrp->e_shnum != 0)
{
- if (i_ehdrp->e_shstrndx >= elf_numsections (abfd))
+ if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
+ || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB)
{
/* PR 2257:
We used to just goto got_wrong_format_error here
--
2.20.1
@@ -1,33 +0,0 @@
From df78be05daf4eb07f60f50ec1080cb979af32ec0 Mon Sep 17 00:00:00 2001
From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 23 Jul 2019 07:33:32 +0000
Subject: [PATCH] libiberty: Check zero value shstrndx in simple-object-elf.c
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273718 138bc75d-0d04-0410-961f-82ee72b054a4
CVE: CVE-2019-14250
Upstream-Status: Backport [from gcc: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=273718]
[Removed Changelog entry]
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c
index 502388991a08..bdee963634d6 100644
--- a/libiberty/simple-object-elf.c
+++ b/libiberty/simple-object-elf.c
@@ -548,7 +548,15 @@ simple_object_elf_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN],
XDELETE (eor);
return NULL;
}
-
+
+ if (eor->shstrndx == 0)
+ {
+ *errmsg = "invalid ELF shstrndx == 0";
+ *err = 0;
+ XDELETE (eor);
+ return NULL;
+ }
+
return (void *) eor;
}
@@ -1,28 +0,0 @@
From e17869db99195849826eaaf5d2d0eb2cfdd7a2a7 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 5 Aug 2019 10:40:35 +0100
Subject: [PATCH] Catch potential integer overflow in readelf when processing
corrupt binaries.
PR 24829
* readelf.c (apply_relocations): Catch potential integer overflow
whilst checking reloc location against section size.
CVE: CVE-2019-14444
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e17869db99195849826eaaf5d2d0eb2cfdd7a2a7]
[Removed Changelog entry]
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b896ad9f406..e785fde43e7 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13366,7 +13366,7 @@ apply_relocations (Filedata * filedata,
}
rloc = start + rp->r_offset;
- if ((rloc + reloc_size) > end || (rloc < start))
+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))
{
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
(unsigned long) rp->r_offset,
@@ -20,12 +20,10 @@ Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
bfd/dwarf2.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 0b4e485582..20ec9e2e56 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2803,13 +2803,13 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
}
@@ -2812,13 +2812,13 @@ static bfd_boolean comp_unit_maybe_decod
struct dwarf2_debug *);
static bfd_boolean
-find_abstract_instance (struct comp_unit * unit,
@@ -45,7 +43,7 @@ index 0b4e485582..20ec9e2e56 100644
{
bfd *abfd = unit->abfd;
bfd_byte *info_ptr;
@@ -2820,6 +2820,14 @@ find_abstract_instance (struct comp_unit * unit,
@@ -2829,6 +2829,14 @@ find_abstract_instance (struct comp_unit
struct attribute attr;
const char *name = NULL;
@@ -60,7 +58,7 @@ index 0b4e485582..20ec9e2e56 100644
/* DW_FORM_ref_addr can reference an entry in a different CU. It
is an offset from the .debug_info section, not the current CU. */
if (attr_ptr->form == DW_FORM_ref_addr)
@@ -2939,15 +2947,6 @@ find_abstract_instance (struct comp_unit * unit,
@@ -2962,15 +2970,6 @@ find_abstract_instance (struct comp_unit
info_ptr, info_ptr_end);
if (info_ptr == NULL)
break;
@@ -76,7 +74,7 @@ index 0b4e485582..20ec9e2e56 100644
switch (attr.name)
{
case DW_AT_name:
@@ -2961,7 +2960,7 @@ find_abstract_instance (struct comp_unit * unit,
@@ -2984,7 +2983,7 @@ find_abstract_instance (struct comp_unit
}
break;
case DW_AT_specification:
@@ -85,7 +83,7 @@ index 0b4e485582..20ec9e2e56 100644
&name, is_linkage,
filename_ptr, linenumber_ptr))
return FALSE;
@@ -3175,7 +3174,7 @@ scan_unit_for_symbols (struct comp_unit *unit)
@@ -3200,7 +3199,7 @@ scan_unit_for_symbols (struct comp_unit
case DW_AT_abstract_origin:
case DW_AT_specification:
@@ -94,6 +92,3 @@ index 0b4e485582..20ec9e2e56 100644
&func->name,
&func->is_linkage,
&func->file,
--
2.23.0
@@ -24,11 +24,9 @@ section of course overflows the buffer and tramples on other memory.
bfd/dwarf2.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 0b4e485582..a91597b1d0 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4426,7 +4426,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd,
@@ -4439,7 +4439,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
for (total_size = 0;
msec;
msec = find_debug_info (debug_bfd, debug_sections, msec))
@@ -46,6 +44,3 @@ index 0b4e485582..a91597b1d0 100644
stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
if (stash->info_ptr_memory == NULL)
--
2.23.0
@@ -1,165 +0,0 @@
From c1202057eb9161a86af27d867703235fee7b7555 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 10 Apr 2019 15:49:36 +0100
Subject: [PATCH] Pull in patch for libiberty that fixes a stack exhaustion bug
when demangling a pathalogically constructed mangled name.
PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter. Adjust
body of the function accordingly. Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.
CVE: CVE-2019-9071
CVE: CVE-2019-9070
Upstream-Status: Backport
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
ChangeLog | 16 ++++++++++++++
libiberty/cp-demangle.c | 48 ++++++++++++++++++++++-------------------
2 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cd631a15b6..4df3aaa62c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2019-04-10 Nick Clifton <nickc@redhat.com>
+
+ * libiberty: Sync with gcc. Bring in:
+ 2019-04-10 Nick Clifton <nickc@redhat.com>
+
+ PR 89394
+ * cp-demangle.c (cplus_demangle_fill_name): Reject negative
+ lengths.
+ (d_count_templates_scopes): Replace num_templates and num_scopes
+ parameters with a struct d_print_info pointer parameter. Adjust
+ body of the function accordingly. Add recursion counter and check
+ that the recursion limit is not reached.
+ (d_print_init): Pass dpi parameter to d_count_templates_scopes.
+ Reset recursion counter afterwards, unless the recursion limit was
+ reached.
+
2018-06-24 Nick Clifton <nickc@redhat.com>
2.32 branch created.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index b34b485692..779b4e763a 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -861,7 +861,7 @@ CP_STATIC_IF_GLIBCPP_V3
int
cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len)
{
- if (p == NULL || s == NULL || len == 0)
+ if (p == NULL || s == NULL || len <= 0)
return 0;
p->d_printing = 0;
p->type = DEMANGLE_COMPONENT_NAME;
@@ -4061,7 +4061,7 @@ d_growable_string_callback_adapter (const char *s, size_t l, void *opaque)
are larger than the actual numbers encountered. */
static void
-d_count_templates_scopes (int *num_templates, int *num_scopes,
+d_count_templates_scopes (struct d_print_info *dpi,
const struct demangle_component *dc)
{
if (dc == NULL)
@@ -4081,13 +4081,13 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
break;
case DEMANGLE_COMPONENT_TEMPLATE:
- (*num_templates)++;
+ dpi->num_copy_templates++;
goto recurse_left_right;
case DEMANGLE_COMPONENT_REFERENCE:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
- (*num_scopes)++;
+ dpi->num_saved_scopes++;
goto recurse_left_right;
case DEMANGLE_COMPONENT_QUAL_NAME:
@@ -4152,42 +4152,42 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
case DEMANGLE_COMPONENT_TAGGED_NAME:
case DEMANGLE_COMPONENT_CLONE:
recurse_left_right:
- d_count_templates_scopes (num_templates, num_scopes,
- d_left (dc));
- d_count_templates_scopes (num_templates, num_scopes,
- d_right (dc));
+ /* PR 89394 - Check for too much recursion. */
+ if (dpi->recursion > DEMANGLE_RECURSION_LIMIT)
+ /* FIXME: There ought to be a way to report to the
+ user that the recursion limit has been reached. */
+ return;
+
+ ++ dpi->recursion;
+ d_count_templates_scopes (dpi, d_left (dc));
+ d_count_templates_scopes (dpi, d_right (dc));
+ -- dpi->recursion;
break;
case DEMANGLE_COMPONENT_CTOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_ctor.name);
+ d_count_templates_scopes (dpi, dc->u.s_ctor.name);
break;
case DEMANGLE_COMPONENT_DTOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_dtor.name);
+ d_count_templates_scopes (dpi, dc->u.s_dtor.name);
break;
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_extended_operator.name);
+ d_count_templates_scopes (dpi, dc->u.s_extended_operator.name);
break;
case DEMANGLE_COMPONENT_FIXED_TYPE:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_fixed.length);
+ d_count_templates_scopes (dpi, dc->u.s_fixed.length);
break;
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
- d_count_templates_scopes (num_templates, num_scopes,
- d_left (dc));
+ d_count_templates_scopes (dpi, d_left (dc));
break;
case DEMANGLE_COMPONENT_LAMBDA:
case DEMANGLE_COMPONENT_DEFAULT_ARG:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_unary_num.sub);
+ d_count_templates_scopes (dpi, dc->u.s_unary_num.sub);
break;
}
}
@@ -4222,8 +4222,12 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback,
dpi->next_copy_template = 0;
dpi->num_copy_templates = 0;
- d_count_templates_scopes (&dpi->num_copy_templates,
- &dpi->num_saved_scopes, dc);
+ d_count_templates_scopes (dpi, dc);
+ /* If we did not reach the recursion limit, then reset the
+ current recursion value back to 0, so that we can print
+ the templates. */
+ if (dpi->recursion < DEMANGLE_RECURSION_LIMIT)
+ dpi->recursion = 0;
dpi->num_copy_templates *= dpi->num_saved_scopes;
dpi->current_template = NULL;
--
2.20.1
@@ -1,68 +0,0 @@
From e2ebb3906432dcca2727186ad79415f920730fb2 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Tue, 19 Feb 2019 22:48:44 +1030
Subject: [PATCH] PR24235, Read memory violation in pei-x86_64.c
PR 24235
* pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks
attempting to prevent read past end of section.
Upstream-Status: Backport [https://github.com/bminor/binutils-gdb/commit/179f2db0d9c397d7dd8a59907b84208b79f7f48c]
CVE: CVE-2019-9074
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
bfd/ChangeLog | 6 ++++++
bfd/pei-x86_64.c | 9 ++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index dd2c741..cbf30de 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-19 Alan Modra <amodra@gmail.com>
+
+ PR 24235
+ * pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks
+ attempting to prevent read past end of section.
+
2019-02-04 Nick Clifton <nickc@redhat.com>
* development.sh (experimental) Set to false.
diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c
index ff1093c..7e75104 100644
--- a/bfd/pei-x86_64.c
+++ b/bfd/pei-x86_64.c
@@ -541,7 +541,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
/* virt_size might be zero for objects. */
if (stop == 0 && strcmp (abfd->xvec->name, "pe-x86-64") == 0)
{
- stop = (datasize / onaline) * onaline;
+ stop = datasize;
virt_size_is_zero = TRUE;
}
else if (datasize < stop)
@@ -551,8 +551,8 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
_("Warning: %s section size (%ld) is smaller than virtual size (%ld)\n"),
pdata_section->name, (unsigned long) datasize,
(unsigned long) stop);
- /* Be sure not to read passed datasize. */
- stop = datasize / onaline;
+ /* Be sure not to read past datasize. */
+ stop = datasize;
}
/* Display functions table. */
@@ -724,8 +724,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
altent += imagebase;
if (altent >= pdata_vma
- && (altent + PDATA_ROW_SIZE <= pdata_vma
- + pei_section_data (abfd, pdata_section)->virt_size))
+ && altent - pdata_vma + PDATA_ROW_SIZE <= stop)
{
pex64_get_runtime_function
(abfd, &arf, &pdata[altent - pdata_vma]);
--
2.7.4
@@ -1,119 +0,0 @@
From 8abac8031ed369a2734b1cdb7df28a39a54b4b49 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 20 Feb 2019 08:21:24 +1030
Subject: [PATCH] PR24236, Heap buffer overflow in
_bfd_archive_64_bit_slurp_armap
PR 24236
* archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding
sentinel NUL to string buffer nearer to loop where it is used.
Don't go past sentinel when scanning strings, and don't write
NUL again.
* archive.c (do_slurp_coff_armap): Simplify string handling to
archive64.c style.
Upstream-Status: Backport [https://github.com/bminor/binutils-gdb/commit/8abac8031ed369a2734b1cdb7df28a39a54b4b49]
CVE: CVE-2019-9075
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
bfd/ChangeLog | 10 ++++++++++
bfd/archive.c | 17 +++++++----------
bfd/archive64.c | 10 +++++-----
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 72c87c7..e39bb12 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2019-02-20 Alan Modra <amodra@gmail.com>
+
+ PR 24236
+ * archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding
+ sentinel NUL to string buffer nearer to loop where it is used.
+ Don't go past sentinel when scanning strings, and don't write
+ NUL again.
+ * archive.c (do_slurp_coff_armap): Simplify string handling to
+ archive64.c style.
+
2019-02-19 Alan Modra <amodra@gmail.com>
PR 24235
diff --git a/bfd/archive.c b/bfd/archive.c
index d2d9b72..68a92a3 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1012,6 +1012,7 @@ do_slurp_coff_armap (bfd *abfd)
int *raw_armap, *rawptr;
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
+ char *stringend;
bfd_size_type stringsize;
bfd_size_type parsed_size;
carsym *carsyms;
@@ -1071,22 +1072,18 @@ do_slurp_coff_armap (bfd *abfd)
}
/* OK, build the carsyms. */
- for (i = 0; i < nsymz && stringsize > 0; i++)
+ stringend = stringbase + stringsize;
+ *stringend = 0;
+ for (i = 0; i < nsymz; i++)
{
- bfd_size_type len;
-
rawptr = raw_armap + i;
carsyms->file_offset = swap ((bfd_byte *) rawptr);
carsyms->name = stringbase;
- /* PR 17512: file: 4a1d50c1. */
- len = strnlen (stringbase, stringsize);
- if (len < stringsize)
- len ++;
- stringbase += len;
- stringsize -= len;
+ stringbase += strlen (stringbase);
+ if (stringbase != stringend)
+ ++stringbase;
carsyms++;
}
- *stringbase = 0;
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 312bf82..42f6ed9 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -100,8 +100,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- stringbase[stringsize] = 0;
- stringend = stringbase + stringsize;
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
@@ -115,15 +113,17 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
goto release_raw_armap;
}
+ stringend = stringbase + stringsize;
+ *stringend = 0;
for (i = 0; i < nsymz; i++)
{
carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
carsyms->name = stringbase;
- if (stringbase < stringend)
- stringbase += strlen (stringbase) + 1;
+ stringbase += strlen (stringbase);
+ if (stringbase != stringend)
+ ++stringbase;
++carsyms;
}
- *stringbase = '\0';
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);
--
2.7.4
@@ -1,49 +0,0 @@
From 9f841c583880eb6d0194455c1583a766f853e628 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 20 Feb 2019 12:06:31 +1030
Subject: [PATCH] PR24233, Out of memory
PR 24233
* objdump.c (dump_bfd_private_header): Print warning if
bfd_print_private_bfd_data returns false.
Upstream-Status: Backport [https://github.com/bminor/binutils-gdb/commit/7d272a55caebfc26ab2e15d1e9439bac978b9bb7]
CVE: CVE-2019-9076
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
binutils/ChangeLog | 6 ++++++
binutils/objdump.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f837c37..d5dd7cb 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-20 Alan Modra <amodra@gmail.com>
+
+ PR 24233
+ * objdump.c (dump_bfd_private_header): Print warning if
+ bfd_print_private_bfd_data returns false.
+
2019-02-02 Nick Clifton <nickc@redhat.com>
* configure: Regenerate.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 8725390..7d0c6a4 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3178,7 +3178,9 @@ dump_bfd_header (bfd *abfd)
static void
dump_bfd_private_header (bfd *abfd)
{
- bfd_print_private_bfd_data (abfd, stdout);
+ if (!bfd_print_private_bfd_data (abfd, stdout))
+ non_fatal (_("warning: private headers incomplete: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
static void
--
2.7.4
@@ -1,37 +0,0 @@
From f7bbc8890de45df6eda0ddef5dd04f835f54eecf Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 20 Feb 2019 17:03:47 +0000
Subject: [PATCH] Fix a illegal memory access fault when parsing a corrupt MIPS
option section using readelf.
PR 24243
* readelf.c (process_mips_specific): Check for an options section
that is too small to even contain a single option.
Upstream-Status: Backport [https://github.com/bminor/binutils-gdb/commit/7fc0c668f2aceb8582d74db1ad2528e2bba8a921]
CVE: CVE-2019-9077
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
binutils/readelf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 9df3742..18ab806 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -16179,6 +16179,12 @@ process_mips_specific (Filedata * filedata)
error (_("No MIPS_OPTIONS header found\n"));
return FALSE;
}
+ /* PR 24243 */
+ if (sect->sh_size < sizeof (* eopt))
+ {
+ error (_("The MIPS options section is too small.\n"));
+ return FALSE;
+ }
eopt = (Elf_External_Options *) get_data (NULL, filedata, options_offset, 1,
sect->sh_size, _("options"));
--
2.7.4