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.
This commit is contained in:
H.J. Lu 2018-02-13 14:31:53 -08:00
parent db5d5ad16f
commit 1031c264fd
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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> 2018-02-13 H.J. Lu <hongjiu.lu@intel.com>
PR gas/22791 PR gas/22791

View File

@ -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 location in the .plt. This is required to make function
pointers compare as equal between the normal executable and pointers compare as equal between the normal executable and
the shared library. */ the shared library. */
if (! bfd_link_pic (info) if (! bfd_link_dll (info)
&& !h->def_regular) && !h->def_regular)
{ {
if (use_plt_got) if (use_plt_got)