X86_64: Don't use PLT nor GOT in static archives [BZ #20750]

There is no need to use PLT nor GOT in static archives to branch to a
function, regardless whether static archives is compiled with PIC or
not.  When static archives are used to create dynamic executable,
PLT/GOT may be used.  The resulting executable still works correctly.

	[BZ #20750]
	* sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead
	of PIC.
This commit is contained in:
H.J. Lu 2016-11-28 09:44:49 -08:00
parent 389d1f1b23
commit c9070e6305
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-11-28 H.J. Lu <hongjiu.lu@intel.com>
[BZ #20750]
* sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead
of PIC.
2016-11-28 Andrew Pinski <andrew.pinski@caviumnetworks.com> 2016-11-28 Andrew Pinski <andrew.pinski@caviumnetworks.com>
Yury Norov <ynorov@caviumnetworks.com> Yury Norov <ynorov@caviumnetworks.com>
Steve Ellcey <sellcey@caviumnetworks.com> Steve Ellcey <sellcey@caviumnetworks.com>

View File

@ -89,13 +89,14 @@ lose: \
END (name) END (name)
#undef JUMPTARGET #undef JUMPTARGET
#ifdef PIC #ifdef SHARED
# ifdef BIND_NOW # ifdef BIND_NOW
# define JUMPTARGET(name) *name##@GOTPCREL(%rip) # define JUMPTARGET(name) *name##@GOTPCREL(%rip)
# else # else
# define JUMPTARGET(name) name##@PLT # define JUMPTARGET(name) name##@PLT
# endif # endif
#else #else
/* For static archives, branch to target directly. */
# define JUMPTARGET(name) name # define JUMPTARGET(name) name
#endif #endif