diff options
Diffstat (limited to 'src/backends')
102 files changed, 6271 insertions, 1670 deletions
diff --git a/src/backends/ChangeLog b/src/backends/ChangeLog index 744d1d55..e800d16b 100644 --- a/src/backends/ChangeLog +++ b/src/backends/ChangeLog @@ -1,3 +1,315 @@ +2014-12-18 Ulrich Drepper <drepper@gmail.com> + + * Makefile.am: Suppress output of textrel_check command. + +2014-11-22 Mark Wielaard <mjw@redhat.com> + + * ppc64_symbol.c (ppc64_bss_plt_p): Remove ehdr argument. + * ppc_symbol.c (find_dyn_got): Likewise. Use elf_getphdrnum. + (ppc_check_special_symbol): Call find_dyn_got without ehdr. + (ppc_bss_plt_p): Remove ehdr argument. + +2014-11-17 Mark Wielaard <mjw@redhat.com> + + * ppc64_init.c (ppc64_init): Check section name is not NULL. + +2014-10-06 Mark Wielaard <mjw@redhat.com> + + * libebl_CPU.h (dwarf_peel_type): Removed. + (dwarf_peeled_die_type): Use libdw dwarf_peel_type. + +2014-07-18 Kyle McMartin <kyle@redhat.com> + Mark Wielaard <mjw@redhat.com> + + * aarch64_initreg.c: Check HAVE_SYS_USER_REGS. + (aarch64_set_initial_registers_tid): Use user_regs_struct and + user_fpsimd_struct. + * arm_initreg.c: Check HAVE_SYS_USER_REGS. + (arm_set_initial_registers_tid): Use user_regs_struct in compat mode. + +2014-07-04 Menanteau Guy <menantea@linux.vnet.ibm.com> + Mark Wielaard <mjw@redhat.com> + + * ppc64_init.c (ppc64_init): Hook check_st_other_bits. + * ppc64_reloc.def: TLSGD, TLSLD, TOCSAVE, ADDR16_HIGH, ADDR16_HIGHA, + TPREL16_HIGH, TPREL16_HIGHA, DTPREL16_HIGH, DTPREL16_HIGHA, JMP_IREL, + IRELATIVE, REL16, REL16_LO, REL16_HI and REL16_HA. + * ppc64_symbol.c (ppc64_dynamic_tag_name): Recognize DT_PPC64_OPT. + (ppc64_dynamic_tag_check): Likewise. + (ppc64_check_st_other_bits): New function. + +2014-07-04 Mark Wielaard <mjw@redhat.com> + + * aarch64_retval.c (aarch64_return_value_location): Handle + DW_ATE_boolean. + +2014-06-18 Mark Wielaard <mjw@redhat.com> + + * libebl_CPU.h (dwarf_peel_type): Remove DW_TAG_mutable_type + handling. + +2014-06-17 Mark Wielaard <mjw@redhat.com> + + * arm_init.c (arm_init): Set func_addr_mask. + +2014-06-20 Petr Machata <pmachata@redhat.com> + + * alpha_retval.c (alpha_return_value_location): Call + dwarf_peeled_die_type instead of inlining equivalent code. + * arm_retval.c (arm_return_value_location): Likewise. + * i386_retval.c (i386_return_value_location): Likewise. + * ia64_retval.c (ia64_return_value_location): Likewise. + * ppc64_retval.c (ppc64_return_value_location): Likewise. + * ppc_retval.c (ppc_return_value_location): Likewise. + * s390_retval.c (s390_return_value_location): Likewise. + * sh_retval.c (sh_return_value_location): Likewise. + * sparc_retval.c (sparc_return_value_location): Likewise. + * tilegx_retval.c (tilegx_return_value_location): Likewise. + * x86_64_retval.c (x86_64_return_value_location): Likewise. + +2014-05-19 Mark Wielaard <mjw@redhat.com> + + * arm_init.c (arm_init): Hook check_reloc_target_type. + * arm_symbol.c (arm_check_reloc_target_type): New function. + * ia64_init.c (ia64_init): Hook check_reloc_target_type. + * ia64_symbol.c (ia64_check_reloc_target_type): New function. + +2014-04-22 Kurt Roeckx <kurt@roeckx.be> + + * i386_initreg.c: Make Linux only. + * x86_64_initreg.c: Make Linux only. + +2014-04-13 Mark Wielaard <mjw@redhat.com> + + * Makefile.am: Remove libelf and libdw definitions when MUDFLAP + is defined. Remove libmudflap from LINK line. + +2014-04-09 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (aarch64_SRCS): Add aarch64_initreg.c. + * aarch64_corenote.c (prstatus_regs): Mark pc_register. + * aarch64_init.c: Assign frame_nregs. Hook set_initial_registers_tid. + * aarch64_initreg: New file. + +2014-03-28 Jean Pihet <jean.pihet@linaro.org> + + * arm_initreg.c (arm_set_initial_registers_tid): Handle compat mode. + ARM compatible code running on AARCH64. + +2014-03-19 Mark Wielaard <mjw@redhat.com> + + * aarch64_reloc.def: AARCH64_ABS32 and AARCH64_ABS64 are also valid + in ET_REL. + +2014-01-30 Petr Machata <pmachata@redhat.com> + + * aarch64_regs.c (aarch64_register_info.regtype): Make this + variadic printf-like function. Call one vsnprintf instead of two + snprintf's. + (regtyper, regtypen): Drop. + (aarch64_register_info): Adjust callers. + +2014-01-26 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (arm_SRCS): Add arm_initreg.c. + * arm_init.c (arm_init): Define frame_nregs and hook + set_initial_registers_tid. + * arm_initreg.c: New file. + +2014-01-25 Mark Wielaard <mjw@redhat.com> + + * arm_cfi.c (arm_abi_cfi): Restore SP (r13) from CFA. + +2014-01-24 Mark Wielaard <mjw@redhat.com> + + * arm_reloc.def: Update list. + +2014-01-22 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (aarch64_regs_no_Wformat): Removed. + * aarch64_regs.c (regtype): Add bool nr argument. snprintf arg + when nr is true. + (regtyper): New function. + (regtypen): Likewise. + (aarch64_register_info): Call either regtyper or regtypen not + regtype directly. + +2014-01-14 Mark Wielaard <mjw@redhat.com> + + * aarch64_symbol.c (aarch64_check_special_symbol): Check shdr is + not NULL before usage. + +2014-01-04 Mark Wielaard <mjw@redhat.com> + + * ppc64_symbol.c (ppc64_machine_flag_check): New function. + * ppc64_init.c (ppc64_init): Hook machine_flag_check. + +2014-01-03 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (aarch64_SRCS): Add aarch64_cfi.c. + * aarch64_cfi.c: New file. + * aarch64_init.c (aarch64_init): Hook abi_cfi. + * aarch64_regs.c (aarch64_register_info): Set *prefix to "". + +2013-12-19 Mark Wielaard <mjw@redhat.com> + + * aarch64_init.c (aarch64_init): Hook check_special_symbol. + * aarch64_symbol.c (aarch64_check_special_symbol): New function. + +2013-12-18 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (ppc64_SRCS): Add ppc64_resolve_sym.c. + * ppc64_resolve_sym.c: New file. + * ppc64_init.c: Hook resolve_sym_value and find function descriptor + table. + +2013-12-18 Mark Wielaard <mjw@redhat.com> + + * s390_initreg.c (s390_set_initial_registers_tid): Use union + to avoid type-punning when assigning a double to a Dwarf_Word. + +2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com> + + unwinder: s390 and s390x + * Makefile.am (s390_SRCS): Add s390_initreg.c and s390_unwind.c. + * s390_corenote.c (prstatus_regs): Set PC_REGISTER. Reindent all the + entries. + * s390_init.c (s390_init): Initialize frame_nregs, + set_initial_registers_tid, normalize_pc and unwind. + * s390_initreg.c: New file. + * s390_unwind.c: New file. + +2013-12-15 Jan Kratochvil <jan.kratochvil@redhat.com> + + unwinder: ppc and ppc64 + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add ppc_initreg.c. + * ppc64_init.c (ppc64_init): Initialize also frame_nregs, + set_initial_registers_tid and dwarf_to_regno. + * ppc_corenote.c (PRSTATUS_REGSET_ITEMS) <nip>: Set PC_REGISTER. + * ppc_init.c (ppc64_init): Initialize also frame_nregs, + set_initial_registers_tid and dwarf_to_regno. + * ppc_initreg.c: New file. + +2013-11-25 Petr Machata <pmachata@redhat.com> + + * Makefile.am (modules): Add aarch64. + (libebl_pic): Add libebl_aarch64_pic.a. + (aarch64_SRCS): New variable. + (libebl_aarch64_pic_a_SOURCES): Likewise. + (am_libebl_aarch64_pic_a_OBJECTS): Likewise. + (aarch64_regs_no_Wformat): Likewise. + * aarch64_corenote.c, aarch64_init.c: New files. + * aarch64_regs.c, aarch64_reloc.def: Likewise. + * aarch64_retval.c, aarch64_symbol.c: Likewise. + * libebl_CPU.h (dwarf_peel_type): New function. + (dwarf_peeled_die_type): Likewise. + +2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com> + Mark Wielaard <mjw@redhat.com> + + * Makefile.am (i386_SRCS): Add i386_initreg.c. + (x86_64_SRCS): Add x86_64_initreg.c. + * i386_initreg.c: New file. + * i386_init.c (i386_init): Initialize frame_nregs and + set_initial_registers_tid. + * x86_64_initreg.c: New file. + * x86_64_init.c (x86_64_init): Initialize frame_nregs and + set_initial_registers_tid. + +2013-10-06 Mark Wielaard <mjw@redhat.com> + + * ppc_cfi.c (ppc_abi_cfi): Use DW_CFA_val_offset for reg1, not + DW_CFA_val_expression. + +2013-08-29 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (arm_SRCS): Add arm_cfi.c. + * arm_cfi.c: New file. + * arm_init.c (arm_init): Initialize abi_cfi. + +2013-08-27 Jan Kratochvil <jan.kratochvil@redhat.com> + + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add ppc_cfi.c. + (s390_SRCS): Add s390_cfi.c. + * ppc64_init.c (ppc64_init): Initialize abi_cfi. + * ppc_cfi.c: New file. + * ppc_init.c (ppc_init): Initialize abi_cfi. + * s390_cfi.c: New file. + * s390_init.c (s390_init): Initialize abi_cfi. + +2013-08-28 Mark Wielaard <mjw@redhat.com> + + * arm_regs.c (arm_register_info): Set *prefix to "". + * ppc_regs.c (ppc_register_info): Likewise. + * sh_regs.c (sh_register_info): Likewise. + +2013-04-24 Mark Wielaard <mjw@redhat.com> + + * Makefile.am: Use AM_CPPFLAGS instead of INCLUDES. + +2013-02-06 Mark Wielaard <mjw@redhat.com> + + * libebl_CPU.h (DWARF_TAG_OR_RETURN): New macro. + * backends/alpha_retval.c (alpha_return_value_location): Use new + DWARF_TAG_OR_RETURN macro instead of dwarf_tag (). + * backends/arm_retval.c (arm_return_value_location): Likewise. + * backends/i386_retval.c (i386_return_value_location): Likewise. + * backends/ia64_retval.c (hfa_type): Likewise. + (ia64_return_value_location): Likewise. + * backends/ppc64_retval.c (ppc64_return_value_location): Likewise. + * backends/ppc_retval.c (ppc_return_value_location): Likewise. + * backends/s390_retval.c (s390_return_value_location): Likewise. + * backends/sh_retval.c (sh_return_value_location): Likewise. + * backends/sparc_retval.c (sparc_return_value_location): Likewise. + * backends/tilegx_retval.c (tilegx_return_value_location): Likewise. + * backends/x86_64_retval.c (x86_64_return_value_location): Likewise. + +2013-01-29 Jan Kratochvil <jan.kratochvil@redhat.com> + Roland McGrath <roland@hack.frob.com> + + * Makefile.am (s390_SRCS): Add s390_corenote.c and s390x_corenote.c. + * linux-core-note.c (ALIGN_PR_REG): New definitions. + (struct EBLHOOK(prstatus)): Change field pr_reg to anonymous struct with + ALIGN_PR_REG. + (EXTRA_ITEMS): New macro. + * s390_corenote.c: New file. + * s390_init.c (s390x_core_note): New declaration. + (s390_init): Install s390x_core_note and s390_core_note. + * s390x_corenote.c: New file. + +2013-01-30 Jan Kratochvil <jan.kratochvil@redhat.com> + + * arm_corenote.c (vfp_items): Remove zero COUNT initializer. + +2012-10-12 Jan Kratochvil <jan.kratochvil@redhat.com> + + * linux-core-note.c (prstatus_items): Rename groups of sigpend and + sighold to signal2 and signal3. + +2012-09-24 Petr Machata <pmachata@redhat.com> + + * arm_corenote.c (vfp_items, vfp_regs): New const variables. + (EXTRA_NOTES): Use it for NT_ARM_VFP. + * linux-core-note.c (EXTRA_REGSET_ITEMS): New macro. + +2012-09-17 Petr Machata <pmachata@redhat.com> + + * arm_corenote.c (FPREGSET_SIZE): Change to 116. + +2012-08-22 Jeff Kenton <jkenton@tilera.com> + + * Makefile.am (modules): Add tilegx. + (libebl_pic): Add libebl_tilegx_pic.a. + (tilegx_SRCS): New variable. + (libebl_tilegx_pic_a_SOURCES): Likewise. + (am_libebl_tilegx_pic_a_OBJECTS): Likewise. + * tilegx_corenote.c: New file. + * tilegx_regs.c: New file. + * tilegx_reloc.def: New file. + * tilegx_init.c: New file. + * tilegx_retval.c: New file. + * tilegx_symbol.c: New file. + 2011-03-09 Mark Wielaard <mjw@redhat.com> * alpha_init.c (alpha_init): Initialize check_st_other_bits hook. diff --git a/src/backends/Makefile b/src/backends/Makefile new file mode 100644 index 00000000..a6152b5a --- /dev/null +++ b/src/backends/Makefile @@ -0,0 +1,914 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# backends/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + + +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/elfutils +pkgincludedir = $(includedir)/elfutils +pkglibdir = $(libdir)/elfutils +pkglibexecdir = $(libexecdir)/elfutils +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \ + $(noinst_HEADERS) ChangeLog +subdir = backends +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +AM_V_AR = $(am__v_AR_$(V)) +am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libebl_aarch64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_aarch64_pic_a_LIBADD = +am__objects_1 = aarch64_init.$(OBJEXT) aarch64_regs.$(OBJEXT) \ + aarch64_symbol.$(OBJEXT) aarch64_corenote.$(OBJEXT) \ + aarch64_retval.$(OBJEXT) aarch64_cfi.$(OBJEXT) \ + aarch64_initreg.$(OBJEXT) +libebl_aarch64_pic_a_OBJECTS = $(am_libebl_aarch64_pic_a_OBJECTS) +libebl_alpha_pic_a_AR = $(AR) $(ARFLAGS) +libebl_alpha_pic_a_LIBADD = +am__objects_2 = alpha_init.$(OBJEXT) alpha_symbol.$(OBJEXT) \ + alpha_retval.$(OBJEXT) alpha_regs.$(OBJEXT) \ + alpha_corenote.$(OBJEXT) alpha_auxv.$(OBJEXT) +libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) +libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) +libebl_arm_pic_a_LIBADD = +am__objects_3 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) \ + arm_regs.$(OBJEXT) arm_corenote.$(OBJEXT) arm_auxv.$(OBJEXT) \ + arm_attrs.$(OBJEXT) arm_retval.$(OBJEXT) arm_cfi.$(OBJEXT) \ + arm_initreg.$(OBJEXT) +libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) +libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) +libebl_i386_pic_a_LIBADD = +am__objects_4 = i386_init.$(OBJEXT) i386_symbol.$(OBJEXT) \ + i386_corenote.$(OBJEXT) i386_cfi.$(OBJEXT) \ + i386_retval.$(OBJEXT) i386_regs.$(OBJEXT) i386_auxv.$(OBJEXT) \ + i386_syscall.$(OBJEXT) i386_initreg.$(OBJEXT) +libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS) +libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ia64_pic_a_LIBADD = +am__objects_5 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT) \ + ia64_regs.$(OBJEXT) ia64_retval.$(OBJEXT) +libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS) +libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ppc64_pic_a_LIBADD = +am__objects_6 = ppc64_init.$(OBJEXT) ppc64_symbol.$(OBJEXT) \ + ppc64_retval.$(OBJEXT) ppc64_corenote.$(OBJEXT) \ + ppc_regs.$(OBJEXT) ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) \ + ppc_syscall.$(OBJEXT) ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) \ + ppc64_resolve_sym.$(OBJEXT) +libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) +libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) +libebl_ppc_pic_a_LIBADD = +am__objects_7 = ppc_init.$(OBJEXT) ppc_symbol.$(OBJEXT) \ + ppc_retval.$(OBJEXT) ppc_regs.$(OBJEXT) ppc_corenote.$(OBJEXT) \ + ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) ppc_syscall.$(OBJEXT) \ + ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) +libebl_ppc_pic_a_OBJECTS = $(am_libebl_ppc_pic_a_OBJECTS) +libebl_s390_pic_a_AR = $(AR) $(ARFLAGS) +libebl_s390_pic_a_LIBADD = +am__objects_8 = s390_init.$(OBJEXT) s390_symbol.$(OBJEXT) \ + s390_regs.$(OBJEXT) s390_retval.$(OBJEXT) \ + s390_corenote.$(OBJEXT) s390x_corenote.$(OBJEXT) \ + s390_cfi.$(OBJEXT) s390_initreg.$(OBJEXT) \ + s390_unwind.$(OBJEXT) +libebl_s390_pic_a_OBJECTS = $(am_libebl_s390_pic_a_OBJECTS) +libebl_sh_pic_a_AR = $(AR) $(ARFLAGS) +libebl_sh_pic_a_LIBADD = +am__objects_9 = sh_init.$(OBJEXT) sh_symbol.$(OBJEXT) \ + sh_corenote.$(OBJEXT) sh_regs.$(OBJEXT) sh_retval.$(OBJEXT) +libebl_sh_pic_a_OBJECTS = $(am_libebl_sh_pic_a_OBJECTS) +libebl_sparc_pic_a_AR = $(AR) $(ARFLAGS) +libebl_sparc_pic_a_LIBADD = +am__objects_10 = sparc_init.$(OBJEXT) sparc_symbol.$(OBJEXT) \ + sparc_regs.$(OBJEXT) sparc_retval.$(OBJEXT) \ + sparc_corenote.$(OBJEXT) sparc64_corenote.$(OBJEXT) \ + sparc_auxv.$(OBJEXT) +libebl_sparc_pic_a_OBJECTS = $(am_libebl_sparc_pic_a_OBJECTS) +libebl_tilegx_pic_a_AR = $(AR) $(ARFLAGS) +libebl_tilegx_pic_a_LIBADD = +am__objects_11 = tilegx_init.$(OBJEXT) tilegx_symbol.$(OBJEXT) \ + tilegx_regs.$(OBJEXT) tilegx_retval.$(OBJEXT) \ + tilegx_corenote.$(OBJEXT) +libebl_tilegx_pic_a_OBJECTS = $(am_libebl_tilegx_pic_a_OBJECTS) +libebl_x86_64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_x86_64_pic_a_LIBADD = +am__objects_12 = x86_64_init.$(OBJEXT) x86_64_symbol.$(OBJEXT) \ + x86_64_corenote.$(OBJEXT) x86_64_cfi.$(OBJEXT) \ + x86_64_retval.$(OBJEXT) x86_64_regs.$(OBJEXT) \ + i386_auxv.$(OBJEXT) x86_64_syscall.$(OBJEXT) \ + x86_64_initreg.$(OBJEXT) +libebl_x86_64_pic_a_OBJECTS = $(am_libebl_x86_64_pic_a_OBJECTS) +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libebl_aarch64_pic_a_SOURCES) \ + $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ + $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) \ + $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ + $(libebl_s390_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) \ + $(libebl_sparc_pic_a_SOURCES) $(libebl_tilegx_pic_a_SOURCES) \ + $(libebl_x86_64_pic_a_SOURCES) +DIST_SOURCES = $(libebl_aarch64_pic_a_SOURCES) \ + $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ + $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) \ + $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ + $(libebl_s390_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) \ + $(libebl_sparc_pic_a_SOURCES) $(libebl_tilegx_pic_a_SOURCES) \ + $(libebl_x86_64_pic_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing aclocal-1.14 +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing autoconf +AUTOHEADER = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing autoheader +AUTOMAKE = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing automake-1.14 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CC_BIARCH = gcc -m32 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CYGPATH_W = echo +DEBUGPRED = 0 +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GETTEXT_MACRO_VERSION = 0.18 +GMSGFMT = /usr/bin/msgfmt +GMSGFMT_015 = /usr/bin/msgfmt +GREP = /bin/grep +HAVE_VALGRIND = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LDFLAGS = +LEX = flex +LEXLIB = -lfl +LEX_OUTPUT_ROOT = lex.yy +LIBEBL_SUBDIR = elfutils +LIBOBJS = +LIBS = +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing makeinfo +MKDIR_P = /bin/mkdir -p +MODVERSION = Build on enh.mtv.corp.google.com 2015-02-18T19:32:04-0800 +MSGFMT = /usr/bin/msgfmt +MSGFMT_015 = /usr/bin/msgfmt +MSGMERGE = /usr/bin/msgmerge +NM = nm +OBJEXT = o +PACKAGE = elfutils +PACKAGE_BUGREPORT = https://bugzilla.redhat.com/ +PACKAGE_NAME = elfutils +PACKAGE_STRING = elfutils 0.161 +PACKAGE_TARNAME = elfutils +PACKAGE_URL = +PACKAGE_VERSION = 0.161 +PATH_SEPARATOR = : +RANLIB = ranlib +READELF = readelf +SET_MAKE = +SHELL = /bin/sh +STRIP = +USE_NLS = yes +VERSION = 0.161 +XGETTEXT = /usr/bin/xgettext +XGETTEXT_015 = /usr/bin/xgettext +XGETTEXT_EXTRA_OPTIONS = +YACC = bison -y +YFLAGS = +abs_builddir = /huge-ssd/aosp-arm64/external/elfutils/src/backends +abs_srcdir = /huge-ssd/aosp-arm64/external/elfutils/src/backends +abs_top_builddir = /huge-ssd/aosp-arm64/external/elfutils/src +abs_top_srcdir = /huge-ssd/aosp-arm64/external/elfutils/src +ac_ct_AR = ar +ac_ct_CC = gcc +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +base_cpu = none +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +eu_version = 161 +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +zip_LIBS = -lz +AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \ + -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw +AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ + $(if $($(*F)_no_Werror),,-Werror) \ + $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ + $($(*F)_CFLAGS) + +COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) +CLEANFILES = *.gcno *.gcda $(foreach m,$(modules), libebl_$(m).map \ + libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS)) +textrel_msg = echo "WARNING: TEXTREL found in '$@'" +#textrel_found = $(textrel_msg) +textrel_found = $(textrel_msg); exit 1 +textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi +modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ + tilegx + +libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ + libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ + libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ + libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a + +noinst_LIBRARIES = $(libebl_pic) +noinst_DATA = $(libebl_pic:_pic.a=.so) +libelf = ../libelf/libelf.so +libdw = ../libdw/libdw.so +i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ + i386_initreg.c + +cpu_i386 = ../libcpu/libcpu_i386.a +libebl_i386_pic_a_SOURCES = $(i386_SRCS) +am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) +sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c +libebl_sh_pic_a_SOURCES = $(sh_SRCS) +am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) +x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ + x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \ + x86_64_initreg.c + +cpu_x86_64 = ../libcpu/libcpu_x86_64.a +libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) +am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) +ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c +libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) +am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) +alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ + alpha_corenote.c alpha_auxv.c + +libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) +am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) +arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ + arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c + +libebl_arm_pic_a_SOURCES = $(arm_SRCS) +am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) +aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \ + aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \ + aarch64_initreg.c + +libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS) +am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os) +sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ + sparc_corenote.c sparc64_corenote.c sparc_auxv.c + +libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) +am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) +ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c + +libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) +am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) +ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c + +libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) +am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) +s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \ + s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \ + s390_unwind.c + +libebl_s390_pic_a_SOURCES = $(s390_SRCS) +am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) +tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \ + tilegx_retval.c tilegx_corenote.c + +libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) +am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) +noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c +EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(top_srcdir)/config/eu.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits backends/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnits backends/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/config/eu.am: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libebl_aarch64_pic.a: $(libebl_aarch64_pic_a_OBJECTS) $(libebl_aarch64_pic_a_DEPENDENCIES) $(EXTRA_libebl_aarch64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_aarch64_pic.a + $(AM_V_AR)$(libebl_aarch64_pic_a_AR) libebl_aarch64_pic.a $(libebl_aarch64_pic_a_OBJECTS) $(libebl_aarch64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_aarch64_pic.a + +libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) $(EXTRA_libebl_alpha_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_alpha_pic.a + $(AM_V_AR)$(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_alpha_pic.a + +libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) $(EXTRA_libebl_arm_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_arm_pic.a + $(AM_V_AR)$(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_arm_pic.a + +libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) $(EXTRA_libebl_i386_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_i386_pic.a + $(AM_V_AR)$(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_i386_pic.a + +libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) $(EXTRA_libebl_ia64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ia64_pic.a + $(AM_V_AR)$(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ia64_pic.a + +libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) $(EXTRA_libebl_ppc64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ppc64_pic.a + $(AM_V_AR)$(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ppc64_pic.a + +libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) $(EXTRA_libebl_ppc_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ppc_pic.a + $(AM_V_AR)$(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ppc_pic.a + +libebl_s390_pic.a: $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_DEPENDENCIES) $(EXTRA_libebl_s390_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_s390_pic.a + $(AM_V_AR)$(libebl_s390_pic_a_AR) libebl_s390_pic.a $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_s390_pic.a + +libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) $(EXTRA_libebl_sh_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_sh_pic.a + $(AM_V_AR)$(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_sh_pic.a + +libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) $(EXTRA_libebl_sparc_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_sparc_pic.a + $(AM_V_AR)$(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_sparc_pic.a + +libebl_tilegx_pic.a: $(libebl_tilegx_pic_a_OBJECTS) $(libebl_tilegx_pic_a_DEPENDENCIES) $(EXTRA_libebl_tilegx_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_tilegx_pic.a + $(AM_V_AR)$(libebl_tilegx_pic_a_AR) libebl_tilegx_pic.a $(libebl_tilegx_pic_a_OBJECTS) $(libebl_tilegx_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_tilegx_pic.a + +libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) $(EXTRA_libebl_x86_64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_x86_64_pic.a + $(AM_V_AR)$(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_x86_64_pic.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/aarch64_cfi.Po +include ./$(DEPDIR)/aarch64_corenote.Po +include ./$(DEPDIR)/aarch64_init.Po +include ./$(DEPDIR)/aarch64_initreg.Po +include ./$(DEPDIR)/aarch64_regs.Po +include ./$(DEPDIR)/aarch64_retval.Po +include ./$(DEPDIR)/aarch64_symbol.Po +include ./$(DEPDIR)/alpha_auxv.Po +include ./$(DEPDIR)/alpha_corenote.Po +include ./$(DEPDIR)/alpha_init.Po +include ./$(DEPDIR)/alpha_regs.Po +include ./$(DEPDIR)/alpha_retval.Po +include ./$(DEPDIR)/alpha_symbol.Po +include ./$(DEPDIR)/arm_attrs.Po +include ./$(DEPDIR)/arm_auxv.Po +include ./$(DEPDIR)/arm_cfi.Po +include ./$(DEPDIR)/arm_corenote.Po +include ./$(DEPDIR)/arm_init.Po +include ./$(DEPDIR)/arm_initreg.Po +include ./$(DEPDIR)/arm_regs.Po +include ./$(DEPDIR)/arm_retval.Po +include ./$(DEPDIR)/arm_symbol.Po +include ./$(DEPDIR)/i386_auxv.Po +include ./$(DEPDIR)/i386_cfi.Po +include ./$(DEPDIR)/i386_corenote.Po +include ./$(DEPDIR)/i386_init.Po +include ./$(DEPDIR)/i386_initreg.Po +include ./$(DEPDIR)/i386_regs.Po +include ./$(DEPDIR)/i386_retval.Po +include ./$(DEPDIR)/i386_symbol.Po +include ./$(DEPDIR)/i386_syscall.Po +include ./$(DEPDIR)/ia64_init.Po +include ./$(DEPDIR)/ia64_regs.Po +include ./$(DEPDIR)/ia64_retval.Po +include ./$(DEPDIR)/ia64_symbol.Po +include ./$(DEPDIR)/ppc64_corenote.Po +include ./$(DEPDIR)/ppc64_init.Po +include ./$(DEPDIR)/ppc64_resolve_sym.Po +include ./$(DEPDIR)/ppc64_retval.Po +include ./$(DEPDIR)/ppc64_symbol.Po +include ./$(DEPDIR)/ppc_attrs.Po +include ./$(DEPDIR)/ppc_auxv.Po +include ./$(DEPDIR)/ppc_cfi.Po +include ./$(DEPDIR)/ppc_corenote.Po +include ./$(DEPDIR)/ppc_init.Po +include ./$(DEPDIR)/ppc_initreg.Po +include ./$(DEPDIR)/ppc_regs.Po +include ./$(DEPDIR)/ppc_retval.Po +include ./$(DEPDIR)/ppc_symbol.Po +include ./$(DEPDIR)/ppc_syscall.Po +include ./$(DEPDIR)/s390_cfi.Po +include ./$(DEPDIR)/s390_corenote.Po +include ./$(DEPDIR)/s390_init.Po +include ./$(DEPDIR)/s390_initreg.Po +include ./$(DEPDIR)/s390_regs.Po +include ./$(DEPDIR)/s390_retval.Po +include ./$(DEPDIR)/s390_symbol.Po +include ./$(DEPDIR)/s390_unwind.Po +include ./$(DEPDIR)/s390x_corenote.Po +include ./$(DEPDIR)/sh_corenote.Po +include ./$(DEPDIR)/sh_init.Po +include ./$(DEPDIR)/sh_regs.Po +include ./$(DEPDIR)/sh_retval.Po +include ./$(DEPDIR)/sh_symbol.Po +include ./$(DEPDIR)/sparc64_corenote.Po +include ./$(DEPDIR)/sparc_auxv.Po +include ./$(DEPDIR)/sparc_corenote.Po +include ./$(DEPDIR)/sparc_init.Po +include ./$(DEPDIR)/sparc_regs.Po +include ./$(DEPDIR)/sparc_retval.Po +include ./$(DEPDIR)/sparc_symbol.Po +include ./$(DEPDIR)/tilegx_corenote.Po +include ./$(DEPDIR)/tilegx_init.Po +include ./$(DEPDIR)/tilegx_regs.Po +include ./$(DEPDIR)/tilegx_retval.Po +include ./$(DEPDIR)/tilegx_symbol.Po +include ./$(DEPDIR)/x86_64_cfi.Po +include ./$(DEPDIR)/x86_64_corenote.Po +include ./$(DEPDIR)/x86_64_init.Po +include ./$(DEPDIR)/x86_64_initreg.Po +include ./$(DEPDIR)/x86_64_regs.Po +include ./$(DEPDIR)/x86_64_retval.Po +include ./$(DEPDIR)/x86_64_symbol.Po +include ./$(DEPDIR)/x86_64_syscall.Po + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(DATA) $(HEADERS) +installdirs: +install-exec: install-exec-am +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + + +%.os: %.c %.o + if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ + -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ + then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ + rm -f "$(DEPDIR)/$*.Tpo"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi +# $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $< + +libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) + @rm -f $(@:.so=.map) + echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \ + > $(@:.so=.map) + $(LINK) -shared -o $(@:.map=.so) \ + -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \ + -Wl,--version-script,$(@:.so=.map) \ + -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) + @$(textrel_check) + +libebl_i386.so: $(cpu_i386) +libebl_x86_64.so: $(cpu_x86_64) + +install: install-am install-ebl-modules +install-ebl-modules: + $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + for m in $(modules); do \ + $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + +uninstall: uninstall-am + for m in $(modules); do \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ + rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ + done + rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am index 3ce448a9..687c089d 100644 --- a/src/backends/Makefile.am +++ b/src/backends/Makefile.am @@ -1,53 +1,53 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2000-2010 Red Hat, Inc. -## This file is part of Red Hat elfutils. +## Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc. +## Copyright (C) 2012 Tilera Corporation +## This file is part of elfutils. ## -## Red Hat elfutils is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by the -## Free Software Foundation; version 2 of the License. +## This file is free software; you can redistribute it and/or modify +## it under the terms of either ## -## Red Hat elfutils is distributed in the hope that it will be useful, but +## * the GNU Lesser General Public License as published by the Free +## Software Foundation; either version 3 of the License, or (at +## your option) any later version +## +## or +## +## * the GNU General Public License as published by the Free +## Software Foundation; either version 2 of the License, or (at +## your option) any later version +## +## or both in parallel, as here. +## +## elfutils is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## -## You should have received a copy of the GNU General Public License along -## with Red Hat elfutils; if not, write to the Free Software Foundation, -## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. -## -## Red Hat elfutils is an included package of the Open Invention Network. -## An included package of the Open Invention Network is a package for which -## Open Invention Network licensees cross-license their patents. No patent -## license is granted, either expressly or impliedly, by designation as an -## included package. Should you wish to participate in the Open Invention -## Network licensing program, please visit www.openinventionnetwork.com -## <http://www.openinventionnetwork.com>. -## +## You should have received copies of the GNU General Public License and +## the GNU Lesser General Public License along with this program. If +## not, see <http://www.gnu.org/licenses/>. include $(top_srcdir)/config/eu.am -INCLUDES += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ +AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw -modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 -libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ - libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ - libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ - libebl_s390_pic.a +modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ + tilegx +libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ + libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ + libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ + libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a noinst_LIBRARIES = $(libebl_pic) noinst_DATA = $(libebl_pic:_pic.a=.so) -if MUDFLAP -libelf = ../libelf/libelf.a -libdw = ../libdw/libdw.a -else libelf = ../libelf/libelf.so libdw = ../libdw/libdw.so -endif i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ - i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ + i386_initreg.c cpu_i386 = ../libcpu/libcpu_i386.a libebl_i386_pic_a_SOURCES = $(i386_SRCS) am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) @@ -57,7 +57,8 @@ libebl_sh_pic_a_SOURCES = $(sh_SRCS) am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ - x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c + x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \ + x86_64_initreg.c cpu_x86_64 = ../libcpu/libcpu_x86_64.a libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) @@ -72,29 +73,44 @@ libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ - arm_auxv.c arm_attrs.c arm_retval.c + arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c libebl_arm_pic_a_SOURCES = $(arm_SRCS) am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) +aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \ + aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \ + aarch64_initreg.c +libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS) +am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os) + sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ sparc_corenote.c sparc64_corenote.c sparc_auxv.c libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ - ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) -s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c +s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \ + s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \ + s390_unwind.c libebl_s390_pic_a_SOURCES = $(s390_SRCS) am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) +tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \ + tilegx_retval.c tilegx_corenote.c +libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) +am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) + libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) @rm -f $(@:.so=.map) @@ -103,8 +119,8 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(LINK) -shared -o $(@:.map=.so) \ -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \ -Wl,--version-script,$(@:.so=.map) \ - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) - $(textrel_check) + -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) + @$(textrel_check) libebl_i386.so: $(cpu_i386) libebl_x86_64.so: $(cpu_x86_64) diff --git a/src/backends/Makefile.in b/src/backends/Makefile.in index b14a480f..d204d036 100644 --- a/src/backends/Makefile.in +++ b/src/backends/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,6 +17,51 @@ VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -36,12 +80,13 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog -@MUDFLAP_TRUE@am__append_1 = -fmudflap +DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \ + $(noinst_HEADERS) ChangeLog subdir = backends ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -51,102 +96,174 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) -AR = ar ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libebl_aarch64_pic_a_AR = $(AR) $(ARFLAGS) +libebl_aarch64_pic_a_LIBADD = +am__objects_1 = aarch64_init.$(OBJEXT) aarch64_regs.$(OBJEXT) \ + aarch64_symbol.$(OBJEXT) aarch64_corenote.$(OBJEXT) \ + aarch64_retval.$(OBJEXT) aarch64_cfi.$(OBJEXT) \ + aarch64_initreg.$(OBJEXT) +libebl_aarch64_pic_a_OBJECTS = $(am_libebl_aarch64_pic_a_OBJECTS) libebl_alpha_pic_a_AR = $(AR) $(ARFLAGS) libebl_alpha_pic_a_LIBADD = -am__objects_1 = alpha_init.$(OBJEXT) alpha_symbol.$(OBJEXT) \ +am__objects_2 = alpha_init.$(OBJEXT) alpha_symbol.$(OBJEXT) \ alpha_retval.$(OBJEXT) alpha_regs.$(OBJEXT) \ alpha_corenote.$(OBJEXT) alpha_auxv.$(OBJEXT) libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) libebl_arm_pic_a_LIBADD = -am__objects_2 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) \ +am__objects_3 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) \ arm_regs.$(OBJEXT) arm_corenote.$(OBJEXT) arm_auxv.$(OBJEXT) \ - arm_attrs.$(OBJEXT) arm_retval.$(OBJEXT) + arm_attrs.$(OBJEXT) arm_retval.$(OBJEXT) arm_cfi.$(OBJEXT) \ + arm_initreg.$(OBJEXT) libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) libebl_i386_pic_a_LIBADD = -am__objects_3 = i386_init.$(OBJEXT) i386_symbol.$(OBJEXT) \ +am__objects_4 = i386_init.$(OBJEXT) i386_symbol.$(OBJEXT) \ i386_corenote.$(OBJEXT) i386_cfi.$(OBJEXT) \ i386_retval.$(OBJEXT) i386_regs.$(OBJEXT) i386_auxv.$(OBJEXT) \ - i386_syscall.$(OBJEXT) + i386_syscall.$(OBJEXT) i386_initreg.$(OBJEXT) libebl_i386_pic_a_OBJECTS = $(am_libebl_i386_pic_a_OBJECTS) libebl_ia64_pic_a_AR = $(AR) $(ARFLAGS) libebl_ia64_pic_a_LIBADD = -am__objects_4 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT) \ +am__objects_5 = ia64_init.$(OBJEXT) ia64_symbol.$(OBJEXT) \ ia64_regs.$(OBJEXT) ia64_retval.$(OBJEXT) libebl_ia64_pic_a_OBJECTS = $(am_libebl_ia64_pic_a_OBJECTS) libebl_ppc64_pic_a_AR = $(AR) $(ARFLAGS) libebl_ppc64_pic_a_LIBADD = -am__objects_5 = ppc64_init.$(OBJEXT) ppc64_symbol.$(OBJEXT) \ +am__objects_6 = ppc64_init.$(OBJEXT) ppc64_symbol.$(OBJEXT) \ ppc64_retval.$(OBJEXT) ppc64_corenote.$(OBJEXT) \ ppc_regs.$(OBJEXT) ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) \ - ppc_syscall.$(OBJEXT) + ppc_syscall.$(OBJEXT) ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) \ + ppc64_resolve_sym.$(OBJEXT) libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) libebl_ppc_pic_a_LIBADD = -am__objects_6 = ppc_init.$(OBJEXT) ppc_symbol.$(OBJEXT) \ +am__objects_7 = ppc_init.$(OBJEXT) ppc_symbol.$(OBJEXT) \ ppc_retval.$(OBJEXT) ppc_regs.$(OBJEXT) ppc_corenote.$(OBJEXT) \ - ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) ppc_syscall.$(OBJEXT) + ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) ppc_syscall.$(OBJEXT) \ + ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) libebl_ppc_pic_a_OBJECTS = $(am_libebl_ppc_pic_a_OBJECTS) libebl_s390_pic_a_AR = $(AR) $(ARFLAGS) libebl_s390_pic_a_LIBADD = -am__objects_7 = s390_init.$(OBJEXT) s390_symbol.$(OBJEXT) \ - s390_regs.$(OBJEXT) s390_retval.$(OBJEXT) +am__objects_8 = s390_init.$(OBJEXT) s390_symbol.$(OBJEXT) \ + s390_regs.$(OBJEXT) s390_retval.$(OBJEXT) \ + s390_corenote.$(OBJEXT) s390x_corenote.$(OBJEXT) \ + s390_cfi.$(OBJEXT) s390_initreg.$(OBJEXT) \ + s390_unwind.$(OBJEXT) libebl_s390_pic_a_OBJECTS = $(am_libebl_s390_pic_a_OBJECTS) libebl_sh_pic_a_AR = $(AR) $(ARFLAGS) libebl_sh_pic_a_LIBADD = -am__objects_8 = sh_init.$(OBJEXT) sh_symbol.$(OBJEXT) \ +am__objects_9 = sh_init.$(OBJEXT) sh_symbol.$(OBJEXT) \ sh_corenote.$(OBJEXT) sh_regs.$(OBJEXT) sh_retval.$(OBJEXT) libebl_sh_pic_a_OBJECTS = $(am_libebl_sh_pic_a_OBJECTS) libebl_sparc_pic_a_AR = $(AR) $(ARFLAGS) libebl_sparc_pic_a_LIBADD = -am__objects_9 = sparc_init.$(OBJEXT) sparc_symbol.$(OBJEXT) \ +am__objects_10 = sparc_init.$(OBJEXT) sparc_symbol.$(OBJEXT) \ sparc_regs.$(OBJEXT) sparc_retval.$(OBJEXT) \ sparc_corenote.$(OBJEXT) sparc64_corenote.$(OBJEXT) \ sparc_auxv.$(OBJEXT) libebl_sparc_pic_a_OBJECTS = $(am_libebl_sparc_pic_a_OBJECTS) +libebl_tilegx_pic_a_AR = $(AR) $(ARFLAGS) +libebl_tilegx_pic_a_LIBADD = +am__objects_11 = tilegx_init.$(OBJEXT) tilegx_symbol.$(OBJEXT) \ + tilegx_regs.$(OBJEXT) tilegx_retval.$(OBJEXT) \ + tilegx_corenote.$(OBJEXT) +libebl_tilegx_pic_a_OBJECTS = $(am_libebl_tilegx_pic_a_OBJECTS) libebl_x86_64_pic_a_AR = $(AR) $(ARFLAGS) libebl_x86_64_pic_a_LIBADD = -am__objects_10 = x86_64_init.$(OBJEXT) x86_64_symbol.$(OBJEXT) \ +am__objects_12 = x86_64_init.$(OBJEXT) x86_64_symbol.$(OBJEXT) \ x86_64_corenote.$(OBJEXT) x86_64_cfi.$(OBJEXT) \ x86_64_retval.$(OBJEXT) x86_64_regs.$(OBJEXT) \ - i386_auxv.$(OBJEXT) x86_64_syscall.$(OBJEXT) + i386_auxv.$(OBJEXT) x86_64_syscall.$(OBJEXT) \ + x86_64_initreg.$(OBJEXT) libebl_x86_64_pic_a_OBJECTS = $(am_libebl_x86_64_pic_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libebl_aarch64_pic_a_SOURCES) \ + $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ + $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) \ + $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ + $(libebl_s390_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) \ + $(libebl_sparc_pic_a_SOURCES) $(libebl_tilegx_pic_a_SOURCES) \ + $(libebl_x86_64_pic_a_SOURCES) +DIST_SOURCES = $(libebl_aarch64_pic_a_SOURCES) \ + $(libebl_alpha_pic_a_SOURCES) $(libebl_arm_pic_a_SOURCES) \ $(libebl_i386_pic_a_SOURCES) $(libebl_ia64_pic_a_SOURCES) \ $(libebl_ppc64_pic_a_SOURCES) $(libebl_ppc_pic_a_SOURCES) \ $(libebl_s390_pic_a_SOURCES) $(libebl_sh_pic_a_SOURCES) \ - $(libebl_sparc_pic_a_SOURCES) $(libebl_x86_64_pic_a_SOURCES) -DIST_SOURCES = $(libebl_alpha_pic_a_SOURCES) \ - $(libebl_arm_pic_a_SOURCES) $(libebl_i386_pic_a_SOURCES) \ - $(libebl_ia64_pic_a_SOURCES) $(libebl_ppc64_pic_a_SOURCES) \ - $(libebl_ppc_pic_a_SOURCES) $(libebl_s390_pic_a_SOURCES) \ - $(libebl_sh_pic_a_SOURCES) $(libebl_sparc_pic_a_SOURCES) \ + $(libebl_sparc_pic_a_SOURCES) $(libebl_tilegx_pic_a_SOURCES) \ $(libebl_x86_64_pic_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(noinst_DATA) HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ +CC_BIARCH = @CC_BIARCH@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUGPRED = @DEBUGPRED@ @@ -155,10 +272,13 @@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +HAVE_VALGRIND = @HAVE_VALGRIND@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -179,6 +299,7 @@ MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NM = @NM@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -189,6 +310,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +READELF = @READELF@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -203,6 +325,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -252,36 +375,36 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ zip_LIBS = @zip_LIBS@ -INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \ +AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \ -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw -AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) -@MUDFLAP_FALSE@libmudflap = -@MUDFLAP_TRUE@libmudflap = -lmudflap -COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\ - $(COMPILE)) +AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ + $(if $($(*F)_no_Werror),,-Werror) \ + $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ + $($(*F)_CFLAGS) +COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) CLEANFILES = *.gcno *.gcda $(foreach m,$(modules), libebl_$(m).map \ libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS)) -textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi -modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 -libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ - libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ - libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ - libebl_s390_pic.a +textrel_msg = echo "WARNING: TEXTREL found in '$@'" +@FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg) +@FATAL_TEXTREL_TRUE@textrel_found = $(textrel_msg); exit 1 +textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi +modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ + tilegx + +libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ + libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ + libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ + libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a noinst_LIBRARIES = $(libebl_pic) noinst_DATA = $(libebl_pic:_pic.a=.so) -@MUDFLAP_FALSE@libelf = ../libelf/libelf.so -@MUDFLAP_TRUE@libelf = ../libelf/libelf.a -@MUDFLAP_FALSE@libdw = ../libdw/libdw.so -@MUDFLAP_TRUE@libdw = ../libdw/libdw.a +libelf = ../libelf/libelf.so +libdw = ../libdw/libdw.so i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ - i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ + i386_initreg.c cpu_i386 = ../libcpu/libcpu_i386.a libebl_i386_pic_a_SOURCES = $(i386_SRCS) @@ -290,7 +413,8 @@ sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c libebl_sh_pic_a_SOURCES = $(sh_SRCS) am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ - x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c + x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \ + x86_64_initreg.c cpu_x86_64 = ../libcpu/libcpu_x86_64.a libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) @@ -304,28 +428,44 @@ alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ - arm_auxv.c arm_attrs.c arm_retval.c + arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c libebl_arm_pic_a_SOURCES = $(arm_SRCS) am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) +aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \ + aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \ + aarch64_initreg.c + +libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS) +am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os) sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ sparc_corenote.c sparc64_corenote.c sparc_auxv.c libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ - ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) -s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c +s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \ + s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \ + s390_unwind.c + libebl_s390_pic_a_SOURCES = $(s390_SRCS) am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) +tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \ + tilegx_retval.c tilegx_corenote.c + +libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) +am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) all: all-am @@ -353,6 +493,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/config/eu.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -365,46 +506,66 @@ $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) - -rm -f libebl_alpha_pic.a - $(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) - $(RANLIB) libebl_alpha_pic.a -libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) - -rm -f libebl_arm_pic.a - $(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) - $(RANLIB) libebl_arm_pic.a -libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) - -rm -f libebl_i386_pic.a - $(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) - $(RANLIB) libebl_i386_pic.a -libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) - -rm -f libebl_ia64_pic.a - $(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) - $(RANLIB) libebl_ia64_pic.a -libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) - -rm -f libebl_ppc64_pic.a - $(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) - $(RANLIB) libebl_ppc64_pic.a -libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) - -rm -f libebl_ppc_pic.a - $(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) - $(RANLIB) libebl_ppc_pic.a -libebl_s390_pic.a: $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_DEPENDENCIES) - -rm -f libebl_s390_pic.a - $(libebl_s390_pic_a_AR) libebl_s390_pic.a $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_LIBADD) - $(RANLIB) libebl_s390_pic.a -libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) - -rm -f libebl_sh_pic.a - $(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) - $(RANLIB) libebl_sh_pic.a -libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) - -rm -f libebl_sparc_pic.a - $(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) - $(RANLIB) libebl_sparc_pic.a -libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) - -rm -f libebl_x86_64_pic.a - $(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) - $(RANLIB) libebl_x86_64_pic.a + +libebl_aarch64_pic.a: $(libebl_aarch64_pic_a_OBJECTS) $(libebl_aarch64_pic_a_DEPENDENCIES) $(EXTRA_libebl_aarch64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_aarch64_pic.a + $(AM_V_AR)$(libebl_aarch64_pic_a_AR) libebl_aarch64_pic.a $(libebl_aarch64_pic_a_OBJECTS) $(libebl_aarch64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_aarch64_pic.a + +libebl_alpha_pic.a: $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_DEPENDENCIES) $(EXTRA_libebl_alpha_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_alpha_pic.a + $(AM_V_AR)$(libebl_alpha_pic_a_AR) libebl_alpha_pic.a $(libebl_alpha_pic_a_OBJECTS) $(libebl_alpha_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_alpha_pic.a + +libebl_arm_pic.a: $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_DEPENDENCIES) $(EXTRA_libebl_arm_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_arm_pic.a + $(AM_V_AR)$(libebl_arm_pic_a_AR) libebl_arm_pic.a $(libebl_arm_pic_a_OBJECTS) $(libebl_arm_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_arm_pic.a + +libebl_i386_pic.a: $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_DEPENDENCIES) $(EXTRA_libebl_i386_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_i386_pic.a + $(AM_V_AR)$(libebl_i386_pic_a_AR) libebl_i386_pic.a $(libebl_i386_pic_a_OBJECTS) $(libebl_i386_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_i386_pic.a + +libebl_ia64_pic.a: $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_DEPENDENCIES) $(EXTRA_libebl_ia64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ia64_pic.a + $(AM_V_AR)$(libebl_ia64_pic_a_AR) libebl_ia64_pic.a $(libebl_ia64_pic_a_OBJECTS) $(libebl_ia64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ia64_pic.a + +libebl_ppc64_pic.a: $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_DEPENDENCIES) $(EXTRA_libebl_ppc64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ppc64_pic.a + $(AM_V_AR)$(libebl_ppc64_pic_a_AR) libebl_ppc64_pic.a $(libebl_ppc64_pic_a_OBJECTS) $(libebl_ppc64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ppc64_pic.a + +libebl_ppc_pic.a: $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_DEPENDENCIES) $(EXTRA_libebl_ppc_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_ppc_pic.a + $(AM_V_AR)$(libebl_ppc_pic_a_AR) libebl_ppc_pic.a $(libebl_ppc_pic_a_OBJECTS) $(libebl_ppc_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_ppc_pic.a + +libebl_s390_pic.a: $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_DEPENDENCIES) $(EXTRA_libebl_s390_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_s390_pic.a + $(AM_V_AR)$(libebl_s390_pic_a_AR) libebl_s390_pic.a $(libebl_s390_pic_a_OBJECTS) $(libebl_s390_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_s390_pic.a + +libebl_sh_pic.a: $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_DEPENDENCIES) $(EXTRA_libebl_sh_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_sh_pic.a + $(AM_V_AR)$(libebl_sh_pic_a_AR) libebl_sh_pic.a $(libebl_sh_pic_a_OBJECTS) $(libebl_sh_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_sh_pic.a + +libebl_sparc_pic.a: $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_DEPENDENCIES) $(EXTRA_libebl_sparc_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_sparc_pic.a + $(AM_V_AR)$(libebl_sparc_pic_a_AR) libebl_sparc_pic.a $(libebl_sparc_pic_a_OBJECTS) $(libebl_sparc_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_sparc_pic.a + +libebl_tilegx_pic.a: $(libebl_tilegx_pic_a_OBJECTS) $(libebl_tilegx_pic_a_DEPENDENCIES) $(EXTRA_libebl_tilegx_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_tilegx_pic.a + $(AM_V_AR)$(libebl_tilegx_pic_a_AR) libebl_tilegx_pic.a $(libebl_tilegx_pic_a_OBJECTS) $(libebl_tilegx_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_tilegx_pic.a + +libebl_x86_64_pic.a: $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_DEPENDENCIES) $(EXTRA_libebl_x86_64_pic_a_DEPENDENCIES) + $(AM_V_at)-rm -f libebl_x86_64_pic.a + $(AM_V_AR)$(libebl_x86_64_pic_a_AR) libebl_x86_64_pic.a $(libebl_x86_64_pic_a_OBJECTS) $(libebl_x86_64_pic_a_LIBADD) + $(AM_V_at)$(RANLIB) libebl_x86_64_pic.a mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -412,6 +573,13 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_cfi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_initreg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_auxv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_init.Po@am__quote@ @@ -420,8 +588,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_attrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_cfi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_initreg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_symbol.Po@am__quote@ @@ -429,6 +599,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_cfi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_initreg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_symbol.Po@am__quote@ @@ -439,20 +610,28 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_resolve_sym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_attrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_cfi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_initreg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_cfi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_initreg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_unwind.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390x_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh_regs.Po@am__quote@ @@ -465,48 +644,43 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilegx_corenote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilegx_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilegx_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilegx_retval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilegx_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_cfi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_initreg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64_syscall.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -518,15 +692,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -535,6 +705,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -581,10 +766,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -668,17 +858,17 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am @@ -698,8 +888,8 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(LINK) -shared -o $(@:.map=.so) \ -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \ -Wl,--version-script,$(@:.so=.map) \ - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) - $(textrel_check) + -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) + @$(textrel_check) libebl_i386.so: $(cpu_i386) libebl_x86_64.so: $(cpu_x86_64) diff --git a/src/backends/aarch64_cfi.c b/src/backends/aarch64_cfi.c new file mode 100644 index 00000000..acbb9b69 --- /dev/null +++ b/src/backends/aarch64_cfi.c @@ -0,0 +1,82 @@ +/* arm ABI-specified defaults for DWARF CFI. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + + +/* ABI-specified state of DWARF CFI based on: + + "DWARF for the ARM 64 bit architecture (AArch64) 1.0" +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf + + "Procedure Call Standard for the ARM 64 bit Architecture 1.0" +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf +*/ + +int +aarch64_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* The initial Canonical Frame Address is the value of the + Stack Pointer (r31) as setup in the previous frame. */ + DW_CFA_def_cfa, ULEB128_7 (30), ULEB128_7 (0), + +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + /* Callee-saved regs r19-r28. */ + SV (19), SV (20), SV (21), SV (22), SV (23), + SV (24), SV (25), SV (26), SV (27), SV (28), + + /* The Frame Pointer (FP, r29) and Link Register (LR, r30). */ + SV (29), SV (30), + + /* Callee-saved fpregs v8-v15. v0 == 64. */ + SV (72), SV (73), SV (74), SV (75), + SV (76), SV (77), SV (78), SV (79), +#undef SV + + /* XXX Note: registers intentionally unused by the program, + for example as a consequence of the procedure call standard + should be initialized as if by DW_CFA_same_value. */ + }; + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = -4; + + abi_info->return_address_register = 30; /* lr. */ + + return 0; +} diff --git a/src/backends/aarch64_corenote.c b/src/backends/aarch64_corenote.c new file mode 100644 index 00000000..9b424859 --- /dev/null +++ b/src/backends/aarch64_corenote.c @@ -0,0 +1,163 @@ +/* AArch64 specific core note handling. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + +#define ULONG uint64_t +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_ULONG 8 +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_ULONG ELF_T_XWORD +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_WORD +#define TYPE_GID_T ELF_T_WORD + +#define PRSTATUS_REGS_SIZE (34 * 8) + +static const Ebl_Register_Location prstatus_regs[] = + { + { .offset = 0, .regno = 0, .count = 32, .bits = 64 }, /* x0..x30, sp */ + }; + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "pc", .type = ELF_T_XWORD, .format = 'x', \ + .offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \ + + PRSTATUS_REGS_SIZE - 16), \ + .group = "register", \ + .pc_register = true \ + }, \ + { \ + .name = "pstate", .type = ELF_T_XWORD, .format = 'x', \ + .offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \ + + PRSTATUS_REGS_SIZE - 8), \ + .group = "register" \ + } + +static const Ebl_Register_Location aarch64_fpregset_regs[] = + { + { .offset = 0, .regno = 64, .count = 32, .bits = 128 }, /* v0..v31 */ + }; + +static const Ebl_Core_Item aarch64_fpregset_items[] = + { + { + .name = "fpsr", .type = ELF_T_WORD, .format = 'x', + .offset = 512, .group = "register" + }, + { + .name = "fpcr", .type = ELF_T_WORD, .format = 'x', + .offset = 516, .group = "register" + } + }; + +static const Ebl_Core_Item aarch64_tls_items[] = + { + { + .name = "tls", .type = ELF_T_XWORD, .format = 'x', + .offset = 0, .group = "register" + } + }; + +#define AARCH64_HWBP_REG(KIND, N) \ + { \ + .name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \ + .offset = 8 + N * 16, .group = "register" \ + }, \ + { \ + .name = "DBG" KIND "CR" #N "_EL1", .type = ELF_T_WORD, .format = 'x', \ + .offset = 16 + N * 16, .group = "register" \ + } + +#define AARCH64_BP_WP_GROUP(KIND, NAME) \ + static const Ebl_Core_Item NAME[] = \ + { \ + { \ + .name = "dbg_info", .type = ELF_T_WORD, .format = 'x', \ + .offset = 0, .group = "control" \ + }, \ + /* N.B.: 4 bytes of padding here. */ \ + \ + AARCH64_HWBP_REG(KIND, 0), \ + AARCH64_HWBP_REG(KIND, 1), \ + AARCH64_HWBP_REG(KIND, 2), \ + AARCH64_HWBP_REG(KIND, 3), \ + AARCH64_HWBP_REG(KIND, 4), \ + AARCH64_HWBP_REG(KIND, 5), \ + AARCH64_HWBP_REG(KIND, 6), \ + AARCH64_HWBP_REG(KIND, 7), \ + AARCH64_HWBP_REG(KIND, 8), \ + AARCH64_HWBP_REG(KIND, 9), \ + AARCH64_HWBP_REG(KIND, 10), \ + AARCH64_HWBP_REG(KIND, 11), \ + AARCH64_HWBP_REG(KIND, 12), \ + AARCH64_HWBP_REG(KIND, 13), \ + AARCH64_HWBP_REG(KIND, 14), \ + AARCH64_HWBP_REG(KIND, 15), \ + \ + /* The DBGBVR+DBGBCR pair only takes 12 bytes. There are 4 bytes \ + of padding at the end of each pair. The item formatter in \ + readelf can skip those, but the missing 4 bytes at the end of \ + the whole block cause it to assume the whole item bunch \ + repeats, so it loops around to read more. Insert an explicit \ + (but invisible) padding word. */ \ + { \ + .name = "", .type = ELF_T_WORD, .format = 'h', \ + .offset = 260, .group = "register" \ + } \ + } + +AARCH64_BP_WP_GROUP ("B", aarch64_hw_bp_items); +AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items); + +#undef AARCH64_BP_WP_GROUP +#undef AARCH64_HWBP_REG + +#define EXTRA_NOTES \ + EXTRA_REGSET_ITEMS (NT_FPREGSET, 528, \ + aarch64_fpregset_regs, aarch64_fpregset_items) \ + EXTRA_ITEMS (NT_ARM_TLS, 8, aarch64_tls_items) \ + EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items) \ + EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items) + +#include "linux-core-note.c" diff --git a/src/backends/aarch64_init.c b/src/backends/aarch64_init.c new file mode 100644 index 00000000..b0fd17a7 --- /dev/null +++ b/src/backends/aarch64_init.c @@ -0,0 +1,69 @@ +/* Initialization of AArch64 specific backend library. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND aarch64_ +#define RELOC_PREFIX R_AARCH64_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on aarch64_reloc.def. */ +#include "common-reloc.c" + + +const char * +aarch64_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "AARCH64"; + aarch64_init_reloc (eh); + HOOK (eh, register_info); + HOOK (eh, core_note); + HOOK (eh, reloc_simple_type); + HOOK (eh, return_value_location); + HOOK (eh, check_special_symbol); + HOOK (eh, abi_cfi); + + /* X0-X30 (31 regs) + SP + 1 Reserved + ELR, 30 Reserved regs (34-43) + + V0-V31 (32 regs, least significant 64 bits only) + + ALT_FRAME_RETURN_COLUMN (used when LR isn't used) = 97 DWARF regs. */ + eh->frame_nregs = 97; + HOOK (eh, set_initial_registers_tid); + + return MODVERSION; +} diff --git a/src/backends/aarch64_initreg.c b/src/backends/aarch64_initreg.c new file mode 100644 index 00000000..9706205e --- /dev/null +++ b/src/backends/aarch64_initreg.c @@ -0,0 +1,92 @@ +/* Fetch live process registers from TID. + Copyright (C) 2013, 2014 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "system.h" +#include <assert.h> +#ifdef __aarch64__ +# include <linux/uio.h> +# include <sys/user.h> +# include <sys/ptrace.h> +/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ +# ifndef HAVE_SYS_USER_REGS +# define user_regs_struct user_pt_regs +# define user_fpsimd_struct user_fpsimd_state +# endif +#endif + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + +bool +aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#ifndef __aarch64__ + return false; +#else /* __aarch64__ */ + + /* General registers. */ + struct user_regs_struct gregs; + struct iovec iovec; + iovec.iov_base = &gregs; + iovec.iov_len = sizeof (gregs); + if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0) + return false; + + /* X0..X30 plus SP. */ + if (! setfunc (0, 32, (Dwarf_Word *) &gregs.regs[0], arg)) + return false; + + /* PC. */ + if (! setfunc (-1, 1, (Dwarf_Word *) &gregs.pc, arg)) + return false; + + /* ELR cannot be found. */ + + /* FP registers (only 64bits are used). */ + struct user_fpsimd_struct fregs; + iovec.iov_base = &fregs; + iovec.iov_len = sizeof (fregs); + if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0) + return false; + + Dwarf_Word dwarf_fregs[32]; + for (int r = 0; r < 32; r++) + dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF; + + if (! setfunc (64, 32, dwarf_fregs, arg)) + return false; + + return true; +#endif /* __aarch64__ */ +} diff --git a/src/backends/aarch64_regs.c b/src/backends/aarch64_regs.c new file mode 100644 index 00000000..7a8a6780 --- /dev/null +++ b/src/backends/aarch64_regs.c @@ -0,0 +1,102 @@ +/* Register names and numbers for AArch64 DWARF. + Copyright (C) 2013, 2014 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <dwarf.h> +#include <stdarg.h> + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + +ssize_t +aarch64_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setnamep, + int *bits, int *typep) +{ + if (name == NULL) + return 128; + + __attribute__ ((format (printf, 3, 4))) + ssize_t + regtype (const char *setname, int type, const char *fmt, ...) + { + *setnamep = setname; + *typep = type; + + va_list ap; + va_start (ap, fmt); + int s = vsnprintf (name, namelen, fmt, ap); + va_end(ap); + + if (s < 0 || (unsigned) s >= namelen) + return -1; + return s + 1; + } + + *prefix = ""; + *bits = 64; + + switch (regno) + { + case 0 ... 30: + return regtype ("integer", DW_ATE_signed, "x%d", regno); + + case 31: + return regtype ("integer", DW_ATE_address, "sp"); + + case 32: + return 0; + + case 33: + return regtype ("integer", DW_ATE_address, "elr"); + + case 34 ... 63: + return 0; + + case 64 ... 95: + /* FP/SIMD register file supports a variety of data types--it + can be thought of as a register holding a single integer or + floating-point value, or a vector of 8-, 16-, 32- or 64-bit + integers. 128-bit quad-word is the only singular value that + covers the whole register, so mark the register thus. */ + *bits = 128; + return regtype ("FP/SIMD", DW_ATE_unsigned, "v%d", regno - 64); + + case 96 ... 127: + return 0; + + default: + return -1; + } +} diff --git a/src/backends/aarch64_reloc.def b/src/backends/aarch64_reloc.def new file mode 100644 index 00000000..36d29e65 --- /dev/null +++ b/src/backends/aarch64_reloc.def @@ -0,0 +1,157 @@ +/* List the relocation types for AArch64. -*- C -*- + Copyright (C) 2013, 2014 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (ABS64, REL|EXEC|DYN) +RELOC_TYPE (ABS32, REL|EXEC|DYN) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JUMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN) +RELOC_TYPE (TLS_DTPREL64, EXEC|DYN) +RELOC_TYPE (TLS_TPREL64, EXEC|DYN) +RELOC_TYPE (TLSDESC, EXEC|DYN) + +/* R_AARCH64_NONE records that the section containing the place to be + relocated depends on the section defining the symbol mentioned in + the relocation directive[.] (ARM IHI 0056B). */ +RELOC_TYPE (NONE, REL) + +RELOC_TYPE (ABS16, REL) +RELOC_TYPE (PREL64, REL) +RELOC_TYPE (PREL32, REL) +RELOC_TYPE (PREL16, REL) +RELOC_TYPE (MOVW_UABS_G0, REL) +RELOC_TYPE (MOVW_UABS_G0_NC, REL) +RELOC_TYPE (MOVW_UABS_G1, REL) +RELOC_TYPE (MOVW_UABS_G1_NC, REL) +RELOC_TYPE (MOVW_UABS_G2, REL) +RELOC_TYPE (MOVW_UABS_G2_NC, REL) +RELOC_TYPE (MOVW_UABS_G3, REL) +RELOC_TYPE (MOVW_SABS_G0, REL) +RELOC_TYPE (MOVW_SABS_G1, REL) +RELOC_TYPE (MOVW_SABS_G2, REL) +RELOC_TYPE (LD_PREL_LO19, REL) +RELOC_TYPE (ADR_PREL_LO21, REL) +RELOC_TYPE (ADR_PREL_PG_HI21, REL) +RELOC_TYPE (ADR_PREL_PG_HI21_NC, REL) +RELOC_TYPE (ADD_ABS_LO12_NC, REL) +RELOC_TYPE (LDST8_ABS_LO12_NC, REL) +RELOC_TYPE (LDST16_ABS_LO12_NC, REL) +RELOC_TYPE (LDST32_ABS_LO12_NC, REL) +RELOC_TYPE (LDST64_ABS_LO12_NC, REL) +RELOC_TYPE (LDST128_ABS_LO12_NC, REL) +RELOC_TYPE (TSTBR14, REL) +RELOC_TYPE (CONDBR19, REL) +RELOC_TYPE (JUMP26, REL) +RELOC_TYPE (CALL26, REL) +RELOC_TYPE (MOVW_PREL_G0, REL) +RELOC_TYPE (MOVW_PREL_G0_NC, REL) +RELOC_TYPE (MOVW_PREL_G1, REL) +RELOC_TYPE (MOVW_PREL_G1_NC, REL) +RELOC_TYPE (MOVW_PREL_G2, REL) +RELOC_TYPE (MOVW_PREL_G2_NC, REL) +RELOC_TYPE (MOVW_PREL_G3, REL) +RELOC_TYPE (MOVW_GOTOFF_G0, REL) +RELOC_TYPE (MOVW_GOTOFF_G0_NC, REL) +RELOC_TYPE (MOVW_GOTOFF_G1, REL) +RELOC_TYPE (MOVW_GOTOFF_G1_NC, REL) +RELOC_TYPE (MOVW_GOTOFF_G2, REL) +RELOC_TYPE (MOVW_GOTOFF_G2_NC, REL) +RELOC_TYPE (MOVW_GOTOFF_G3, REL) +RELOC_TYPE (GOTREL64, REL) +RELOC_TYPE (GOTREL32, REL) +RELOC_TYPE (GOT_LD_PREL19, REL) +RELOC_TYPE (LD64_GOTOFF_LO15, REL) +RELOC_TYPE (ADR_GOT_PAGE, REL) +RELOC_TYPE (LD64_GOT_LO12_NC, REL) +RELOC_TYPE (LD64_GOTPAGE_LO15, REL) +RELOC_TYPE (TLSGD_ADR_PREL21, REL) +RELOC_TYPE (TLSGD_ADR_PAGE21, REL) +RELOC_TYPE (TLSGD_ADD_LO12_NC, REL) +RELOC_TYPE (TLSGD_MOVW_G1, REL) +RELOC_TYPE (TLSGD_MOVW_G0_NC, REL) +RELOC_TYPE (TLSLD_ADR_PREL21, REL) +RELOC_TYPE (TLSLD_ADR_PAGE21, REL) +RELOC_TYPE (TLSLD_ADD_LO12_NC, REL) +RELOC_TYPE (TLSLD_MOVW_G1, REL) +RELOC_TYPE (TLSLD_MOVW_G0_NC, REL) +RELOC_TYPE (TLSLD_LD_PREL19, REL) +RELOC_TYPE (TLSLD_MOVW_DTPREL_G2, REL) +RELOC_TYPE (TLSLD_MOVW_DTPREL_G1, REL) +RELOC_TYPE (TLSLD_MOVW_DTPREL_G1_NC, REL) +RELOC_TYPE (TLSLD_MOVW_DTPREL_G0, REL) +RELOC_TYPE (TLSLD_MOVW_DTPREL_G0_NC, REL) +RELOC_TYPE (TLSLD_ADD_DTPREL_HI12, REL) +RELOC_TYPE (TLSLD_ADD_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_ADD_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSLD_LDST8_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_LDST8_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSLD_LDST16_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_LDST16_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSLD_LDST32_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_LDST32_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSLD_LDST64_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_LDST64_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSLD_LDST128_DTPREL_LO12, REL) +RELOC_TYPE (TLSLD_LDST128_DTPREL_LO12_NC, REL) +RELOC_TYPE (TLSIE_MOVW_GOTTPREL_G1, REL) +RELOC_TYPE (TLSIE_MOVW_GOTTPREL_G0_NC, REL) +RELOC_TYPE (TLSIE_ADR_GOTTPREL_PAGE21, REL) +RELOC_TYPE (TLSIE_LD64_GOTTPREL_LO12_NC, REL) +RELOC_TYPE (TLSIE_LD_GOTTPREL_PREL19, REL) +RELOC_TYPE (TLSLE_MOVW_TPREL_G2, REL) +RELOC_TYPE (TLSLE_MOVW_TPREL_G1, REL) +RELOC_TYPE (TLSLE_MOVW_TPREL_G1_NC, REL) +RELOC_TYPE (TLSLE_MOVW_TPREL_G0, REL) +RELOC_TYPE (TLSLE_MOVW_TPREL_G0_NC, REL) +RELOC_TYPE (TLSLE_ADD_TPREL_HI12, REL) +RELOC_TYPE (TLSLE_ADD_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_ADD_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSLE_LDST8_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_LDST8_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSLE_LDST16_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_LDST16_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSLE_LDST32_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_LDST32_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSLE_LDST64_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_LDST64_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSLE_LDST128_TPREL_LO12, REL) +RELOC_TYPE (TLSLE_LDST128_TPREL_LO12_NC, REL) +RELOC_TYPE (TLSDESC_LD_PREL19, REL) +RELOC_TYPE (TLSDESC_ADR_PREL21, REL) +RELOC_TYPE (TLSDESC_ADR_PAGE21, REL) +RELOC_TYPE (TLSDESC_LD64_LO12, REL) +RELOC_TYPE (TLSDESC_ADD_LO12, REL) +RELOC_TYPE (TLSDESC_OFF_G1, REL) +RELOC_TYPE (TLSDESC_OFF_G0_NC, REL) +RELOC_TYPE (TLSDESC_LDR, REL) +RELOC_TYPE (TLSDESC_ADD, REL) +RELOC_TYPE (TLSDESC_CALL, REL) diff --git a/src/backends/aarch64_retval.c b/src/backends/aarch64_retval.c new file mode 100644 index 00000000..68de307e --- /dev/null +++ b/src/backends/aarch64_retval.c @@ -0,0 +1,376 @@ +/* Function return value location for Linux/AArch64 ABI. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <inttypes.h> + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + +static int +skip_until (Dwarf_Die *child, int tag) +{ + int i; + while (DWARF_TAG_OR_RETURN (child) != tag) + if ((i = dwarf_siblingof (child, child)) != 0) + /* If there are no members, then this is not a HFA. Errors + are propagated. */ + return i; + return 0; +} + +static int +dwarf_bytesize_aux (Dwarf_Die *die, Dwarf_Word *sizep) +{ + int bits; + if (((bits = 8 * dwarf_bytesize (die)) < 0 + && (bits = dwarf_bitsize (die)) < 0) + || bits % 8 != 0) + return -1; + + *sizep = bits / 8; + return 0; +} + +/* HFA (Homogeneous Floating-point Aggregate) is an aggregate type + whose members are all of the same floating-point type, which is + then base type of this HFA. Instead of being floating-point types + directly, members can instead themselves be HFA. Such HFA fields + are handled as if their type were HFA base type. + + This function returns 0 if TYPEDIE is HFA, 1 if it is not, or -1 if + there were errors. In the former case, *SIZEP contains byte size + of the base type (e.g. 8 for IEEE double). *COUNT is set to the + number of leaf members of the HFA. */ +static int hfa_type (Dwarf_Die *ftypedie, int tag, + Dwarf_Word *sizep, Dwarf_Word *countp); + +/* Return 0 if MEMBDIE refers to a member with a floating-point or HFA + type, or 1 if it's not. Return -1 for errors. The meaning of the + remaining arguments is as documented at hfa_type. */ +static int +member_is_fp (Dwarf_Die *membdie, Dwarf_Word *sizep, Dwarf_Word *countp) +{ + Dwarf_Die typedie; + int tag = dwarf_peeled_die_type (membdie, &typedie); + switch (tag) + { + case DW_TAG_base_type:; + Dwarf_Word encoding; + Dwarf_Attribute attr_mem; + if (dwarf_attr_integrate (&typedie, DW_AT_encoding, &attr_mem) == NULL + || dwarf_formudata (&attr_mem, &encoding) != 0) + return -1; + + switch (encoding) + { + case DW_ATE_complex_float: + *countp = 2; + break; + + case DW_ATE_float: + *countp = 1; + break; + + default: + return 1; + } + + if (dwarf_bytesize_aux (&typedie, sizep) < 0) + return -1; + + *sizep /= *countp; + return 0; + + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_array_type: + return hfa_type (&typedie, tag, sizep, countp); + } + + return 1; +} + +static int +hfa_type (Dwarf_Die *ftypedie, int tag, Dwarf_Word *sizep, Dwarf_Word *countp) +{ + assert (tag == DW_TAG_structure_type || tag == DW_TAG_class_type + || tag == DW_TAG_union_type || tag == DW_TAG_array_type); + + int i; + if (tag == DW_TAG_array_type) + { + Dwarf_Word tot_size; + if (dwarf_aggregate_size (ftypedie, &tot_size) < 0) + return -1; + + /* For vector types, we don't care about the underlying + type, but only about the vector type itself. */ + bool vec; + Dwarf_Attribute attr_mem; + if (dwarf_formflag (dwarf_attr_integrate (ftypedie, DW_AT_GNU_vector, + &attr_mem), &vec) == 0 + && vec) + { + *sizep = tot_size; + *countp = 1; + + return 0; + } + + if ((i = member_is_fp (ftypedie, sizep, countp)) == 0) + { + *countp = tot_size / *sizep; + return 0; + } + + return i; + } + + /* Find first DW_TAG_member and determine its type. */ + Dwarf_Die member; + if ((i = dwarf_child (ftypedie, &member) != 0)) + return i; + + if ((i = skip_until (&member, DW_TAG_member)) != 0) + return i; + + *countp = 0; + if ((i = member_is_fp (&member, sizep, countp)) != 0) + return i; + + while ((i = dwarf_siblingof (&member, &member)) == 0 + && (i = skip_until (&member, DW_TAG_member)) == 0) + { + Dwarf_Word size, count; + if ((i = member_is_fp (&member, &size, &count)) != 0) + return i; + + if (*sizep != size) + return 1; + + *countp += count; + } + + /* At this point we already have at least one FP member, which means + FTYPEDIE is an HFA. So either return 0, or propagate error. */ + return i < 0 ? i : 0; +} + +static int +pass_in_gpr (const Dwarf_Op **locp, Dwarf_Word size) +{ + static const Dwarf_Op loc[] = + { + { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 8 }, + { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 8 } + }; + + *locp = loc; + return size <= 8 ? 1 : 4; +} + +static int +pass_by_ref (const Dwarf_Op **locp) +{ + static const Dwarf_Op loc[] = { { .atom = DW_OP_breg0 } }; + + *locp = loc; + return 1; +} + +static int +pass_hfa (const Dwarf_Op **locp, Dwarf_Word size, Dwarf_Word count) +{ + assert (count >= 1 && count <= 4); + assert (size == 2 || size == 4 || size == 8 || size == 16); + +#define DEFINE_FPREG(NAME, SIZE) \ + static const Dwarf_Op NAME[] = { \ + { .atom = DW_OP_regx, .number = 64 }, \ + { .atom = DW_OP_piece, .number = SIZE }, \ + { .atom = DW_OP_regx, .number = 65 }, \ + { .atom = DW_OP_piece, .number = SIZE }, \ + { .atom = DW_OP_regx, .number = 66 }, \ + { .atom = DW_OP_piece, .number = SIZE }, \ + { .atom = DW_OP_regx, .number = 67 }, \ + { .atom = DW_OP_piece, .number = SIZE } \ + } + + switch (size) + { + case 2:; + DEFINE_FPREG (loc_hfa_2, 2); + *locp = loc_hfa_2; + break; + + case 4:; + DEFINE_FPREG (loc_hfa_4, 4); + *locp = loc_hfa_4; + break; + + case 8:; + DEFINE_FPREG (loc_hfa_8, 8); + *locp = loc_hfa_8; + break; + + case 16:; + DEFINE_FPREG (loc_hfa_16, 16); + *locp = loc_hfa_16; + break; + } +#undef DEFINE_FPREG + + return count == 1 ? 1 : 2 * count; +} + +static int +pass_in_simd (const Dwarf_Op **locp) +{ + /* This is like passing single-element HFA. Size doesn't matter, so + pretend it's for example double. */ + return pass_hfa (locp, 8, 1); +} + +int +aarch64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + Dwarf_Die typedie; + int tag = dwarf_peeled_die_type (functypedie, &typedie); + if (tag <= 0) + return tag; + + Dwarf_Word size = (Dwarf_Word)-1; + + /* If the argument type is a Composite Type that is larger than 16 + bytes, then the argument is copied to memory allocated by the + caller and the argument is replaced by a pointer to the copy. */ + if (tag == DW_TAG_structure_type || tag == DW_TAG_union_type + || tag == DW_TAG_class_type || tag == DW_TAG_array_type) + { + Dwarf_Word base_size, count; + switch (hfa_type (&typedie, tag, &base_size, &count)) + { + default: + return -1; + + case 0: + assert (count > 0); + if (count <= 4) + return pass_hfa (locp, base_size, count); + /* Fall through. */ + + case 1: + /* Not a HFA. */ + if (dwarf_aggregate_size (&typedie, &size) < 0) + return -1; + if (size > 16) + return pass_by_ref (locp); + } + } + + if (tag == DW_TAG_base_type + || tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + { + if (dwarf_bytesize_aux (&typedie, &size) < 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + + Dwarf_Attribute attr_mem; + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (&typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + + switch (encoding) + { + /* If the argument is a Half-, Single-, Double- or Quad- + precision Floating-point [...] the argument is allocated + to the least significant bits of register v[NSRN]. */ + case DW_ATE_float: + switch (size) + { + case 2: /* half */ + case 4: /* sigle */ + case 8: /* double */ + case 16: /* quad */ + return pass_in_simd (locp); + + default: + return -2; + } + + case DW_ATE_complex_float: + switch (size) + { + case 8: /* float _Complex */ + case 16: /* double _Complex */ + case 32: /* long double _Complex */ + return pass_hfa (locp, size / 2, 2); + + default: + return -2; + } + + /* If the argument is an Integral or Pointer Type, the + size of the argument is less than or equal to 8 bytes + [...] the argument is copied to the least significant + bits in x[NGRN]. */ + case DW_ATE_boolean: + case DW_ATE_signed: + case DW_ATE_unsigned: + case DW_ATE_unsigned_char: + case DW_ATE_signed_char: + return pass_in_gpr (locp, size); + } + + return -2; + } + else + return pass_in_gpr (locp, size); + } + + *locp = NULL; + return 0; +} diff --git a/src/backends/aarch64_symbol.c b/src/backends/aarch64_symbol.c new file mode 100644 index 00000000..3fdc9cf8 --- /dev/null +++ b/src/backends/aarch64_symbol.c @@ -0,0 +1,87 @@ +/* AArch64 specific symbolic name handling. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> +#include <string.h> + +#define BACKEND aarch64_ +#include "libebl_CPU.h" + + +/* Check for the simple reloc types. */ +Elf_Type +aarch64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_AARCH64_ABS64: + return ELF_T_XWORD; + case R_AARCH64_ABS32: + return ELF_T_WORD; + case R_AARCH64_ABS16: + return ELF_T_HALF; + + default: + return ELF_T_NUM; + } +} + +/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point to + .got[0] even if there is a .got.plt section. */ +bool +aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, + const char *name, const GElf_Shdr *destshdr) +{ + if (name != NULL + && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) + { + const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); + if (sname != NULL && strcmp (sname, ".got.plt") == 0) + { + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL) + { + sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name); + if (sname != NULL && strcmp (sname, ".got") == 0) + return sym->st_value == shdr->sh_addr; + } + } + } + } + + return false; +} diff --git a/src/backends/alpha_auxv.c b/src/backends/alpha_auxv.c index 38a8bcdf..83e71997 100644 --- a/src/backends/alpha_auxv.c +++ b/src/backends/alpha_auxv.c @@ -1,27 +1,30 @@ /* Alpha-specific auxv handling. Copyright (C) 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/alpha_corenote.c b/src/backends/alpha_corenote.c index dcc62e9e..6190df37 100644 --- a/src/backends/alpha_corenote.c +++ b/src/backends/alpha_corenote.c @@ -1,27 +1,30 @@ /* PowerPC specific core note handling. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/alpha_init.c b/src/backends/alpha_init.c index 30fe5c6c..a3307d83 100644 --- a/src/backends/alpha_init.c +++ b/src/backends/alpha_init.c @@ -1,28 +1,31 @@ /* Initialization of Alpha specific backend library. Copyright (C) 2002-2011 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/alpha_regs.c b/src/backends/alpha_regs.c index 3bb9a6cd..436af3b1 100644 --- a/src/backends/alpha_regs.c +++ b/src/backends/alpha_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for Alpha DWARF. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/alpha_reloc.def b/src/backends/alpha_reloc.def index 347a483f..ed7e5c32 100644 --- a/src/backends/alpha_reloc.def +++ b/src/backends/alpha_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for alpha. -*- C -*- Copyright (C) 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/alpha_retval.c b/src/backends/alpha_retval.c index 57ba867b..53dbfa45 100644 --- a/src/backends/alpha_retval.c +++ b/src/backends/alpha_retval.c @@ -1,27 +1,30 @@ /* Function return value location for Alpha ELF ABI. - Copyright (C) 2005, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005, 2007, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -64,27 +67,10 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; switch (tag) { @@ -94,9 +80,10 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -105,6 +92,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: { + Dwarf_Attribute attr_mem; Dwarf_Word size; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem), &size) != 0) diff --git a/src/backends/alpha_symbol.c b/src/backends/alpha_symbol.c index 5d25d3e4..657d9eec 100644 --- a/src/backends/alpha_symbol.c +++ b/src/backends/alpha_symbol.c @@ -1,28 +1,31 @@ /* Alpha specific symbolic name handling. Copyright (C) 2002-2011 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/arm_attrs.c b/src/backends/arm_attrs.c index 84f4d451..c858715d 100644 --- a/src/backends/arm_attrs.c +++ b/src/backends/arm_attrs.c @@ -1,27 +1,30 @@ /* Object attribute tags for ARM. Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/arm_auxv.c b/src/backends/arm_auxv.c index 728f940d..3282bafc 100644 --- a/src/backends/arm_auxv.c +++ b/src/backends/arm_auxv.c @@ -1,27 +1,30 @@ /* ARM-specific auxv handling. Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/arm_cfi.c b/src/backends/arm_cfi.c new file mode 100644 index 00000000..971a1fc4 --- /dev/null +++ b/src/backends/arm_cfi.c @@ -0,0 +1,90 @@ +/* arm ABI-specified defaults for DWARF CFI. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> + +#define BACKEND arm_ +#include "libebl_CPU.h" + + +/* ABI-specified state of DWARF CFI based on: + + "DWARF for the ARM Architecture ABI r2.09" +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf + + "Procedure Call Standard for the ARM Architecture ABI r2.09" +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf +*/ + +int +arm_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* The initial Canonical Frame Address is the value of the + Stack Pointer (r13) as setup in the previous frame. */ + DW_CFA_def_cfa, ULEB128_7 (13), ULEB128_7 (0), + + /* The Stack Pointer (r13) is restored from CFA address by default. */ + DW_CFA_val_offset, ULEB128_7 (13), ULEB128_7 (0), + +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + /* Callee-saved regs r4-r8, r10, r11. */ + SV (4), SV (5), SV (6), SV (7), SV (8), SV (10), SV (11), + + /* The link register contains the return address setup by caller. */ + SV (14), + DW_CFA_register, ULEB128_7 (15), ULEB128_7 (14), /* pc = lr */ +#undef SV + + /* VFP S16-S31/D8-D15/Q4-Q7 are callee saved. + And uleb128 encoded with two bytes. */ +#define ULEB128_8_2(x) ((x & 0x7f) | 0x80), 0x02 +#define SV(n) DW_CFA_same_value, ULEB128_8_2 (n) + SV (264), SV (265), SV (266), SV (267), + SV (268), SV (269), SV (270), SV (271), + + /* XXX Note: registers intentionally unused by the program, + for example as a consequence of the procedure call standard + should be initialized as if by DW_CFA_same_value. */ + }; +#undef ULEB128_8_2 +#undef SV + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = 4; + + abi_info->return_address_register = 15; /* pc. */ + + return 0; +} diff --git a/src/backends/arm_corenote.c b/src/backends/arm_corenote.c index 6f2d3a3e..c5d8d887 100644 --- a/src/backends/arm_corenote.c +++ b/src/backends/arm_corenote.c @@ -1,27 +1,30 @@ /* ARM specific core note handling. - Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2009, 2012 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -55,7 +58,7 @@ static const Ebl_Register_Location fpregset_regs[] = { { .offset = 0, .regno = 96, .count = 8, .bits = 96 }, /* f0..f7 */ }; -#define FPREGSET_SIZE 140 +#define FPREGSET_SIZE 116 #define ULONG uint32_t #define PID_T int32_t @@ -70,4 +73,22 @@ static const Ebl_Register_Location fpregset_regs[] = #define TYPE_UID_T ELF_T_HALF #define TYPE_GID_T ELF_T_HALF +#define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ ) +static const Ebl_Register_Location vfp_regs[] = + { + { .offset = 0, .regno = 256, .count = 32, .bits = 64 }, /* fpregs */ + }; + +static const Ebl_Core_Item vfp_items[] = + { + { + .name = "fpscr", .group = "register", + .offset = 0, + .type = ELF_T_WORD, .format = 'x', + }, + }; + +#define EXTRA_NOTES \ + EXTRA_REGSET_ITEMS (NT_ARM_VFP, ARM_VFPREGS_SIZE, vfp_regs, vfp_items) + #include "linux-core-note.c" diff --git a/src/backends/arm_init.c b/src/backends/arm_init.c index 15c0ee67..3283c978 100644 --- a/src/backends/arm_init.c +++ b/src/backends/arm_init.c @@ -1,28 +1,31 @@ /* Initialization of Arm specific backend library. - Copyright (C) 2002, 2005, 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2002, 2005, 2009, 2013, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -59,6 +62,15 @@ arm_init (elf, machine, eh, ehlen) HOOK (eh, auxv_info); HOOK (eh, check_object_attribute); HOOK (eh, return_value_location); + HOOK (eh, abi_cfi); + HOOK (eh, check_reloc_target_type); + + /* We only unwind the core integer registers. */ + eh->frame_nregs = 16; + HOOK (eh, set_initial_registers_tid); + + /* Bit zero encodes whether an function address is THUMB or ARM. */ + eh->func_addr_mask = ~(GElf_Addr)1; return MODVERSION; } diff --git a/src/backends/arm_initreg.c b/src/backends/arm_initreg.c new file mode 100644 index 00000000..a0a9be94 --- /dev/null +++ b/src/backends/arm_initreg.c @@ -0,0 +1,92 @@ +/* Fetch live process registers from TID. + Copyright (C) 2014 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if defined __arm__ +# include <sys/types.h> +# include <sys/user.h> +# include <sys/ptrace.h> +#endif + +#ifdef __aarch64__ +# include <linux/uio.h> +# include <sys/user.h> +# include <sys/ptrace.h> +/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ +# ifndef HAVE_SYS_USER_REGS +# define user_regs_struct user_pt_regs +# endif +#endif + +#define BACKEND arm_ +#include "libebl_CPU.h" + +bool +arm_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#if !defined __arm__ && !defined __aarch64__ + return false; +#else /* __arm__ || __aarch64__ */ +#if defined __arm__ + struct user_regs user_regs; + if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0) + return false; + + Dwarf_Word dwarf_regs[16]; + /* R0..R12 SP LR PC */ + for (int i = 0; i < 16; i++) + dwarf_regs[i] = user_regs.uregs[i]; + + return setfunc (0, 16, dwarf_regs, arg); +#elif defined __aarch64__ + /* Compat mode: arm compatible code running on aarch64 */ + int i; + struct user_regs_struct gregs; + struct iovec iovec; + iovec.iov_base = &gregs; + iovec.iov_len = sizeof (gregs); + if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0) + return false; + + Dwarf_Word dwarf_regs[16]; + /* R0..R12 SP LR PC, encoded as 32 bit quantities */ + uint32_t *u32_ptr = (uint32_t *) &gregs.regs[0]; + for (i = 0; i < 16; i++) + dwarf_regs[i] = u32_ptr[i]; + + return setfunc (0, 16, dwarf_regs, arg); +#else +# error "source file error, it cannot happen" +#endif +#endif +} diff --git a/src/backends/arm_regs.c b/src/backends/arm_regs.c index 0a9536d4..21c5ad3a 100644 --- a/src/backends/arm_regs.c +++ b/src/backends/arm_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for ARM DWARF. Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -45,7 +48,7 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)), if (regno < 0 || regno > 320 || namelen < 5) return -1; - *prefix = NULL; + *prefix = ""; *bits = 32; *type = DW_ATE_signed; *setname = "integer"; diff --git a/src/backends/arm_reloc.def b/src/backends/arm_reloc.def index 4dc54b7e..4b7894bb 100644 --- a/src/backends/arm_reloc.def +++ b/src/backends/arm_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for arm. -*- C -*- - Copyright (C) 2005-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ @@ -38,7 +41,7 @@ RELOC_TYPE (SBREL32, REL) RELOC_TYPE (THM_PC22, REL) RELOC_TYPE (THM_PC8, REL) RELOC_TYPE (AMP_VCALL9, REL) -RELOC_TYPE (SWI24, REL) +RELOC_TYPE (TLS_DESC, EXEC|DYN) RELOC_TYPE (THM_SWI8, REL) RELOC_TYPE (XPC25, REL) RELOC_TYPE (THM_XPC22, REL) @@ -53,12 +56,78 @@ RELOC_TYPE (GOTOFF, REL) RELOC_TYPE (GOTPC, REL) RELOC_TYPE (GOT32, REL) RELOC_TYPE (PLT32, REL) +RELOC_TYPE (CALL, REL) +RELOC_TYPE (JUMP24, REL) +RELOC_TYPE (THM_JUMP24, REL) +RELOC_TYPE (BASE_ABS, REL) RELOC_TYPE (ALU_PCREL_7_0, REL) RELOC_TYPE (ALU_PCREL_15_8, REL) RELOC_TYPE (ALU_PCREL_23_15, REL) RELOC_TYPE (LDR_SBREL_11_0, REL) RELOC_TYPE (ALU_SBREL_19_12, REL) RELOC_TYPE (ALU_SBREL_27_20, REL) +RELOC_TYPE (TARGET1, REL) +RELOC_TYPE (SBREL31, REL) +RELOC_TYPE (V4BX, REL) +RELOC_TYPE (TARGET2, REL) +RELOC_TYPE (PREL31, REL) +RELOC_TYPE (MOVW_ABS_NC, REL) +RELOC_TYPE (MOVT_ABS, REL) +RELOC_TYPE (MOVW_PREL_NC, REL) +RELOC_TYPE (MOVT_PREL, REL) +RELOC_TYPE (THM_MOVW_ABS_NC, REL) +RELOC_TYPE (THM_MOVT_ABS, REL) +RELOC_TYPE (THM_MOVW_PREL_NC, REL) +RELOC_TYPE (THM_MOVT_PREL, REL) +RELOC_TYPE (THM_JUMP19, REL) +RELOC_TYPE (THM_JUMP6, REL) +RELOC_TYPE (THM_ALU_PREL_11_0, REL) +RELOC_TYPE (THM_PC12, REL) +RELOC_TYPE (ABS32_NOI, REL) +RELOC_TYPE (REL32_NOI, REL) +RELOC_TYPE (ALU_PC_G0_NC, REL) +RELOC_TYPE (ALU_PC_G0, REL) +RELOC_TYPE (ALU_PC_G1_NC, REL) +RELOC_TYPE (ALU_PC_G1, REL) +RELOC_TYPE (ALU_PC_G2, REL) +RELOC_TYPE (LDR_PC_G1, REL) +RELOC_TYPE (LDR_PC_G2, REL) +RELOC_TYPE (LDRS_PC_G0, REL) +RELOC_TYPE (LDRS_PC_G1, REL) +RELOC_TYPE (LDRS_PC_G2, REL) +RELOC_TYPE (LDC_PC_G0, REL) +RELOC_TYPE (LDC_PC_G1, REL) +RELOC_TYPE (LDC_PC_G2, REL) +RELOC_TYPE (ALU_SB_G0_NC, REL) +RELOC_TYPE (ALU_SB_G0, REL) +RELOC_TYPE (ALU_SB_G1_NC, REL) +RELOC_TYPE (ALU_SB_G1, REL) +RELOC_TYPE (ALU_SB_G2, REL) +RELOC_TYPE (LDR_SB_G0, REL) +RELOC_TYPE (LDR_SB_G1, REL) +RELOC_TYPE (LDR_SB_G2, REL) +RELOC_TYPE (LDRS_SB_G0, REL) +RELOC_TYPE (LDRS_SB_G1, REL) +RELOC_TYPE (LDRS_SB_G2, REL) +RELOC_TYPE (LDC_SB_G0, REL) +RELOC_TYPE (LDC_SB_G1, REL) +RELOC_TYPE (LDC_SB_G2, REL) +RELOC_TYPE (MOVW_BREL_NC, REL) +RELOC_TYPE (MOVT_BREL, REL) +RELOC_TYPE (MOVW_BREL, REL) +RELOC_TYPE (THM_MOVW_BREL_NC, REL) +RELOC_TYPE (THM_MOVT_BREL, REL) +RELOC_TYPE (THM_MOVW_BREL, REL) +RELOC_TYPE (TLS_GOTDESC, REL) +RELOC_TYPE (TLS_CALL, REL) +RELOC_TYPE (TLS_DESCSEQ, REL) +RELOC_TYPE (THM_TLS_CALL, REL) +RELOC_TYPE (PLT32_ABS, REL) +RELOC_TYPE (GOT_ABS, REL) +RELOC_TYPE (GOT_PREL, REL) +RELOC_TYPE (GOT_BREL12, REL) +RELOC_TYPE (GOTOFF12, REL) +RELOC_TYPE (GOTRELAX, REL) RELOC_TYPE (GNU_VTENTRY, REL) RELOC_TYPE (GNU_VTINHERIT, REL) RELOC_TYPE (THM_PC11, REL) @@ -68,6 +137,17 @@ RELOC_TYPE (TLS_LDM32, REL) RELOC_TYPE (TLS_LDO32, REL) RELOC_TYPE (TLS_IE32, REL) RELOC_TYPE (TLS_LE32, REL) +RELOC_TYPE (TLS_LDO12, REL) +RELOC_TYPE (TLS_LE12, REL) +RELOC_TYPE (TLS_IE12GP, REL) + +RELOC_TYPE (ME_TOO, REL) +RELOC_TYPE (THM_TLS_DESCSEQ16, REL) +RELOC_TYPE (THM_TLS_DESCSEQ32, REL) +RELOC_TYPE (THM_GOT_BREL12, REL) + +RELOC_TYPE (IRELATIVE, EXEC|DYN) + RELOC_TYPE (RXPC25, REL) RELOC_TYPE (RSBREL32, REL) RELOC_TYPE (THM_RPC22, REL) diff --git a/src/backends/arm_retval.c b/src/backends/arm_retval.c index 191cb174..7aced742 100644 --- a/src/backends/arm_retval.c +++ b/src/backends/arm_retval.c @@ -1,27 +1,30 @@ /* Function return value location for ARM EABI. - Copyright (C) 2009-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2009-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -60,27 +63,10 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -91,9 +77,10 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -101,24 +88,27 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 4; - else - return -1; - } - if (size <= 16) - { - intreg: - *locp = loc_intreg; - return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4); - } - - aggregate: - *locp = loc_aggregate; - return nloc_aggregate; + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + if (size <= 16) + { + intreg: + *locp = loc_intreg; + return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4); + } + + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + } case DW_TAG_structure_type: case DW_TAG_class_type: diff --git a/src/backends/arm_symbol.c b/src/backends/arm_symbol.c index e08874bb..cd467ffc 100644 --- a/src/backends/arm_symbol.c +++ b/src/backends/arm_symbol.c @@ -1,27 +1,30 @@ /* Arm specific symbolic name handling. - Copyright (C) 2002-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2002-2009, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -119,3 +122,10 @@ arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) return ELF_T_NUM; } } + +/* The SHT_ARM_EXIDX section type is a valid target for relocation. */ +bool +arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type) +{ + return sh_type == SHT_ARM_EXIDX; +} diff --git a/src/backends/common-reloc.c b/src/backends/common-reloc.c index 191b22a2..2667ec4a 100644 --- a/src/backends/common-reloc.c +++ b/src/backends/common-reloc.c @@ -1,27 +1,30 @@ /* Common code for ebl reloc functions. Copyright (C) 2005, 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #include "libebl_CPU.h" #include <assert.h> diff --git a/src/backends/i386_auxv.c b/src/backends/i386_auxv.c index 5f7b15ef..dba63fe0 100644 --- a/src/backends/i386_auxv.c +++ b/src/backends/i386_auxv.c @@ -1,27 +1,30 @@ /* i386 specific auxv handling. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/i386_cfi.c b/src/backends/i386_cfi.c index 77478f7e..31f85f7e 100644 --- a/src/backends/i386_cfi.c +++ b/src/backends/i386_cfi.c @@ -1,27 +1,30 @@ /* i386 ABI-specified defaults for DWARF CFI. Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/i386_corenote.c b/src/backends/i386_corenote.c index 40b6a24e..15cd66b5 100644 --- a/src/backends/i386_corenote.c +++ b/src/backends/i386_corenote.c @@ -1,27 +1,30 @@ /* i386 specific core note handling. Copyright (C) 2007-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/i386_init.c b/src/backends/i386_init.c index be9bbf90..1e0b4863 100644 --- a/src/backends/i386_init.c +++ b/src/backends/i386_init.c @@ -1,28 +1,31 @@ /* Initialization of i386 specific backend library. - Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2000-2009, 2013 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -60,6 +63,9 @@ i386_init (elf, machine, eh, ehlen) HOOK (eh, auxv_info); HOOK (eh, disasm); HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS. For i386 it is 17, why? */ + eh->frame_nregs = 9; + HOOK (eh, set_initial_registers_tid); return MODVERSION; } diff --git a/src/backends/i386_initreg.c b/src/backends/i386_initreg.c new file mode 100644 index 00000000..51fd9ea6 --- /dev/null +++ b/src/backends/i386_initreg.c @@ -0,0 +1,79 @@ +/* Fetch live process registers from TID. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if defined __i386__ || defined __x86_64__ +# include <sys/types.h> +# include <sys/user.h> +# include <sys/ptrace.h> +#endif + +#define BACKEND i386_ +#include "libebl_CPU.h" + +bool +i386_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__) + return false; +#else /* __i386__ || __x86_64__ */ + struct user_regs_struct user_regs; + if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0) + return false; + Dwarf_Word dwarf_regs[9]; +# if defined __i386__ + dwarf_regs[0] = user_regs.eax; + dwarf_regs[1] = user_regs.ecx; + dwarf_regs[2] = user_regs.edx; + dwarf_regs[3] = user_regs.ebx; + dwarf_regs[4] = user_regs.esp; + dwarf_regs[5] = user_regs.ebp; + dwarf_regs[6] = user_regs.esi; + dwarf_regs[7] = user_regs.edi; + dwarf_regs[8] = user_regs.eip; +# elif defined __x86_64__ + dwarf_regs[0] = user_regs.rax; + dwarf_regs[1] = user_regs.rcx; + dwarf_regs[2] = user_regs.rdx; + dwarf_regs[3] = user_regs.rbx; + dwarf_regs[4] = user_regs.rsp; + dwarf_regs[5] = user_regs.rbp; + dwarf_regs[6] = user_regs.rsi; + dwarf_regs[7] = user_regs.rdi; + dwarf_regs[8] = user_regs.rip; +# else /* (__i386__ || __x86_64__) && (!__i386__ && !__x86_64__) */ +# error "source file error, it cannot happen" +# endif /* (__i386__ || __x86_64__) && (!__i386__ && !__x86_64__) */ + return setfunc (0, 9, dwarf_regs, arg); +#endif /* __i386__ || __x86_64__ */ +} diff --git a/src/backends/i386_regs.c b/src/backends/i386_regs.c index 5cf0d810..fb8ded33 100644 --- a/src/backends/i386_regs.c +++ b/src/backends/i386_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for i386 DWARF. Copyright (C) 2005, 2006, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/i386_reloc.def b/src/backends/i386_reloc.def index 1befd1b6..bd273b38 100644 --- a/src/backends/i386_reloc.def +++ b/src/backends/i386_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for i386. -*- C -*- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/i386_retval.c b/src/backends/i386_retval.c index 67a090d5..9da797d5 100644 --- a/src/backends/i386_retval.c +++ b/src/backends/i386_retval.c @@ -1,27 +1,30 @@ /* Function return value location for Linux/i386 ABI. - Copyright (C) 2005-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -64,27 +67,10 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; switch (tag) { @@ -94,9 +80,10 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -106,6 +93,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_ptr_to_member_type: { Dwarf_Word size; + Dwarf_Attribute attr_mem; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem), &size) != 0) { diff --git a/src/backends/i386_symbol.c b/src/backends/i386_symbol.c index 5d6c0efd..7dbf899f 100644 --- a/src/backends/i386_symbol.c +++ b/src/backends/i386_symbol.c @@ -1,28 +1,31 @@ /* i386 specific symbolic name handling. Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/i386_syscall.c b/src/backends/i386_syscall.c index 4d6e438c..535dcd86 100644 --- a/src/backends/i386_syscall.c +++ b/src/backends/i386_syscall.c @@ -1,27 +1,30 @@ /* Linux/i386 system call ABI in DWARF register numbers. Copyright (C) 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/ia64_init.c b/src/backends/ia64_init.c index 290c192c..91da748d 100644 --- a/src/backends/ia64_init.c +++ b/src/backends/ia64_init.c @@ -1,28 +1,31 @@ /* Initialization of IA-64 specific backend library. - Copyright (C) 2002, 2003, 2005, 2006, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2002, 2003, 2005, 2006, 2007, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -58,6 +61,7 @@ ia64_init (elf, machine, eh, ehlen) HOOK (eh, machine_section_flag_check); HOOK (eh, register_info); HOOK (eh, return_value_location); + HOOK (eh, check_reloc_target_type); return MODVERSION; } diff --git a/src/backends/ia64_regs.c b/src/backends/ia64_regs.c index 0460739c..a27fe63d 100644 --- a/src/backends/ia64_regs.c +++ b/src/backends/ia64_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for IA64 DWARF. Copyright (C) 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/ia64_reloc.def b/src/backends/ia64_reloc.def index a4234656..9e058c8b 100644 --- a/src/backends/ia64_reloc.def +++ b/src/backends/ia64_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for ia64. -*- C -*- Copyright (C) 2005, 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/ia64_retval.c b/src/backends/ia64_retval.c index 7645c3c8..b5928c58 100644 --- a/src/backends/ia64_retval.c +++ b/src/backends/ia64_retval.c @@ -1,27 +1,30 @@ /* Function return value location for IA64 ABI. - Copyright (C) 2006-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2006-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -106,7 +109,7 @@ hfa_type (Dwarf_Die *typedie, Dwarf_Word size, return fpregs_used + nregs; } - int tag = dwarf_tag (typedie); + int tag = DWARF_TAG_OR_RETURN (typedie); switch (tag) { Dwarf_Attribute attr_mem; @@ -235,27 +238,10 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -266,9 +252,10 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -276,16 +263,21 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 8; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + } + if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &attr_mem), diff --git a/src/backends/ia64_symbol.c b/src/backends/ia64_symbol.c index 1edef8b5..f928b0b7 100644 --- a/src/backends/ia64_symbol.c +++ b/src/backends/ia64_symbol.c @@ -1,28 +1,31 @@ /* IA-64 specific symbolic name handling. - Copyright (C) 2002-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2002-2009, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -145,3 +148,10 @@ ia64_reloc_simple_type (Ebl *ebl, int type) return ELF_T_NUM; } + +/* The SHT_IA_64_UNWIND section type is a valid target for relocation. */ +bool +ia64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type) +{ + return sh_type == SHT_IA_64_UNWIND; +} diff --git a/src/backends/libebl_CPU.h b/src/backends/libebl_CPU.h index b00e7231..ef2b922b 100644 --- a/src/backends/libebl_CPU.h +++ b/src/backends/libebl_CPU.h @@ -1,31 +1,35 @@ /* Common interface for libebl modules. - Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBEBL_CPU_H #define _LIBEBL_CPU_H 1 +#include <dwarf.h> #include <libeblP.h> #define EBLHOOK(name) EBLHOOK_1(BACKEND, name) @@ -42,5 +46,31 @@ extern const char *EBLHOOK(init) (Elf *elf, GElf_Half machine, extern bool (*generic_debugscn_p) (const char *) attribute_hidden; +/* Helper for retval. Return dwarf_tag (die), but calls return -1 + if there where previous errors that leave die NULL. */ +#define DWARF_TAG_OR_RETURN(die) \ + ({ Dwarf_Die *_die = (die); \ + if (_die == NULL) return -1; \ + dwarf_tag (_die); }) + +/* Get a type die corresponding to DIE. Peel CV qualifiers off + it. */ +static inline int +dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result) +{ + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (die, DW_AT_type, &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + if (dwarf_formref_die (attr, result) == NULL) + return -1; + + if (dwarf_peel_type (result, result) != 0) + return -1; + + return DWARF_TAG_OR_RETURN (result); +} #endif /* libebl_CPU.h */ diff --git a/src/backends/linux-core-note.c b/src/backends/linux-core-note.c index 9d01219c..e3c01098 100644 --- a/src/backends/linux-core-note.c +++ b/src/backends/linux-core-note.c @@ -1,27 +1,30 @@ /* Common core note type descriptions for Linux. Copyright (C) 2007-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #include <string.h> @@ -39,6 +42,9 @@ #define INT int32_t #define ALIGN_INT 4 #define TYPE_INT ELF_T_SWORD +#ifndef ALIGN_PR_REG +# define ALIGN_PR_REG ALIGN_ULONG +#endif #define FIELD(type, name) type name __attribute__ ((aligned (ALIGN_##type))) @@ -78,7 +84,14 @@ struct EBLHOOK(prstatus) struct EBLHOOK(timeval) pr_stime; struct EBLHOOK(timeval) pr_cutime; struct EBLHOOK(timeval) pr_cstime; - FIELD (ULONG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (ULONG)]); + struct + { + FIELD (ULONG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (ULONG)]); + } +#ifdef ALIGN_PR_REG + __attribute__ ((aligned (ALIGN_PR_REG))) +#endif + ; FIELD (INT, pr_fpvalid); }; @@ -120,8 +133,10 @@ static const Ebl_Core_Item prstatus_items[] = FIELD (signal, INT, info.si_code, 'd'), FIELD (signal, INT, info.si_errno, 'd'), FIELD (signal, SHORT, cursig, 'd'), - FIELD (signal, ULONG, sigpend, 'B'), - FIELD (signal, ULONG, sighold, 'B'), + + /* Use different group name for a newline delimiter. */ + FIELD (signal2, ULONG, sigpend, 'B'), + FIELD (signal3, ULONG, sighold, 'B'), FIELD (identity, PID_T, pid, 'd', .thread_identifier = true), FIELD (identity, PID_T, ppid, 'd'), FIELD (identity, PID_T, pgrp, 'd'), @@ -249,6 +264,28 @@ EBLHOOK(core_note) (nhdr, name, regs_offset, nregloc, reglocs, nitems, items) *items = NULL; \ return 1; +#define EXTRA_REGSET_ITEMS(type, size, table, extra_items) \ + case type: \ + if (nhdr->n_descsz != size) \ + return 0; \ + *regs_offset = 0; \ + *nregloc = sizeof table / sizeof table[0]; \ + *reglocs = table; \ + *nitems = sizeof extra_items / sizeof extra_items[0]; \ + *items = extra_items; \ + return 1; + +#define EXTRA_ITEMS(type, size, extra_items) \ + case type: \ + if (nhdr->n_descsz != size) \ + return 0; \ + *regs_offset = 0; \ + *nregloc = 0; \ + *reglocs = NULL; \ + *nitems = sizeof extra_items / sizeof extra_items[0]; \ + *items = extra_items; \ + return 1; + #ifdef FPREGSET_SIZE EXTRA_REGSET (NT_FPREGSET, FPREGSET_SIZE, fpregset_regs) #endif diff --git a/src/backends/ppc64_init.c b/src/backends/ppc64_init.c index 3060a605..56e1828e 100644 --- a/src/backends/ppc64_init.c +++ b/src/backends/ppc64_init.c @@ -1,33 +1,38 @@ /* Initialization of PPC64 specific backend library. - Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <string.h> + #define BACKEND ppc64_ #define RELOC_PREFIX R_PPC64_ #include "libebl_CPU.h" @@ -53,14 +58,52 @@ ppc64_init (elf, machine, eh, ehlen) HOOK (eh, reloc_simple_type); HOOK (eh, dynamic_tag_name); HOOK (eh, dynamic_tag_check); + HOOK (eh, machine_flag_check); HOOK (eh, copy_reloc_p); HOOK (eh, check_special_symbol); + HOOK (eh, check_st_other_bits); HOOK (eh, bss_plt_p); HOOK (eh, return_value_location); HOOK (eh, register_info); HOOK (eh, syscall_abi); HOOK (eh, core_note); HOOK (eh, auxv_info); + HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS. */ + eh->frame_nregs = (114 - 1) + 32; + HOOK (eh, set_initial_registers_tid); + HOOK (eh, dwarf_to_regno); + HOOK (eh, resolve_sym_value); + + /* Find the function descriptor .opd table for resolve_sym_value. */ + if (elf != NULL) + { + GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr != NULL && ehdr->e_type != ET_REL) + { + /* We could also try through DT_PPC64_OPD and DT_PPC64_OPDSZ. */ + GElf_Shdr opd_shdr_mem, *opd_shdr; + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + opd_shdr = gelf_getshdr (scn, &opd_shdr_mem); + if (opd_shdr != NULL + && (opd_shdr->sh_flags & SHF_ALLOC) != 0 + && opd_shdr->sh_type == SHT_PROGBITS + && opd_shdr->sh_size > 0) + { + const char *name = elf_strptr (elf, ehdr->e_shstrndx, + opd_shdr->sh_name); + if (name != NULL && strcmp (name, ".opd") == 0) + { + eh->fd_addr = opd_shdr->sh_addr; + eh->fd_data = elf_getdata (scn, NULL); + break; + } + } + } + } + } return MODVERSION; } diff --git a/src/backends/ppc64_reloc.def b/src/backends/ppc64_reloc.def index e51512be..3a693cf6 100644 --- a/src/backends/ppc64_reloc.def +++ b/src/backends/ppc64_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for ppc64. -*- C -*- Copyright (C) 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ @@ -129,6 +132,21 @@ RELOC_TYPE (DTPREL16_HIGHER, REL) RELOC_TYPE (DTPREL16_HIGHERA, REL) RELOC_TYPE (DTPREL16_HIGHEST, REL) RELOC_TYPE (DTPREL16_HIGHESTA, REL) +RELOC_TYPE (TLSGD, REL) +RELOC_TYPE (TLSLD, REL) +RELOC_TYPE (TOCSAVE, REL) +RELOC_TYPE (ADDR16_HIGH, REL) +RELOC_TYPE (ADDR16_HIGHA, REL) +RELOC_TYPE (TPREL16_HIGH, REL) +RELOC_TYPE (TPREL16_HIGHA, REL) +RELOC_TYPE (DTPREL16_HIGH, REL) +RELOC_TYPE (DTPREL16_HIGHA, REL) +RELOC_TYPE (JMP_IREL, REL) +RELOC_TYPE (IRELATIVE, REL) +RELOC_TYPE (REL16, REL) +RELOC_TYPE (REL16_LO, REL) +RELOC_TYPE (REL16_HI, REL) +RELOC_TYPE (REL16_HA, REL) /* Notes from Alan Modra: diff --git a/src/backends/ppc64_resolve_sym.c b/src/backends/ppc64_resolve_sym.c new file mode 100644 index 00000000..03f65584 --- /dev/null +++ b/src/backends/ppc64_resolve_sym.c @@ -0,0 +1,63 @@ +/* Resolve symbol values through .opd function descriptors. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND ppc64_ +#include "libebl_CPU.h" + +/* Resolve a function descriptor if addr points into the .opd section. + The .opd section contains function descriptors consisting of 3 addresses. + function, toc and chain. We are just interested in the first. + http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES + + Returns true if the given address could be resolved, false otherwise. +*/ +bool +ppc64_resolve_sym_value (Ebl *ebl, GElf_Addr *addr) +{ + if (ebl->fd_data != NULL && *addr >= ebl->fd_addr + && *addr + sizeof (Elf64_Addr) <= ebl->fd_addr + ebl->fd_data->d_size) + { + GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem); + if (ehdr != NULL) + { + Elf_Data opd_in, opd_out; + opd_in.d_buf = ebl->fd_data->d_buf + (*addr - ebl->fd_addr); + opd_out.d_buf = addr; + opd_out.d_size = opd_in.d_size = sizeof (Elf64_Addr); + opd_out.d_type = opd_in.d_type = ELF_T_ADDR; + if (elf64_xlatetom (&opd_out, &opd_in, + ehdr->e_ident[EI_DATA]) != NULL) + return true; + } + } + return false; +} diff --git a/src/backends/ppc64_retval.c b/src/backends/ppc64_retval.c index a5fc0dc8..a2519839 100644 --- a/src/backends/ppc64_retval.c +++ b/src/backends/ppc64_retval.c @@ -1,27 +1,30 @@ /* Function return value location for Linux/PPC64 ABI. - Copyright (C) 2005-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -74,27 +77,10 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -105,9 +91,10 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -115,16 +102,21 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 8; - else - return -1; + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; } + } + if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &attr_mem), @@ -159,6 +151,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_array_type: { + Dwarf_Attribute attr_mem; bool is_vector; if (dwarf_formflag (dwarf_attr_integrate (typedie, DW_AT_GNU_vector, &attr_mem), &is_vector) == 0 @@ -176,9 +169,10 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) if (tag == DW_TAG_array_type) { /* Check if it's a character array. */ + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); if (tag != DW_TAG_base_type) goto aggregate; if (dwarf_formudata (dwarf_attr_integrate (typedie, diff --git a/src/backends/ppc64_symbol.c b/src/backends/ppc64_symbol.c index 49fde0ca..0feddcee 100644 --- a/src/backends/ppc64_symbol.c +++ b/src/backends/ppc64_symbol.c @@ -1,28 +1,31 @@ /* PPC64 specific symbolic name handling. - Copyright (C) 2004, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2004, 2005, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -69,6 +72,8 @@ ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), return "PPC64_OPD"; case DT_PPC64_OPDSZ: return "PPC64_OPDSZ"; + case DT_PPC64_OPT: + return "PPC64_OPT"; default: break; } @@ -81,7 +86,8 @@ ppc64_dynamic_tag_check (int64_t tag) { return (tag == DT_PPC64_GLINK || tag == DT_PPC64_OPD - || tag == DT_PPC64_OPDSZ); + || tag == DT_PPC64_OPDSZ + || tag == DT_PPC64_OPT); } @@ -102,8 +108,23 @@ ppc64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, /* Check if backend uses a bss PLT in this file. */ bool -ppc64_bss_plt_p (Elf *elf __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused))) +ppc64_bss_plt_p (Elf *elf __attribute__ ((unused))) { return true; } + +/* Check whether machine flags are valid. PPC64 has three possible values: + 0 - for unspecified ABI, or not using any specific ABI features. + 1 - for the original ELF PPC64 ABI using function descriptors. + 2 - for the revised ELFv2 PPC64 ABI without function descriptors. */ +bool +ppc64_machine_flag_check (GElf_Word flags) +{ + return flags == 0 || flags == 1 || flags == 2; +} + +bool +ppc64_check_st_other_bits (unsigned char st_other) +{ + return (PPC64_LOCAL_ENTRY_OFFSET (st_other) != 0); +} diff --git a/src/backends/ppc_attrs.c b/src/backends/ppc_attrs.c index 985df3f9..ebeafe5a 100644 --- a/src/backends/ppc_attrs.c +++ b/src/backends/ppc_attrs.c @@ -1,27 +1,30 @@ /* Object attribute tags for PowerPC. Copyright (C) 2008, 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/ppc_auxv.c b/src/backends/ppc_auxv.c index 1c0a5cfc..a27a1da4 100644 --- a/src/backends/ppc_auxv.c +++ b/src/backends/ppc_auxv.c @@ -1,27 +1,30 @@ /* i386 specific auxv handling. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/ppc_cfi.c b/src/backends/ppc_cfi.c new file mode 100644 index 00000000..55169aef --- /dev/null +++ b/src/backends/ppc_cfi.c @@ -0,0 +1,77 @@ +/* ppc ABI-specified defaults for DWARF CFI. + Copyright (C) 2012, 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +int +ppc_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* This instruction is provided in every CIE. It is not repeated here: + DW_CFA_def_cfa, ULEB128_7 (1), ULEB128_7 (0) */ + /* r1 is assumed to be restored from cfa adress, + r1 acts as a stack frame pointer. */ + DW_CFA_val_offset, ULEB128_7 (1), ULEB128_7 (0), + /* lr is not callee-saved but it needs to be preserved as it is pre-set + by the caller. */ + DW_CFA_same_value, ULEB128_7 (65), /* lr */ + + /* Callee-saved regs. */ +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + SV (2), /* r2 is TOC pointer. */ + SV (13), /* Reserved as system thread id (is it for CFI?). */ + /* r14-r31 are non-volatile registers. */ + SV (14), SV (15), SV (16), SV (17), SV (18), SV (19), SV (20), SV (21), + SV (22), SV (23), SV (24), SV (25), SV (26), SV (27), SV (28), SV (29), + SV (30), SV (31) + /* VMX registers v20-v31 and vrsave are non-volatile but they are + assigned DWARF registers 1144-1156 (v20-v31) which is outside of the + CFI supported range. */ +#undef SV + }; + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = ebl->class == ELFCLASS64 ? 8 : 4; + + abi_info->return_address_register = 65; + + return 0; +} + +__typeof (ppc_abi_cfi) + ppc64_abi_cfi + __attribute__ ((alias ("ppc_abi_cfi"))); diff --git a/src/backends/ppc_corenote.c b/src/backends/ppc_corenote.c index af0c46aa..9ac88712 100644 --- a/src/backends/ppc_corenote.c +++ b/src/backends/ppc_corenote.c @@ -1,27 +1,30 @@ /* PowerPC specific core note handling. Copyright (C) 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -120,7 +123,7 @@ static const Ebl_Register_Location spe_regs[] = { \ .name = "nip", .type = ELF_T_ADDR, .format = 'x', \ .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[32]), \ - .group = "register" \ + .group = "register", .pc_register = true \ }, \ { \ .name = "orig_gpr3", .type = TYPE_LONG, .format = 'd', \ diff --git a/src/backends/ppc_init.c b/src/backends/ppc_init.c index 523c6583..ad92765c 100644 --- a/src/backends/ppc_init.c +++ b/src/backends/ppc_init.c @@ -1,28 +1,31 @@ /* Initialization of PPC specific backend library. - Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -61,6 +64,11 @@ ppc_init (elf, machine, eh, ehlen) HOOK (eh, core_note); HOOK (eh, auxv_info); HOOK (eh, check_object_attribute); + HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS. */ + eh->frame_nregs = (114 - 1) + 32; + HOOK (eh, set_initial_registers_tid); + HOOK (eh, dwarf_to_regno); return MODVERSION; } diff --git a/src/backends/ppc_initreg.c b/src/backends/ppc_initreg.c new file mode 100644 index 00000000..64f53793 --- /dev/null +++ b/src/backends/ppc_initreg.c @@ -0,0 +1,114 @@ +/* Fetch live process registers from TID. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "system.h" +#include <stdlib.h> +#ifdef __powerpc__ +# include <sys/user.h> +# include <sys/ptrace.h> +#endif + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +bool +ppc_dwarf_to_regno (Ebl *ebl __attribute__ ((unused)), unsigned *regno) +{ + switch (*regno) + { + case 108: + // LR uses both 65 and 108 numbers, there is no consistency for it. + *regno = 65; + return true; + case 0 ... 107: + case 109 ... (114 - 1) -1: + return true; + case 1200 ... 1231: + *regno = *regno - 1200 + (114 - 1); + return true; + default: + return false; + } + abort (); +} + +__typeof (ppc_dwarf_to_regno) + ppc64_dwarf_to_regno + __attribute__ ((alias ("ppc_dwarf_to_regno"))); + +bool +ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#ifndef __powerpc__ + return false; +#else /* __powerpc__ */ + union + { + struct pt_regs r; + long l[sizeof (struct pt_regs) / sizeof (long)]; + } + user_regs; + eu_static_assert (sizeof (struct pt_regs) % sizeof (long) == 0); + /* PTRACE_GETREGS is EIO on kernel-2.6.18-308.el5.ppc64. */ + errno = 0; + for (unsigned regno = 0; regno < sizeof (user_regs) / sizeof (long); + regno++) + { + user_regs.l[regno] = ptrace (PTRACE_PEEKUSER, tid, + (void *) (uintptr_t) (regno + * sizeof (long)), + NULL); + if (errno != 0) + return false; + } + const size_t gprs = sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr); + Dwarf_Word dwarf_regs[gprs]; + for (unsigned gpr = 0; gpr < gprs; gpr++) + dwarf_regs[gpr] = user_regs.r.gpr[gpr]; + if (! setfunc (0, gprs, dwarf_regs, arg)) + return false; + dwarf_regs[0] = user_regs.r.link; + // LR uses both 65 and 108 numbers, there is no consistency for it. + if (! setfunc (65, 1, dwarf_regs, arg)) + return false; + /* Registers like msr, ctr, xer, dar, dsisr etc. are probably irrelevant + for CFI. */ + dwarf_regs[0] = user_regs.r.nip; + return setfunc (-1, 1, dwarf_regs, arg); +#endif /* __powerpc__ */ +} + +__typeof (ppc_set_initial_registers_tid) + ppc64_set_initial_registers_tid + __attribute__ ((alias ("ppc_set_initial_registers_tid"))); diff --git a/src/backends/ppc_regs.c b/src/backends/ppc_regs.c index 637c25d1..4b92a9aa 100644 --- a/src/backends/ppc_regs.c +++ b/src/backends/ppc_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for PowerPC DWARF. Copyright (C) 2005, 2006, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -45,7 +48,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)), if (regno < 0 || regno > 1155 || namelen < 8) return -1; - *prefix = NULL; + *prefix = ""; *bits = ebl->machine == EM_PPC64 ? 64 : 32; *type = (regno < 32 ? DW_ATE_signed : regno < 64 ? DW_ATE_float : DW_ATE_unsigned); diff --git a/src/backends/ppc_reloc.def b/src/backends/ppc_reloc.def index 974c24fc..dc963a0e 100644 --- a/src/backends/ppc_reloc.def +++ b/src/backends/ppc_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for ppc. -*- C -*- Copyright (C) 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/ppc_retval.c b/src/backends/ppc_retval.c index 15a0dba8..b14a99f1 100644 --- a/src/backends/ppc_retval.c +++ b/src/backends/ppc_retval.c @@ -1,27 +1,30 @@ /* Function return value location for Linux/PPC ABI. - Copyright (C) 2005, 2006, 2007, 2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005, 2006, 2007, 2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -86,27 +89,10 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -117,9 +103,10 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -127,18 +114,23 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 4; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + } + if (size <= 8) { if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, @@ -162,6 +154,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_array_type: { + Dwarf_Attribute attr_mem; bool is_vector; if (dwarf_formflag (dwarf_attr_integrate (typedie, DW_AT_GNU_vector, &attr_mem), &is_vector) == 0 diff --git a/src/backends/ppc_symbol.c b/src/backends/ppc_symbol.c index 9540a3e9..c17ab374 100644 --- a/src/backends/ppc_symbol.c +++ b/src/backends/ppc_symbol.c @@ -1,28 +1,31 @@ /* PPC specific symbolic name handling. - Copyright (C) 2004, 2005, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2004, 2005, 2007, 2014 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -78,9 +81,13 @@ ppc_dynamic_tag_check (int64_t tag) /* Look for DT_PPC_GOT. */ static bool -find_dyn_got (Elf *elf, GElf_Ehdr *ehdr, GElf_Addr *addr) +find_dyn_got (Elf *elf, GElf_Addr *addr) { - for (int i = 0; i < ehdr->e_phnum; ++i) + size_t phnum; + if (elf_getphdrnum (elf, &phnum) != 0) + return false; + + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); @@ -124,7 +131,7 @@ ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, { /* In -msecure-plt mode, DT_PPC_GOT is present and must match. */ GElf_Addr gotaddr; - if (find_dyn_got (elf, ehdr, &gotaddr)) + if (find_dyn_got (elf, &gotaddr)) return sym->st_value == gotaddr; /* In -mbss-plt mode, any place in the section is valid. */ @@ -151,8 +158,8 @@ ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, /* Check if backend uses a bss PLT in this file. */ bool -ppc_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr) +ppc_bss_plt_p (Elf *elf) { GElf_Addr addr; - return ! find_dyn_got (elf, ehdr, &addr); + return ! find_dyn_got (elf, &addr); } diff --git a/src/backends/ppc_syscall.c b/src/backends/ppc_syscall.c index 23eff812..b1b9c52b 100644 --- a/src/backends/ppc_syscall.c +++ b/src/backends/ppc_syscall.c @@ -1,27 +1,30 @@ /* Linux/PPC system call ABI in DWARF register numbers. Copyright (C) 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/s390_cfi.c b/src/backends/s390_cfi.c new file mode 100644 index 00000000..cb494861 --- /dev/null +++ b/src/backends/s390_cfi.c @@ -0,0 +1,65 @@ +/* s390 ABI-specified defaults for DWARF CFI. + Copyright (C) 2012, 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + +int +s390_abi_cfi (Ebl *ebl, Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* This instruction is provided in every CIE. It is not repeated here: + DW_CFA_def_cfa, ULEB128_7 (15), ULEB128_7 (96) */ + /* r14 is not callee-saved but it needs to be preserved as it is pre-set + by the caller. */ + DW_CFA_same_value, ULEB128_7 (14), /* r14 */ + + /* Callee-saved regs. */ +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + SV (6), SV (7), SV (8), SV (9), SV (10), /* r6-r13, r15 */ + SV (11), SV (12), SV (13), SV (15), + SV (16 + 8), SV (16 + 9), SV (16 + 10), SV (16 + 11), /* f8-f15 */ + SV (16 + 12), SV (16 + 13), SV (16 + 14), SV (16 + 15) +#undef SV + }; + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = ebl->class == ELFCLASS64 ? 8 : 4; + + abi_info->return_address_register = 14; + + return 0; +} diff --git a/src/backends/s390_corenote.c b/src/backends/s390_corenote.c new file mode 100644 index 00000000..7ca35168 --- /dev/null +++ b/src/backends/s390_corenote.c @@ -0,0 +1,189 @@ +/* S390-specific core note handling. + Copyright (C) 2012 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#ifndef BITS +# define BITS 32 +# define BACKEND s390_ +#else +# define BITS 64 +# define BACKEND s390x_ +#endif +#include "libebl_CPU.h" + +static const Ebl_Register_Location prstatus_regs[] = + { +#define GR(at, n, dwreg, b...) \ + { .offset = at * BITS/8, .regno = dwreg, .count = n, .bits = b } + + GR ( 0, 1, 64, BITS), /* pswm */ + GR ( 1, 1, 65, BITS, .pc_register = true ), /* pswa */ + GR ( 2, 16, 0, BITS), /* r0-r15 */ + GR (18, 16, 48, 32), /* ar0-ar15 */ + +#undef GR + }; + + /* orig_r2 is at offset (BITS == 32 ? 34 * 4 : 26 * 8). */ +#define PRSTATUS_REGS_SIZE (BITS / 8 * (BITS == 32 ? 35 : 27)) + +static const Ebl_Register_Location fpregset_regs[] = + { +#define FPR(at, n, dwreg) \ + { .offset = at * 64/8, .regno = dwreg, .count = n, .bits = 64 } + + /* fpc is at offset 0, see fpregset_items, it has no assigned DWARF regno. + Bytes at offsets 4 to 7 are unused. */ + FPR (1 + 0, 1, 16), /* f0 */ + FPR (1 + 1, 1, 20), /* f1 */ + FPR (1 + 2, 1, 17), /* f2 */ + FPR (1 + 3, 1, 21), /* f3 */ + FPR (1 + 4, 1, 18), /* f4 */ + FPR (1 + 5, 1, 22), /* f5 */ + FPR (1 + 6, 1, 19), /* f6 */ + FPR (1 + 7, 1, 23), /* f7 */ + FPR (1 + 8, 1, 24), /* f8 */ + FPR (1 + 9, 1, 28), /* f9 */ + FPR (1 + 10, 1, 25), /* f10 */ + FPR (1 + 11, 1, 29), /* f11 */ + FPR (1 + 12, 1, 26), /* f12 */ + FPR (1 + 13, 1, 30), /* f13 */ + FPR (1 + 14, 1, 27), /* f14 */ + FPR (1 + 15, 1, 31), /* f15 */ + +#undef FPR + }; + +static const Ebl_Core_Item fpregset_items[] = + { + { + .name = "fpc", .group = "register", .offset = 0, .type = ELF_T_WORD, + .format = 'x', + }, + }; + +/* Do not set FPREGSET_SIZE so that we can supply fpregset_items. */ +#define EXTRA_NOTES_FPREGSET \ + EXTRA_REGSET_ITEMS (NT_FPREGSET, 17 * 8, fpregset_regs, fpregset_items) + +#if BITS == 32 +# define ULONG uint32_t +# define ALIGN_ULONG 4 +# define TYPE_ULONG ELF_T_WORD +# define TYPE_LONG ELF_T_SWORD +# define UID_T uint16_t +# define GID_T uint16_t +# define ALIGN_UID_T 2 +# define ALIGN_GID_T 2 +# define TYPE_UID_T ELF_T_HALF +# define TYPE_GID_T ELF_T_HALF +#else +# define ULONG uint64_t +# define ALIGN_ULONG 8 +# define TYPE_ULONG ELF_T_XWORD +# define TYPE_LONG ELF_T_SXWORD +# define UID_T uint32_t +# define GID_T uint32_t +# define ALIGN_UID_T 4 +# define ALIGN_GID_T 4 +# define TYPE_UID_T ELF_T_WORD +# define TYPE_GID_T ELF_T_WORD +#endif +#define PID_T int32_t +#define ALIGN_PID_T 4 +#define TYPE_PID_T ELF_T_SWORD +/* s390 psw_compat_t has alignment 8 bytes where it is inherited from. */ +#define ALIGN_PR_REG 8 + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "orig_r2", .type = TYPE_LONG, .format = 'd', \ + .offset = offsetof (struct EBLHOOK(prstatus), \ + pr_reg[BITS == 32 ? 34 : 26]), \ + .group = "register" \ + } + +#if BITS == 32 + +static const Ebl_Core_Item high_regs_items[] = + { +#define HR(n) \ + { \ + .name = "high_r" #n , .group = "register", .offset = (n) * 4, \ + .type = ELF_T_WORD, .format = 'x', \ + } + + /* Upper halves of r0-r15 are stored here. + FIXME: They are currently not combined with the r0-r15 lower halves. */ + HR (0), HR (1), HR (2), HR (3), HR (4), HR (5), HR (6), HR (7), + HR (8), HR (9), HR (10), HR (11), HR (12), HR (13), HR (14), HR (15) + +#undef HR + }; + +#define EXTRA_NOTES_HIGH_GPRS \ + EXTRA_ITEMS (NT_S390_HIGH_GPRS, 16 * 4, high_regs_items) + +#else /* BITS == 64 */ + +#define EXTRA_NOTES_HIGH_GPRS + +#endif /* BITS == 64 */ + +static const Ebl_Core_Item last_break_items[] = + { + { + .name = "last_break", .group = "system", .offset = BITS == 32 ? 4 : 0, + .type = BITS == 32 ? ELF_T_WORD : ELF_T_XWORD, .format = 'x', + }, + }; + +static const Ebl_Core_Item system_call_items[] = + { + { + .name = "system_call", .group = "system", .offset = 0, .type = ELF_T_WORD, + .format = 'd', + }, + }; + +#define EXTRA_NOTES \ + EXTRA_NOTES_FPREGSET \ + EXTRA_NOTES_HIGH_GPRS \ + EXTRA_ITEMS (NT_S390_LAST_BREAK, 8, last_break_items) \ + EXTRA_ITEMS (NT_S390_SYSTEM_CALL, 4, system_call_items) + +#include "linux-core-note.c" diff --git a/src/backends/s390_init.c b/src/backends/s390_init.c index 05ffce60..26b20b49 100644 --- a/src/backends/s390_init.c +++ b/src/backends/s390_init.c @@ -1,27 +1,30 @@ /* Initialization of S/390 specific backend library. - Copyright (C) 2005, 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005, 2006, 2013 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -34,6 +37,8 @@ /* This defines the common reloc hooks based on arm_reloc.def. */ #include "common-reloc.c" +extern __typeof (s390_core_note) s390x_core_note; + const char * s390_init (elf, machine, eh, ehlen) @@ -52,6 +57,20 @@ s390_init (elf, machine, eh, ehlen) HOOK (eh, reloc_simple_type); HOOK (eh, register_info); HOOK (eh, return_value_location); + if (eh->class == ELFCLASS64) + eh->core_note = s390x_core_note; + else + HOOK (eh, core_note); + HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS 34. + But from the gcc/config/s390/s390.h "Register usage." comment it looks as + if #32 (Argument pointer) and #33 (Condition code) are not used for + unwinding. */ + eh->frame_nregs = 32; + HOOK (eh, set_initial_registers_tid); + if (eh->class == ELFCLASS32) + HOOK (eh, normalize_pc); + HOOK (eh, unwind); /* Only the 64-bit format uses the incorrect hash table entry size. */ if (eh->class == ELFCLASS64) diff --git a/src/backends/s390_initreg.c b/src/backends/s390_initreg.c new file mode 100644 index 00000000..b4c4b67c --- /dev/null +++ b/src/backends/s390_initreg.c @@ -0,0 +1,95 @@ +/* Fetch live process registers from TID. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "system.h" +#include <assert.h> +#ifdef __s390__ +# include <sys/user.h> +# include <asm/ptrace.h> +# include <sys/ptrace.h> +#endif + +#define BACKEND s390_ +#include "libebl_CPU.h" + +bool +s390_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#ifndef __s390__ + return false; +#else /* __s390__ */ + struct user user_regs; + ptrace_area parea; + parea.process_addr = (uintptr_t) &user_regs; + parea.kernel_addr = 0; + parea.len = sizeof (user_regs); + if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea, NULL) != 0) + return false; + /* If we run as s390x we get the 64-bit registers of tid. + But -m31 executable seems to use only the 32-bit parts of its + registers so we ignore the upper half. */ + Dwarf_Word dwarf_regs[16]; + for (unsigned u = 0; u < 16; u++) + dwarf_regs[u] = user_regs.regs.gprs[u]; + if (! setfunc (0, 16, dwarf_regs, arg)) + return false; + /* Avoid conversion double -> integer. */ + eu_static_assert (sizeof user_regs.regs.fp_regs.fprs[0] + == sizeof dwarf_regs[0]); + for (unsigned u = 0; u < 16; u++) + { + // Store the double bits as is in the Dwarf_Word without conversion. + union + { + double d; + Dwarf_Word w; + } fpr = { .d = user_regs.regs.fp_regs.fprs[u] }; + dwarf_regs[u] = fpr.w; + } + + if (! setfunc (16, 16, dwarf_regs, arg)) + return false; + dwarf_regs[0] = user_regs.regs.psw.addr; + return setfunc (-1, 1, dwarf_regs, arg); +#endif /* __s390__ */ +} + +void +s390_normalize_pc (Ebl *ebl __attribute__ ((unused)), Dwarf_Addr *pc) +{ + assert (ebl->class == ELFCLASS32); + + /* Clear S390 bit 31. */ + *pc &= (1U << 31) - 1; +} diff --git a/src/backends/s390_regs.c b/src/backends/s390_regs.c index 7e8113a2..ba6178a3 100644 --- a/src/backends/s390_regs.c +++ b/src/backends/s390_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for S/390 DWARF. Copyright (C) 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/s390_reloc.def b/src/backends/s390_reloc.def index b2bc9224..b4686a30 100644 --- a/src/backends/s390_reloc.def +++ b/src/backends/s390_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for s390. -*- C -*- Copyright (C) 2005, 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/s390_retval.c b/src/backends/s390_retval.c index 15bd97bf..a927d46a 100644 --- a/src/backends/s390_retval.c +++ b/src/backends/s390_retval.c @@ -1,27 +1,30 @@ /* Function return value location for S/390 ABI. - Copyright (C) 2006, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2006, 2007, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -65,27 +68,10 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -96,9 +82,10 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -112,6 +99,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) if (dwarf_diecu (typedie, &cudie, &asize, NULL) == NULL) return -1; + Dwarf_Attribute attr_mem; if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size, &attr_mem), &size) != 0) { diff --git a/src/backends/s390_symbol.c b/src/backends/s390_symbol.c index 98c76530..a0a4fafa 100644 --- a/src/backends/s390_symbol.c +++ b/src/backends/s390_symbol.c @@ -1,27 +1,30 @@ /* S/390-specific symbolic name handling. Copyright (C) 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/s390_unwind.c b/src/backends/s390_unwind.c new file mode 100644 index 00000000..752bc287 --- /dev/null +++ b/src/backends/s390_unwind.c @@ -0,0 +1,139 @@ +/* Get previous frame state for an existing frame state. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdlib.h> +#include <assert.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + +/* s390/s390x do not annotate signal handler frame by CFI. It would be also + difficult as PC points into a stub built on stack. Function below is called + only if unwinder could not find CFI. Function then verifies the register + state for this frame really belongs to a signal frame. In such case it + fetches original registers saved by the signal frame. */ + +bool +s390_unwind (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc, + ebl_tid_registers_get_t *getfunc, ebl_pid_memory_read_t *readfunc, + void *arg, bool *signal_framep) +{ + /* Caller already assumed caller adjustment but S390 instructions are 4 bytes + long. Undo it. */ + if ((pc & 0x3) != 0x3) + return false; + pc++; + /* We can assume big-endian read here. */ + Dwarf_Word instr; + if (! readfunc (pc, &instr, arg)) + return false; + /* Fetch only the very first two bytes. */ + instr = (instr >> (ebl->class == ELFCLASS64 ? 48 : 16)) & 0xffff; + /* See GDB s390_sigtramp_frame_sniffer. */ + /* Check for 'svc' as the first instruction. */ + if (((instr >> 8) & 0xff) != 0x0a) + return false; + /* Check for 'sigreturn' or 'rt_sigreturn' as the second instruction. */ + if ((instr & 0xff) != 119 && (instr & 0xff) != 173) + return false; + /* See GDB s390_sigtramp_frame_unwind_cache. */ + Dwarf_Word this_sp; + if (! getfunc (0 + 15, 1, &this_sp, arg)) + return false; + unsigned word_size = ebl->class == ELFCLASS64 ? 8 : 4; + Dwarf_Addr next_cfa = this_sp + 16 * word_size + 32; + /* "New-style RT frame" is not supported, + assuming "Old-style RT frame and all non-RT frames". + Pointer to the array of saved registers is at NEXT_CFA + 8. */ + Dwarf_Word sigreg_ptr; + if (! readfunc (next_cfa + 8, &sigreg_ptr, arg)) + return false; + /* Skip PSW mask. */ + sigreg_ptr += word_size; + /* Read PSW address. */ + Dwarf_Word val; + if (! readfunc (sigreg_ptr, &val, arg)) + return false; + if (! setfunc (-1, 1, &val, arg)) + return false; + sigreg_ptr += word_size; + /* Then the GPRs. */ + Dwarf_Word gprs[16]; + for (int i = 0; i < 16; i++) + { + if (! readfunc (sigreg_ptr, &gprs[i], arg)) + return false; + sigreg_ptr += word_size; + } + /* Then the ACRs. Skip them, they are not used in CFI. */ + for (int i = 0; i < 16; i++) + sigreg_ptr += 4; + /* The floating-point control word. */ + sigreg_ptr += 8; + /* And finally the FPRs. */ + Dwarf_Word fprs[16]; + for (int i = 0; i < 16; i++) + { + if (! readfunc (sigreg_ptr, &val, arg)) + return false; + if (ebl->class == ELFCLASS32) + { + Dwarf_Addr val_low; + if (! readfunc (sigreg_ptr + 4, &val_low, arg)) + return false; + val = (val << 32) | val_low; + } + fprs[i] = val; + sigreg_ptr += 8; + } + /* If we have them, the GPR upper halves are appended at the end. */ + if (ebl->class == ELFCLASS32) + { + /* Skip signal number. */ + sigreg_ptr += 4; + for (int i = 0; i < 16; i++) + { + if (! readfunc (sigreg_ptr, &val, arg)) + return false; + Dwarf_Word val_low = gprs[i]; + val = (val << 32) | val_low; + gprs[i] = val; + sigreg_ptr += 4; + } + } + if (! setfunc (0, 16, gprs, arg)) + return false; + if (! setfunc (16, 16, fprs, arg)) + return false; + *signal_framep = true; + return true; +} diff --git a/src/backends/s390x_corenote.c b/src/backends/s390x_corenote.c new file mode 100644 index 00000000..427bf7de --- /dev/null +++ b/src/backends/s390x_corenote.c @@ -0,0 +1,2 @@ +#define BITS 64 +#include "s390_corenote.c" diff --git a/src/backends/sh_corenote.c b/src/backends/sh_corenote.c index 80bcd6f8..9268f568 100644 --- a/src/backends/sh_corenote.c +++ b/src/backends/sh_corenote.c @@ -1,28 +1,31 @@ /* SH specific core note handling. Copyright (C) 2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Contributed Matt Fleming <matt@console-pimps.org>. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sh_init.c b/src/backends/sh_init.c index 7b36e7a3..90ddcb2c 100644 --- a/src/backends/sh_init.c +++ b/src/backends/sh_init.c @@ -1,28 +1,31 @@ /* Initialization of SH specific backend library. Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sh_regs.c b/src/backends/sh_regs.c index fc6705e4..d4332364 100644 --- a/src/backends/sh_regs.c +++ b/src/backends/sh_regs.c @@ -1,28 +1,31 @@ /* Register names and numbers for SH DWARF. Copyright (C) 2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Contributed by Matt Fleming <matt@console-pimps.org>. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -47,7 +50,7 @@ sh_register_info (Ebl *ebl __attribute__ ((unused)), if (regno < 0 || regno > 103 || namelen < 6) return -1; - *prefix = NULL; + *prefix = ""; *bits = 32; *type = DW_ATE_signed; diff --git a/src/backends/sh_reloc.def b/src/backends/sh_reloc.def index e4f24427..66a5a9d2 100644 --- a/src/backends/sh_reloc.def +++ b/src/backends/sh_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for SH. -*- C -*- Copyright (C) 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/sh_retval.c b/src/backends/sh_retval.c index 096d955d..d44f2601 100644 --- a/src/backends/sh_retval.c +++ b/src/backends/sh_retval.c @@ -1,28 +1,31 @@ /* Function return value location for Linux/SH ABI. - Copyright (C) 2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2010, 2014 Red Hat, Inc. + This file is part of elfutils. Contributed by Matt Fleming <matt@console-pimps.org>. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -62,27 +65,10 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -93,9 +79,10 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -103,18 +90,23 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 4; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + } + if (size <= 8) { if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, diff --git a/src/backends/sh_symbol.c b/src/backends/sh_symbol.c index 9fb5db44..8101e96f 100644 --- a/src/backends/sh_symbol.c +++ b/src/backends/sh_symbol.c @@ -1,28 +1,31 @@ /* SH specific relocation handling. Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sparc_auxv.c b/src/backends/sparc_auxv.c index a22b3cea..2da349ca 100644 --- a/src/backends/sparc_auxv.c +++ b/src/backends/sparc_auxv.c @@ -1,27 +1,30 @@ /* SPARC-specific auxv handling. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sparc_corenote.c b/src/backends/sparc_corenote.c index 55aed8f4..7912539b 100644 --- a/src/backends/sparc_corenote.c +++ b/src/backends/sparc_corenote.c @@ -1,27 +1,30 @@ /* PowerPC specific core note handling. Copyright (C) 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sparc_init.c b/src/backends/sparc_init.c index 856bd48c..7d229981 100644 --- a/src/backends/sparc_init.c +++ b/src/backends/sparc_init.c @@ -1,27 +1,30 @@ /* Initialization of SPARC specific backend library. Copyright (C) 2002, 2005, 2006, 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sparc_regs.c b/src/backends/sparc_regs.c index b3e9e201..f9709bb3 100644 --- a/src/backends/sparc_regs.c +++ b/src/backends/sparc_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for SPARC DWARF. Copyright (C) 2005, 2006 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/sparc_reloc.def b/src/backends/sparc_reloc.def index a7ea52a3..c39b0fae 100644 --- a/src/backends/sparc_reloc.def +++ b/src/backends/sparc_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for sparc. -*- C -*- Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/sparc_retval.c b/src/backends/sparc_retval.c index dcff67a2..e1b17753 100644 --- a/src/backends/sparc_retval.c +++ b/src/backends/sparc_retval.c @@ -1,27 +1,30 @@ /* Function return value location for SPARC. - Copyright (C) 2006-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2006-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -69,27 +72,10 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -100,9 +86,10 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -110,19 +97,24 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - uint8_t asize; - Dwarf_Die cudie; - if ((tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - && dwarf_diecu (typedie, &cudie, &asize, NULL) != NULL) - size = asize; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + uint8_t asize; + Dwarf_Die cudie; + if ((tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + && dwarf_diecu (typedie, &cudie, &asize, NULL) != NULL) + size = asize; + else + return -1; + } + } + if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &attr_mem), diff --git a/src/backends/sparc_symbol.c b/src/backends/sparc_symbol.c index 7896e9f4..ec11dc97 100644 --- a/src/backends/sparc_symbol.c +++ b/src/backends/sparc_symbol.c @@ -1,28 +1,31 @@ /* SPARC specific symbolic name handling. Copyright (C) 2002, 2003, 2005, 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Jakub Jelinek <jakub@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/tilegx_corenote.c b/src/backends/tilegx_corenote.c new file mode 100644 index 00000000..be3e7dbf --- /dev/null +++ b/src/backends/tilegx_corenote.c @@ -0,0 +1,64 @@ +/* TILE-Gx specific core note handling. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <inttypes.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + +static const Ebl_Register_Location prstatus_regs[] = + { + { .offset = 0, .regno = 0, .count = 56, .bits = 64 }, /* r0-r55 */ + { .offset = 56 * 8, .regno = 64, .count = 1, .bits = 64 } /* pc */ + }; +#define PRSTATUS_REGS_SIZE (57 * 8) + +#define ULONG uint64_t +#define ALIGN_ULONG 8 +#define TYPE_ULONG ELF_T_XWORD +#define TYPE_LONG ELF_T_SXWORD +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_WORD +#define TYPE_GID_T ELF_T_WORD + +#include "linux-core-note.c" diff --git a/src/backends/tilegx_init.c b/src/backends/tilegx_init.c new file mode 100644 index 00000000..858798bf --- /dev/null +++ b/src/backends/tilegx_init.c @@ -0,0 +1,60 @@ +/* Initialization of TILE-Gx specific backend library. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND tilegx_ +#define RELOC_PREFIX R_TILEGX_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on tilegx_reloc.def. */ +#include "common-reloc.c" + +const char * +tilegx_init (elf, machine, eh, ehlen) + Elf *elf __attribute__ ((unused)); + GElf_Half machine __attribute__ ((unused)); + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return NULL; + + /* We handle it. */ + eh->name = "TILE-Gx"; + tilegx_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, core_note); + + return MODVERSION; +} diff --git a/src/backends/tilegx_regs.c b/src/backends/tilegx_regs.c new file mode 100644 index 00000000..b1e17439 --- /dev/null +++ b/src/backends/tilegx_regs.c @@ -0,0 +1,129 @@ +/* Register names and numbers for TILE-Gx DWARF. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <dwarf.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + +ssize_t +tilegx_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 65; + + if (regno < 0 || regno > 64 || namelen < 5) + return -1; + + *prefix = ""; + *setname = "integer"; + *bits = 64; + + switch (regno) + { + case 0 ... 9: + *type = DW_ATE_signed; + name[0] = 'r'; + name[1] = regno + '0'; + namelen = 2; + break; + + case 10 ... 52: + *type = DW_ATE_signed; + name[0] = 'r'; + name[1] = regno / 10 + '0'; + name[2] = regno % 10 + '0'; + namelen = 3; + break; + + case 53: + *type = DW_ATE_address; + return stpcpy (name, "tp") + 1 - name; + + case 54: + *type = DW_ATE_address; + return stpcpy (name, "sp") + 1 - name; + + case 55: + *type = DW_ATE_address; + return stpcpy (name, "lr") + 1 - name; + + case 56: + *type = DW_ATE_unsigned; + return stpcpy (name, "sn") + 1 - name; + + case 57: + *type = DW_ATE_unsigned; + return stpcpy (name, "idn0") + 1 - name; + + case 58: + *type = DW_ATE_unsigned; + return stpcpy (name, "idn1") + 1 - name; + + case 59: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn0") + 1 - name; + + case 60: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn1") + 1 - name; + + case 61: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn2") + 1 - name; + + case 62: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn3") + 1 - name; + + case 63: + *type = DW_ATE_unsigned; + return stpcpy (name, "zero") + 1 - name; + + case 64: + *type = DW_ATE_address; + return stpcpy (name, "pc") + 1 - name; + + /* Can't happen. */ + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/src/backends/tilegx_reloc.def b/src/backends/tilegx_reloc.def new file mode 100644 index 00000000..9736286e --- /dev/null +++ b/src/backends/tilegx_reloc.def @@ -0,0 +1,120 @@ +/* List the relocation types for tilegx. -*- C -*- + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (64, REL|EXEC|DYN) +RELOC_TYPE (32, REL|EXEC|DYN) +RELOC_TYPE (16, REL|EXEC|DYN) +RELOC_TYPE (8, REL|EXEC|DYN) +RELOC_TYPE (64_PCREL, REL) +RELOC_TYPE (32_PCREL, REL) +RELOC_TYPE (16_PCREL, REL) +RELOC_TYPE (8_PCREL, REL) +RELOC_TYPE (HW0, REL) +RELOC_TYPE (HW1, REL) +RELOC_TYPE (HW2, REL) +RELOC_TYPE (HW3, REL) +RELOC_TYPE (HW0_LAST, REL) +RELOC_TYPE (HW1_LAST, REL) +RELOC_TYPE (HW2_LAST, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (BROFF_X1, REL) +RELOC_TYPE (JUMPOFF_X1, REL) +RELOC_TYPE (JUMPOFF_X1_PLT, REL) +RELOC_TYPE (IMM8_X0, REL) +RELOC_TYPE (IMM8_Y0, REL) +RELOC_TYPE (IMM8_X1, REL) +RELOC_TYPE (IMM8_Y1, REL) +RELOC_TYPE (DEST_IMM8_X1, REL) +RELOC_TYPE (MT_IMM14_X1, REL) +RELOC_TYPE (MF_IMM14_X1, REL) +RELOC_TYPE (MMSTART_X0, REL) +RELOC_TYPE (MMEND_X0, REL) +RELOC_TYPE (SHAMT_X0, REL) +RELOC_TYPE (SHAMT_X1, REL) +RELOC_TYPE (SHAMT_Y0, REL) +RELOC_TYPE (SHAMT_Y1, REL) +RELOC_TYPE (IMM16_X0_HW0, REL) +RELOC_TYPE (IMM16_X1_HW0, REL) +RELOC_TYPE (IMM16_X0_HW1, REL) +RELOC_TYPE (IMM16_X1_HW1, REL) +RELOC_TYPE (IMM16_X0_HW2, REL) +RELOC_TYPE (IMM16_X1_HW2, REL) +RELOC_TYPE (IMM16_X0_HW3, REL) +RELOC_TYPE (IMM16_X1_HW3, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST, REL) +RELOC_TYPE (IMM16_X0_HW2_LAST, REL) +RELOC_TYPE (IMM16_X1_HW2_LAST, REL) +RELOC_TYPE (IMM16_X0_HW0_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW0_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW1_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW1_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW2_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW2_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW3_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW3_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW2_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW2_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW0_GOT, REL) +RELOC_TYPE (IMM16_X1_HW0_GOT, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_GOT, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_GOT, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_GOT, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_GOT, REL) +RELOC_TYPE (IMM16_X0_HW0_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW0_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW0_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW0_TLS_IE, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_TLS_IE, REL) +RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF64, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF64, EXEC|DYN) +RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) +RELOC_TYPE (GNU_VTINHERIT, REL) +RELOC_TYPE (GNU_VTENTRY, REL) diff --git a/src/backends/tilegx_retval.c b/src/backends/tilegx_retval.c new file mode 100644 index 00000000..db81a20b --- /dev/null +++ b/src/backends/tilegx_retval.c @@ -0,0 +1,154 @@ +/* Function return value location for Linux/TILE-Gx ABI. + Copyright (C) 2012 Tilera Corporation + Copyright (C) 2014 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + + +/* r0. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 } + }; +#define nloc_intreg 1 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in r0. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + +int +tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + Dwarf_Attribute attr_mem, *attr; + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = DWARF_TAG_OR_RETURN (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + } + } + + /* Small enough structs are passed directly in registers R0 ... R7. */ + if (size <= 8) + { + intreg: + *locp = loc_intreg; + return nloc_intreg; + } + + /* Else fall through. */ + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_array_type: + case DW_TAG_string_type: + if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 8) + { + if (tag == DW_TAG_array_type) + { + Dwarf_Attribute attr_mem, *attr; + /* Check if it's a character array. */ + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = DWARF_TAG_OR_RETURN (typedie); + if (tag != DW_TAG_base_type) + goto aggregate; + if (dwarf_formudata (dwarf_attr_integrate (typedie, + DW_AT_byte_size, + &attr_mem), + &size) != 0) + return -1; + if (size != 1) + goto aggregate; + } + goto intreg; + } + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/src/backends/tilegx_symbol.c b/src/backends/tilegx_symbol.c new file mode 100644 index 00000000..b6533266 --- /dev/null +++ b/src/backends/tilegx_symbol.c @@ -0,0 +1,57 @@ +/* TILEGX-specific symbolic name handling. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +tilegx_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_TILEGX_64: + return ELF_T_SXWORD; + case R_TILEGX_32: + return ELF_T_SWORD; + case R_TILEGX_16: + return ELF_T_HALF; + case R_TILEGX_8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} diff --git a/src/backends/x86_64_cfi.c b/src/backends/x86_64_cfi.c index caaee44e..6db8ac44 100644 --- a/src/backends/x86_64_cfi.c +++ b/src/backends/x86_64_cfi.c @@ -1,27 +1,30 @@ /* x86-64 ABI-specified defaults for DWARF CFI. Copyright (C) 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/x86_64_corenote.c b/src/backends/x86_64_corenote.c index 552ac88b..f9d8db45 100644 --- a/src/backends/x86_64_corenote.c +++ b/src/backends/x86_64_corenote.c @@ -1,27 +1,30 @@ /* x86-64 specific core note handling. Copyright (C) 2005, 2007, 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/x86_64_init.c b/src/backends/x86_64_init.c index 32f32e02..b885558b 100644 --- a/src/backends/x86_64_init.c +++ b/src/backends/x86_64_init.c @@ -1,28 +1,31 @@ /* Initialization of x86-64 specific backend library. - Copyright (C) 2002-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2002-2009, 2013 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -57,6 +60,9 @@ x86_64_init (elf, machine, eh, ehlen) HOOK (eh, auxv_info); HOOK (eh, disasm); HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS. */ + eh->frame_nregs = 17; + HOOK (eh, set_initial_registers_tid); return MODVERSION; } diff --git a/src/backends/x86_64_initreg.c b/src/backends/x86_64_initreg.c new file mode 100644 index 00000000..db9216ed --- /dev/null +++ b/src/backends/x86_64_initreg.c @@ -0,0 +1,73 @@ +/* Fetch live process registers from TID. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdlib.h> +#ifdef __x86_64__ +# include <sys/user.h> +# include <sys/ptrace.h> +#endif + +#define BACKEND x86_64_ +#include "libebl_CPU.h" + +bool +x86_64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), + ebl_tid_registers_t *setfunc __attribute__ ((unused)), + void *arg __attribute__ ((unused))) +{ +#if !defined(__x86_64__) || !defined(__linux__) + return false; +#else /* __x86_64__ */ + struct user_regs_struct user_regs; + if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0) + return false; + Dwarf_Word dwarf_regs[17]; + dwarf_regs[0] = user_regs.rax; + dwarf_regs[1] = user_regs.rdx; + dwarf_regs[2] = user_regs.rcx; + dwarf_regs[3] = user_regs.rbx; + dwarf_regs[4] = user_regs.rsi; + dwarf_regs[5] = user_regs.rdi; + dwarf_regs[6] = user_regs.rbp; + dwarf_regs[7] = user_regs.rsp; + dwarf_regs[8] = user_regs.r8; + dwarf_regs[9] = user_regs.r9; + dwarf_regs[10] = user_regs.r10; + dwarf_regs[11] = user_regs.r11; + dwarf_regs[12] = user_regs.r12; + dwarf_regs[13] = user_regs.r13; + dwarf_regs[14] = user_regs.r14; + dwarf_regs[15] = user_regs.r15; + dwarf_regs[16] = user_regs.rip; + return setfunc (0, 17, dwarf_regs, arg); +#endif /* __x86_64__ */ +} diff --git a/src/backends/x86_64_regs.c b/src/backends/x86_64_regs.c index 8eb0d33f..2172d9f1 100644 --- a/src/backends/x86_64_regs.c +++ b/src/backends/x86_64_regs.c @@ -1,27 +1,30 @@ /* Register names and numbers for x86-64 DWARF. Copyright (C) 2005, 2006, 2007 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/x86_64_reloc.def b/src/backends/x86_64_reloc.def index ef302e55..8ed98f64 100644 --- a/src/backends/x86_64_reloc.def +++ b/src/backends/x86_64_reloc.def @@ -1,27 +1,30 @@ /* List the relocation types for x86-64. -*- C -*- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ /* NAME, REL|EXEC|DYN */ diff --git a/src/backends/x86_64_retval.c b/src/backends/x86_64_retval.c index ba772bb9..b3799ae0 100644 --- a/src/backends/x86_64_retval.c +++ b/src/backends/x86_64_retval.c @@ -1,27 +1,30 @@ /* Function return value location for Linux/x86-64 ABI. - Copyright (C) 2005-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + Copyright (C) 2005-2010, 2014 Red Hat, Inc. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -78,27 +81,10 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = dwarf_tag (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -109,9 +95,10 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); - tag = dwarf_tag (typedie); + tag = DWARF_TAG_OR_RETURN (typedie); } /* Fall through. */ @@ -119,16 +106,21 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 8; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + } + if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &attr_mem), diff --git a/src/backends/x86_64_symbol.c b/src/backends/x86_64_symbol.c index 97fd15b3..1622461d 100644 --- a/src/backends/x86_64_symbol.c +++ b/src/backends/x86_64_symbol.c @@ -1,28 +1,31 @@ /* x86_64 specific symbolic name handling. Copyright (C) 2002, 2005 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/x86_64_syscall.c b/src/backends/x86_64_syscall.c index c3db715d..0deb8bad 100644 --- a/src/backends/x86_64_syscall.c +++ b/src/backends/x86_64_syscall.c @@ -1,27 +1,30 @@ /* Linux/x86-64 system call ABI in DWARF register numbers. Copyright (C) 2008 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/src/backends/x86_corenote.c b/src/backends/x86_corenote.c index 78849a66..629462c3 100644 --- a/src/backends/x86_corenote.c +++ b/src/backends/x86_corenote.c @@ -1,27 +1,30 @@ /* x86-specific core note handling, pieces common to x86-64 and i386. Copyright (C) 2005-2010 Red Hat, Inc. - This file is part of Red Hat elfutils. + This file is part of elfutils. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of either - Red Hat elfutils is distributed in the hope that it will be useful, but + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - <http://www.openinventionnetwork.com>. */ + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ #define EXTRA_NOTES_IOPERM \ case NT_386_IOPERM: \ |