This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] x86: Properly check building shared library


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1031c264fd23641111df1e12a35d0a8f7e82fb80

commit 1031c264fd23641111df1e12a35d0a8f7e82fb80
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 13 14:31:53 2018 -0800

    x86: Properly check building shared library
    
    If a symbol is not defined in a regular file, and we are not generating
    a shared library, then set the symbol to its location in the .plt.  This
    is required to make function pointers compare as equal between the normal
    executable and the shared library.
    
    	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Check bfd_link_dll,
    	instead of bfd_link_pic, for building shared library.

Diff:
---
 bfd/ChangeLog   | 5 +++++
 bfd/elfxx-x86.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 726225a..77cdfe8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Check bfd_link_dll,
+	instead of bfd_link_pic, for building shared library.
+
+2018-02-13  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR gas/22791
 	* elf64-x86-64.c (is_32bit_relative_branch): Removed.
 	(elf_x86_64_relocate_section): Check PIC relocations in PIE.
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index fc08d1b..bd36707 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -200,7 +200,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 	     location in the .plt.  This is required to make function
 	     pointers compare as equal between the normal executable and
 	     the shared library.  */
-	  if (! bfd_link_pic (info)
+	  if (! bfd_link_dll (info)
 	      && !h->def_regular)
 	    {
 	      if (use_plt_got)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]