Commit 6b4cb8b8 authored by Georg Koppen's avatar Georg Koppen
Browse files

Merge remote-tracking branch 'boklm/bug_16472_v16'

parents 473342ee b24500f6
Loading
Loading
Loading
Loading
−24 KiB (1.14 KiB)

File changed.

No diff preview for this file type.

+18 −13
Original line number Diff line number Diff line
From f3ba95e14437f10de8b8f296930ff2a8495d18c6 Mon Sep 17 00:00:00 2001
From 05164a1162d5f6f696d7f7c4b1bc61ef06d1c288 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Tue, 12 Sep 2017 07:21:16 +0000
Subject: [PATCH] 64bit fixups

---
 ld/emultempl/pep.em | 4 ++--
 ld/pep-dll.c        | 1 +
 ld/pep-dll.h        | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index b566903b14..27006bdf79 100644
index fccbd63..f7c0a57 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -730,7 +730,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
@@ -742,7 +742,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
       pep_dll_exclude_all_symbols = 1;
       break;
     case OPTION_ENABLE_RELOC_SECTION:
@@ -17,17 +22,17 @@ index b566903b14..27006bdf79 100644
       break;
     case OPTION_EXCLUDE_LIBS:
       pep_dll_add_excludes (optarg, EXCLUDELIBS);
@@ -1623,7 +1623,7 @@ gld_${EMULATION_NAME}_finish (void)
 
@@ -1862,7 +1862,7 @@ gld_${EMULATION_NAME}_finish (void)
 #ifdef DLL_SUPPORT
   if (link_info.shared
-      || (!link_info.relocatable && pe_dll_enable_reloc_section)
+      || (!link_info.relocatable && pep_dll_enable_reloc_section)
       || (!link_info.relocatable && pep_def_file->num_exports != 0))
   if (bfd_link_pic (&link_info)
       || (!bfd_link_relocatable (&link_info)
-          && pe_dll_enable_reloc_section)
+          && pep_dll_enable_reloc_section)
       || (!bfd_link_relocatable (&link_info)
           && pep_def_file->num_exports != 0))
     {
       pep_dll_fill_sections (link_info.output_bfd, &link_info);
diff --git a/ld/pep-dll.c b/ld/pep-dll.c
index 0e5e8b1523..b5f99b90e0 100644
index b8c017f..5ad5733 100644
--- a/ld/pep-dll.c
+++ b/ld/pep-dll.c
@@ -31,6 +31,7 @@
@@ -39,7 +44,7 @@ index 0e5e8b1523..b5f99b90e0 100644
 #define pe_dll_stdcall_aliases      pep_dll_stdcall_aliases
 #define pe_dll_warn_dup_exports     pep_dll_warn_dup_exports
diff --git a/ld/pep-dll.h b/ld/pep-dll.h
index 1e7e3d65d4..c31e69cc8e 100644
index 0a27c1f..95d9c15 100644
--- a/ld/pep-dll.h
+++ b/ld/pep-dll.h
@@ -31,6 +31,7 @@ extern def_file * pep_def_file;
@@ -51,5 +56,5 @@ index 1e7e3d65d4..c31e69cc8e 100644
 extern int pep_dll_stdcall_aliases;
 extern int pep_dll_warn_dup_exports;
-- 
2.14.1
2.1.4
+0 −98
Original line number Diff line number Diff line
From f984741df04cd68bb116073fdfa9405808810ab4 Mon Sep 17 00:00:00 2001
From: Cary Coutant <ccoutant@google.com>
Date: Wed, 5 Feb 2014 22:59:02 -0800
Subject: [PATCH] Fix issues with gold undefined symbol diagnostics.

PR binutils/15435 complains that gold issues a visibility error for an
weak undefined symbol with hidden visibility. The message should be
suppressed if the symbol is a weak undef.

An earlier patch to add an extra note about key functions when a class's
vtable symbol is undefined missed a case where the reference to the
vtable came from a shared library. This patch moves the check to a
lower-level routine that catches both cases.

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

	* errors.cc (Errors::undefined_symbol): Move undef vtable symbol
	check to here.
	* target-reloc.h (is_strong_undefined): New function.
	(relocate_section): Move undef vtable symbol check from here.
	Check for is_strong_undefined.

diff --git a/gold/ChangeLog b/gold/ChangeLog
index dcf7ed41f8..dd7ef72980 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,14 @@
+2014-02-05  Cary Coutant  <ccoutant@google.com>
+
+	Fix issues with gold undefined symbol diagnostics.
+
+	PR binutils/15435
+	* errors.cc (Errors::undefined_symbol): Move undef vtable symbol
+	check to here.
+	* target-reloc.h (is_strong_undefined): New function.
+	(relocate_section): Move undef vtable symbol check from here.
+	Check for is_strong_undefined.
+
 2013-11-22  Cary Coutant  <ccoutant@google.com>
 
 	* testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
diff --git a/gold/errors.cc b/gold/errors.cc
index b79764bd1d..98db0fdd86 100644
--- a/gold/errors.cc
+++ b/gold/errors.cc
@@ -193,6 +193,11 @@ Errors::undefined_symbol(const Symbol* sym, const std::string& location)
     fprintf(stderr,
             _("%s: %s: undefined reference to '%s', version '%s'\n"),
 	    location.c_str(), zmsg, sym->demangled_name().c_str(), version);
+
+  if (sym->is_cxx_vtable())
+    gold_info(_("%s: the vtable symbol may be undefined because "
+		"the class is missing its key function"),
+	      program_name);
 }
 
 // Issue a debugging message.
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index b544c78f37..d609bcbaa8 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -144,6 +144,12 @@ class Default_comdat_behavior
   }
 };
 
+inline bool
+is_strong_undefined(const Symbol* sym)
+{
+  return sym->is_undefined() && sym->binding() != elfcpp::STB_WEAK;
+}
+
 // Give an error for a symbol with non-default visibility which is not
 // defined locally.
 
@@ -411,16 +417,10 @@ relocate_section(
 	}
 
       if (issue_undefined_symbol_error(sym))
-	{
-	  gold_undefined_symbol_at_location(sym, relinfo, i, offset);
-	  if (sym->is_cxx_vtable())
-	    gold_info(_("%s: the vtable symbol may be undefined because "
-			"the class is missing its key function"),
-		      program_name);
-	}
+	gold_undefined_symbol_at_location(sym, relinfo, i, offset);
       else if (sym != NULL
 	       && sym->visibility() != elfcpp::STV_DEFAULT
-	       && (sym->is_undefined() || sym->is_from_dynobj()))
+	       && (is_strong_undefined(sym) || sym->is_from_dynobj()))
 	visibility_error(sym);
 
       if (sym != NULL && sym->has_warning())
-- 
2.11.0
+3 −7
Original line number Diff line number Diff line
@@ -25,17 +25,13 @@ cd [% project %]-[% c("version") %]
  patch -p1 < ../peXXigen.patch
  # Needed for the hardening...
  patch -p1 < ../enable-reloc-section-ld.patch
  # fix "right-hand operand of comma expression has no effect" warning
  patch -p1 < ../fix-warning-bfd.patch
  # fix build reproducibility of Windows builds by reverting commit 13e570f80c.
  # See bug 16472.
  patch -p1 < ../fix-windows-reproducibility.patch
[% END -%]
[% IF c('var/windows-x86_64') -%]
  patch -p1 < ../64bit-fixups.patch
[% END -%]
[% IF c("var/linux") && ! c("var/release") -%]
  # We need to work around a gold linker bug in 2.24 to get selfrando working,
  # see bug 20683.
  patch -p1 < $rootdir/binutils-224-gold.patch
[% END -%]
./configure --prefix=$distdir [% c('var/configure_opt') %]
make -j[% c("buildconf/num_procs") %]
make install
+6 −5
Original line number Diff line number Diff line
# vim: filetype=yaml sw=2
version: 2.24
version: 2.26.1
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
var:
  configure_opt: '--disable-multilib --enable-gold --enable-deterministic-archives --enable-plugins'
@@ -10,6 +10,9 @@ targets:
  windows:
    var:
      configure_opt: '--target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-deterministic-archives'
      arch_deps:
        # texinfo required for fix-windows-reproducibility.patch
        - texinfo

input_files:
  - URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.bz2
@@ -19,11 +22,9 @@ input_files:
  - project: container-image
  - filename: enable-reloc-section-ld.patch
    enable: '[% c("var/windows") %]'
  - filename: fix-warning-bfd.patch
    enable: '[% c("var/windows") %]'
  - filename: 64bit-fixups.patch
    enable: '[% c("var/windows-x86_64") %]'
  - filename: peXXigen.patch
    enable: '[% c("var/windows") %]'
  - filename: binutils-224-gold.patch
    enable: '[% c("var/linux") %]'
  - filename: fix-windows-reproducibility.patch
    enable: '[% c("var/windows") %]'
Loading