aboutsummaryrefslogtreecommitdiff
path: root/gold
AgeCommit message (Collapse)AuthorFilesLines
2015-01-02Regenerate Makeile.in file for copyright updateAlan Modra1-1/+1
2015-01-02Correct printed year in copyright notices for gold.Alan Modra3-2/+7
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra393-395/+399
2014-12-25ARM: Add support for value 3 of Tag_ABI_VFP_args attributeAlan Modra2-6/+12
Missing from 5c294fee elfcpp/ * arm.h: Add enums for Tag_ABI_FP_number_model and Tag_ABI_VFP_args. gold/ * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on new enums. (Target_arm::merge_object_attributes, ): Likewise.
2014-12-25ARM: Add support for value 3 of Tag_ABI_VFP_args attributeTerry Guo2-3/+19
*** bfd/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. (elf32_arm_post_process_headers): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. *** binutils/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". *** gdb/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of Tag_ABI_VFP_args. Also replace hardcoded values by enum values in the switch handling the different values of Tag_ABI_VFP_args. *** gold/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. *** include/elf/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values. *** ld/testsuite/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args. * ld-arm/attr-merge-2b.s: Likewise. * ld-arm/attr-merge-2.attr: Likewise. * ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and Tag_ABI_VFP_args. * ld-arm/attr-merge-4b.s: Likewise. * ld-arm/attr-merge-4.attr: Likewise. * ld-arm/attr-merge-6a.s: Likewise. * ld-arm/attr-merge-6b.s: Likewise. * ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.
2014-12-22gold/Cary Coutant2-1/+6
* powerpc.cc (Target_powerpc::relocate): Fix overflow check.
2014-12-20Change SometimesInlineFunction to "return i * i * 3;"H.J. Lu2-1/+7
The debug_msg test has 2 implementations of SometimesInlineFunction: int SometimesInlineFunction(int i) { return i; } int SometimesInlineFunction(int i) { return i * i; } and One Definition Rule (ODR) violation detection expects they will be compiled into functions of different sizes. Hower, on x86, GCC 4.7 and newer compile them into functions of the same size and ODR violation detection test fails. This patch changes int SometimesInlineFunction(int i) { return i; } to int SometimesInlineFunction(int i) { return i * i * 3; } so that it will be compiled into a function of larger size. PR gold/14608 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed to "return i * i * 3;".
2014-12-16Fix internal error in gold when -Map and --compress-debug-sections are usedCary Coutant2-4/+21
together. gold/ * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes. (Mapfile::print_output_data): Use current_data_size() to avoid assert for sections requiring postprocessing; if address is not valid, print 0. (Mapfile::print_output_section): Use current_data_size(); print note that addresses and sizes are before compression.
2014-12-14Cast current_group_size to unsigned longH.J. Lu2-1/+6
* aarch64.cc (AArch64_relocate_functions::maybe_apply_stub): Cast current_group_size to unsigned long when reporting error.
2014-12-10Give informative error message for stub-group-sizeJing Yu2-10/+26
This patch gives current stub-group-size in error message when stub is too far away. * aarch64.cc (Target_aarch64): Add new variable: stub_group_size_. (AArch64_relocate_functions::maybe_apply_stub): Add new parameter. Update error message. (Target_aarch64::do_relax): Use absolute value of option stub_group_size. Replace local variable with class member stub_group_size_.
2014-12-04ChangeLog typo fixAlan Modra1-1/+1
2014-12-04PowerPC gold, fix 32-bit branch address arithmeticAlan Modra2-5/+14
Mixing 64-bit and 32-bit types led to the wrong promotions. Keep calculation in same type. Also fix a case where PLTREL25 reloc addend should be ignored. * Powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore addend of PLTREL24 reloc when not generating a plt stub. Make max_branch_offset an "Address". (Stub_table::can_read_stub): Make max_branch_offset an "Address". (Target_powerpc::Relocate::relocate): Likewise.
2014-12-04powerpc gold, work around pr17670Alan Modra3-24/+44
pr17670 is about an assert triggering on a branch to an undefined weak symbol, the symbol being undefined due to dropping its comdat group section. (Well sort of. The symbol is actually defined in an .opd section which isn't part of the group, but the code section the opd entry points at is dropped.) So don't assert. Also, don't make long branch stubs to such symbols, and arrange to have target-reloc.h code warn when applying relocs that use the sym. PR 17670 * symtab.cc (Symbol::set_undefined): Remove assertion. * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert on symbols defined in discarded sections, instead return false. Rearrange params, update all callers. (Target_powerpc::Branch_info::make_stub): Don't make stubs for branches to syms in discarded sections. (Global_symbol_visitor_opd::operator()): Set discarded opd syms undefined and flag as discarded. (Target_powerpc::Relocate::relocate): Localize variable.
2014-12-03Compile pie_copyrelocs_test.cc with -fno-exceptions ↵H.J. Lu3-5/+26
-fno-asynchronous-unwind-tables PR gold/17675 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New. * testsuite/Makefile.in: Regenerated.
2014-12-04powerpc gold, fix pr17566Alan Modra2-3/+23
Code stolen from arm.cc. PR 17566 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section when adding dynamic relocations against section symbols.
2014-12-01Add support for -z global.Dmitriy Ivanov3-0/+11
gold/ * layout.cc (Layout::finish_dynamic_section): When '-z global' is specified set DF_1_GLOBAL in DT_FLAGS_1 flags. * options.h (General_options): New -z option (global).
2014-12-01Fix extraneous warning about executable stack.Cary Coutant2-3/+17
PR gold/17578 notes that gold will print a warning about an executable stack when the -z execstack option is given, even when there is no --warn_execstack option. The warning is completely useless and unexpected, since the user explicitly requested an executable stack, and did not even ask for warnings. This patch fixes that, and adds an extra warning when --warn_execstack and -z noexecstack are both given and an input file requires an executable stack. gold/ PR gold/17578 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack is given. (Layout::create_executable_stack_info): Warn when -z noexecstack is given but some inputs require executable stack.
2014-11-26Update list of debug sections for --strip-debug-xxx options.Cary Coutant2-0/+15
Add .debug_gdb_scripts, .debug_gnu_pubnames, .debug_gnu_pubtypes, and .debug_str_offsets to lists of sections to strip or keep when stripping debug info. gold/ * layout.cc (gdb_sections): Keep .debug_gdb_scripts and .debug_str_offsets; strip .debug_gnu_pubnames and .debug_gnu_pubtypes. (lines_only_debug_sections): Strip all four new sections.
2014-11-26Fix for gold linking tlsdesc into an executable with -pie.Han Shen2-1/+11
(Also included in this patch is a minor typo fix in gold/ChangeLog.) When linking the following tlsdesc access sequence into an executable with -pie, adrp x0, :tlsdesc:tls_gd ldr x1, [x0, #:tlsdesc_lo12:tls_gd] add x0, x0, :tlsdesc_lo12:tls_gd .tlsdesccall tls_gd blr x1 mrs x1, tpidr_el0 add x0, x1, x0 ldr w0, [x0] current gold-aarch64 backend does tls-desc-gd-to-ie relaxation, into adrp x0, 1000 <__FRAME_END__+0x720> ldr x1, [x0,#4064] ;; <=== the target register should be x0 nop nop mrs x1, tpidr_el0 add x0, x1, x0 ldr w0, [x0] This code is wrong. The fix changes ldr target register into x0.
2014-11-26Retry powerpc gold stub grouping when groups prove too largeAlan Modra2-132/+243
An unusually large number of stubs can result in the default section group size being too large; sections plus stubs exceed the range of a branch. Restarting the relaxation pass with a smaller group size can sometimes help. * powerpc.cc (struct Stub_table_owner): New. (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an unsigned int vector. Update all references. (powerpc_relobj::set_stub_table): Take an unsigned int param rather than a Stub_table. Update callers. (Powerpc_relobj::clear_stub_table): New function. (Target_powerpc): Add relax_failed_, relax_fail_count_ and stub_group_size_ vars. (Target_powerpc::new_stub_table): Delete. (max_branch_delta): New function, extracted from.. (Target_powerpc::Relocate::relocate): ..here.. (Target_powerpc::Branch_info::make_stub): ..and here. Return status on whether stub created successfully. (Stub_control::Stub_control): Add "no_size_errors" param. Move default sizing to.. (Target_powerpc::do_relax): ..here. Init stub_group_size_ and reduce on relax failure. (Target_powerpc::group_sections): Add "no_size_errors" param. Use stub_group_size_. Set up group info in a temp vector, before building Stub_table vector. Account for input sections possibly already converted to relaxed sections. (Stub_table::init): Delete. Merge into.. (Stub_table::Stub_table): ..here. (Stub_table::can_reach_stub): New function. (Stub_table::add_plt_call_entry): Add "from" parameter and return true iff stub could be reached. (Stub_table::add_long_branch_entry): Similarly. Add "r_type" param too. (Stub_table::clear_stubs): Add "all" param.
2014-11-26[GOLD] PowerPC relaxation corner caseAlan Modra2-0/+14
It's possible for the section grouping code to decide that the last section looked at (the first section by address) doesn't fit into a group. In one case that section is already a group owner and that is handled correctly. In other cases the section should be put into its own group. Like this: * powerpc.cc (Stub_control::set_output_and_owner): New function. (Target_powerpc::group_sections): Use it.
2014-11-25Add file size to ELF symbol labelling start of a binary file.Cary Coutant3-8/+16
gold/ * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol. (Binary_to_elf::write_symbol): Add st_size parameter. * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
2014-11-25Fix corrupted .eh_frame section with LTO and --gc-sections.Cary Coutant3-6/+30
When --gc-sections is turned on during an LTO link, the .eh_frame sections from deferred files are processed before those from the replacement files. As a result, the section end-cap from crtendS.o is placed ahead of the .eh_frame data from the replacement files. This patch fixes the bug by skipping the layout of the deferred sections during GC pass 2. gold/ PR gold/17639 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_. (Sized_relobj_file::do_layout): Handle deferred sections properly during GC pass 1. Don't add reloc sections to deferred list twice. * object.h (Sized_relobj_file::is_deferred_layout): New function. (Sized_relobj_file::is_deferred_layout_): New data member.
2014-11-21Check PC-relative offset overflow in PLT entryH.J. Lu2-3/+14
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.
2014-11-21PPC gold doesn't check for overflow properlyAlan Modra2-4/+9
* powerpc.cc (Target_powerpc::Relocate::relocate): Correct test for undefined weaks.
2014-11-20PPC gold doesn't check for overflow properlyAlan Modra2-37/+60
Corrects overflow test for rel14, addr14, rel24, addr24 branch relocs, and prints an information message to give a hint as to how a branch that can't reach a stub might be cured. bfd/ * elf64-ppc.c (group_sections): Init stub14_group_size from --stub-group-size parameter divided by 1024. gold/ * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_ from --stub-group-size parameter divided by 1024. (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize template parameter. Update all uses. (Target_powerpc::Relocate::relocate): Rename has_plt_value to has_stub_value. Set for long branches. Don't report overflow for branch to undefined weak symbols. Print info message on overflowing branch to stub.
2014-11-20Default powerpc64 to --plt-thread-safe for GoAlan Modra2-0/+6
Go is multi-threaded, so use thread-safe plt stubs. __go_go doesn't actually start threads, but is a convenient libgo function with a reasonably unique name that is called by all Go executables. (Threads are started by a static function of libgo, runtime_newosproc, called by a whole lot of global functions, including runtime_starttheworld and runtime_main.) bfd/ * elf64-ppc.c (ppc64_elf_size_stubs): Add __go_go to thread_starters. gold/ * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
2014-11-14Don't make PLT entry for R_X86_64_GOTPLT64H.J. Lu2-7/+9
* 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.
2014-11-07Fix race condition when using --threads with linker plugins.Evgeniy Dushistov3-1/+14
2014-11-06 Evgeniy Dushistov <dushistov@mail.ru> gold/ * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file * plugin.h: add lock definition
2014-10-29Misc about gold for aarch64 backend.Han Shen5-142/+660
The patch does the following things: -- Add support for ifunc. -- Enable safe icf -- Add support for TLSLD relocations R_AARCH64_TLSLD_ADR_PAGE21, R_AARCH64_TLSLD_ADD_LO12_NC, R_AARCH64_TLSLD_MOVW_DTPREL_G1, R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC. (R_AARCH64_TLSLD_MOVW_* are used by LLVM.) -- Add support for TLSLD->TLSLE relaxation. -- Add support for R_AARCH64_LD_PREL_LO19, R_AARCH64_ADR_PREL_LO21. -- Fix 2 encoding bugs in AArch64_relocate_functions::update_movnz. -- Correct TLS relocation properties in gold/aarch64-reloc.def. -- Update testsuite/icf_safe_so_test.cc, testsuite/icf_safe_test.sh. gold/ 2014-10-29 Han Shen <shenhan@google.com> Jing Yu <jingyu@google.com> * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to Symbol::TLS_REF. * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New method. (Target_aarch64::reloc_needs_plt_for_ifunc): New method. (Target_aarch64::tls_ld_to_le): New method. (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections for 64bit targets. (Output_data_plt_aarch64::irelative_rel_): New data member. (Output_data_plt_aarch64::add_entry): Add irelative entries to plt. (Output_data_plt_aarch64::add_local_ifunc_entry): New method. (Output_data_plt_aarch64::add_relocation): New method. (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative offset. Add got_irelative size to got size. (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long type string with the new typename. (AArch64_relocate_functions::update_adr): Replace parameter x with immed. (AArch64_relocate_functions::update_movnz): Correct wrong val mask. (AArch64_relocate_functions::reloc_common): New method. (AArch64_relocate_funcsions::rela_general): Extract common part out into reloc_common method. (AArch64_relocate_functions::rela_general): Likewise. (AArch64_relocate_functions::pcrela_general): Likewise. (AArch64_relocate_functions::adr): New method. (AArch64_relocate_functions::adrp): Calculate immed before calling update_adr. (AArch64_relocate_functions::adrp): Likewise. (AArch64_relocate_functions::movnz): Cast x to SignedW type when comparing x to 0. Calculate immed from ~x when x < 0. (Target_aarch64::optimize_tls_reloc): Add new cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::possible_function_pointer_reloc): Implement this method. (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update comment. (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::make_plt_entry): Call add_entry with two more parameters. (Target_aarch64::make_local_ifunc_plt_entry): New method. (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19, ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::Relocate::relocate_tls): Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. * testsuite/icf_safe_so_test.cc: Correct test comment. * testsuite/icf_safe_test.sh: Add AArch64 arch.
2014-10-22[GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7Alan Modra2-0/+11
As for bfd.ld. Refer 2300b5a14 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to thread_starter.
2014-10-18* configure.tgt (targ_extra_obj) [aarch64*-*]: Define.Andreas Schwab2-0/+5
2014-10-17Add "typename" keyword to satisfy GCC 4.2.Cary Coutant2-1/+6
gold/ * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub): Add "typename" keyword.
2014-10-15Here we have the patch for gold aarch64 backend to support relaxation.Han Shen3-78/+2189
In short relaxation is the linker's generation of stubs that fixes the out-of-range jumps/branches in the original object file. With this implementation, we are able to link a 456MB aarch64 application. Tested: 1) Build natively on x86_64 and aarch64 machines. 2) Pass unit tests regarding relaxation.
2014-09-30Fix error from previous patch where tosize and tovalue were redefinedCary Coutant2-2/+7
in a block, shadowing the declarations outside the block. gold/ PR gold/17432 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
2014-09-30Fix SysV-style hash table when --hash-style=both.Kito Cheng2-20/+28
When --hash-style-both is used, gold currently builds the sysv hash table first, then the gnu hash table. Building the gnu hash table renumbers the dynamic symbol table, invalidating the sysv hash table. This patch reverses the order in which the hash tables are build so that both hash tables are correct. gold/ PR gold/13597 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style hash table before sysv-style hash table.
2014-09-292014-09-29 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam2-1/+6
* options.h (--pic-executable): Add negative to alias to -no-pie.
2014-09-26Fix handling of relocations against TLS section symbols.Cary Coutant2-1/+9
Gold doesn't handle relocations against the section symbol for a TLS section correctly. Instead of using the offset of the section relative to the TLS segment, it uses the address of the actual section. This patch checks for section symbols for TLS sections, and treats them the same as TLS symbols. gold/ PR gold/16773 * object.cc (Sized_relobj_file): Compute value of section symbols for TLS sections the same as TLS symbols.
2014-09-25Fix problem where TLS common symbols are not allocated properly during LTO.Cary Coutant3-8/+35
The plugin API doesn't provide a way for the claimed file handler to identify a TLS symbol, so when adding a common TLS symbol, gold mistakenly places the symbol in the non-TLS commons list, and does not override it when we see the replacement symbol that is marked as TLS. Consequently, we allocate the TLS common symbol as a regular common, and, if it's the only TLS in the program, we'll give an internal error because we haven't allocated a TLS segment. This patch fixes the problem by removing an exclusion where common symbols would not override the placeholder symbols, but checking to see if the size needs adjusting (the original reason for the exclusion). Furthermore, we need to avoid putting placeholder symbols in the common list, and wait until we see a real common symbol with a type we can trust. gold/ PR gold/17432 * resolve.cc (Symbol_table::resolve): Override common placeholder symbols, but adjust sizes. * symtab.cc (Symbol_table::add_from_object): Don't add placeholder symbols to common lists.
2014-09-24Regen gold POTFILES.inAlan Modra2-1/+7
* po/POTFILES.in: Regenerate.
2014-09-23Add PR reference to ChangeLog entry.Cary Coutant1-0/+1
2014-09-23 Taiju Tsuiki <tzik@google.com> Cary Coutant <ccoutant@google.com> gold/ PR gold/14860 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker on input_sections_blocker. * layout.cc (Write_sections_task::locks): Unblock input_sections_blocker_. * layout.h (Write_sections_task::Write_sections_task): Add input_sections_blocker. * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld to DEPENDENCIES. * testsuite/Makefile.in: Regenerate.
2014-09-23Fix race condition causing assert in Eh_frame_hdr::do_sized_write().Cary Coutant6-7/+25
2014-09-23 Taiju Tsuiki <tzik@google.com> Cary Coutant <ccoutant@google.com> gold/ * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker on input_sections_blocker. * layout.cc (Write_sections_task::locks): Unblock input_sections_blocker_. * layout.h (Write_sections_task::Write_sections_task): Add input_sections_blocker. * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld to DEPENDENCIES. * testsuite/Makefile.in: Regenerate.
2014-09-18A a testcase for common symbol handling with plugins.Rafael Ávila de Espíndola5-14/+94
2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> * testsuite/Makefile.am (plugin_test_10): New test. * testsuite/Makefile.in: Regenerate * testsuite/plugin_common_test_2.c (c1): Align to 8. * testsuite/plugin_test_10.sh: New file.
2014-09-17Regenerate gold/Makefile.in.Cary Coutant1-0/+1
2014-09-17Fix handling of common symbols with plugins.Rafael Ávila de Espíndola3-4/+11
gold/ChangeLog: 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size. * resolve.cc (Symbol_table::resolve): Don't override common symbols during the replacement phase.
2014-09-17Add tls support to gold aarch64 backend.Jing Yu3-132/+1568
elfcpp/ChangeLog: 2014-09-17 Han Shen <shenhan@google.com> * aarch64.h (R_AARCH64_TLS_DTPREL64): Switch enum value with ... (R_AARCH64_TLS_DTPMOD64): ... enum value. gold/ChangeLog: 2014-09-17 Han Shen <shenhan@google.com> Jing Yu <jingyu@google.com> * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC, TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL. * aarch64.cc (Target_aarch64): Add data members got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_, tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in constructor. (Target_aarch64::do_reloc_symbol_index): New method. (Target_aarch64::do_reloc_addend): New method. (Target_aarch64::add_tlsdesc_info): New method. (Target_aarch64::do_dynsym_value): New method. (Target_aarch64::do_make_data_plt): Add new parameters: got, got_irelative. Pass them to Output_data_plt_aarch64_standard. (Target_aarch64::make_data_plt): Add new parameters: got, got_irelative. Pass them to do_make_data_plt. (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable. (Target_aarch64::Relocate:tls_gd_to_le): New method. (Target_aarch64::Relocate:tls_ie_to_le): New method. (Target_aarch64::Relocate:tls_desc_gd_to_le): New method. (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method. (Target_aarch64::got_tlsdesc_section): New method. (Target_aarch64::make_local_ifunc_plt_entry): New method. (Target_aarch64::define_tls_base_symbol): New method. (Target_aarch64::reserve_tlsdesc_entries): New method. (Target_aarch64::got_mod_index_entry): New method. (Target_aarch64::rela_tlsdesc_section): New method. (Target_aarch64::rela_irelative_section): New method. (Target_aarch64::Tlsdesc_info): New struct. (Target_aarch64::got_section): Create .got.plt space for IRELATIVE relocations and tlsdesc relocations. (Target_aarch64::optimize_tls_reloc): Implement method. (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_, got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them in constructor. (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method. (Output_data_plt_aarch64::has_tlsdesc_entry): New method. (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method. (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method. (Output_data_plt_aarch64::rela_tlsdesc): New method. (Output_data_plt_aarch64::rela_irelative): New method. (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations. (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute. (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method. (Output_data_plt_aarch64::fill_tlsdesc_entry): New method. (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method. (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method. (Output_data_plt_aarch64_standard): New member variables: plt_tlsdesc_entry_size, tlsdesc_plt_entry. (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard): New parameter: got, got_irelative. (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method. (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method. (Output_data_plt_aarch64::do_write): Replace got_address with gotplt_address. Add irelative_count_ to count. Write tlsdesc entry. (AArch64_relocate_functions::update_movnz): New method. (AArch64_relocate_functions): Correct format. (AArch64_relocate_functions::movnz): New method. (Target_aarch64::Scan::local): Correct format. Move r_sym, got to before the switch. Add new cases to switch. Check ie_to_le relaxation on tlsie relocations. Add code handling tlsgd tlsdesc cases. (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when needed. Add new cases to switch. Insert dynamic RELATIVE relocation when needed. Add code handling tlsgd, tlsie, tlsdesc cases. Call reloc_name_in_error_message to print unsupported reloc. (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to make_data_plt. (Target_aarch64::do_finalize_sections): Emit relocs to save COPY relocs. Fill in some more dynamic tags. (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs. Skip call tls_get_addr when tlsgd is relaxed. (Target_aarch64::Relocate::relocate_tls): Correct format. Add code handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le, tlsdesc->ie relaxation.
2014-09-03Add NaCl (NativeClient) specific classes Target_mips_nacl andSasa Stankovic2-7/+75
Target_selector_mips_nacl. gold/ * mips.cc (Target_mips_nacl): New class. (Target_selector_mips_nacl): New class. (target_selector_mips32): Rename from target_selector_mips32be and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips32el): Rename from target_selector_mips32 and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips64): Rename from target_selector_mips64be and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips64el): Rename from target_selector_mips64 and use Target_selector_mips_nacl instead of Target_selector_mips. (Target_mips::mips_info): Add const attribute.
2014-09-02Make Elf_file::section_name() a const function, so that it can be used inCary Coutant8-13/+27
places where we have only a const Elf_file*. elfcpp/ * elfcpp_file.h (Elf_file::shnum): New const function. (Elf_file::shstrndx): New const function. (Elf_file::large_shndx_offset): New const function. (Elf_file::section_name): Add const attribute. (Elf_file::section_header_offset): Likewise. gold/ * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute. * dynobj.h (Sized_dynobj::do_section_name): Likewise. * incremental.cc (Sized_relobj_incr::do_section_name): Likewise. (Sized_incr_dynobj::do_section_name): Likewise. * incremental.h (Sized_relobj_incr::do_section_name): Likewise. (Sized_incr_dynobj::do_section_name): Likewise. * object.h (Object::section_name): Likewise. (Object::do_section_name): Likewise. (Sized_relobj_file::do_section_name): Likewise. * plugin.cc (Sized_pluginobj::do_section_name): Likewise. * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2014-09-02Fix problem with optimization of .eh_frame section and --sort-section option.Cary Coutant4-85/+72
When --sort-section=name is used, gold will sort the linker-generated contents of .eh_frame (after optimization) after the endcap provided by crtendS.o. This causes two problems: the .eh_frame_hdr section is generated assuming that the optimized .eh_frame contents will be placed at the very beginning of the section, and the endcap no longer appears at the end of the section. This patch fixes the first problem by adjusting FDE offsets to take into account the actual starting offset within the output section, and fixes the second problem by sorting linker-generated (Output_section_data) sections based on the name of the output section. gold/ PR gold/17005 * ehframe.cc (Fde::write): Add output_offset parameter. (Cie::write): Likewise. (Eh_frame::set_final_data_size): Account for offset within output section. (Eh_frame::do_sized_write): Likewise. * ehframe.h (Fde::write): Add output_offset parameter. (Cie::write): Likewise. * output.cc (Output_section::Input_section_sort_entry): Remove section_has_name_; add output_section_name parameter. Use output section name for non-input sections. (Output_section::Input_section_sort_entry::section_has_name): Remove. (Output_section::Input_section_sort_entry::section_has_name_): Remove. (Output_section::Input_section_sort_compare): Remove logic for sections without names. (Output_section::Input_section_sort_init_fini_compare): Likewise. (Output_section::Input_section_sort_section_prefix_special_ordering_compare): Likewise. (Output_section::Input_section_sort_section_name_compare): Likewise.
2014-08-29The 3rd patch for aarch64 gold.Han Shen4-56/+624
This enables - 1. static linking hello world 2. limited support for TLSIE and TLSLE 3. limited support for linking shared library, linking executable against shared library. gold/ChangeLog 2014-08-29 Han Shen <shenhan@google.com> Jing Yu <jingyu@google.com> * aarch64-reloc-property.cc (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in reference reloc property in the table. * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in 3 other entries. * aarch64.cc: (Output_data_got_aarch64::add_static_reloc): 2 new overloaded methods. (Output_data_got_aarch64::do_write): Add code to write out static relocs. (class Output_data_got_aarch64::Static_reloc): New class to wrap static relocs. (Output_data_got_aarch64::static_relocs): New vector to hold static relocs. (Target_aarch64::TCB_SIZE): New const static memeber. (Target_aarch64::tcb_size): New method. (Target_aarch64::Relocate::relocate): Add code handling new reloc types. (Target_aarch64::Relocate::relocate_tls): New method. (Target_aarch64::Scan::local): Add code handling new reloc types. (Target_aarch64::Scan::global): Add code handling new reloc types.