summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Disallow copy relocation against protected data symbolusers/hjl/pr21997H.J. Lu2017-08-2514-127/+438
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We shpouldn't generate copy relocation to resolve reference to protected data symbol defined in shared object with the NO_COPY_ON_PROTECTED property. This patch adds a bit to elf_obj_tdata as well as elf_i386_link_hash_entry and elf_x86_64_link_hash_entry to track the bfd with the NO_COPY_ON_PROTECTED property as well as protected symbol defined in shared object. extern_protected_data is set to FALSE if any input relocatable file contains the NO_COPY_ON_PROTECTED property. bfd/ PR ld/21997 * elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id, dyn_lib_class and has_gnu_symbols. Change bad_symtab to bitfield. Add a has_no_copy_on_protected bitfield. (elf_has_no_copy_on_protected): New. * elf-properties.c (_bfd_elf_parse_gnu_properties): Set elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED. (elf_merge_gnu_property_list): Likewise. (_bfd_elf_link_setup_gnu_properties): Set extern_protected_data to FALSE for elf_has_no_copy_on_protected. * elf32-i386.c (SYMBOL_NO_COPYRELOC): New. (elf_i386_link_hash_entry): Add def_protected. (elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC when checking info->nocopyreloc. (elf_i386_link_setup_gnu_properties): Don't set extern_protected_data here. (elf_i386_merge_symbol_attribute): New function. (elf_backend_merge_symbol_attribute): New. * elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New. (elf_x86_64_link_hash_entry): Add def_protected. (elf_x86_64_need_pic): Report protected symbol for def_protected. (elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC when checking info->nocopyreloc. (elf_x86_64_relocate_section): Also check for R_X86_64_PC32 relocation run-time overflow and unresolvable R_X86_64_32S relocation against protected data symbol defined in shared object with GNU_PROPERTY_NO_COPY_ON_PROTECTED. (elf_x86_64_link_setup_gnu_properties): Don't set extern_protected_data here. (elf_x86_64_merge_symbol_attribute): New function. (elf_backend_merge_symbol_attribute): New. ld/ PR ld/21997 * testsuite/ld-i386/i386.exp: Run PR ld/21997 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr21997-1a.S: New file. * testsuite/ld-i386/pr21997-1b.c: Likewise. * testsuite/ld-i386/pr21997-1c.S: Likewise. * testsuite/ld-x86-64/pr21997-1a.S: Likewise. * testsuite/ld-x86-64/pr21997-1a.err: Likewise. * testsuite/ld-x86-64/pr21997-1b.c: Likewise. * testsuite/ld-x86-64/pr21997-1b.err: Likewise. * testsuite/ld-x86-64/pr21997-1c.c: Likewise.
* x86: Remove redundant "symbol" in commentsH.J. Lu2017-08-253-2/+8
| | | | | | * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant "symbol" in comments. * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
* Automatic date update in version.inGDB Administrator2017-08-261-1/+1
|
* gdbserver: Rename some functions, thread -> inferiorSimon Marchi2017-08-257-22/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions apply to thread, and not inferiors (in the gdbserver sense, the abstraction for threads and processes, as in inferior_list). Therefore, it would make more sense if these functions were named with "thread" rather than "inferior". gdb/gdbserver/ChangeLog: * inferiors.h (inferior_target_data): Rename to ... (thread_target_data): ... this. (inferior_regcache_data): Rename to ... (thread_regcache_data): ... this. (set_inferior_regcache_data): Rename to ... (set_thread_regcache_data): ... this. * inferiors.c (inferior_target_data): Rename to ... (thread_target_data): ... this. (inferior_regcache_data): Rename to ... (thread_regcache_data): ... this. (set_inferior_regcache_data): Rename to ... (set_thread_regcache_data): ... this. (free_one_thread): Update. * linux-low.h (get_thread_lwp): Update. * regcache.c (get_thread_regcache): Update. (regcache_invalidate_thread): Update. (free_register_cache_thread): Update. * win32-i386-low.c (update_debug_registers_callback): Update. (win32_get_current_dr): Update. * win32-low.c (thread_rec): Update. (delete_thread_info): Update. (continue_one_thread): Update. (suspend_one_thread): Update.
* PR21994, readelf looping on verdefsAlan Modra2017-08-252-14/+39
| | | | | | | | | | PR 21994 * readelf.c (process_version_sections <SHT_GNU_verdef>): Check vd_aux and vda_next for sanity. Delete "end". Correct overflow checks. (process_version_sections <SHT_GNU_verneed>): Correct overflow check. Don't report invalid vna_next on overflow. Do report invalid vna_next on size less than aux info.
* ld: Add "--" after regexpH.J. Lu2017-08-245-4/+12
| | | | | | | | | | Add "--" after regexp to support dejagnu 1.4.4. * testsuite/ld-elf/pr21903c.d: Remove '\' before --. * testsuite/ld-elf/pr21903d.d: Likewise. * testsuite/ld-elf/pr21903e.d: Likewise. * testsuite/lib/ld-lib.exp (run_dump_test): Add "--" after regexp.
* Automatic date update in version.inGDB Administrator2017-08-251-1/+1
|
* Remove unused function set_inferior_target_dataSimon Marchi2017-08-243-7/+5
| | | | | | | | | The inferior (thread) target data is always set through add_thread. gdb/gdbserver/ChangeLog: * inferiors.c (set_inferior_target_data): Remove. * inferiors.h (set_inferior_target_data): Remove.
* ld: Replace regexp with string matchH.J. Lu2017-08-243-4/+10
| | | | | | | | | | | Replace regexp with string match to workaround dejagnu 1.4.4 which complains: ERROR: bad switch "-fPIE": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or -- * testsuite/ld-i386/i386.exp (undefined_weak): Replace regexp with string match. * testsuite/ld-x86-64/x86-64.exp (undefined_weak): Likewise.
* x86-64: Run pr22001-1b on x32H.J. Lu2017-08-242-16/+37
| | | | | | | Run pr22001-1b on x32 since R_X86_64_32S relocation can be turned into dynamic R_X86_64_32 relocation which won't overflow on x32. * testsuite/ld-x86-64/x86-64.exp: Run pr22001-1b on x32.
* DWARF-5 Fix DW_FORM_implicit_constJan Kratochvil2017-08-242-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -gdwarf-4: ptype logical type = const char [2] (gdb) PASS: gdb.base/constvars.exp: ptype logical -gdwarf-5: ptype logical type = const char [] (gdb) FAIL: gdb.base/constvars.exp: ptype logical <2><2fc>: Abbrev Number: 1 (DW_TAG_variable) <2fd> DW_AT_name : (indirect string, offset: 0x2eb): logical <301> DW_AT_decl_file : 1 1 DW_TAG_variable [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_implicit_const: 1 During symbol reading, invalid attribute class or form for 'DW_FORM_implicit_const' in '(null)'. gdb/ChangeLog 2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com> PR symtab/22003 * dwarf2read.c (dwarf2_const_value_attr, dump_die_shallow) (dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes) (skip_form_bytes, attr_form_is_constant): Handle DW_FORM_implicit_const.
* x86-64: Check relocations with -z nocopyrelocH.J. Lu2017-08-2413-12/+283
| | | | | | | | | | | | | | | | | | | | | | | | | | | On x86-64, when -z nocopyreloc is used to build executable, relocations may overflow at run-time or may not be resolved without PIC. This patch checks these conditions and issues an error with suggestion for -fPIC. bfd/ PR ld/22001 * elf64-x86-64.c (elf_x86_64_relocate_section): Check for R_X86_64_PC32 relocation run-time overflow and unresolvable R_X86_64_32S relocation with -z nocopyreloc. ld/ PR ld/22001 * testsuite/ld-i386/i386.exp: Run -z nocopyreloc tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * ld/testsuite/ld-i386/pr22001-1a.c: New file. * ld/testsuite/ld-i386/pr22001-1b.c: Likewise. * ld/testsuite/ld-i386/pr22001-1c.S: Likewise. * ld/testsuite/ld-x86-64/pr22001-1a.c: Likewise. * ld/testsuite/ld-x86-64/pr22001-1a.err: Likewise. * ld/testsuite/ld-x86-64/pr22001-1b.c: Likewise. * ld/testsuite/ld-x86-64/pr22001-1b.err: Likewise. * ld/testsuite/ld-x86-64/pr22001-1c.c: Likewise.
* ld: Early detection of orphans we know will be discardedAndrew Burgess2017-08-247-15/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When processing an orphan section we first call lang_place_orphans, this function handles a few sections for which the behaviour is known COMMON sections, or sections marked as SEC_EXCLUDE. Any orphans that are not handled in lang_place_orphans are passed on to ldlang_place_orphan, this is where we decide where to put the orphan, and then call lang_add_section to perform the actual orphan placement. We previously had a larger set of checks at the start of the function lang_add_section to discard some sections that we _knew_ should not be added into the output file, this was where .group sections (in a final link) and .debug* sections (with --strip-debug) were dropped. The problem with dropping these sections at the lang_add_section stage is that a user might also be using --orphan-handling=error to prevent orphans. If they are then they should not be get errors about sections that we know will be discarded, and which are not mentioned in the linker script. The solution proposed in this patch is to move the "will this section be discarded" check into a separate function, and use this in lang_place_orphans to have the early discard phase discard sections that we know should not be included in the output file. ld/ChangeLog: PR 21961 * ldlang.c (lang_discard_section_p): New function. (lang_add_section): Checks moved out into new function, which is now called. (lang_place_orphans): Call lang_discard_section_p instead of duplicating some of the checks from lang_add_section. * testsuite/ld-elf/orphan-11.d: New file. * testsuite/ld-elf/orphan-11.ld: New file. * testsuite/ld-elf/orphan-11.s: New file. * testsuite/ld-elf/orphan-12.d: New file. * testsuite/ld-elf/orphan-12.s: New file.
* Revert commit aab921adcb656e4eefcc7d0f14241f3d7504400eH.J. Lu2017-08-243-6/+10
| | | | | | * elf32-i386.c (elf_i386_check_relocs): Revert the last change. Undefined symbols may not have a type. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* DWARF-5: Fix -fdebug-types-sectionJan Kratochvil2017-08-242-17/+48
| | | | | | | | | | | | | | GDB was now accessing as signatured_type memory allocated only by size of dwarf2_per_cu_data. gdb/ChangeLog 2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf2read.c (build_type_psymtabs_reader): New prototype. (process_psymtab_comp_unit): Accept IS_DEBUG_TYPES. (read_comp_units_from_section): New parameter abbrev_section, use read_and_check_comp_unit_head, allocate signatured_type if needed. (create_all_comp_units): Update read_comp_units_from_section caller.
* [PowerPC VLE] Add SPE2 and EFS2 instructions supportAlexander Fedotov2017-08-2423-13/+3844
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/ * opcode/ppc.h: (spe2_opcodes, spe2_num_opcodes): New. (PPC_OPCODE_SPE2): New define. (PPC_OPCODE_EFS2): Likewise. (SPE2_XOP): Likewise. (SPE2_XOP_TO_SEG): Likewise. opcodes/ * ppc-dis.c (ppc_mopt): Add PPC_OPCODE_SPE2 and PPC_OPCODE_EFS2 flag to "e200z4" entry. New entries efs2 and spe2. Add PPC_OPCODE_SPE2 and PPC_OPCODE_EFS2 flag to "vle" entry. (SPE2_OPCD_SEGS): New macro. (spe2_opcd_indices): New. (disassemble_init_powerpc): Handle SPE2 opcodes. (lookup_spe2): New function. (print_insn_powerpc): call lookup_spe2. * ppc-opc.c (insert_evuimm1_ex0): New function. (extract_evuimm1_ex0): Likewise. (insert_evuimm_lt8): Likewise. (extract_evuimm_lt8): Likewise. (insert_off_spe2): Likewise. (extract_off_spe2): Likewise. (insert_Ddd): Likewise. (extract_Ddd): Likewise. (DD): New operand. (EVUIMM_LT8): Likewise. (EVUIMM_LT16): Adjust. (MMMM): New operand. (EVUIMM_1): Likewise. (EVUIMM_1_EX0): Likewise. (EVUIMM_2): Adjust. (NNN): New operand. (VX_OFF_SPE2): Likewise. (BBB): Likewise. (DDD): Likewise. (VX_MASK_DDD): New mask. (HH): New operand. (VX_RA_CONST): New macro. (VX_RA_CONST_MASK): Likewise. (VX_RB_CONST): Likewise. (VX_RB_CONST_MASK): Likewise. (VX_OFF_SPE2_MASK): Likewise. (VX_SPE_CRFD): Likewise. (VX_SPE_CRFD_MASK VX): Likewise. (VX_SPE2_CLR): Likewise. (VX_SPE2_CLR_MASK): Likewise. (VX_SPE2_SPLATB): Likewise. (VX_SPE2_SPLATB_MASK): Likewise. (VX_SPE2_OCTET): Likewise. (VX_SPE2_OCTET_MASK): Likewise. (VX_SPE2_DDHH): Likewise. (VX_SPE2_DDHH_MASK): Likewise. (VX_SPE2_HH): Likewise. (VX_SPE2_HH_MASK): Likewise. (VX_SPE2_EVMAR): Likewise. (VX_SPE2_EVMAR_MASK): Likewise. (PPCSPE2): Likewise. (PPCEFS2): Likewise. (vle_opcodes): Add EFS2 and some missing SPE opcodes. (powerpc_macros): Map old SPE instructions have new names with the same opcodes. Add SPE2 instructions which just are mapped to SPE2. (spe2_opcodes): Add SPE2 opcodes. gas/ * config/tc-ppc.c: (md_parse_option): Add mspe2 switch. (md_show_usage): Document -mspe2. (ppc_setup_opcodes): Handle spe2_opcodes. * doc/as.texinfo: Document -mspe2. * doc/c-ppc.texi: Likewise. * testsuite/gas/ppc/efs.d: New file. * testsuite/gas/ppc/efs.s: Likewise. * testsuite/gas/ppc/efs2.d: Likewise. * testsuite/gas/ppc/efs2.s: Likewise. * testsuite/gas/ppc/ppc.exp: Run new tests. * testsuite/gas/ppc/spe.d: New file. * testsuite/gas/ppc/spe.s: Likewise. * testsuite/gas/ppc/spe2-checks.d: Likewise. * testsuite/gas/ppc/spe2-checks.l: Likewise. * testsuite/gas/ppc/spe2-checks.s: Likewise. * testsuite/gas/ppc/spe2.d: Likewise. * testsuite/gas/ppc/spe2.s: Likewise. * testsuite/gas/ppc/spe_ambiguous.d: Likewise. * testsuite/gas/ppc/spe_ambiguous.s: Likewise.
* Test undefined symbols in shared librariesAlan Modra2017-08-243-98/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | git commit 46434633f9 said Make undefined symbols in allocate_dynrelocs dynamic ..if they have dynamic relocs. An undefined symbol in a PIC object that finds no definition ought to become dynamic in order to support --allow-shlib-undefined, but there is nothing in the generic ELF linker code to do this if the reference isn't via the GOT or PLT. (An initialized function pointer is an example.) So it falls to backend code to ensure the symbol is made dynamic. The above isn't true. Undefined symbols are indeed made dynamic for shared libraries. Undefined symbols are not automatically made dynamic in executables, and it was the PIE case that triggered an internal consistency assertion on powerpc64. I guess I could have jumped the other way when fixing PR21988, and not created a dynamic reloc. Either way, it doesn't matter a great deal. We're going to get an error on strong undefined symbols in an executable anyway, and broken binaries if you try to use --unresolved-symbols=ignore-all to disable the error. * testsuite/ld-undefined/fundef.s: New test. * testsuite/ld-undefined/undefined.exp: Test that undefined symbols in shared libraries are made dynamic.
* Automatic date update in version.inGDB Administrator2017-08-241-1/+1
|
* Update PR ld/21903 tests for dejagnu 1.4.4H.J. Lu2017-08-234-3/+9
| | | | | | | | | | Add '\' before -- to workaround dejagnu 1.4.4 which complains: ERROR: bad switch "--no-define-common may not be used without -shared":... * testsuite/ld-elf/pr21903c.d: Add '\' before --. * testsuite/ld-elf/pr21903d.d: Likewise. * testsuite/ld-elf/pr21903e.d: Likewise.
* Fix PR remote/21852: Remote run without specifying a local binary crashes GDBSergio Durigan Junior2017-08-235-9/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an assertion that is triggering when we start GDB and instruct it to debug a remote inferior, but don't provide a local binary, like: ./gdb -nx -q --data-directory=data-directory -ex "tar ext :1234" \ -ex "set remote exec-file /bin/ls" -ex r In this case, when calling exec_file_locate_attach to locate the inferior, GDB is incorrectly resetting the breakpoints without a thread/inferior even running, which causes an assertion to be triggered: binutils-gdb/gdb/thread.c:1609: internal-error: scoped_restore_current_thread::scoped_restore_current_thread(): Assertion `tp != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This happens because add_current_inferior_and_thread (on remote.c) is breaking an invariant: making inferior_ptid point to a non-existing thread and then calling common code, which in this case is breakpoint_re_set. The fix is to make sure that inferior_ptid points to null_ptid if there is no thread present. A testcase is provided. Regtested on buildbot. gdb/ChangeLog: 2017-08-23 Pedro Alves <palves@redhat.com> PR remote/21852 * remote.c (add_current_inferior_and_thread): Set inferior_ptid to null_ptid and switch to thread without reading the registers after adding the inferior. gdb/testsuite/ChangeLog: 2017-08-23 Sergio Durigan Junior <sergiodj@redhat.com> PR remote/21852 * gdb.server/normal.c: New file, copied from gdb.base. * gdb.server/run-without-local-binary.exp: New file.
* x86-64: Properly report output type when PIC is neededH.J. Lu2017-08-237-10/+35
| | | | | | | | | | | | | | | | | | | | -fPIC may be needed to compile PIE or PDE objects, not just shared object. bfd/ * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for bfd_link_info. Report shared, PIE or PDE object based on bfd_link_info. (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call. (elf_x86_64_relocate_section): Likewise. ld/ * testsuite/ld-x86-64/pie2.d: Updated. * testsuite/ld-x86-64/pr19719.d: Likewise. * testsuite/ld-x86-64/pr19807-2a.d: Likewise. * testsuite/ld-x86-64/pr19969.d: Likewise.
* x86: Increment PLT count only for function symbolsH.J. Lu2017-08-233-4/+12
| | | | | | | | | Since PLT entry is needed only for function symbols, increment PLT count only for function symbols. * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only for function symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* x86: Clear extern_protected_data for GNU_PROPERTY_NO_COPY_ON_PROTECTEDH.J. Lu2017-08-2310-95/+241
| | | | | | | | | | | | | | | | | | | | | | | When GNU_PROPERTY_NO_COPY_ON_PROTECTED is set, it indicates that there are no copy relocations against protected data symbols. When linker sees GNU_PROPERTY_NO_COPY_ON_PROTECTED on any input relocatable file, it sets extern_protected_data to FALSE. bfd/ * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED is set on any input relocatable file. * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise. ld/ * testsuite/ld-i386/i386.exp: Run protected7. * testsuite/ld-i386/protected7.d: New file. * testsuite/ld-i386/protected7.s: Likewise. * testsuite/ld-x86-64/protected8.d: Likewise. * testsuite/ld-x86-64/protected8.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run protected8.
* compile: Add 'set compile-gcc'Jan Kratochvil2017-08-237-31/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in How to use compile & execute function in GDB https://sourceware.org/ml/gdb/2015-04/msg00026.html GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and chooses a match from there. However, it is not currently possible for the user to override which compiler to use. This is what this patch implements. It is also a sync between GCC's and GDB's interfaces. gdb/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (Changes since GDB 7.9): Add set compile-gcc and show compile-gcc. * compile/compile.c (compile_gcc, show_compile_gcc): New. (compile_to_object): Implement compile_gcc. (_initialize_compile): Install "set compile-gcc". Initialize compile_gcc. gdb/doc/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Compiling and Injecting Code): Add to subsection "Compiler search for the compile command" descriptions of set compile-gcc and show compile-gcc. include/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * gcc-interface.h (enum gcc_base_api_version): Update comment for GCC_FE_VERSION_1. (struct gcc_base_vtable): Rename set_arguments to set_arguments_v0. Add set_arguments, set_triplet_regexp and set_driver_filename.
* compile: set debug compile: Display GCC driver filenameJan Kratochvil2017-08-234-10/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in How to use compile & execute function in GDB https://sourceware.org/ml/gdb/2015-04/msg00026.html GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and chooses a match from there. However, it is not currently possible for the user to display which compiler was selected. Up until now, GDB's compiler interface was not up-to-date with GCC's one, which means that it wasn't possible to obtain this information. This patch implements the mechanisms necessary for that. gdb/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * compile/compile.c (compile_to_object): Conditionally call set_verbose. Conditionally call compile or compile_v0. include/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1. (struct gcc_base_vtable): Rename compile to compile_v0. Update comment for compile. New methods set_verbose and compile.
* gas: enable PC-relative diff relocations on sparc64James Clarke2017-08-233-1/+56
| | | | | | | | | | | | | | | gas/ * config/tc-sparc.c (tc_gen_reloc): Convert BFD_RELOC_8/16/32/64 into the corresponding BFD_RELOC_8/16/32/64_PCREL relocation when requested. * config/tc-sparc.h (DIFF_EXPR_OK): Define to enable PC-relative diff relocations. (TC_FORCE_RELOCATION_SUB_LOCAL): Define to ensure only supported relocations are made PC-relative. (CFI_DIFF_EXPR_OK): Define to 0 to force BFD_RELOC_32_PCREL to be used directly, since otherwise BFD_RELOC_SPARC_UA32 will be used for .eh_frame which cannot in general be converted to a BFD_RELOC_32_PCREL due to alignment requirements.
* ppc-opc.c formattingAlan Modra2017-08-232-1089/+1101
| | | | | | | * ppc-opc.c: Formatting and comment fixes. Move insert and extract functions earlier, deleting forward declarations. (insert_nbi, insert_raq, insert_rbx): Expand use of RT_MASK and RA_MASK.
* PR21990, Integer overflow in process_version_sectionsAlan Modra2017-08-232-26/+29
| | | | | | | | | | | This tidies some of the overflow checking when processing verneed and verdef sections. PR 21990 * readelf.c (process_version_sections <SHT_GNU_verneed>): Check for invalid vn_next field before adding to idx. Use unsigned long for index vars. Move index checks. <SHT_GNU_verdef>: Likewise for vd_next.
* gdb: SPARC ADI supportWeimin Pan2017-08-2310-0/+903
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The M7 processor supports an Application Data Integrity (ADI) feature that detects invalid data accesses. When software allocates data, it chooses a 4-bit version number, sets the version in the upper 4 bits of the 64-bit pointer to that data, and stores the 4-bit version in every cacheline of the object. Hardware saves the latter in spare bits in the cache and memory hierarchy. On each load and store, the processor compares the upper 4 VA (virtual address) bits to the cacheline's version. If there is a mismatch, the processor generates a version mismatch trap which can be either precise or disrupting. The trap is an error condition which the kernel delivers to the process as a SIGSEGV signal. The upper 4 bits of the VA represent a version and are not part of the true address. The processor clears these bits and sign extends bit 59 to generate the true address. Note that 32-bit applications cannot use ADI. This patch adds ADI support in gdb which allows the user to examine current version tags and assign new version tags in the program. It also catches and reports precise or disrupting memory corruption traps. gdb/ChangeLog: 2017-08-07 Weimin Pan <weimin.pan@oracle.com> * sparc64-tdep.h: (adi_normalize_address): New export. * sparc-nat.h: (open_adi_tag_fd): New export. * sparc64-linux-nat.c: (open_adi_tag_fd): New function. * sparc64-linux-tdep.c: (SEGV_ACCADI, SEGV_ADIDERR, SEGV_ADIPERR) New defines. (sparc64_linux_handle_segmentation_fault): New function. (sparc64_linux_init_abi): Register sparc64_linux_handle_segmentation_fault * sparc64-tdep.c: Include cli-utils.h,gdbcmd.h,auxv.h. (sparc64_addr_bits_remove): New function. (sparc64_init_abi): Register sparc64_addr_bits_remove. (MAX_PROC_NAME_SIZE): New macro. (AT_ADI_BLKSZ, AT_ADI_NBITS, AT_ADI_UEONADI) New defines. (sparc64adilist): New variable. (adi_proc_list): New variable. (find_adi_info): New function. (add_adi_info): New function. (get_adi_info_proc): New function. (get_adi_info): New function. (info_adi_command): New function. (read_maps_entry): New function. (adi_available): New function. (adi_normalize_address): New function. (adi_align_address): New function. (adi_convert_byte_count): New function. (adi_tag_fd): New function. (adi_is_addr_mapped): New function. (adi_read_versions): New function. (adi_write_versions): New function. (adi_print_versions): New function. (do_examine): New function. (do_assign): New function. (adi_examine_command): New function. (adi_assign_command): New function. (_initialize_sparc64_adi_tdep): New function. gdb/doc/ChangeLog: 2017-08-07 Weimin Pan <weimin.pan@oracle.com> * gdb.texinfo (Architectures): Add new Sparc64 section to document ADI support. * NEWS: Add "adi examine" and "adi assign" commands. gdb/testsuite/ChangeLog: 2017-08-07 Weimin Pan <weimin.pan@oracle.com> * gdb.arch/sparc64-adi.exp: New file. * gdb.arch/sparc64-adi.c: New file.
* Automatic date update in version.inGDB Administrator2017-08-231-1/+1
|
* Remove pr19161 test hppa xfailAlan Modra2017-08-232-1/+5
| | | | * testsuite/ld-gc/pr19161.d: Don't xfail hppa.
* Make undefined symbols in allocate_dynrelocs dynamicAlan Modra2017-08-234-54/+59
| | | | | | | | | | | | | | | | | ..if they have dynamic relocs. An undefined symbol in a PIC object that finds no definition ought to become dynamic in order to support --allow-shlib-undefined, but there is nothing in the generic ELF linker code to do this if the reference isn't via the GOT or PLT. (An initialized function pointer is an example.) So it falls to backend code to ensure the symbol is made dynamic. PR 21988 * elf64-ppc.c (ensure_undef_dynamic): Rename from ensure_undefweak_dynamic. Handle undefined too. * elf32-ppc.c (ensure_undef_dynamic): Likewise. * elf32-hppa.c (ensure_undef_dynamic): Likewise. (allocate_dynrelocs): Discard undefined non-default visibility relocs first. Make undefined syms dynamic. Tidy goto.
* Assemble powerpc vle lsp tests with -a32Alan Modra2017-08-233-2/+7
| | | | | | | -mvle isn't a valid 64-bit option. * testsuite/gas/ppc/lsp-checks.d: Assemble with -a32. * testsuite/gas/ppc/lsp.d: Likewise.
* Rename some command functionsSimon Marchi2017-08-2218-81/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch renames a few functions implementing CLI commands to follow the style <command-name>_command, so that they are easier to search for. gdb/ChangeLog: * breakpoint.c (breakpoints_info): Rename to ... (info_breakpoints_command): ... this. (watchpoints_info): Rename to ... (info_watchpoints_command): ... this. (tracepoints_info): Rename to ... (info_tracepoints_command): ... this. (_initialize_breakpoint): Adjust. * dcache.c (dcache_info): Rename to ... (info_display_command): ... this. (_initialize_dcache): Adjust. * frame.h (args_info): Rename to ... (info_args_command): ... this. (locals_info): Rename to ... (info_locals_command): ... this. * infcmd.c (nofp_registers_info): Rename to ... (info_registers_command): ... this. (float_info): Rename to ... (info_float_command): ... this. (program_info): Rename to ... (info_program_command): ... this. (all_registers_info): Rename to ... (info_all_registers_command): ... this. (vector_info): Rename to ... (info_vector_command): ... this. (float_info): Rename to ... (info_float_command): ... this. (_initialize_infcmd): Adjust. * inferior.h (term_info): Rename to ... (info_terminal_command): ... this. * inflow.c (term_info): Rename to ... (info_terminal_command): ... this. (_initialize_inflow): Adjust. * infrun.c (signals_info): Rename to ... (info_signals_command): ... this. (_initialize_infrun): Adjust. * objc-lang.c (classes_info): Rename to ... (info_classes_command): ... this. (selectors_info): Rename to ... (info_selectors_command): ... this. (_initialize_objc_language): Adjust. * printcmd.c (sym_info): Rename to ... (info_symbol_command): ... this. (address_info): Rename to ... (info_address_command): ... this. (display_info): Rename to ... (info_display_command): ... this. (_initialize_printcmd): Adjust. * reverse.c (bookmarks_info): Rename to ... (info_breakpoints_command): ... this. (_initialize_reverse): Adjust. * ser-go32.c (dos_info): Rename to ... (info_serial_command): ... this. (_initialize_ser_dos): Adjust. * skip.c (skip_info): Rename to ... (info_skip_command): ... this. (_initialize_step_skip): Adjust. * source.c (line_info): Rename to ... (info_line_command): ... this. (source_info): Rename to ... (info_source_command) * stack.c (frame_info): Rename to ... (info_frame_command): ... this. (locals_info): Rename to ... (info_locals_command): ... this. (args_info): Rename to ... (info_args_command): ... this. (_initialize_stack): Adjust. * symtab.c (sources_info): Rename to ... (info_sources_command): ... this. (variables_info): Rename to ... (info_variables_command): ... this. (functions_info): Rename to ... (info_functions_command): ... this. (types_info): Rename to ... (info_types_command): ... this. (_initialize_symtab): Adjust. * target.c (target_info): Rename to ... (info_target_command): ... this. (initialize_targets): Adjust. * tracepoint.c (tvariables_info): Rename to ... (info_tvariables_command): ... this. (scope_info): Rename to ... (info_scope_command): ... this. (trace_dump_actions): Adjust. (_initialize_tracepoint): Adjust.
* Update PR ld/21964 testsH.J. Lu2017-08-228-52/+107
| | | | | | | | | | | | * testsuite/ld-elf/pr21964-1a.c (foo): Renamed to ... (foo1): This. * testsuite/ld-elf/pr21964-1b.c: Rewrite. * testsuite/ld-elf/pr21964-1c.c: New file. * testsuite/ld-elf/pr21964-2c.c: Likewise. * testsuite/ld-elf/pr21964-2a.c (foo): Renamed to ... (foo1): This. * testsuite/ld-elf/pr21964-2b.c: Rewrite. * testsuite/ld-elf/shared.exp: Update PR ld/21964 tests.
* RISC-V: Mark "c.nop" as an aliasPalmer Dabbelt2017-08-222-1/+5
| | | | | | | | | | | This fixes "-M noaliases" disassembly for "c.nop", which is an alias for "c.addi x0, 0". opcodes/ChangeLog 2017-08-01 Palmer Dabbelt <palmer@dabbelt.com> * riscv-opc.c (riscv_opcodes): Mark "c.nop" as an alias.
* Add test for "List actual code around more than one location" changePedro Alves2017-08-222-1/+38
| | | | | | | | | | This adds a test for the "list" command change done in 0d999a6ef0f9 ("List actual code around more than one location"). gdb/ChangeLog: 2017-08-22 Pedro Alves <palves@redhat.com> * gdb.cp/overload.exp (line_range_pattern): New procedure. (top level): Add "list all overloads" tests.
* Change install_breakpoint to take a std::unique_ptrTom Tromey2017-08-227-66/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes install_breakpoint to take a std::unique_ptr rvalue-ref argument. This makes it clear that install_breakpoint takes ownership of the pointer, and prevents bugs like the one fixed by the previous patch. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * breakpoint.h (install_breakpoint): Update. * breakpoint.c (add_solib_catchpoint): Update. (install_breakpoint): Change argument to a std::unique_ptr. (create_fork_vfork_event_catchpoint): Use std::unique_ptr. (create_breakpoint_sal, create_breakpoint): Update. (watch_command_1, catch_exec_command_1) (strace_marker_create_breakpoints_sal): Use std::unique_ptr. (add_to_breakpoint_chain): Change argument to a std::unique_ptr. Return the breakpoint. (set_raw_breakpoint_without_location, set_raw_breakpoint) (new_single_step_breakpoint): Update. * break-catch-throw.c (handle_gnu_v3_exceptions): Use std::unique_ptr. * break-catch-syscall.c (create_syscall_event_catchpoint): Use std::unique_ptr. * break-catch-sig.c (create_signal_catchpoint): Use std::unique_ptr. * ada-lang.c (create_ada_exception_catchpoint): Use std::unique_ptr.
* Fix erroneous cleanup use in add_solib_catchpointTom Tromey2017-08-222-7/+7
| | | | | | | | | | | | I happened to notice that add_solib_catchpoint allocated the new catchpoint with "new" but installed a cleanup using "xfree". This patch fixes the bug by changing the function to use std::unique_ptr instead. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * breakpoint.c (add_solib_catchpoint): Use std::unique_ptr.
* Change psymtab_search_name to return a unique_xmalloc_ptrTom Tromey2017-08-222-20/+17
| | | | | | | | | | | This changes psymtab_search_name to return a unique_xmalloc_ptr and fixes up its one caller. This allows the removal of some cleanups. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * psymtab.c (psymtab_search_name): Return a unique_xmalloc_ptr. (lookup_partial_symbol): Update.
* Change rewrite_source_path to return a unique_xmalloc_ptrTom Tromey2017-08-224-41/+33
| | | | | | | | | | | | | This changes rewrite_source_path to return a unique_xmalloc_ptr and fixes up the callers. This allows removing some cleanups. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * source.h (rewrite_source_path): Return a unique_xmalloc_ptr. * source.c (rewrite_source_path): Return a unique_xmalloc_ptr. (find_and_open_source, symtab_to_fullname): Update. * psymtab.c (psymtab_to_fullname): Update.
* Change gdb_realpath to return a unique_xmalloc_ptrTom Tromey2017-08-2215-145/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes gdb_realpath to return a unique_xmalloc_ptr and fixes up the callers. This allows removing some cleanups. This change by itself caused xfullpath.exp to fail; and attempting to fix that ran into various problems (like .get() being optimized out); so this patch also rewrites xfullpath.exp to be a C++ selftest instead. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * exec.c (exec_file_attach): Update. * linux-thread-db.c (try_thread_db_load): Update. * guile/scm-safe-call.c (gdbscm_safe_source_script): Update. * utils.c (gdb_realpath): Change return type. (gdb_realpath_keepfile): Update. (gdb_realpath_check_trailer, gdb_realpath_tests): New functions. (_initialize_utils): Register the new self test. * source.c (openp): Update. (find_and_open_source): Update. * nto-tdep.c (nto_find_and_open_solib): Update. * main.c (set_gdb_data_directory): Update. (captured_main_1): Update. * dwarf2read.c (dwarf2_get_dwz_file): Update (dw2_map_symbol_filenames): Update. * auto-load.c (auto_load_safe_path_vec_update): Update. (filename_is_in_auto_load_safe_path_vec): Change type of "filename_realp". (auto_load_objfile_script): Update. (file_is_auto_load_safe): Update. Use std::string. * utils.h (gdb_realpath): Return a gdb::unique_xmalloc_ptr. testsuite/ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * gdb.gdb/xfullpath.exp: Remove.
* Change gdb_realpath_keepfile to return a unique_xmalloc_ptrTom Tromey2017-08-224-5/+13
| | | | | | | | | | | | | | This changes gdb_realpath_keepfile to return a unique_xmalloc_ptr, and fixes up the callers. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * utils.c (gdb_realpath_keepfile): Return a gdb::unique_xmalloc_ptr. * exec.c (exec_file_attach): Update. * utils.h (gdb_realpath_keepfile): Return a gdb::unique_xmalloc_ptr.
* Change gdb_abspath to return a unique_xmalloc_ptrTom Tromey2017-08-227-28/+33
| | | | | | | | | | | | | | | | | This changes gdb_abspath to return a unique_xmalloc_ptr, and fixes up the callers. This allows the removal of a cleanup, and also puts ownership rules into the API, where they belong. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * compile/compile.c (compile_file_command): Use gdb::unique_xmalloc_ptr, std::string. * utils.c (gdb_abspath): Change return type. * source.c (openp): Update. * objfiles.c (allocate_objfile): Update. * main.c (set_gdb_data_directory): Update. * utils.h (gdb_abspath): Return a gdb::unique_xmalloc_ptr.
* List actual code around more than one locationZhouyi Zhou2017-08-222-16/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the following C++ code: int bar() { return 0;} int bar(int) { return 0; } GDB behaves as: (gdb) list bar file: "overload.cc", line number: 1 file: "overload.cc", line number: 2 It would be better for GDB to list the actual code around those two locations, not just print the location. Like: (gdb) list bar file: "overload.cc", line number: 1 1 int bar() { return 0;} 2 int bar(int) { return 0; } file: "overload.cc", line number: 2 1 int bar() { return 0;} 2 int bar(int) { return 0; } That's what this this commit implements. Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-08-22 Zhouyi Zhou <zhouzhouyi@gmail.com> * cli-cmds.c (list_commands): List actual code around more than one location.
* Use an array type (lwpid_t[]) for the array of lwp IDs.John Baldwin2017-08-212-5/+8
| | | | | | gdb/ChangeLog: * fbsd-nat.c (fbsd_add_threads): Use array type for `lwps'.
* Correct earlier ChangeLog entry for fbsd_add_threads.John Baldwin2017-08-211-1/+1
|
* Make __start/__stop symbols protected visibilityAlan Modra2017-08-2129-37/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They can't be hidden visibility since apparently people use dlsym to look them up. bfd/ PR ld/21964 * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols. * elflink.c (bfd_elf_define_start_stop): Rewrite. ld/ PR ld/21964 * testsuite/ld-elf/pr21562a.d: Update for changed start/stop symbols. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-gc/pr20022.d: Likewise. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-elf/pr21964-1a.c: New file. * testsuite/ld-elf/pr21964-1b.c: New file. * testsuite/ld-elf/pr21964-2a.c: New file. * testsuite/ld-elf/pr21964-2b.c: New file. * testsuite/ld-elf/shared.exp: Run PR ld/21964 tests.
* [PowerPC VLE] Add LSP (Lightweight Signal Processing) instruction supportAlexander Fedotov2017-08-2112-6/+2531
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/ * opcode/ppc.h (PPC_OPCODE_LSP): New define. opcodes/ * ppc-opc.c (insert_evuimm2_ex0): New function. (extract_evuimm2_ex0): Likewise. (insert_evuimm4_ex0): Likewise. (extract_evuimm4_ex0): Likewise. (insert_evuimm8_ex0): Likewise. (extract_evuimm8_ex0): Likewise. (insert_evuimm_lt16): Likewise. (extract_evuimm_lt16): Likewise. (insert_rD_rS_even): Likewise. (extract_rD_rS_even): Likewise. (insert_off_lsp): Likewise. (extract_off_lsp): Likewise. (RD_EVEN): New operand. (RS_EVEN): Likewise. (RSQ): Adjust. (EVUIMM_LT16): New operand. (HTM_SI): Adjust. (EVUIMM_2_EX0): New operand. (EVUIMM_4): Adjust. (EVUIMM_4_EX0): New operand. (EVUIMM_8): Adjust. (EVUIMM_8_EX0): New operand. (WS): Adjust. (VX_OFF): New operand. (VX_LSP): New macro. (VX_LSP_MASK): Likewise. (VX_LSP_OFF_MASK): Likewise. (PPC_OPCODE_LSP): Likewise. (vle_opcodes): Add LSP opcodes. * ppc-dis.c (ppc_mopt): Add PPC_OPCODE_LSP flag to "vle" entry. gas/ * testsuite/gas/ppc/lsp-checks.d, * testsuite/gas/ppc/lsp-checks.l, * testsuite/gas/ppc/lsp-checks.s: New test. * testsuite/gas/ppc/lsp.d, * testsuite/gas/ppc/lsp.s: New test. * testsuite/gas/ppc/ppc.exp: Run new tests.
* Handle function aliases better (PR gdb/19487, errno printing)Pedro Alves2017-08-2110-9/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Ref: https://sourceware.org/ml/gdb/2017-06/msg00048.html) This patch improves GDB support for function aliases defined with __attribute__ alias. For example, in the test added by this commit, there is no reference to "func_alias" in the debug info at all, only to "func"'s definition: $ nm ./testsuite/outputs/gdb.base/symbol-alias/symbol-alias | grep " func" 00000000004005ae t func 00000000004005ae T func_alias $ readelf -w ./testsuite/outputs/gdb.base/symbol-alias/symbol-alias | grep func -B 1 -A 8 <1><db>: Abbrev Number: 5 (DW_TAG_subprogram) <dc> DW_AT_name : (indirect string, offset: 0x111): func <e0> DW_AT_decl_file : 1 <e1> DW_AT_decl_line : 27 <e2> DW_AT_prototyped : 1 <e2> DW_AT_type : <0xf8> <e6> DW_AT_low_pc : 0x4005ae <ee> DW_AT_high_pc : 0xb <f6> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <f8> DW_AT_GNU_all_call_sites: 1 So all GDB knows about "func_alias" is from the minsym (elf symbol): (gdb) p func_alias $1 = {<text variable, no debug info>} 0x4005ae <func> (gdb) ptype func_alias type = int () (gdb) p func $2 = {struct S *(void)} 0x4005ae <func> (gdb) ptype func type = struct S { int field1; int field2; } *(void) The result is that calling func_alias from the command line produces incorrect results. This is similar (though not exactly the same) to the glibc errno/__errno_location/__GI___errno_location situation. On glibc, errno is defined like this: extern int *__errno_location (void); #define errno (*__errno_location ()) with __GI___errno_location being an internal alias for __errno_location. On my system's libc (F23), I do see debug info for __errno_location, in the form of name vs linkage name: <1><95a5>: Abbrev Number: 18 (DW_TAG_subprogram) <95a6> DW_AT_external : 1 <95a6> DW_AT_name : (indirect string, offset: 0x2c26): __errno_location <95aa> DW_AT_decl_file : 1 <95ab> DW_AT_decl_line : 24 <95ac> DW_AT_linkage_name: (indirect string, offset: 0x2c21): __GI___errno_location <95b0> DW_AT_prototyped : 1 <95b0> DW_AT_type : <0x9206> <95b4> DW_AT_low_pc : 0x20f40 <95bc> DW_AT_high_pc : 0x11 <95c4> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <95c6> DW_AT_GNU_all_call_sites: 1 however that doesn't matter in practice, because GDB doesn't record demangled names anyway, and so we end up with the exact same situation covered by the testcase. So the fix is to make the expression parser find a debug symbol for the same address as the just-found minsym, when a lookup by name didn't find a debug symbol by name. We now get: (gdb) p func_alias $1 = {struct S *(void)} 0x4005ae <func> (gdb) p __errno_location $2 = {int *(void)} 0x7ffff6e92830 <__errno_location> I've made the test exercise variable aliases too, for completeness. Those already work correctly, because unlike for function aliases, GCC emits debug information for variable aliases. Tested on GNU/Linux. gdb/ChangeLog: 2017-08-21 Pedro Alves <palves@redhat.com> PR gdb/19487 * c-exp.y (variable production): Handle function aliases. * minsyms.c (msymbol_is_text): New function. * minsyms.h (msymbol_is_text): Declare. * symtab.c (find_function_alias_target): New function. * symtab.h (find_function_alias_target): Declare. gdb/testsuite/ChangeLog: 2017-08-21 Pedro Alves <palves@redhat.com> PR gdb/19487 * gdb.base/symbol-alias.c: New. * gdb.base/symbol-alias2.c: New. * gdb.base/symbol-alias.exp: New.