aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-11-04Remove powerpc.cc copy of use_plt_offsetAlan Modra2-115/+37
This adds an extra flag for needs_dynamic_reloc() in order to remove the copy of this function and use_plt_offset() in powerpc.cc, and tweaks the powerpc get_reference_flags() to return the flag as appropriate. ELFv2 does not want ELFv1 behaviour here. * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI. (Symbol::needs_dynamic_reloc): Test new flag. * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete. (Target_powerpc::Scan::get_reference_flags): Add target param. Return FUNC_DESC_ABI for 64-bit ELFv1. (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags call. (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc. (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2013-11-03Remove incorrect ATTRIBUTE_UNUSED from nios2 bfdSandra Loosemore2-13/+29
2013-11-03 Sandra Loosemore <sandra@codesourcery.com> bfd/ * elf32-niso2.c (nios2_elf32_do_hi16_relocate): Remove incorrect ATTRIBUTE_UNUSED from parameter. (nios2_elf_do_lo16_relocate): Likewise. (nios2_elf32_do_hiadj16_relocate): Likewise. (nios2_elf32_do_pcrel_lo16_relocate): Likewise. (nios2_elf32_do_pcrel_hiadj16_relocate): Likewise. (nios2_elf32_do_pcrel16_relocate): Likewise. (nios2_elf32_do_call26_relocate): Likewise. (nios2_elf32_do_gprel_relocate): Likewise. (nios2_elf32_do_ujmp_relocate): Likewise. (nios2_elf32_do_cjmp_relocate): Likewise. (nios2_elf32_do_callr_relocate): Likewise. (nios2_elf32_gc_mark_hook): Likewise.
2013-11-04Edit ELFv2 global entry prologue to non-PICAlan Modra4-2/+44
Changing addis r2,r12,..; addi r2,r2,.. to lis r2,..; addi r2,r2.. in non-PIC executables has the benefit of removing a dependency on r12. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Edit global entry prologue to non-PIC in non-PIC executables. ld/testsuite/ * ld-powerpc/elfv2exe.d: Adjust for non-PIC global entry.
2013-11-04PowerPC64 ELFv2 symbols defined in pltAlan Modra2-48/+276
In a non-pic executable, ELFv2 like other targets, needs to emit a plt entry even for non-call references to functions defined in shared libraries, and define the function on the plt code. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Copy pointer_equality_needed flag. (ppc64_elf_check_relocs): For ELFv2 arrange to emit plt entries for references to functions in shared libraries on non-call relocs. (readonly_dynrelocs): Split into function of the same name and.. (maybe_set_textrel): ..this new function. Update call. (ppc64_elf_adjust_dynamic_symbol): Don't emit dynrelocs for ELFv2 in most cases if we have a plt entry. Use new readonly_relocs. (allocate_dynrelocs): For ELFv2, don't allocate dynreloc space for ifunc in static executables. (size_global_entry_stubs): New function. (ppc64_elf_size_dynamic_sections): Call size_global_entry_stubs. Save end of glink branch table. (ppc64_elf_hash_symbol): New function. (build_global_entry_stubs): New function. (ppc64_elf_build_stubs): Call build_global_entry_stubs. Adjust glink sizing. (ppc64_elf_relocate_section): Tidy plt16/32/64 reloc code. (ppc64_elf_finish_dynamic_symbol): For ELFv2, adjust symbols defined on plt code.
2013-11-04Allow for extra st_other readelf output in ld testsuiteAlan Modra3-3/+10
On PowerPC64 ELFv2 readelf emits [<localentry>: 8] describing extra symbol st_other bits. * ld-elfvers/vers24.rd: Allow extra readelf output after symbol visibility. * ld-ifunc/ifunc.exp: Likewise.
2013-11-04ld crossref test fixAlan Modra2-2/+16
* ld-scripts/crossref.exp: Don't allow changes made to CFLAGS for this test to bleed into following tests. Don't set -mcall-aixdesc for powerpc64le.
2013-11-04daily updateAlan Modra1-1/+1
2013-11-03daily updateAlan Modra1-1/+1
2013-11-02ChangeLog fix.Alan Modra1-0/+1
2013-11-02Fix gprof buildAlan Modra3-4/+8
* Makefile.am (.m.c): Fix input and output file specification.
2013-11-02Remove unnecessary _bfd_new_bfd initialisationAlan Modra2-15/+4
nbfd is allocated by bfd_zmalloc. * opncls.c (_bfd_new_bfd): Don't init vars already zeroed.
2013-11-02Assorted x86 testsuite fixes.Alan Modra6-11/+16
I think HJ has already fixed the binutils and ld tests with his 2013-09-27 readelf change, but this allows them to pass with wider address output as per Nick's 2013-09-12 readelf change. binutils/testsuite/ * binutils-all/x86-64/compressed-1a.d: Allow wide display of addresses. gas/testsuite/ * gas/cfi/cfi-x86_64.d: Match when lacking end of section padding. ld/testsuite/ * ld-pe/cfi.d: Allow wide display of addresses.
2013-11-02Testsuite fix for targets where .int isn't 4 bytesAlan Modra3-3/+8
* binutils-all/dw2-1.S: Use .4byte rather than .int. * binutils-all/dw2-2.S: Likewise.
2013-11-02Simplify ppc64 code setting toc_off.Alan Modra2-35/+23
Every function has a nominal toc pointer value, even if it isn't used, so set toc_off for every code section to the value used in that object file. The thinking here was that if a code section didn't use the toc it could use the previous object file's toc pointer value. It can, but doing so is only a gain if functions in that section are called mostly from previous objects sharing the same toc. We lose if the functions in question are called mostly from the current object or following objects, and it's a good bet they will probably mostly be called from the current object. * elf64-ppc.c (ppc64_elf_next_input_section): Always set toc_off to value for object file.
2013-11-02gdb.cp/derivation.exp: s/perrro/perror/Maciej W. Rozycki2-1/+5
2013-11-02daily updateAlan Modra1-1/+1
2013-11-01x86_64-*-nacl*: Adjust test cases for PLT nop fix.Roland McGrath3-3/+8
ld/testsuite/ * ld-x86-64/plt-nacl.pd: Update expected disassembly for PLT nop fix. * ld-x86-64/tlsdesc-nacl.pd: Likewise.
2013-11-01*-*-nacl* layout: Drop requirement that some section have SEC_HAS_CONTENTS set.Roland McGrath2-5/+9
bfd/ * elf-nacl.c (segment_eligible_for_headers): Drop requirement that some section have SEC_HAS_CONTENTS set. It's not set for .note.gnu.build-id, and a segment of only read-only SHT_NOBITS sections is implausible and not really supportable anyway.
2013-11-01gdb.dwarf2/dwzbuildid.exp: Avoid reserved variable nameMaciej W. Rozycki2-3/+8
* gdb.dwarf2/dwzbuildid.exp: Rename `outdir' variable to `debugdir'.
2013-11-01breakpoint.c: fix libc probe scan when no get_longjmp_target exists.Tiago Stürmer Daitx2-2/+8
As discussed on the GDB ML[1], libc probes for longjmp were not being loaded if a custom <arch>_get_longjmp_target function was not implemented. This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p (gdbarch))' down, just bellow libc probe code and above the per-objfile cache lookup. While the condition could also be removed altogether with no side-effects, it is in fact an optimization to avoid searching for symbols if the arch doesn't provide support for get_longjmp_target(). This has been tested on PPC and PPC64. [1] https://sourceware.org/ml/gdb/2013-10/msg00191.html gdb/ 2013-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com> * breakpoint.c (create_longjmp_master_breakpoint): Allow libc probe scan even when the arch provides no get_longjmp_target.
2013-11-01daily updateAlan Modra1-1/+1
2013-10-31infrun.c: use GDB_SIGNAL_0 when hidding signals, not GDB_SIGNAL_TRAP.Pedro Alves2-9/+15
IMO, it doesn't make sense to map random syscall, fork, etc. events to GDB_SIGNAL_TRAP, and possible have the debuggee see that trap. This just seems conceptually wrong to me - these aren't real signals a debuggee would ever see. In fact, when stopped for those events, on Linux, the debuggee isn't in a signal-stop -- there's no way to resume-and-deliver-signal at that point, for example. E.g., when stopped at a fork event: (gdb) catch fork Catchpoint 2 (fork) (gdb) c Continuing. Catchpoint 2 (forked process 4570), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) set debug infrun 1 (gdb) signal SIGTRAP Continuing with signal SIGTRAP. infrun: clear_proceed_status_thread (process 4566) infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0) infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4566] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4566 [process 4566], infrun: status->kind = exited, status = 0 infrun: infwait_normal_state infrun: TARGET_WAITKIND_EXITED [Inferior 1 (process 4566) exited normally] infrun: stop_stepping (gdb) Note the signal went nowhere. It was swallowed. Resuming with a SIGTRAP from a syscall event does queue the signal, but doesn't deliver it immediately, like "signal SIGTRAP" from a real signal would. It's still an artificial SIGTRAP: (gdb) catch syscall Catchpoint 2 (any syscall) (gdb) c Continuing. Catchpoint 2 (call to syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) set debug infrun 1 (gdb) signal SIGTRAP Continuing with signal SIGTRAP. infrun: clear_proceed_status_thread (process 4622) infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0) infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4622 [process 4622], infrun: status->kind = exited syscall infrun: infwait_normal_state infrun: TARGET_WAITKIND_SYSCALL_RETURN infrun: syscall number = '56' infrun: BPSTAT_WHAT_STOP_NOISY infrun: stop_stepping Catchpoint 2 (returned from syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) c Continuing. infrun: clear_proceed_status_thread (process 4622) infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0) infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4622 [process 4622], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4ba7c4 infrun: random signal 5 Program received signal SIGTRAP, Trace/breakpoint trap. infrun: stop_stepping 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) In all the above, I used 'signal SIGTRAP' to emulate 'handle SIGTRAP pass'. As described in "keep_going", 'handle SIGTRAP pass' does have its place: /* Do not deliver GDB_SIGNAL_TRAP (except when the user explicitly specifies that such a signal should be delivered to the target program). Typically, that would occur when a user is debugging a target monitor on a simulator: the target monitor sets a breakpoint; the simulator encounters this breakpoint and halts the simulation handing control to GDB; GDB, noting that the stop address doesn't map to any known breakpoint, returns control back to the simulator; the simulator then delivers the hardware equivalent of a GDB_SIGNAL_TRAP to the program being debugged. */ ... and I've made use of that myself when implementing/debugging stubs/monitors. But in these cases, treating these events as SIGTRAP possibly injects signals in the debuggee they'd never see otherwise, because you need to use ptrace to enable these special events, which aren't real signals. There's more. Take this bit of handle_inferior_event, where we determine whether a real signal (TARGET_WAITKIND_STOPPED) was random or not: if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP) ecs->random_signal = !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat, GDB_SIGNAL_TRAP) != BPSTAT_SIGNAL_NO) || stopped_by_watchpoint || ecs->event_thread->control.trap_expected || (ecs->event_thread->control.step_range_end && (ecs->event_thread->control.step_resume_breakpoint == NULL))); else { enum bpstat_signal_value sval; sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat, ecs->event_thread->suspend.stop_signal); ecs->random_signal = (sval == BPSTAT_SIGNAL_NO); if (sval == BPSTAT_SIGNAL_HIDE) ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP; } Note that the if (sval == BPSTAT_SIGNAL_HIDE) ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP; bit is only reacheable for signals != GDB_SIGNAL_TRAP. AFAICS, sval can only be BPSTAT_SIGNAL_HIDE if nothing in the bpstat returns BPSTAT_SIGNAL_PASS. So that excludes a "catch signal" for the signal in question in the bpstat. All other catchpoints that aren't based on breakpoints behind the scenes call process_event_stop_test directly (don't pass through here) (well, almost all: TARGET_WAITKIND_LOADED does have a fall through, but only for STOP_QUIETLY or STOP_QUIETLY_NO_SIGSTOP, which still return before this code is reached). Catchpoints that are implemented as breakpoints behind the scenes can only appear in the bpstat if the signal was GDB_SIGNAL_TRAP (bkpt_breakpoint_hit returns false otherwise). So that leaves a target reporting a hardware watchpoint hit with a signal other than GDB_SIGNAL_TRAP. And even then it looks quite wrong to me to magically convert the signal into a GDB_SIGNAL_TRAP here too -- if the user has set SIGTRAP to "handle pass", the program will see a trap that gdb invented, not one the program would ever see without gdb in the picture. Tested on x86_64 Fedora 17. gdb/ 2013-10-31 Pedro Alves <palves@redhat.com> * infrun.c (handle_syscall_event): Don't set or clear stop_signal. (handle_inferior_event) <TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED>: Don't set stop_signal to GDB_SIGNAL_TRAP, or clear it. Pass GDB_SIGNAL_0 to bpstat_explains signal, instead of GDB_SIGNAL_TRAP. <bpstat handling>: If the bpstat chain wants the signal to be hidden, then set stop_signal to GDB_SIGNAL_0 instead of GDB_SIGNAL_TRAP.
2013-10-31Restore support for dwp v2 DWARF package file format.Cary Coutant5-549/+682
gold/ * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add tu_length parameter. Adjust all callers. * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise. * dwp.cc: Include dwarf.h. (Section_bounds): New struct type. (Unit_set): New struct type. (Dwo_file::Dwo_file): Initialize new data member. (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index): Combine and rename to... (Dwo_file::read_unit_index): ...this. (Dwo_file::sized_read_compunit_index) (Dwo_file::sized_read_typeunit_index): Combine and rename to... (Dwo_file::sized_read_unit_index): ...this. (Dwo_file::copy_section): Remove section_name, is_str_offsets parameters; add section_id parameter. (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to... (Dwo_file::add_unit_set): ...this. (Dwo_file::shndx_map_): Remove. (Dwo_file::sect_offsets_): New data member. (Dwp_output_file::Dwp_output_file): Initialize new data members. (Dwp_output_file::add_section): Rename to... (Dwp_output_file::add_contribution): ...this. (Dwp_output_file::add_cu_set): Combine parameters into a struct. (Dwp_output_file::add_tu_set): Likewise. (Dwp_output_file::Contribution): New type. (Dwp_output_file::Section::contributions): New data member. (Dwp_output_file::Cu_or_tu_set): Remove. (Dwp_output_file::Section::Section): New ctor. (Dwp_output_file::Dwp_index::Shndx_pool): Remove. (Dwp_output_file::Dwp_index::Section_table): New type. (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members. (Dwp_output_file::Dwp_index::enter_set): Change type of "set" parameter. (Dwp_output_file::Dwp_index::shndx_pool): Remove. (Dwp_output_file::Dwp_index::shndx_pool_end): Remove. (Dwp_output_file::Dwp_index::section_table): New member function. (Dwp_output_file::Dwp_index::section_table_end): New member function. (Dwp_output_file::Dwp_index::shndx_pool_size): Remove. (Dwp_output_file::Dwp_index::section_table_rows): New member function. (Dwp_output_file::Dwp_index::section_table_cols): New member function. (Dwp_output_file::Dwp_index::shndx_pool_): Remove. (Dwp_output_file::Dwp_index::section_table_): New data member. (Dwp_output_file::Dwp_index::section_mask_): New data member. (Dwp_output_file::add_output_section): New member function. (Dwp_output_file::write_new_section): New member function. (Dwp_output_file::write_contributions): New member function. (Dwp_output_file::section_id_map_): New data member. (class Dwo_id_info_reader): Remove. (class Unit_reader): New class. (get_dwarf_section_name): New function. (Dwo_file::read_executable): Adjust initializations of class data. (Dwo_file::read): Add support for v2 package file format. (Dwo_file::read_unit_index): Likewise. (Dwo_file::sized_read_unit_index): Likewise. (Dwo_file::copy_section): Likewise. (Dwo_file::add_unit_set): Likewise. (Dwp_output_file::add_output_section): Likewise. (Dwp_output_file::add_contribution): Likewise. (Dwp_output_file::Dwp_index::find_or_add): Use row index to check for empty slot. (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package file format. (Dwp_output_file::Dwp_index::grow): Use row index to check for empty slot. (Dwp_output_file::initialize): Remove unused function. (Dwp_output_file::finalize): Add support for v2 package file format. (Dwp_output_file::write_index): Likewise. * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust function prototype.
2013-10-31gold/Cary Coutant3-4/+9
* configure.ac: Fix check for -fmerge-constants. * configure.ac: Regenerate.
2013-10-31Extra error message from update_watchpointAndrew Burgess5-6/+48
https://sourceware.org/ml/gdb-patches/2013-10/msg00551.html gdb/ChangeLog * breakpoint.c (update_watchpoint): Update error message and add an additional error message. gdb/testsuite/ChangeLog * gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional tests and update expected error message. (test_watch_register_location): New tests. (do_tests): Call test_watch_register_location. * gdb.base/watchpoints.exp: Update expected error message.
2013-10-30gold: x86_64-nacl: Correct 9-byte nop sequence to match what the assembler ↵Roland McGrath2-1/+6
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.
2013-10-31daily updateAlan Modra1-1/+1
2013-10-30S/390: Add missing gdb_prompt in s390-multiarch.expUlrich Weigand2-2/+9
Correct the patterns in the gdb_test_multiple invocation. testsuite/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to the patterns in gdb_test_multiple.
2013-10-30S/390: Rename source files to *-linux-*Ulrich Weigand8-9/+27
As suggested before, rename the S/390-related source files (tdep and nat) such that "-linux-" occurs in the file name, like with other GNU/Linux targets. Since no other operating system is currently supported by GDB on this architecture, this isn't strictly necessary. But the old names sometimes caused GDB contributors to miss these files when performing a change that affects all GNU/Linux targets. The latest such incident was observed here: https://sourceware.org/ml/gdb-patches/2013-09/msg00619.html gdb/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * s390-tdep.h: Rename to... * s390-linux-tdep.h: ...here. * s390-tdep.c: Rename to... * s390-linux-tdep.c: ...here. Adjust #include. * s390-nat.c: Rename to... * s390-linux-nat.c: ...here. Adjust #include. * config/s390/s390.mh: Rename to... * config/s390/linux.mh: ...here. Reflect rename s390-nat.o -> s390-linux-nat.o. * configure.host: Reflect host rename "s390" -> "linux". * configure.tgt: Reflect rename s390-tdep.o -> s390-linux-tdep.o. * Makefile.in (ALL_TARGET_OBS): Likewise. (HFILES_NO_SRCDIR): Reflect rename s390-tdep.h -> s390-linux-tdep.h. (ALLDEPFILES): Reflect rename of .c files.
2013-10-30Clean up whitespace in S/390 -tdep and -nat files.Ulrich Weigand4-134/+139
gdb/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * s390-nat.c: Whitespace cleanup. * s390-tdep.c: Likewise. * s390-tdep.h: Remove empty line at end of file.
2013-10-30S/390: Disassemble 31-bit binaries with "zarch" opcode set by defaultAndreas Arnez2-11/+6
Currently the disassembler for s390 (by default) assumes that a 31-bit binary was compiled in "ESA" mode -- and then only disassembles a limited opcode set. The change upgrades the default to the full "zarch" opcode set even for 31-bit binaries. opcodes/ * s390-dis.c (init_disasm): Default to full 'zarch' opcode availability even for 31-bit programs.
2013-10-30PowerPC64 ELFv2 support for gold.Alan Modra4-134/+506
elfcpp/ * powerpc.h (EF_PPC64_ABI): New enum constant. (STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Likewise. (ppc64_decode_local_entry): New function. (ppc64_encode_local_entry): Likewise. gold/ * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion, ppc64_local_entry_offset, ppc64_local_entry_offset, do_read_symbols): New functions. (Powerpc_relobj::e_flags_, st_other_): New vars. (Powerpc_relobj::Powerpc_relobj): Call set_abiversion. (Powerpc_dynobj::abiversion, set_abiversion): New functions. (Powerpc_relobj::e_flags_): New var. (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline and adjust for ELFv2. (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions. (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2. (Powerpc_dynobj::do_find_special_sections): Likewise. (Target_powerpc::do_define_standard_symbols): Define ".TOC.". (Target_powerpc::Branch_info::make_stub): Adjust stub destination to ELFv2 local entry. (Target_powerpc::do_relax): No thread safe barriers needed for ELFv2. (Output_data_plt_powerpc::initial_plt_entry_size_, plt_entry_size): Delete. Replace all uses with first_plt_entry_offset() and plt_entry_size(). (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove reserved_size parm. Update callers. (Output_data_plt_powerpc::entry_count): Update. (Output_data_plt_powerpc::first_plt_entry_offset): Make private and use Target_powerpc::first_plt_entry_offset(). (Output_data_plt_powerpc::get_plt_entry_size): Similarly and rename to plt_entry_size. (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): Adjust reloc for ELFv2. (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1. (glink_eh_frame_fde_64v2): New. (Stub_table::plt_call_size): Support ELFv2 sizing. (Output_data_glink::add_eh_frame): Use the new FDE. (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink. (Stub_table::do_write): Write ELFv2 stubs and glink. (Target_powerpc::Relocate::relocate): Replaces nop after call with ld 2,24(1) and adjust local offset destination for ELFv2.
2013-10-30Add PowerPC64 ELFv2 tests.Alan Modra5-0/+163
* ld-powerpc/elfv2.s, * ld-powerpc/elfv2so.d, * ld-powerpc/elfv2exe.d: New tests. * ld-powerpc/powerpc.exp: Run them.
2013-10-30Replace DT_PPC_TLSOPT with DT_PPC_OPT.Alan Modra8-11/+44
This removes the DT_PPC_TLSOPT/DT_PPC64_TLSOPT dynamic tag and replaces it with DT_PPC_OPT/DT_PPC64_OPT tag to provide the same functionality and more. This isn't backwards compatible, but the TLSOPT tag hasn't been used since the tls optimisation support was never submitted to glibc. /include/elf/ * ppc.h (DT_PPC_TLSOPT): Delete. (DT_PPC_OPT, PPC_OPT_TLS): Define. * ppc64.h (DT_PPC64_TLSOPT): Delete. (DT_PPC64_OPT, PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC): Define. bfd/ * elf32-ppc.c (ppc_elf_size_dynamic_sections): Use new DT_PPC_OPT tag to specify tls optimisation. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise. (ppc64_elf_finish_dynamic_sections): Specify whether multiple toc pointers are used via DT_PPC64_OPT. binutils/ * readelf.c (get_ppc_dynamic_type): Replace PPC_TLSOPT with PPC_OPT. (get_ppc64_dynamic_type): Replace PPC64_TLSOPT with PPC64_OPT.
2013-10-30Support ELFv2 stack frame.Alan Modra2-17/+32
The toc pointer save slot changes on ELFv2 from 40(1) to 24(1). * elf64-ppc.c (STK_LR, STK_TOC, STK_LINKER): Define. (savegpr0_tail, restgpr0_tail, savefpr0_tail, restfpr0_tail) build_plt_stub, build_tls_get_addr_stub, ppc_build_one_stub, ppc64_elf_relocate_section): Use new defines.
2013-10-30ELFv2 stub, plt and glink changesAlan Modra2-119/+220
An ELFv2 PLT entry is simply the address of the target function rather than three (or two) words to specify entry, toc and static chain. PLT call stubs are correspondingly simpler and need no thread safety barrier. The glink resolver stub and branch table also is simplified, a change that could be applied to ELFv1 too, but isn't as yet. * elf64-ppc.c (PLT_ENTRY_SIZE, PLT_INITIAL_ENTRY_SIZE): Add htab parameter and adjust for ELFv2. Update all uses. (PLT_CALL_STUB_SIZE): Delete. (ppc64_elf_get_synthetic_symtab): Support new glink layout. (allocate_dynrelocs): Likewise. (plt_stub_size, build_plt_stub): Adjust for ELFv2. (get_r2off): Return 0 for ELFv2 -R. (ppc_build_one_stub, ppc_size_one_stub): Adjust for ELFv2. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_build_stubs): Add new ELFv2 glink.
2013-10-30Add ELFv2 .localentry support.Alan Modra8-9/+268
This defines the ELF symbol st_other field used to encode the number of instructions between a function "global entry" and its "local entry", and adds support related to the local entry offset. include/elf/ * ppc64.h (STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Define. (ppc64_decode_local_entry, ppc64_encode_local_entry): New functions. (PPC64_LOCAL_ENTRY_OFFSET, PPC64_SET_LOCAL_ENTRY_OFFSET): Define. bfd/ * elf64-ppc.c (struct ppc_stub_hash_entry): Add "other". (stub_hash_newfunc): Init new ppc_stub_hash_entry field, and one we forgot, "plt_ent". (ppc64_elf_add_symbol_hook): Check ELFv1 objects don't have st_other bits only valid in ELFv2. (ppc64_elf_merge_symbol_attribute): New function. (ppc_type_of_stub): Add local_off param to test branch range. (ppc_build_one_stub): Adjust destinations for ELFv2 locals. (ppc_size_one_stub, toc_adjusting_stub_needed): Similarly. (ppc64_elf_size_stubs): Pass local_off to ppc_type_of_stub. Set "other" field. (ppc64_elf_relocate_section): Adjust destination for ELFv2 local calls. gas/ * config/tc-ppc.c (md_pseudo_table): Add .localentry. (ppc_elf_localentry): New function. (ppc_force_relocation): Force relocs on all branches to localenty symbols. (ppc_fix_adjustable): Don't reduce such symbols to section+offset. binutils/ * readelf.c (get_ppc64_symbol_other): New function. (get_symbol_other): Use it for EM_PPC64.
2013-10-30Add .abiversion related support for ELFv2Alan Modra9-15/+213
Defines bits in ELF e_flags to differentiate ELFv2 objects from ELFv2, adds .abiversion directive to explicitly choose the ABI, and code to check and automatically select ABI. include/elf/ * ppc64.h (EF_PPC64_ABI): Define. bfd/ * elf64-ppc.c (abiversion, set_abiversion): New functions. (ppc64_elf_get_synthetic_symtab): Handle ELFv2 objects without .opd. (struct ppc_link_hash_table): Add opd_abi. (ppc64_elf_check_relocs): Check no .opd with ELFv2. (ppc64_elf_merge_private_bfd_data): New function. (ppc64_elf_print_private_bfd_data): New function. (ppc64_elf_tls_setup): Set htab->opd_abi. (ppc64_elf_size_dynamic_sections): Don't emit OPD related dynamic tags for ELFv2. (ppc_build_one_stub): Use R_PPC64_IRELATIVE for ELFv2 ifunc. (ppc64_elf_finish_dynamic_symbol): Likewise binutils/ * readelf.c (get_machine_flags): Display ABI version for EM_PPC64. gas/ * config/tc-ppc.c: Include elf/ppc64.h. (ppc_abiversion): New variable. (md_pseudo_table): Add .abiversion. (ppc_elf_abiversion, ppc_elf_end): New functions. * config/tc-ppc.h (md_end): Define.
2013-10-30Change plt stubs to have destination in r12.Alan Modra22-244/+299
This change is to support the new ELFv2 ABI, which uses the value in r12 on function entry to calculate the got/toc pointer. bfd/ * elf64-ppc.c (build_plt_stub): Switch stubs to use r11 as base reg and r12 as destination. (ppc_build_one_stub): Likewise. (ppc64_elf_build_stubs): Likewise for glink. ld/testsuite/ * ld-powerpc/tls.s: Add proper .opd entry for _start. * ld-powerpc/tlstoc.s: Likewise. * ld-powerpc/relbrlt.d: Update for changed stubs. * ld-powerpc/tls.d: Update for changed stubs and _start .opd entry. * ld-powerpc/tls.g: Likewise. * ld-powerpc/tlsexe.d: Likewise. * ld-powerpc/tlsexe.g: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.d: Likewise. * ld-powerpc/tlsexetoc.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.d: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstoc.d: Likewise. * ld-powerpc/tlstoc.g: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-powerpc/tlstocso.r: Likewise.
2013-10-30Report overflow on PowerPC64 @h and @ha relocations.Alan Modra13-109/+433
This changes the behaviour of @h and @ha on PowerPC64 to report errors on 32-bit overflow. The motivation for this change is that on PowerPC64, most uses of @h and @ha modifiers and their corresponding relocations are to build up 32-bit offsets. We'd like to know when such offsets overflow. Only rarely do people use @h or @ha with the high 32-bit modifiers to build a 64-bit constant. Those uses will now need to use two new modifiers, @high and @higha, if the constant isn't known at assembly time. For now, we won't report overflow at assembly time.. This also fixes an error when applying some of the HIGHER and HIGHEST relocations. include/elf/ * ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA, R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA, R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New. (IS_PPC64_TLS_RELOC): Match new tls relocs. bfd/ * reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA, BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA, BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New. * elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs. Make all _HA and _HI relocs report signed overflow. (ppc64_elf_reloc_type_lookup): Handle new relocs. (must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise. (dec_dynrel_count, ppc64_elf_relocate_section): Likewise. (ppc64_elf_relocate_section): Don't apply 0x8000 adjust to R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST, R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. gas/ * config/tc-ppc.c (SEX16): Don't mask. (REPORT_OVERFLOW_HI): Define as zero. (ppc_elf_suffix): Support @high, @higha, @dtprel@high, @dtprel@higha, @tprel@high, and @tprel@higha modifiers. (md_assemble): Ignore X_unsigned when applying 16-bit insn fields. Add (disabled) code to check @h and @ha reloc overflow for powerpc64. Handle new relocs. (md_apply_fix): Similarly. elfcpp/ * powerpc.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA, R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA, R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Define. gold/ * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs. (Target_powerpc::Scan::global, local): Likewise. (Target_powerpc::Relocate::relocate): Likewise. Check for overflow on all ppc64 @h and @ha relocs.
2013-10-30linux-tdep.c: Fix "warning: 'siginfo_size' may be used uninitialized..."Maciej W. Rozycki2-1/+6
* linux-tdep.c (linux_corefile_thread_callback): Preinitialize siginfo_size.
2013-10-29BFD: elf64-x86-64-nacl: Correct 9-byte nop sequence used in PLT0 entry.Roland McGrath2-1/+6
bfd/ * elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop sequence to match what the assembler generates.
2013-10-30daily updateAlan Modra1-1/+1
2013-10-30daily updateAlan Modra1-1/+1
2013-10-29ld/ELF: refine fake STT_FILE symbol emissionJan Beulich31-89/+106
There's no real need to emit these always: They're needed only if we indeed want to emit a localized symbol. Hence defer emission until we at least did the basic early checks that would lead to no such symbol getting emitted. This in particular avoids emitting such a symbol in the majority of (if not all) "ld -r" cases. I hope my set of cross build tests caught all the test cases needing adjustment - please forgive if I missed a few. bfd/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * elflink.c (struct elf_outext_info): Add field file_sym_done. (bfd_elf_final_link): Initialize new field. Move fake STT_FILE symbol emission from here ... (elf_link_output_extsym): ... to here. gas/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * gas/microblaze/relax_size.elf: Drop expectation of no longer present STT_FILE symbol. * gas/microblaze/relax_size2.elf: Likewise. ld/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer present STT_FILE symbol. * ld-mmix/bpo-18.d: Likewise. * ld-mmix/bpo-22.d: Likewise. * ld-mmix/greg-6.d: Likewise. * ld-mmix/greg-7.d: Likewise. * ld-mmix/loc4.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/loct-1.d: Likewise. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2.xd: Likewise. * ld-sh/sh64/shdl32.xd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise.
2013-10-29undef reg in gdb_curses.hTom Tromey3-5/+13
I tried to build gdb on the AIX machine in the GCC compile farm (gcc111), but it failed in a couple of spots because gdb uses "reg" as a variable name and the AIX <curses.h> defines "reg" to "register". I saw that we already had a workaround for this lurking in utils.c, so I just moved that to gdb_curses.h. This fixed the problem on AIX and still builds on x86-64 Fedora 18. 2013-10-29 Tom Tromey <tromey@redhat.com> * utils.c (reg): Move undefinition... * gdb_curses.h: ... here. Update comment to mention AIX.
2013-10-29ChangeLog entries for the remove-symbol-file commits.Nicolas Blanc3-0/+35
2013-10-29gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables ↵Pedro Alves3-13/+5
defining change-log-default-name. These references to ChangeLog-mi are stale. testsuite/gdb.mi/ChangeLog-mi doesn't exist anymore, since: ... commit 2dd627049d915a78ba15b65ab718d54958d115bf Author: Andrew Cagney <cagney@redhat.com> Date: Sat Jun 23 21:47:09 2001 +0000 Rename gdb.mi/ChangeLog-mi to gdb.mi/ChangeLog. Update everything. ... commit 48efe7049b1c286c702621e2f3e89e4584df2bd2 Author: Andrew Cagney <cagney@redhat.com> Date: Mon Jan 12 15:16:44 2004 +0000 Eliminate the old mi/tui specific ChangeLog files as in ... Added Files: mi/ChangeLog-1999-2003 testsuite/gdb.mi/ChangeLog-1999-2003 tui/ChangeLog-1998-2003 Removed Files: mi/ChangeLog testsuite/gdb.mi/ChangeLog tui/ChangeLog Tested with 'make check RUNTESTFLAGS="--directory=gdb.mi"' on x86_64 Fedora 17. gdb/testsuite/ 2013-10-29 Pedro Alves <palves@redhat.com> * gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variable setting change-log-default-name to ChangeLog-mi.
2013-10-29Print <unavailable> for unavailable registers in info register output.Andrew Burgess4-17/+23
https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html gdb/ChangeLog * infcmd.c (default_print_one_register_info): Use val_print to print all values even optimized out or unavailable ones. Don't try to print a raw form of optimized out or unavailable values. gdb/testsuite/ChangeLog * gdb.trace/unavailable.exp (gdb_unavailable_registers_test): Expect <unavailable> pattern.
2013-10-29Test adding and removing a symbol file at runtime.Nicolas Blanc5-0/+715
This test exercises the commands 'add-symbol-file' and 'remove-symbol-file'. 2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> gdb/testsuite * gdb.base/sym-file-lib.c: New file. * gdb.base/sym-file-loader.c: New file. * gdb.base/sym-file-loader.h: New file. * gdb.base/sym-file-main.c: New file. * gdb.base/sym-file.exp: New file. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>