Age | Commit message (Collapse) | Author | Files | Lines |
|
2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
PR gold/17641
* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
(Target_x86_64::Scan::local): Don't create GOT entry, when we
can convert mov to lea.
(Target_x86_64::Scan::global): Ditto.
(Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
%reg to lea foo(%rip), %reg if possible.
* testsuite/Makefile.am (x86_64_mov_to_lea): New test.
* testsuite/x86_64_mov_to_lea1.s: New.
* testsuite/x86_64_mov_to_lea2.s: Ditto.
* testsuite/x86_64_mov_to_lea3.s: Ditto.
* testsuite/x86_64_mov_to_lea4.s: Ditto.
* testsuite/x86_64_mov_to_lea.sh: Ditto.
---
|
|
We need to check that the output is executable before assuming that we
can replace the reference with zero.
2015-02-02 Cary Coutant <ccoutant@google.com>
gold/
* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
executable output file.
|
|
When --warn-unresolved-symbols is used, gold tries to create a dynamic relocation
for it, and gives an internal error if the TLS segment has not already been
created. This patch allows the IE-to-LE optimization for an undefined symbol
when building an executable, which suppresses the dynamic relocation, and
relaxes the requirement to have a TLS segment when applying a relocation for
an undefined symbol.
2015-01-28 Cary Coutant <ccoutant@google.com>
gold/
* x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
for undef TLS symbols.
(Target_x86_64::Relocate::relocate_tls): Likewise.
(Target_x86_64::Relocate::tls_ie_to_le): Likewise.
|
|
X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.
PR gold/17729
* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
(DEFAULT_TARGET_X32): Set for x32.
* x86_64.cc (cmp_insn_32): New.
(lea_r10_insn_32): Likewise.
(lea_r11_insn_32): Likewise.
(cmp_insn_64): Likewise.
(lea_r10_insn_64): Likewise.
(lea_r11_insn_64): Likewise.
(Target_x86_64<size>::do_calls_non_split): Handle x32.
* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
(check_DATA): Add split_x32 files.
(split_x32_[1234n].o): New targets.
(split_x32_[124]): New targets.
(split_x32_[1234r].stdout): New targets.
* testsuite/split_x32.sh: New file.
* testsuite/split_x32_1.s: Likewise.
* testsuite/split_x32_2.s: Likewise.
* testsuite/split_x32_3.s: Likewise.
* testsuite/split_x32_4.s: Likewise.
* testsuite/split_x32_n.s: Likewise.
* configure: Regenerated.
* testsuite/Makefile.in: Likewise.
|
|
PR gold/17809
* x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
x32.
|
|
|
|
PR gold/17619
* x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
Check PC-relative offset overflow in PLT entry.
|
|
* x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
entry for R_X86_64_GOTPLT64.
(Target_x86_64<size>::Relocate::relocate): Update comments for
R_X86_64_GOTPLT64.
|
|
This patch fixes 2 issues:
1. Since the GOT offset is always negative, we need to use signed int
to support 64-bit GOT relocations.
2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is
the address of the .got.plt section, not the .got section.
|
|
to access a global as it expects a GOTPCREL relocation. This is really not
necessary as the linker could use a copy relocation to get around it. This
patch enables copy relocations with pie.
Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable. By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access. It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead. Gold can then create a copy reloc for only the undefined globals.
gold/
* symtab.h (may_need_copy_reloc): Remove check for position independent
code.
* x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
position independence before pc absolute may_need_copy_reloc call.
Add check for executable output befor pc relative may_need_copy_reloc
call.
* i386.cc: Ditto.
* arm.cc: Ditto.
* sparc.cc: Ditto.
* tilegx.cc: Ditto.
* powerpc.cc: Add check for no position independence before
may_need_copy_reloc calls.
* testsuite/pie_copyrelocs_test.cc: New file.
* testsuite/pie_copyrelocs_shared_test.cc: New file.
* Makefile.am (pie_copyrelocs_test): New test.
* Makefile.in: Regenerate.
|
|
is no PLT.
gold/
PR gold/16900
* i386.cc (Output_data_got_plt_i386): New class.
(Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
parameter. Change all callers.
(Output_data_plt_i386::layout_): Remove.
(Output_data_plt_i386::got_plt_): Change type.
(Target_i386::got_plt_): Change type. Change all references.
(Target_i386::got_section): Create instance of new class.
(Output_data_got_plt_i386::do_write): New function.
* x86_64.cc (Output_data_got_plt_x86_64): New class.
(Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
parameter. Change all callers.
(Output_data_plt_x86_64::layout_): Remove.
(Output_data_plt_x86_64::got_plt_): Change type.
(Target_x86_64::got_plt_): Change type. Change all references.
(Target_x86_64::got_section): Create instance of new class.
(Output_data_got_plt_x86_64::do_write): New function.
(Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
(Target_x86_64<size>::init_got_plt_for_update): Create instance of new
class.
|
|
gold/
* x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
|
|
|
|
elfcpp/
* x86_64.h (R_X86_64_PC32_BND): New.
(R_X86_64_PLT32_BND): Likewise.
gold/
* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
R_X86_64_PC32 and R_X86_64_PLT32, respectively.
(Target_x86_64<size>::Scan::local): Likewise.
(Target_x86_64<size>::Scan::global): Likewise.
(Target_x86_64<size>::Relocate::relocate): Likewise.
(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.
(Target_x86_64<size>::Scan::check_non_pic(): Handle
R_X86_64_PC32_BND.
* testsuite/Makefile.am (check_PROGRAMS): Add
exception_x86_64_bnd_test.
(exception_x86_64_bnd_test_SOURCES): New macro.
(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
(exception_x86_64_bnd_test_LDFLAGS): Likewise.
(exception_x86_64_bnd_test_LDADD): Likewise.
(exception_x86_64_bnd_1.o): New rule.
(exception_x86_64_bnd_2.o): Likewise.
* testsuite/Makefile.in: Regenerated.
|
|
generates.
gold/
* x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
Correct 9-byte nop sequence to match what the assembler generates.
|
|
* i386.cc (Target_i386): Remove unused member dynbss_.
* arm.cc (Target_arm): Likewise.
* powerpc.cc (Target_powerpc): Likewise.
* sparc.cc (Target_sparc): Likewise.
* tilegx.cc (Target_tilegx): Likewise.
* x86_64.cc (Target_x86_64): Likewise.
* dwarf_reader.h (Dwarf_info_reader): Remove unused members
type_signature_, type_offset_.
* plugin.h (Plugin_hook): Remove unused member layout_.
* readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
mapfile_.
(Read_member): Remove unused members input_objects_, symtab_,
mapfile_, layout_.
(Check_library): Remove unused member symtab_.
* archive.h (Lib_group): Remove unused member lib_.
* archive.cc (Lib_group::Lib_group): Update initializer.
* incremental.h (Incremental_binary): Remove unused member target_.
(Incremental_script_entry): Removed unused member script_.
* layout.h (Write_symbols_task): Remove unused member input_objects_.
* icf.h (Icf): Remove unused member num_tracked_relocs.
|
|
2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
PR gold/15927
* x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
relocation for R_X86_64_32 on x32.
|
|
* i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
* x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
|
|
* parameters.cc (Parameters::entry): Return target-specific entry
symbol name.
* target.h (Target::entry_symbol_name): New function.
(Target_info::entry_symbol_name): New data member.
* arm.cc (Target_arm::arm_info): Add entry_symbol_name.
(Target_arm_nacl::arm_nacl_info): Likewise.
* i386.cc (Target_i386::i386_info): Likewise.
(Target_i386_nacl::i386_nacl_info): Likewise.
* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
* sparc.cc (Target_sparc::sparc_info): Likewise.
* tilegx.cc (Target_tilegx::tilegx_info): Likewise.
* x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
(Target_x86_64_nacl::x86_64_nacl_info) Likewise.
* testsuite/testfile.cc (Target_test::test_target_info): Likewise.
|
|
range, pass VIEW as NULL to relocate.relocate.
* arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
* i386.cc (Target_i386::Relocate::relocate): Likewise.
* powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
* sparc.cc (Target_sparc::Relocate::relocate): Likewise.
* tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
* x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
|
|
PR gold/14858
* x86_64.cc (Relocate::tls_ld_to_le): Support x32.
|
|
* target.h (Sized_target::relocate_relocs): Use Elf_Off
for offset_in_output_section parameter.
(Sized_target::relocate_special_relocatable): Likewise.
* arm.cc (Target_arm::relocate_relocs): Likewise.
(Target_arm::relocate_special_relocatable): Likewise.
* i386.cc (Target_i386::relocate_relocs): Likewise.
* powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
* sparc.cc (Target_sparc::relocate_relocs): Likewise.
* target-reloc.h (relocate_relocs): Likewise.
* testsuite/testfile.cc (Target_test): Likewise.
* tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
* x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
|
|
(get_comdat_behaviour): ..this.
(relocate_section): Add Relocate_comdat_behavior template arg,
adjust code to suit.
* arm.cc (Target_arm::relocate_section): Adjust to suit.
(Target_arm::scan_reloc_section): Likewise.
* i386.cc (Target_i386::relocate_section): Likewise.
* sparc.cc (Target_sparc::relocate_section): Likewise.
* tilegx.cc (Target_tilegx::relocate_section): Likewise.
* x86_64.cc (Target_x86_64::relocate_section): Likewise.
* powerpc.cc (class Relocate_comdat_behavior): New.
(Target_powerpc::relocate_section): Don't zap opd relocs. Supply
gold::relocate_section with new template arg.
|
|
address_for_local): Add plt offset to returned value. Adjust uses.
* sparc.cc (Output_data_plt_sparc::address_for_global,
address_for_local): Likewise.
* tilegx.cc (Output_data_plt_tilegx::address_for_global,
address_for_local): Likewise.
* x86_64.cc (Output_data_plt_x86_64::address_for_global,
address_for_local): Likewise.
* target.h (Target::plt_address_for_global, plt_address_for_local):
Update comment.
* output.cc (Output_reloc::symbol_value): Don't add plt offset here.
(Output_data_got::Got_entry::write): Nor here.
* output.h: Comment fix.
|
|
against symbols in discarded sections. Pass is_discarded
param.
* arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
Add is_discarded param.
* powerpc (Target_powerpc::Scan::local): Likewise. Use
is_discarded to flag opd entry as discarded. Don't emit dyn
relocs on such entries.
(Target_powerpc::Scan::global): Similarly detect and handle
such opd entries.
(Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
opd_ent_. Update all uses.
(Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
(Target_powerpc::relocate_section): Zero out discarded opd
entry relocs.
|
|
add_local_tls_pair): New functions.
(Output_data_got::add_local_pair_with_rel): Remove second
reloc param. Expand comment.
(Output_data_got::Got_entry): Rename use_plt_offset_ to
use_plt_or_tls_offset_, similarly for constructor param.
(Output_data_got::Got_entry::write): Add got_index param.
* output.cc (Output_data_got::add_global_tls, add_local_tls,
add_local_tls_pair): New functions.
(Output_data_got::Got_entry::write): Handle tls symbols
with use_plt_or_tls_offset_ set specially.
(Output_data_got::add_local_pair_with_rel): Only one reloc.
(Output_data_got::do_write): Replace iterator with index, pass
index to entry write function.
* target.h (Target::tls_offset_for_local, tls_offset_for_global,
do_tls_offset_for_local, do_tls_offset_for_global): New functions.
* arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
call.
* i386.cc (Target_i386::Scan::local): Likewise.
* sparc.cc (Target_sparc::Scan::local): Likewise.
* x86_64.cc (Target_x86_64::Scan::local): Likewise.
* powerpc.cc (Target_powerpc::do_tls_offset_for_local,
do_tls_offset_for_global): New functions.
(Target_powerpc::Scan::local): Correct TLS relocations and got
entry values.
(Target_powerpc::Scan::global): Don't emit unnecessary
dynamic relocations on TLS GOT entries.
|
|
(Sized_relobj_file::emit_relocs_reltype): Delete.
* reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
relocate_relocs for --emit-relocs.
(Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
* output.h: Update comment.
(Output_segment::first_section): New function.
(Output_segment::first_section_load_address): Use first_section.
* output.cc (Output_segment::first_section): New function extracted..
(Output_segment::first_section_load_address): ..from here. Delete.
* target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
* target.h (Sized_target::relocate_for_relocatable): Likewise.
* arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
adjust call to target.h function.
* i386.cc (Target_i386): Likewise.
* sparc.cc (Target_sparc): Likewise.
* x86_64.cc (Target_x86_64): Likewise.
* powerpc.cc (Target_powerpc): Likewise.
(Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
first tls section has section symbol for optimised local dynamic
output relocs.
(Target_powerpc::Relocate::relocate): Correct local dynamic value.
(Target_powerpc::relocate_relocs): Adjust relocs emitted for
optimised tls code.
* testsuite/testfile.cc (Target_test::relocate_for_relocatable):
Rename to relocate_relocs. Update error message.
|
|
unsupported_relocal_local to call unsupported_reloc_global.
|
|
elfcpp/
PR gold/14091
* x86_64.h (R_X86_64_RELATIVE64): New.
gold/
PR gold/14091
* x86_64.cc (Target_x86_64::Scan::local): For x32, generate
R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
R_X86_64_64.
|
|
* configure: Regenerate.
gold/
* nacl.cc: New file.
* nacl.h: New file.
* Makefile.am (CCFILES, HFILES): Add them.
* Makefile.in: Regenerate.
* i386.cc (Output_data_plt_i386_nacl): New class.
(Output_data_plt_i386_nacl_exec): New class.
(Output_data_plt_i386_nacl_dyn): New class.
(Target_i386_nacl): New class.
(Target_selector_i386_nacl): New class.
(target_selector_i386): Use it instead of Target_selector_i386.
* x86_64.cc (Output_data_plt_x86_64_nacl): New class.
(Target_x86_64_nacl): New class.
(Target_selector_x86_64_nacl): New class.
(target_selector_x86_64, target_selector_x32): Use it instead of
Target_selector_x86_64.
* arm.cc (Output_data_plt_arm_nacl): New class.
(Target_arm_nacl): New class.
(Target_selector_arm_nacl): New class.
(target_selector_arm, target_selector_armbe): Use it instead of
Target_selector_arm.
* target-select.cc (select_target): Take new Input_file* and off_t
arguments, pass them on to recognize method of selector.
* object.cc (make_elf_sized_object): Update caller.
* parameters.cc (parameters_force_valid_target): Likewise.
* incremental.cc (make_sized_incremental_binary): Likewise.
* target-select.h: Update decl.
(Target_selector::recognize): Take new Input_file* argument,
pass it on to do_recognize.
(Target_selector::do_recognize): Take new Input_file* argument.
* freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
* powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
* sparc.cc (Target_selector_sparc::do_recognize): Likewise.
* testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
* target.h (Target::Target_info): New members isolate_execinstr
and rosegment_gap.
(Target::isolate_execinstr, Target::rosegment_gap): New methods.
* arm.cc (Target_arm::arm_info): Update initializer.
* i386.cc (Target_i386::i386_info): Likewise.
* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
* sparc.cc (Target_sparc::sparc_info): Likewise.
* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
* testsuite/testfile.cc (Target_test::test_target_info): Likewise.
* layout.cc (Layout::attach_allocated_section_to_segment):
Take new const Target* argument. If target->isolate_execinstr(), act
like --rosegment.
(Layout::find_first_load_seg): Take new const Target* argument;
if target->isolate_execinstr(), reject PF_X segments.
(Layout::relaxation_loop_body): Update caller.
(Layout::set_segment_offsets): If target->isolate_execinstr(),
reset file offset to zero when we hit LOAD_SEG, and then do a second
loop over the segments before LOAD_SEG to reassign offsets after
addresses have been determined. Handle target->rosegment_gap().
(Layout::attach_section_to_segment): Take new const Target* argument;
pass it to attach_allocated_section_to_segment.
(Layout::make_output_section): Update caller.
(Layout::attach_sections_to_segments): Take new const Target* argument;
pass it to attach_section_to_segment.
* gold.cc (queue_middle_tasks): Update caller.
* layout.h (Layout): Update method decls with new arguments.
* arm.cc (Target_arm::Target_arm): Take optional argument for the
Target_info pointer to use.
(Target_arm::do_make_data_plt): New virtual method.
(Target_arm::make_data_plt): New method that calls it.
(Target_arm::make_plt_entry): Use it.
(Output_data_plt_arm::Output_data_plt_arm): Take additional argument
for the section alignment.
(Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
method.
(Output_data_plt_arm::first_plt_entry_offset): Call it.
(Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_arm::get_plt_entry_size): Call it.
(Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
(Output_data_plt_arm::fill_plt_entry): New method that calls it.
(Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
method.
(Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
(Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
method instead of sizeof(plt_entry).
(Output_data_plt_arm::add_entry): Likewise.
Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
(Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
than static method.
(Target_arm::plt_entry_size): Likewise.
(Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
Move to ...
(Output_data_plt_arm_standard): ... here, new class.
(Output_data_plt_arm::do_write): Move guts of PLT filling to...
(Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
(Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
* x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
Take additional argument for the PLT entry size.
(Output_data_plt_x86_64::get_tlsdesc_plt_offset):
Use get_plt_entry_size method rather than plt_entry_size variable.
(Output_data_plt_x86_64::reserve_slot): Likewise.
(Output_data_plt_x86_64::do_adjust_output_section): Likewise.
(Output_data_plt_x86_64::add_entry): Likewise.
(Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
(Output_data_plt_x86_64::address_for_global): Likewise.
(Output_data_plt_x86_64::address_for_local): Likewise.
(Output_data_plt_x86_64::set_final_data_size): Likewise.
(Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
Make method non-static.
(Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_x86_64::get_plt_entry_size): Just call that.
(Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
(Output_data_plt_x86_64::add_eh_frame): New method to call it.
(Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
(Output_data_plt_x86_64::do_fill_plt_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_plt_entry): New method to call it.
(Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
(Output_data_plt_x86_64::plt_entry_size)
(Output_data_plt_x86_64::first_plt_entry)
(Output_data_plt_x86_64::plt_entry)
(Output_data_plt_x86_64::tlsdesc_plt_entry)
(Output_data_plt_x86_64::plt_eh_frame_fde_size)
(Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
(Output_data_plt_x86_64_standard): ... here, new class.
(Target_x86_64::Target_x86_64): Take optional argument for the
Target_info pointer to use.
(Target_x86_64::do_make_data_plt): New virtual method.
(Target_x86_64::make_data_plt): New method to call it.
(Target_x86_64::init_got_plt_for_update): Use that.
Call this->plt_->add_eh_frame method here.
(Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
(Target_x86_64::first_plt_entry_offset): Call method on this->plt_
rather than static method.
(Target_x86_64::plt_entry_size): Likewise.
(Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
rather than plt_entry_size variable. Move guts of PLT filling to...
(Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
(Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
(Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
* i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
additional argument for the section alignment.
Don't do add_eh_frame_for_plt here.
(Output_data_plt_i386::first_plt_entry_offset): Make the method
non-static. Use get_plt_entry_size method rather than plt_entry_size
variable.
(Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_i386::get_plt_entry_size): Call it.
(Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
(Output_data_plt_i386::add_eh_frame): New method to call it.
(Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
method.
(Output_data_plt_i386::fill_first_plt_entry): New method to call it.
(Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
method.
(Output_data_plt_i386::fill_plt_entry): New method to call it.
(Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
method instead of plt_entry_size.
(Output_data_plt_i386::plt_entry_size)
(Output_data_plt_i386::plt_eh_frame_fde_size)
(Output_data_plt_i386::plt_eh_frame_fde): Move to ...
(Output_data_plt_i386_standard): ... here, new class.
(Output_data_plt_i386_exec): New class.
(Output_data_plt_i386::exec_first_plt_entry): Move to ...
(Output_data_plt_i386_exec::first_plt_entry): ... here.
(Output_data_plt_i386::exec_plt_entry): Move to ...
(Output_data_plt_i386_exec::plt_entry): ... here.
(Output_data_plt_i386_dyn): New class.
(Output_data_plt_i386::first_plt_entry): Move to ...
(Output_data_plt_i386_dyn::first_plt_entry): ... here.
(Output_data_plt_i386::dyn_plt_entry): Move to ...
(Output_data_plt_i386_dyn::plt_entry): ... here.
(Target_i386::Target_i386): Take optional argument for the Target_info
pointer to use.
(Target_i386::do_make_data_plt): New virtual method.
(Target_i386::make_data_plt): New method to call it.
(Target_i386::make_plt_section): Use that.
Call this->plt_->add_eh_frame method here.
(Output_data_plt_i386::add_entry): Use get_plt_entry_size method
rather than plt_entry_size variable.
(Output_data_plt_i386::add_local_ifunc_entry): Likewise.
(Output_data_plt_i386::address_for_local): Likewise.
(Output_data_plt_i386::do_write): Likewise.
Move guts of PLT filling to...
(Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
(Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
(Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
(Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
Change-Id: Id24b95600489835ff5e860a39c147203d4380c2b
|
|
gold/
* output.h (Output_reloc): Allow use_plt_offset for global relocs too.
(class Output_data_reloc): Adjust calls to Output_reloc_type.
(Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
* output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
global relocs too.
(Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
* powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
calls.
* sparc.cc (Target_sparc::Scan::global): Likewise.
* x86_64.cc (Target_x86_64::Scan::global): Likewise.
|
|
2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
(Relocate::tls_gd_to_le): Likewise.
|
|
2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
|
|
* i386.cc (Target_i386::do_code_fill): When using a jmp
instruction, pad with nop instructions.
* x86_64.cc (Target_x86_64::do_code_fill): Likewise.
|
|
2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (gc_process_relocs): Add typename on types used in
template.
(scan_relocs): Likewise.
(relocate_section): Likewise.
(apply_relocation): Likewise.
|
|
2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
(Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
under x32.
|
|
2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc: Initial support for x32.
|
|
Use abstract base class for GOT.
* gold/output.h (class Output_data_got_base): New abstract base class.
(class Output_data_got): Derive from new base class, adjust ctors.
(Output_data_got::reserve_slot): Make virtual; rename to
do_reserve_slot; Adjust callers.
* gold/target.h (Sized_target::init_got_plt_for_update): Return
pointer to abstract base class.
* gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
|
|
(Relobj::local_plt_offset): New function.
(Relobj::local_has_got_offset): New function.
(Relobj::local_got_offset): New function.
(Relobj::set_local_got_offset): New function.
(Relobj::do_local_symbol_value): New pure virtual function.
(Relobj::do_local_plt_offset): Likewise.
(Relobj::do_local_has_got_offset): Likewise.
(Relobj::do_local_got_offset): Likewise.
(Relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::do_local_has_got_offset): Rename from
local_has_got_offset.
(Sized_relobj::do_local_got_offset): Rename from local_got_offset.
(Sized_relobj::do_set_local_got_offset): Rename from
set_local_got_offset.
(Sized_relobj_file::do_local_plt_offset): Rename from
local_plt_offset.
(Sized_relobj_file::do_local_symbol_value): New function.
* object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
local_plt_offset.
* output.cc (Output_data_got::Got_entry::write): Change object to
Relobj. Use local_symbol_value.
(Output_data_got::add_global_with_rel): Change rel_dyn to
Output_data_reloc_generic*. Use add_global_generic.
(Output_data_got::add_global_with_rela): Remove. Change all
callers to use add_global_with_rel.
(Output_data_got::add_global_pair_with_rel): Change rel_dyn to
Output_data_reloc_generic*. Use add_global_generic.
(Output_data_got::add_global_pair_with_rela): Remove. Change all
callers to use add_global_pair_with_rel.
(Output_data_got::add_local): Change object to Relobj*.
(Output_data_got::add_local_plt): Likewise.
(Output_data_got::add_local_with_rel): Change object to Relobj*,
change rel_dyn to Output_data_reloc_generic*. Use
add_local_generic.
(Output_data_got::add_local_with_rela): Remove. Change all
callers to use all_local_with_rel.
(Output_data_got::add_local_pair_with_rel): Change object to
Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
add_output_section_generic.
(Output_data_got::add_local_pair_with_rela): Remove. Change all
callers to use add_local_pair_with_rel.
(Output_data_got::reserve_local): Change object to Relobj*.
* output.h: (class Output_data_reloc_generic): Add pure virtual
declarations for add_global_generic, add_local_generic,
add_output_section_generic.
(class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
functions for Output_data_reloc_generic. Update declarations for
changes listed in output.cc.
(class Output_data_got): Change template parameter to got_size.
Don't define Rel_dyn or Rela_dyn. Update declarations per above.
* incremental.h (Sized_relobj_incr::do_local_symbol_value): New
function.
(Sized_relobj_incr::do_local_plt_offset): New function.
* copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
add_global_generic.
|
|
* dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
* resolve.cc (Symbol_table::resolve): Likewise.
* i386.cc (Target_i386::do_code_fill): Use char constants for nop
arrays.
* x86_64.cc (Target_x86_64::do_code_fill): Likewise.
|
|
* i386.cc (Target_i386::Relocate::relocate_tls): Remove
unnecessary assertion.
* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
|
|
* gold/output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
(Output_reloc::symbol_value): Return PLT offset if flag is set.
* gold/output.h (class Output_reloc): Add use_plt_offset flag.
(Output_reloc::type_): Adjust size of bit field.
(Output_reloc::use_plt_offset_): New bit field.
(class Output_data_reloc): Adjust all calls to Output_reloc_type.
(Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
flag. Adjust all callers.
* gold/x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
creating RELATIVE relocations.
|
|
(Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
(Output_data_plt_i386::do_write): Write address of .dynamic
section to first entry in .got.plt section.
* x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
(Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
Initialize layout_.
(Output_data_plt_x86_64::do_write): Write address of .dynamic
section to first entry in .got.plt section.
* layout.h (Layout::dynamic_section): New function.
|
|
relro section.
* x86_64.cc (Target_x86_64::got_section): Likewise.
* testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
(relro_now_test_SOURCES): New variable.
(relro_now_test_DEPENDENCIES): New variable.
(relro_now_test_LDFLAGS): New variable.
(relro_now_test_LDADD): New variable.
(relro_now_test.so): New target.
* testsuite/Makefile.in: Rebuild.
|
|
* i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
GLOB_DAT relocation rather than a RELATIVE relocation for a
protected symbol when creating a shared library.
* x86_64.cc (Target_x86_64::Scan::global): Likewise.
* testsuite/protected_1.cc (f2, get_f2_addr): New functions.
* testsuite/protected_main_1.cc (main): Test that protected
function has same address.
|
|
* target-reloc.h (issue_undefined_symbol_error): New inline
function, broken out of relocate_section.
(relocate_section): Call issue_undefined_symbol_error.
* i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
there is no TLS segment if we are about to issue an undefined
symbol error.
* x86_64.cc (Target_x86_64::relocate_tls): Likewise.
|
|
* resolve.cc (Symbol_table::should_override): Add fromtype
parameter. Change all callers. Give error when linking together
TLS and non-TLS symbol.
(Symbol_table::should_override_with_special): Add fromtype
parameter. Change all callers.
* i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
there is no TLS segment if we have reported some errors.
* x86_64.cc (Target_x86_64::relocate_tls): Likewise.
|
|
* target.h (Target::plt_address_for_global): New function.
(Target::plt_address_for_local): New function.
(Target::plt_section_for_global): Remove.
(Target::plt_section_for_local): Remove.
(Target::do_plt_address_for_global): New virtual function.
(Target::do_plt_address_for_local): New virtual function.
(Target::do_plt_section_for_global): Remove.
(Target::do_plt_section_for_local): Remove.
(Target::register_global_plt_entry): Add Symbol_table and Layout
parameters.
* output.cc (Output_data_got::Got_entry::write): Use
plt_address_for_global and plt_address_for_local.
* layout.cc (Layout::add_target_dynamic_tags): Use size and
address of output section.
* i386.cc (class Output_data_plt_i386): Add irelative_rel_,
got_irelative_, and irelative_count_ fields. Update
declarations.
(Output_data_plt_i386::has_irelative_section): New function.
(Output_data_plt_i386::entry_count): Add irelative_count_.
(Output_data_plt_i386::set_final_data_size): Likewise.
(class Target_i386): Add got_irelative_ and rel_irelative_
fields. Update declarations.
(Target_i386::Target_i386): Initialize new fields.
(Target_i386::do_plt_address_for_global): New function replacing
do_plt_section_for_global.
(Target_i386::do_plt_address_for_local): New function replacing
do_plt_section_for_local.
(Target_i386::got_section): Create got_irelative_.
(Target_i386::rel_irelative_section): New function.
(Output_data_plt_i386::Output_data_plt_i386): Initialize new
fields. Don't define __rel_iplt_{start,end}.
(Output_data_plt_i386::add_entry): Add symtab and layout
parameters. Change all callers. Use different PLT and GOT for
IFUNC symbols.
(Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
layout parameters. Change all callers. Use different PLT and
GOT.
(Output_data_plt_i386::rel_tls_desc): Fix formatting.
(Output_data_plt_i386::rel_irelative): New function.
(Output_data_plt_i386::address_for_global): New function.
(Output_data_plt_i386::address_for_local): New function.
(Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
IRELATIVE GOT when changing IFUNC GOT entries.
(Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
reloc.
(Target_i386::do_finalize_sections): Create the __rel_iplt symbols
if we didn't create an IRELATIVE GOT.
(Target_i386::Relocate::relocate): Use plt_address_for_global and
plt_address_for_local.
(Target_i386::do_dynsym_value): Use plt_address_for_global.
* x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
got_irelative_, and irelative_count_ fields. Update
declarations.
(Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
Initialize new fields. Remove symtab parameter. Change all
callers.
(Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
irelative_count_.
(Output_data_plt_x86_64::has_irelative_section): New function.
(Output_data_plt_x86_64::entry_count): Add irelative_count_.
(class Target_x86_64): Add got_irelative_ and rel_irelative_
fields. Update declarations.
(Target_x86_64::Target_x86_64): Initialize new fields.
(Target_x86_64::do_plt_address_for_global): New function replacing
do_plt_section_for_global.
(Target_x86_64::do_plt_address_for_local): New function replacing
do_plt_section_for_local.
(Target_x86_64::got_section): Create got_irelative_.
(Target_x86_64::rela_irelative_section): New function.
(Output_data_plt_x86_64::init): Remove symtab parameter. Change
all callers. Don't create __rel_iplt_{start,end}.
(Output_data_plt_x86_64::add_entry): Add symtab and layout
parameters. Change all callers. Use different PLT and GOT for
IFUNC symbols.
(Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
layout parameters. Change all callers. Use different PLT and
GOT.
(Output_data_plt_x86_64::add_relocation): Add symtab and layout
parameters. Change all callers. Use different PLT and GOT for
IFUNC symbols.
(Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
(Output_data_plt_x86_64::rela_irelative): New function.
(Output_data_plt_x86_64::address_for_global): New function.
(Output_data_plt_x86_64::address_for_local): New function.
(Output_data_plt_x86_64::set_final_data_size): Likewise.
(Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
(Target_x86_64::init_got_plt_for_update): Create got_irelative_.
(Target_x86_64::register_global_plt_entry): Add symtab and layout
parameters.
(Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
reloc.
(Target_x86_64::do_finalize_sections): Create the __rela_iplt
symbols if we didn't create an IRELATIVE GOT.
(Target_x86_64::Relocate::relocate): Use plt_address_for_global and
plt_address_for_local.
(Target_x86_64::do_dynsym_value): Use plt_address_for_global.
* testsuite/ifuncvar1.c: New test file.
* testsuite/ifuncvar2.c: New test file.
* testsuite/ifuncvar3.c: New test file.
* testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
(ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
(ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
(ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
* testsuite/Makefile.in: Rebuild.
|
|
* i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
symbols if necessary.
* x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
|
|
* ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
Assert if we see DW_EH_PE_indirect.
* target.h (Target::ehframe_datarel_base): New function.
(Target::do_ehframe_datarel_base): New target function.
* i386.cc (Target_i386::do_ehframe_datarel_base): New function.
* x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
function.
|