From a31eff6894099ee1d0ce7ccf2972f7276ca12743 Mon Sep 17 00:00:00 2001 From: Andre McCurdy Date: Wed, 12 Oct 2016 17:16:30 -0700 Subject: binutils: fix for MIPS "Can't find matching LO16 reloc" errors Patch taken from Binutils Bugzilla: https://sourceware.org/bugzilla/show_bug.cgi?id=20649 Signed-off-by: Andre McCurdy Signed-off-by: Ross Burton --- meta/recipes-devtools/binutils/binutils-2.27.inc | 1 + .../0015-binutils-mips-gas-pic-relax-linkonce.diff | 65 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/0015-binutils-mips-gas-pic-relax-linkonce.diff diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index 03b7bedd25..b0c5267456 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -34,6 +34,7 @@ SRC_URI = "\ file://0012-Add-support-for-Netlogic-XLP.patch \ file://0013-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \ file://0014-libtool-remove-rpath.patch \ + file://0015-binutils-mips-gas-pic-relax-linkonce.diff \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/0015-binutils-mips-gas-pic-relax-linkonce.diff b/meta/recipes-devtools/binutils/binutils/0015-binutils-mips-gas-pic-relax-linkonce.diff new file mode 100644 index 0000000000..78b971a996 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0015-binutils-mips-gas-pic-relax-linkonce.diff @@ -0,0 +1,65 @@ +Patch taken from Binutils Bugzilla: + + https://sourceware.org/bugzilla/show_bug.cgi?id=20649 + +Upstream-Status: Pending + +Signed-off-by: Andre McCurdy + +Index: binutils/gas/config/tc-mips.c +=================================================================== +--- binutils.orig/gas/config/tc-mips.c 2016-09-29 05:12:31.000000000 +0100 ++++ binutils/gas/config/tc-mips.c 2016-09-29 20:05:13.257411084 +0100 +@@ -1353,7 +1353,7 @@ static void s_mips_stab (int); + static void s_mips_weakext (int); + static void s_mips_file (int); + static void s_mips_loc (int); +-static bfd_boolean pic_need_relax (symbolS *, asection *); ++static bfd_boolean pic_need_relax (symbolS *); + static int relaxed_branch_length (fragS *, asection *, int); + static int relaxed_micromips_16bit_branch_length (fragS *, asection *, int); + static int relaxed_micromips_32bit_branch_length (fragS *, asection *, int); +@@ -4258,6 +4258,8 @@ mips_move_text_labels (void) + mips_move_labels (seg_info (now_seg)->label_list, TRUE); + } + ++/* Duplicate the test for LINK_ONCE sections as in `adjust_reloc_syms'. */ ++ + static bfd_boolean + s_is_linkonce (symbolS *sym, segT from_seg) + { +@@ -14823,7 +14825,7 @@ mips_frob_file (void) + constants; we'll report an error for those later. */ + if (got16_reloc_p (l->fixp->fx_r_type) + && !(l->fixp->fx_addsy +- && pic_need_relax (l->fixp->fx_addsy, l->seg))) ++ && pic_need_relax (l->fixp->fx_addsy))) + continue; + + /* Check quickly whether the next fixup happens to be a matching %lo. */ +@@ -17043,7 +17045,7 @@ nopic_need_relax (symbolS *sym, int befo + /* Return true if the given symbol should be considered local for SVR4 PIC. */ + + static bfd_boolean +-pic_need_relax (symbolS *sym, asection *segtype) ++pic_need_relax (symbolS *sym) + { + asection *symsec; + +@@ -17068,7 +17070,6 @@ pic_need_relax (symbolS *sym, asection * + return (!bfd_is_und_section (symsec) + && !bfd_is_abs_section (symsec) + && !bfd_is_com_section (symsec) +- && !s_is_linkonce (sym, segtype) + /* A global or weak symbol is treated as external. */ + && (!S_IS_WEAK (sym) && !S_IS_EXTERNAL (sym))); + } +@@ -17507,7 +17508,7 @@ md_estimate_size_before_relax (fragS *fr + if (mips_pic == NO_PIC) + change = nopic_need_relax (fragp->fr_symbol, 0); + else if (mips_pic == SVR4_PIC) +- change = pic_need_relax (fragp->fr_symbol, segtype); ++ change = pic_need_relax (fragp->fr_symbol); + else if (mips_pic == VXWORKS_PIC) + /* For vxworks, GOT16 relocations never have a corresponding LO16. */ + change = 0; -- cgit 1.2.3-korg