forked from Imagelibrary/binutils-gdb
* symtab.h (Symbol::use_plt_offset): New function.
* i386.cc (Relocate::relocate): Call Symbol::use_plt_offset. * powerpc.cc (Relocate::relocate): Likewise. * sparc.cc (Relocate::relocate): Likewise. * x86_64.cc (Relocate::relocate): Likewise. * testsuite/weak_plt.sh: New test. * testsuite/weak_plt_main.cc: New test. * testsuite/weak_plt_shared.cc: New test. * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh. (check_PROGRAMS): Add weak_plt. (check_DATA): Add weak_plt_shared.so. (weak_plt_main_pic.o, weak_plt): New targets. (weak_plt_shared_pic.o, weak_plt_shared.so): New targets. * testsuite/Makefile.in: Rebuild. * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon gcctestdir/ld. (weak_alias_test_2.so, weak_alias_test_4.so): Likewise. * testsuite/Makefile.in: Rebuild.
This commit is contained in:
11
gold/i386.cc
11
gold/i386.cc
@@ -1595,15 +1595,10 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
|
||||
|
||||
// Pick the value to use for symbols defined in shared objects.
|
||||
Symbol_value<32> symval;
|
||||
bool is_nonpic = (r_type == elfcpp::R_386_PC8
|
||||
|| r_type == elfcpp::R_386_PC16
|
||||
|| r_type == elfcpp::R_386_PC32);
|
||||
if (gsym != NULL
|
||||
&& (gsym->is_from_dynobj()
|
||||
|| (parameters->options().shared()
|
||||
&& (gsym->is_undefined() || gsym->is_preemptible())))
|
||||
&& gsym->has_plt_offset()
|
||||
&& (!is_nonpic || !parameters->options().shared()))
|
||||
&& gsym->use_plt_offset(r_type == elfcpp::R_386_PC8
|
||||
|| r_type == elfcpp::R_386_PC16
|
||||
|| r_type == elfcpp::R_386_PC32))
|
||||
{
|
||||
symval.set_output_value(target->plt_section()->address()
|
||||
+ gsym->plt_offset());
|
||||
|
||||
Reference in New Issue
Block a user