Skip to content
Snippets Groups Projects
  1. Sep 23, 2024
    • Matthieu Longo's avatar
      libgcc: hide CIE and FDE data for DWARF architecture extensions behind a handler. · bdf41d62
      Matthieu Longo authored
      This patch provides a new handler MD_ARCH_FRAME_STATE_T to hide an
      architecture-specific structure containing CIE and FDE data related
      to DWARF architecture extensions.
      
      Hiding the architecture-specific attributes behind a handler has the
      following benefits:
      1. isolating those data from the generic ones in _Unwind_FrameState
      2. avoiding casts to custom types.
      3. preserving typing information when debugging with GDB, and so
         facilitating their printing.
      
      This approach required to add a new header md-unwind-def.h included at
      the top of libgcc/unwind-dw2.h, and redirecting to the corresponding
      architecture header via a symbolic link.
      
      An obvious drawback is the increase in complexity with macros, and
      headers. It also caused a split of architecture definitions between
      md-unwind-def.h (types definitions used in unwind-dw2.h) and
      md-unwind.h (local types definitions and handlers implementations).
      The naming of md-unwind.h with .h extension is a bit misleading as
      the file is only included in the middle of unwind-dw2.c. Changing
      this naming would require modification of others backends, which I
      prefered to abstain from. Overall the benefits are worth the added
      complexity from my perspective.
      
      libgcc/ChangeLog:
      
      	* Makefile.in: New target for symbolic link to md-unwind-def.h
      	* config.host: New parameter md_unwind_def_header. Set it to
      	aarch64/aarch64-unwind-def.h for AArch64 targets, or no-unwind.h
      	by default.
      	* config/aarch64/aarch64-unwind.h
      	(aarch64_pointer_auth_key): Move to aarch64-unwind-def.h
      	(aarch64_cie_aug_handler): Update.
      	(aarch64_arch_extension_frame_init): Update.
      	(aarch64_demangle_return_addr): Update.
      	* configure.ac: New substitute variable md_unwind_def_header.
      	* unwind-dw2.h (defined): MD_ARCH_FRAME_STATE_T.
      	* config/aarch64/aarch64-unwind-def.h: New file.
      	* configure: Regenerate.
      	* config/no-unwind.h: Updated comment
      bdf41d62
    • Matthieu Longo's avatar
      aarch64: store signing key and signing method in DWARF _Unwind_FrameState · f5316739
      Matthieu Longo authored
      This patch is only a refactoring of the existing implementation
      of PAuth and returned-address signing. The existing behavior is
      preserved.
      
      _Unwind_FrameState already contains several CIE and FDE information
      (see the attributes below the comment "The information we care
      about from the CIE/FDE" in libgcc/unwind-dw2.h).
      The patch aims at moving the information from DWARF CIE (signing
      key stored in the augmentation string) and FDE (the used signing
      method) into _Unwind_FrameState along the already-stored CIE and
      FDE information.
      Note: those information have to be saved in frame_state_reg_info
      instead of _Unwind_FrameState as they need to be savable by
      DW_CFA_remember_state and restorable by DW_CFA_restore_state, that
      both rely on the attribute "prev".
      
      Those new information in _Unwind_FrameState simplifies the look-up
      of the signing key when the return address is demangled. It also
      allows future signing methods to be easily added.
      
      _Unwind_FrameState is not a part of the public API of libunwind,
      so the change is backward compatible.
      
      A new architecture-specific handler MD_ARCH_EXTENSION_FRAME_INIT
      allows to reset values (if needed) in the frame state and unwind
      context before changing the frame state to the caller context.
      
      A new architecture-specific handler MD_ARCH_EXTENSION_CIE_AUG_HANDLER
      isolates the architecture-specific augmentation strings in AArch64
      backend, and allows others architectures to reuse augmentation
      strings that would have clashed with AArch64 DWARF extensions.
      
      aarch64_demangle_return_addr, DW_CFA_AARCH64_negate_ra_state and
      DW_CFA_val_expression cases in libgcc/unwind-dw2-execute_cfa.h
      were documented to clarify where the value of the RA state register
      is stored (FS and CONTEXT respectively).
      
      libgcc/ChangeLog:
      
      	* config/aarch64/aarch64-unwind.h
      	(AARCH64_DWARF_RA_STATE_MASK): The mask for RA state register.
      	(aarch64_ra_signing_method_t): The diversifiers used to sign a
      	function's return address.
      	(aarch64_pointer_auth_key): The key used to sign a function's
      	return address.
      	(aarch64_cie_signed_with_b_key): Deleted as the signing key is
      	available now in _Unwind_FrameState.
      	(MD_ARCH_EXTENSION_CIE_AUG_HANDLER): New CIE augmentation string
      	handler for architecture extensions.
      	(MD_ARCH_EXTENSION_FRAME_INIT): New architecture-extension
      	initialization routine for DWARF frame state and context before
      	execution of DWARF instructions.
      	(aarch64_context_ra_state_get): Read RA state register from CONTEXT.
      	(aarch64_ra_state_get): Read RA state register from FS.
      	(aarch64_ra_state_set): Write RA state register into FS.
      	(aarch64_ra_state_toggle): Toggle RA state register in FS.
      	(aarch64_cie_aug_handler): Handler AArch64 augmentation strings.
      	(aarch64_arch_extension_frame_init): Initialize defaults for the
      	signing key (PAUTH_KEY_A), and RA state register (RA_no_signing).
      	(aarch64_demangle_return_addr): Rely on the frame registers and
      	the signing_key attribute in _Unwind_FrameState.
      	* unwind-dw2-execute_cfa.h:
      	Use the right alias DW_CFA_AARCH64_negate_ra_state for __aarch64__
      	instead of DW_CFA_GNU_window_save.
      	(DW_CFA_AARCH64_negate_ra_state): Save the signing method in RA
      	state register. Toggle RA state register without resetting 'how'
      	to REG_UNSAVED.
      	* unwind-dw2.c:
      	(extract_cie_info): Save the signing key in the current
      	_Unwind_FrameState while parsing the augmentation data.
      	(uw_frame_state_for): Reset some attributes related to architecture
      	extensions in _Unwind_FrameState.
      	(uw_update_context): Move authentication code to AArch64 unwinding.
      	* unwind-dw2.h (enum register_rule): Give a name to the existing
      	enum for the register rules, and replace 'unsigned char' by 'enum
      	register_rule' to facilitate debugging in GDB.
      	(_Unwind_FrameState): Add a new architecture-extension attribute
      	to store the signing key.
      f5316739
  2. Jan 03, 2024
  3. Jan 18, 2023
    • Wilco Dijkstra's avatar
      libgcc: Fix uninitialized RA signing on AArch64 [PR107678] · c98cd1df
      Wilco Dijkstra authored
      A recent change only initializes the regs.how[] during Dwarf unwinding
      which resulted in an uninitialized offset used in return address signing
      and random failures during unwinding.  The fix is to encode the return
      address signing state in REG_UNSAVED and a new state REG_UNSAVED_ARCHEXT.
      
      libgcc/
      	PR target/107678
      	* unwind-dw2.h (REG_UNSAVED_ARCHEXT): Add new enum.
      	* unwind-dw2.c (uw_update_context_1): Add REG_UNSAVED_ARCHEXT case.
      	* unwind-dw2-execute_cfa.h: Use REG_UNSAVED_ARCHEXT/REG_UNSAVED to
      	encode the return address signing state.
      	* config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr)
      	Check current return address signing state.
      	(aarch64_frob_update_contex): Remove.
      c98cd1df
  4. Jan 16, 2023
  5. Oct 17, 2022
    • Florian Weimer's avatar
      libgcc: Move cfa_how into potential padding in struct frame_state_reg_info · acdb2416
      Florian Weimer authored
      On many architectures, there is a padding gap after the how array
      member, and cfa_how can be moved there.  This reduces the size of the
      struct and the amount of memory that uw_frame_state_for has to clear.
      
      There is no measurable performance benefit from this on x86-64 (even
      though the memset goes from 120 to 112 bytes), but it seems to be a
      good idea to do anyway.
      
      libgcc/
      
      	* unwind-dw2.h (struct frame_state_reg_info): Move cfa_how member
      	and reduce its size.
      acdb2416
  6. Oct 06, 2022
    • Jakub Jelinek's avatar
      libgcc: Decrease size of _Unwind_FrameState and even more size of cleared area... · 146e4591
      Jakub Jelinek authored
      libgcc: Decrease size of _Unwind_FrameState and even more size of cleared area in uw_frame_state_for
      
      The following patch implements something that has Florian found as
      low hanging fruit in our unwinder and has been discussed in the
      https://gcc.gnu.org/wiki/cauldron2022#cauldron2022talks.inprocess_unwinding_bof
      talk.
      _Unwind_FrameState type seems to be (unlike the pre-GCC 3 frame_state
      which has been part of ABI) private to unwind-dw2.c + unwind.inc it
      includes, it is always defined on the stack of some entrypoints, initialized
      by static uw_frame_state_for and the address of it is also passed to other
      static functions or the static inlines handling machine dependent unwinding,
      but it isn't fortunately passed to any callbacks or public functions, so I
      think we can safely change it any time we want.
      Florian mentioned that the structure is large even on x86_64, 384 bytes
      there, starts with 328 bytes long element with frame_state_reg_info type
      which then starts with an array with __LIBGCC_DWARF_FRAME_REGISTERS__ + 1
      elements, each of them is 16 bytes long, on x86_64
      __LIBGCC_DWARF_FRAME_REGISTERS__ is just 17 but even that is big, on say
      riscv __LIBGCC_DWARF_FRAME_REGISTERS__ is I think 128, on powerpc 111,
      on sh 153 etc.  And, we memset to zero the whole fs variable with the
      _Unwind_FrameState type at the start of the unwinding.
      The reason why each element is 16 byte (on 64-bit arches) is that it
      contains some pointer or pointer sized integer and then an enum (with just
      7 different enumerators) + padding.
      
      The following patch decreases it by moving the enum into a separate
      array and using just one byte for each register in that second array.
      We could compress it even more, say 4 bits per register, but I don't
      want to uglify the code for it too much and make the accesses slower.
      Furthermore, the clearing of the object can clear only thos how array
      and members after it, because REG_UNSAVED enumerator (0) doesn't actually
      need any pointer or pointer sized integer, it is just the other kinds
      that need to have there something.
      By doing this, on x86_64 the above numbers change to _Unwind_FrameState
      type being now 264 bytes long, frame_state_reg_info 208 bytes and we
      don't clear the first 144 bytes of the object, so the memset is 120 bytes,
      so ~ 31% of the old clearing size.  On riscv 64-bit assuming it has same
      structure layout rules for the few types used there that would be
      ~ 2160 bytes of _Unwind_FrameState type before and ~ 1264 bytes after,
      with the memset previously ~ 2160 bytes and after ~ 232 bytes after.
      
      We've also talked about possibly adding a number of initially initialized
      regs and initializing the rest lazily, but at least for x86_64 with
      18 elements in the array that doesn't seem to be worth it anymore,
      especially because return address column is 16 there and that is usually the
      first thing to be touched.  It might theory help with lots of registers if
      they are usually untouched, but would uglify and complicate any stores to
      how by having to check there for the not initialized yet cases and lazy
      initialization, and similarly for all reads of how to do there if below
      last initialized one, use how, otherwise imply REG_UNSAVED.
      
      The disadvantage of the patch is that touching reg[x].loc and how[x]
      now means 2 cachelines rather than one as before, and I admit beyond
      bootstrap/regtest I haven't benchmarked it in any way.
      
      2022-10-06  Jakub Jelinek  <jakub@redhat.com>
      
      	* unwind-dw2.h (REG_UNSAVED, REG_SAVED_OFFSET, REG_SAVED_REG,
      	REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, REG_SAVED_VAL_EXP,
      	REG_UNDEFINED): New anonymous enum, moved from inside of
      	struct frame_state_reg_info.
      	(struct frame_state_reg_info): Remove reg[].how element and the
      	anonymous enum there.  Add how element.
      	* unwind-dw2.c: Include stddef.h.
      	(uw_frame_state_for): Don't clear first
      	offsetof (_Unwind_FrameState, regs.how[0]) bytes of *fs.
      	(execute_cfa_program, __frame_state_for, uw_update_context_1,
      	uw_update_context): Use fs->regs.how[X] instead of fs->regs.reg[X].how
      	or fs.regs.how[X] instead of fs.regs.reg[X].how.
      	* config/sh/linux-unwind.h (sh_fallback_frame_state): Likewise.
      	* config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise.
      	* config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise.
      	* config/pa/hpux-unwind.h (UPDATE_FS_FOR_SAR, UPDATE_FS_FOR_GR,
      	UPDATE_FS_FOR_FR, UPDATE_FS_FOR_PC, pa_fallback_frame_state):
      	Likewise.
      	* config/alpha/vms-unwind.h (alpha_vms_fallback_frame_state):
      	Likewise.
      	* config/alpha/linux-unwind.h (alpha_fallback_frame_state): Likewise.
      	* config/arc/linux-unwind.h (arc_fallback_frame_state,
      	arc_frob_update_context): Likewise.
      	* config/riscv/linux-unwind.h (riscv_fallback_frame_state): Likewise.
      	* config/nios2/linux-unwind.h (NIOS2_REG): Likewise.
      	* config/nds32/linux-unwind.h (NDS32_PUT_FS_REG): Likewise.
      	* config/s390/tpf-unwind.h (s390_fallback_frame_state): Likewise.
      	* config/s390/linux-unwind.h (s390_fallback_frame_state): Likewise.
      	* config/sparc/sol2-unwind.h (sparc64_frob_update_context,
      	MD_FALLBACK_FRAME_STATE_FOR): Likewise.
      	* config/sparc/linux-unwind.h (sparc64_fallback_frame_state,
      	sparc64_frob_update_context, sparc_fallback_frame_state): Likewise.
      	* config/i386/sol2-unwind.h (x86_64_fallback_frame_state,
      	x86_fallback_frame_state): Likewise.
      	* config/i386/w32-unwind.h (i386_w32_fallback_frame_state): Likewise.
      	* config/i386/linux-unwind.h (x86_64_fallback_frame_state,
      	x86_fallback_frame_state): Likewise.
      	* config/i386/freebsd-unwind.h (x86_64_freebsd_fallback_frame_state):
      	Likewise.
      	* config/i386/dragonfly-unwind.h
      	(x86_64_dragonfly_fallback_frame_state): Likewise.
      	* config/i386/gnu-unwind.h (x86_gnu_fallback_frame_state): Likewise.
      	* config/csky/linux-unwind.h (csky_fallback_frame_state): Likewise.
      	* config/aarch64/linux-unwind.h (aarch64_fallback_frame_state):
      	Likewise.
      	* config/aarch64/freebsd-unwind.h
      	(aarch64_freebsd_fallback_frame_state): Likewise.
      	* config/aarch64/aarch64-unwind.h (aarch64_frob_update_context):
      	Likewise.
      	* config/or1k/linux-unwind.h (or1k_fallback_frame_state): Likewise.
      	* config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise.
      	* config/loongarch/linux-unwind.h (loongarch_fallback_frame_state):
      	Likewise.
      	* config/m68k/linux-unwind.h (m68k_fallback_frame_state): Likewise.
      	* config/xtensa/linux-unwind.h (xtensa_fallback_frame_state):
      	Likewise.
      	* config/rs6000/darwin-fallback.c (set_offset): Likewise.
      	* config/rs6000/aix-unwind.h (MD_FROB_UPDATE_CONTEXT): Likewise.
      	* config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Likewise.
      	* config/rs6000/freebsd-unwind.h (frob_update_context): Likewise.
      146e4591
  7. Jan 03, 2022
  8. Jan 04, 2021
  9. Jan 01, 2020
  10. Jan 01, 2019
  11. Jan 03, 2018
  12. Jan 01, 2017
  13. Jan 04, 2016
  14. Jan 05, 2015
  15. Sep 05, 2014
    • Joseph Myers's avatar
      Use -fbuilding-libgcc for more target macros used in libgcc. · 53d68b9f
      Joseph Myers authored
      gcc/c-family:
      	* c-cppbuiltin.c (c_cpp_builtins): Also define
      	__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__,
      	__LIBGCC_EH_FRAME_SECTION_NAME__, __LIBGCC_JCR_SECTION_NAME__,
      	__LIBGCC_CTORS_SECTION_ASM_OP__, __LIBGCC_DTORS_SECTION_ASM_OP__,
      	__LIBGCC_TEXT_SECTION_ASM_OP__, __LIBGCC_INIT_SECTION_ASM_OP__,
      	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__,
      	__LIBGCC_STACK_GROWS_DOWNWARD__,
      	__LIBGCC_DONT_USE_BUILTIN_SETJMP__,
      	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__,
      	__LIBGCC_DWARF_FRAME_REGISTERS__,
      	__LIBGCC_EH_RETURN_STACKADJ_RTX__, __LIBGCC_JMP_BUF_SIZE__,
      	__LIBGCC_STACK_POINTER_REGNUM__ and
      	__LIBGCC_VTABLE_USES_DESCRIPTORS__ for -fbuilding-libgcc.
      	(builtin_define_with_value): Handle backslash-escaping in string
      	macro values.
      
      libgcc:
      	* Makefile.in (CRTSTUFF_CFLAGS): Add -fbuilding-libgcc.
      	* config/aarch64/linux-unwind.h (STACK_POINTER_REGNUM): Change all
      	uses to __LIBGCC_STACK_POINTER_REGNUM__.
      	(DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
      	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	* config/alpha/vms-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
      	Change use to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	* config/cr16/unwind-cr16.c (STACK_GROWS_DOWNWARD): Change all
      	uses to __LIBGCC_STACK_GROWS_DOWNWARD__.
      	(DWARF_FRAME_REGISTERS): Change all uses to
      	__LIBGCC_DWARF_FRAME_REGISTERS__.
      	(EH_RETURN_STACKADJ_RTX): Change all uses to
      	__LIBGCC_EH_RETURN_STACKADJ_RTX__.
      	* config/cr16/unwind-dw2.h (DWARF_FRAME_REGISTERS): Change use to
      	__LIBGCC_DWARF_FRAME_REGISTERS__.  Remove conditional definition.
      	* config/i386/cygming-crtbegin.c (EH_FRAME_SECTION_NAME): Change
      	use to __LIBGCC_EH_FRAME_SECTION_NAME__.
      	(JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__.
      	* config/i386/cygming-crtend.c (EH_FRAME_SECTION_NAME): Change use
      	to __LIBGCC_EH_FRAME_SECTION_NAME__.
      	(JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__
      	* config/mips/linux-unwind.h (STACK_POINTER_REGNUM): Change use to
      	__LIBGCC_STACK_POINTER_REGNUM__.
      	(DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
      	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	* config/nios2/linux-unwind.h (STACK_POINTER_REGNUM): Change use
      	to __LIBGCC_STACK_POINTER_REGNUM__.
      	* config/pa/hpux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
      	all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	* config/pa/linux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
      	all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	* config/rs6000/aix-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
      	Change all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
      	(STACK_POINTER_REGNUM): Change all uses to
      	__LIBGCC_STACK_POINTER_REGNUM__.
      	* config/rs6000/darwin-fallback.c (STACK_POINTER_REGNUM): Change
      	use to __LIBGCC_STACK_POINTER_REGNUM__.
      	* config/rs6000/linux-unwind.h (STACK_POINTER_REGNUM): Change all
      	uses to __LIBGCC_STACK_POINTER_REGNUM__.
      	* config/sparc/linux-unwind.h (DWARF_FRAME_REGISTERS): Change use
      	to __LIBGCC_DWARF_FRAME_REGISTERS__.
      	* config/sparc/sol2-unwind.h (DWARF_FRAME_REGISTERS): Change use
      	to __LIBGCC_DWARF_FRAME_REGISTERS__.
      	* config/tilepro/linux-unwind.h (STACK_POINTER_REGNUM): Change use
      	to __LIBGCC_STACK_POINTER_REGNUM__.
      	* config/xtensa/unwind-dw2-xtensa.h (DWARF_FRAME_REGISTERS):
      	Remove conditional definition.
      	* crtstuff.c (TEXT_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_TEXT_SECTION_ASM_OP__.
      	(EH_FRAME_SECTION_NAME): Change all uses to
      	__LIBGCC_EH_FRAME_SECTION_NAME__.
      	(EH_TABLES_CAN_BE_READ_ONLY): Change all uses to
      	__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__.
      	(CTORS_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_CTORS_SECTION_ASM_OP__.
      	(DTORS_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_DTORS_SECTION_ASM_OP__.
      	(JCR_SECTION_NAME): Change all uses to
      	__LIBGCC_JCR_SECTION_NAME__.
      	(INIT_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_INIT_SECTION_ASM_OP__.
      	(INIT_ARRAY_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
      	* generic-morestack.c (STACK_GROWS_DOWNWARD): Change all uses to
      	__LIBGCC_STACK_GROWS_DOWNWARD__.
      	* libgcc2.c (INIT_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_INIT_SECTION_ASM_OP__.
      	(INIT_ARRAY_SECTION_ASM_OP): Change all uses to
      	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
      	(EH_FRAME_SECTION_NAME): Change all uses to
      	__LIBGCC_EH_FRAME_SECTION_NAME__.
      	* libgcov-profiler.c (VTABLE_USES_DESCRIPTORS): Remove conditional
      	definitions.  Change all uses to
      	__LIBGCC_VTABLE_USES_DESCRIPTORS__.
      	* unwind-dw2.c (STACK_GROWS_DOWNWARD): Change all uses to
      	__LIBGCC_STACK_GROWS_DOWNWARD__.
      	(DWARF_FRAME_REGISTERS): Change all uses to
      	__LIBGCC_DWARF_FRAME_REGISTERS__.
      	(EH_RETURN_STACKADJ_RTX): Change all uses to
      	__LIBGCC_EH_RETURN_STACKADJ_RTX__.
      	* unwind-dw2.h (DWARF_FRAME_REGISTERS): Remove conditional
      	definition.  Change use to __LIBGCC_DWARF_FRAME_REGISTERS__.
      	* unwind-sjlj.c (DONT_USE_BUILTIN_SETJMP): Change all uses to
      	__LIBGCC_DONT_USE_BUILTIN_SETJMP__.
      	(JMP_BUF_SIZE): Change use to __LIBGCC_JMP_BUF_SIZE__.
      
      From-SVN: r214954
      53d68b9f
  16. Jan 02, 2014
  17. Feb 04, 2013
  18. Aug 05, 2011
    • Rainer Orth's avatar
      Makefile.in (UNWIND_H): Remove. · 201cdb74
      Rainer Orth authored
      	gcc:
      	* Makefile.in (UNWIND_H): Remove.
      	(LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): Move to
      	../libgcc/Makefile.in.
      	(LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL): Likewise.
      	(LIBUNWINDDEP): Remove.
      	(libgcc-support): Remove LIB2ADDEH, $(srcdir)/emutls.c dependencies.
      	(libgcc.mvars): Remove LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED,
      	LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL.
      	(stmp-int-hdrs): Remove $(UNWIND_H) dependency.
      	Don't copy $(UNWIND_H).
      	* config.gcc (ia64*-*-linux*): Remove with_system_libunwind
      	handling.
      	* configure.ac (GCC_CHECK_UNWIND_GETIPINFO): Remove.
      	* aclocal.m4: Regenerate.
      	* configure: Regenerate.
      	* emutls.c, unwind-c.c, unwind-compat.c, unwind-compat.h,
      	unwind-dw2-fde-compat.c, unwind-dw2-fde-glibc.c, unwind-dw2-fde.c,
      	unwind-dw2-fde.h, unwind-dw2.c, unwind-dw2.h, unwind-generic.h,
      	unwind-pe.h, unwind-sjlj.c, unwind.inc: Move to ../libgcc.
      	* unwind-dw2-fde-darwin.c: Move to ../libgcc/config.
      	* config/arm/libunwind.S, config/arm/pr-support.c,
      	config/arm/unwind-arm.c, config/arm/unwind-arm.h: Move to
      	../libgcc/config/arm.
      	* config/arm/t-bpabi (UNWIND_H, LIB2ADDEH): Remove.
      	* config/arm/t-symbian (UNWIND_H, LIB2ADDEH): Remove.
      	* config/frv/t-frv ($(T)frvbegin$(objext)): Use
      	$(srcdir)/../libgcc to refer to unwind-dw2-fde.h.
      	($(T)frvend$(objext)): Likewise.
      	* config/ia64/t-glibc (LIB2ADDEH): Remove.
      	* config/ia64/t-glibc-libunwind: Move to ../libgcc/config/ia64.
      	* config/ia64/fde-glibc.c, config/ia64/fde-vms.c,
      	config/ia64/unwind-ia64.c, config/ia64/unwind-ia64.h: Move to
      	../libgcc/config/ia64.
      	* config/ia64/t-hpux (LIB2ADDEH): Remove.
      	* config/ia64/t-ia64 (LIB2ADDEH): Remove.
      	* config/ia64/t-vms (LIB2ADDEH): Remove.
      	* config/ia64/vms.h (UNW_IVMS_MODE,
      	MD_UNW_COMPATIBLE_PERSONALITY_P): Remove.
      	* config/picochip/t-picochip (LIB2ADDEH): Remove.
      	* config/rs6000/aix.h (R_LR, MD_FROB_UPDATE_CONTEXT): Remove.
      	* config/rs6000/t-darwin (LIB2ADDEH): Remove.
      	* config/rs6000/darwin-fallback.c: Move to ../libgcc/config/rs6000.
      	* config/sh/t-sh ($(T)unwind-dw2-Os-4-200.o): Use
      	$(srcdir)/../libgcc to refer to unwinder sources.
      	* config/spu/t-spu-elf (LIB2ADDEH): Remove.
      	* config/t-darwin (LIB2ADDEH): Remove.
      	* config/t-freebsd (LIB2ADDEH): Remove.
      	* config/t-libunwind (LIB2ADDEH, LIB2ADDEHSTATIC): Remove.
      	* config/t-libunwind-elf: Move to ../libgcc/config.
      	* config/t-linux (LIB2ADDEH): Remove.
      	* config/t-sol2 (LIB2ADDEH): Remove.
      	* config/xtensa/t-xtensa (LIB2ADDEH): Remove.
      	* system.h (MD_FROB_UPDATE_CONTEXT): Poison.
      
      	gcc/po:
      	* EXCLUDES (unwind-c.c, unwind-dw2-fde-darwin.c)
      	(unwind-dw2-fde-glibc.c, unwind-dw2-fde.c, unwind-dw2-fde.h)
      	(unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h): Remove.
      
      	libgcc:
      	* Makefile.in (LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): New
      	variables.
      	(LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL): New variables.
      	(LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): Add $(srcdir)/emutls.c.
      	(install-unwind_h): New target.
      	(all): Depend on it.
      	* config.host (unwind_header): New variable.
      	(*-*-freebsd*): Set tmake_file to t-eh-dw2-dip.
      	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
      	*-*-gnu*): Likewise, also for *-*-kopensolaris*-gnu.
      	(*-*-solaris2*): Add t-eh-dw2-dip to tmake_file.
      	(arm*-*-linux*): Add arm/t-bpabi for arm*-*-linux-*eabi.
      	Set unwind_header.
      	(arm*-*-uclinux*): Add arm/t-bpabi for arm*-*-uclinux*eabi.
      	Set unwind_header.
      	(arm*-*-eabi*, arm*-*-symbianelf*): Add arm/t-bpabi for
      	arm*-*-eabi*.
      	Add arm/t-symbian to tmake_file for arm*-*-symbianelf*.
      	Set unwind_header.
      	(ia64*-*-elf*): Add ia64/t-eh-ia64 to tmake_file.
      	(ia64*-*-freebsd*): Likewise.
      	(ia64*-*-linux*): Add ia64/t-glibc, ia64/t-eh-ia64, t-libunwind to
      	tmake_file.
      	Add t-libunwind-elf, ia64/t-glibc-libunwind unless
      	$with_system_libunwind.
      	(ia64*-*-hpux*): Set tmake_file.
      	(ia64-hp-*vms*): Add ia64/t-eh-ia64 to tmake_file.
      	(picochip-*-*): Set tmake_file.
      	(rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Set
      	md_unwind_header.
      	(rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
      	(rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise.
      	(s390x-ibm-tpf*): Add t-eh-dw2-dip to tmake_file.
      	(xtensa*-*-elf*): Set tmake_file.
      	(xtensa*-*-linux*): Likewise.
      	* configure.ac: Include ../config/unwind_ipinfo.m4.
      	Call GCC_CHECK_UNWIND_GETIPINFO.
      	Link unwind.h to $unwind_header.
      	* configure: Regenerate.
      	* emutls.c, unwind-c.c, unwind-compat.c, unwind-compat.h,
      	unwind-dw2-fde-compat.c, unwind-dw2-fde-dip.c, unwind-dw2-fde.c,
      	unwind-dw2-fde.h, unwind-dw2.c, unwind-dw2.h, unwind-generic.h,
      	unwind-pe.h, unwind-sjlj.c, unwind.inc: New files.
      	* config/unwind-dw2-fde-darwin.c: New file.
      	* config/arm/libunwind.S, config/arm/pr-support.c,
      	config/arm/t-bpabi, config/arm/t-symbian, config/arm/unwind-arm.c,
      	config/arm/unwind-arm.h,: New files.
      	* config/ia64/fde-glibc.c, config/ia64/fde-vms.c,
      	config/ia64/t-eh-ia64, config/ia64/t-glibc,
      	config/ia64/t-glibc-libunwind, config/ia64/t-hpux,
      	config/ia64/t-vms, config/ia64/unwind-ia64.c,
      	config/ia64/unwind-ia64.h: New files.
      	* config/picochip/t-picochip: New file.
      	* config/rs6000/aix-unwind.h, config/rs6000/darwin-fallback.c: New
      	files.
      	* config/rs6000/t-darwin (LIB2ADDEH): Set.
      	* config/s390/t-tpf (LIB2ADDEH): Remove.
      	* config/t-darwin (LIB2ADDEH): Set.
      	* config/t-eh-dw2-dip: New file.
      	* config/t-libunwind, config/t-libunwind-elf: New files.
      	* config/t-sol2 (LIB2ADDEH): Remove.
      	* config/xtensa/t-xtensa: New file.
      
      	gcc/ada:
      	* gcc-interface/Makefile.in (raise-gcc.o): Search
      	$(srcdir)/../libgcc.
      
      	libgo:
      	* Makefile.am (AM_CFLAGS): Search $(srcdir)/../libgcc.
      	* Makefile.in: Regenerate.
      
      	libjava:
      	* configure.ac (GCC_UNWIND_INCLUDE): Rename to
      	LIBGCC_UNWIND_INCLUDE.
      	Point to $(multi_basedir)/./libjava/../libgcc.
      	* configure: Regenerate.
      	* Makefile.am (GCC_UNWIND_INCLUDE): Reflect this.
      	* Makefile.in: Regenerate.
      
      	libobjc:
      	* Makefile.in (INCLUDES): Search
      	$(srcdir)/$(MULTISRCTOP)../libgcc.
      
      	libstdc++-v3:
      	* acinclude.m4 (GLIBCXX_EXPORT_INCLUDES): Point TOPLEVEL_INCLUDES
      	to $(toplevel_srcdir)/libgcc.
      	* configure: Regenerate.
      
      From-SVN: r177447
      201cdb74
  19. Apr 09, 2009
  20. Apr 04, 2009
    • Jakub Jelinek's avatar
      unwind-dw2.h (_Unwind_FrameState): Add REG_UNDEFINED enum value. · 54f5943c
      Jakub Jelinek authored
      	* unwind-dw2.h (_Unwind_FrameState): Add REG_UNDEFINED enum value.
      	* unwind-dw2.c (execute_cfa_program): Set how to REG_UNDEFINED
      	instead of REG_UNSAVED for DW_CFA_undefined.
      	(uw_update_context_1): Handle REG_UNDEFINED the same as REG_UNSAVED.
      	(uw_update_context): If RA column is REG_UNDEFINED, mark it as
      	outermost frame.
      
      From-SVN: r145535
      54f5943c
  21. Oct 26, 2006
    • Nathan Froyd's avatar
      unwind-dw2.h: Move cfa-related variables into struct frame_state_reg_info to ensure that the... · 6673f90b
      Nathan Froyd authored
      	* gcc/unwind-dw2.h: Move cfa-related variables into
      	struct frame_state_reg_info to ensure that the CFA is properly
      	handled when executing DW_CFA_{remember,restore}_state.
      	* gcc/unwind-dw2.c, gcc/config/alpha/linux-unwind.h,
      	gcc/config/alpha/vms-unwind.h, gcc/config/s390/tpf-unwind.h
      	gcc/config/s390/linux-unwind.h, gcc/config/sparc/linux-unwind.h
      	gcc/config/i386/linux-unwind.h, gcc/config/sh/linux-unwind.h
      	gcc/config/rs6000/linux-unwind.h,
      	gcc/config/rs6000/darwin-fallback.c, gcc/config/pa/linux-unwind.h,
      	gcc/config/pa/hpux-unwind.h, gcc/config/mips/linux-unwind.h:
      	Modify to use new cfa_* fields.
      
      From-SVN: r118068
      6673f90b
  22. Mar 04, 2006
    • Jakub Jelinek's avatar
      unwind-dw2.h (_Unwind_FrameState): Add REG_SAVED_VAL_OFFSET and REG_SAVED_VAL_EXP constants. · 4469af7a
      Jakub Jelinek authored
      	* unwind-dw2.h (_Unwind_FrameState): Add REG_SAVED_VAL_OFFSET
      	and REG_SAVED_VAL_EXP constants.
      	* unwind-dw2.c (struct _Unwind_Context): Add by_value array.
      	(_Unwind_GetGR, _Unwind_SetGR, _Unwind_GetGRPtr, _Unwind_SetGRPtr):
      	Handle regs stored by value.
      	(_Unwind_SetGRValue, _Unwind_GRByValue): New functions.
      	(execute_cfa_program): Handle DW_CFA_val_offset,
      	DW_CFA_val_offset_sf and DW_CFA_val_expression.
      	(uw_update_context_1): Handle REG_SAVED_REG with regs stored by
      	value specially.  Handle REG_SAVED_VAL_OFFSET and REG_SAVED_VAL_EXP.
      	(uw_install_context_1): Handle target regs stored by value.
      
      	* gcc.target/i386/cleanup-1.c: New test.
      	* gcc.target/i386/cleanup-2.c: New test.
      
      From-SVN: r111705
      4469af7a
  23. Feb 27, 2006
    • Jakub Jelinek's avatar
      re PR other/26208 (Serious problem with unwinding through signal frames) · 754e45a8
      Jakub Jelinek authored
      	PR other/26208
      	* unwind-dw2.c (struct _Unwind_Context): Add signal_frame field.
      	(extract_cie_info): Handle S flag in augmentation string.
      	(execute_cfa_program): If context->signal_frame, execute also
      	fs->pc == context->ra instructions.
      	(uw_frame_state_for): If context->signal_frame, don't subtract one
      	from context->ra to find FDE.
      	(uw_update_context_1): Set context->signal_frame to
      	fs->signal_frame.
      	(_Unwind_GetIPInfo): New function.
      	* unwind-dw2.h (_Unwind_FrameState): Add signal_frame field.
      	* unwind-c.c (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
      	of _Unwind_GetIP.
      	* unwind-sjlj.c (_Unwind_GetIPInfo): New function.
      	* unwind-generic.h (_Unwind_GetIPInfo): New prototype.
      	* unwind-compat.c (_Unwind_GetIPInfo): New function.
      	* libgcc-std.ver (_Unwind_GetIPInfo): Export @@GCC_4.2.0.
      	* config/ia64/unwind-ia64.c (_Unwind_GetIPInfo): New function.
      	* config/arm/unwind-arm.h (_Unwind_GetIPInfo): Define.
      	* config/i386/linux-unwind.h (x86_fallback_frame_state,
      	x86_64_fallback_frame_state): Set fs->signal_frame.
      	* config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Likewise.
      	(MD_FROB_UPDATE_CONTEXT): Define unconditionally.
      	(frob_update_context): Likewise.  Workaround missing S flag in
      	Linux 2.6.12 - 2.6.16 kernel vDSOs.
      	* config/s390/linux-unwind.h (s390_fallback_frame_state): Likewise.
      	Remove the psw_addr + 1 hack.
      libjava/
      	* exception.cc (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
      	of _Unwind_GetIP.
      	* include/i386-signal.h (MAKE_THROW_FRAME): Change into empty macro.
      	(HANDLE_DIVIDE_OVERFLOW): Don't adjust _res->eip if falling through
      	to throw.
      	* include/x86_64-signal.h (MAKE_THROW_FRAME): Change into empty
      	macro.
      	* include/powerpc-signal.h (MAKE_THROW_FRAME): Change into empty
      	macro.
      libstdc++-v3/
      	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Use
      	_Unwind_GetIPInfo instead of _Unwind_GetIP.
      
      From-SVN: r111488
      754e45a8
  24. Jun 25, 2005
  25. Jul 01, 2004
    • Geoffrey Keating's avatar
      Index: gcc/ChangeLog · f8a57be8
      Geoffrey Keating authored
      2004-06-28  Geoffrey Keating  <geoffk@apple.com>
      	    Andreas Tobler  <a.tobler@schweiz.ch>
      
      	PR 15813
      	* dwarf2out.c (reg_save): Output DW_CFA_same_value when a
      	register is saved in itself.
      	(initial_return_save): If the return address is a register,
      	it's already there, don't bother to mention it in the CFI.
      	(struct queued_reg_save): Add field saved_reg.
      	(struct reg_saved_in_data): New.
      	(regs_saved_in_regs): New.
      	(num_regs_saved_in_regs): New.
      	(queue_reg_save): Add extra parameter to specify register saved
      	in register.  Remove duplicate entries from queue.  Add comment
      	for function.
      	(flush_queued_reg_saves): Handle registers saved in registers.
      	Update regs_saved_in_regs.  Add comment for function.
      	(clobbers_queued_reg_save): Add comment for function.  Allow
      	for regs_saved_in_regs.
      	(reg_saved_in): New.
      	(dwarf2out_frame_debug_expr): Handle saving registers in other
      	registers.
      	(dwarf2out_frame_debug): Reset regs_saved_in_regs.
      	* unwind-dw2.c (execute_cfa_program): Correct handling of
      	DW_CFA_same_value.  Add FIXME comment about incorrect implementation
      	of DW_CFA_restore_extended.
      	* config/rs6000/rs6000.c (rs6000_emit_prologue): Let
      	dwarf2out_frame_debug_expr see instructions that save registers
      	in other registers or save those other registers in memory.
      
      	* unwind-dw2.c (DWARF_FRAME_REGISTERS): Move to unwind-dw2.h.
      	(_Unwind_FrameState): Likewise.
      	* unwind-dw2.h: New.
      	* Makefile.in (LIB2ADDEHDEP): Add unwind-dw2.h.
      	* config/rs6000/darwin-fallback.c: New file.
      	* config/rs6000/darwin.h (MD_FALLBACK_FRAME_STATE_FOR): Define.
      	* config/rs6000/t-darwin (LIB2FUNCS_EXTRA): Add darwin-fallback.o.
      
      Index: gcc/testsuite/ChangeLog
      2004-06-26  Geoffrey Keating  <geoffk@apple.com>
      	    Andreas Tobler  <a.tobler@schweiz.ch>
      
      	* gcc.dg/cleanup-10.c: Run on all Linux platforms and powerpc-darwin.
      	Use SA_RESETHAND rather than SA_ONESHOT.  Trap SIGBUS as well
      	as SIGSEGV.
      	* gcc.dg/cleanup-11.c: Likewise.
      	* gcc.dg/cleanup-8.c: Likewise.
      	* gcc.dg/cleanup-9.c: Likewise.
      	* gcc.dg/cleanup-5.c: Run on all platforms.
      
      Index: libjava/ChangeLog
      2004-06-26  Geoffrey Keating  <geoffk@apple.com>
      	    Andreas Tobler  <a.tobler@schweiz.ch>
      
      	* configure.host (powerpc-*-darwin*): New case, define
      	can_unwind_signal.
      	* configure.in (*-*-darwin*): New case, point to darwin-signal.h.
      	* configure: Regenerate.
      	* include/darwin-signal.h: New.
      
      Co-Authored-By: default avatarAndreas Tobler <a.tobler@schweiz.ch>
      
      From-SVN: r83953
      f8a57be8
Loading