public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Matthias Klose <doko@ubuntu.com>
To: Paul Brook <paul@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, GCC Java <java@gcc.gnu.org>,
	       Nicola Pero <nicola.pero@meta-innovation.com>
Subject: Re: [patch] C6X unwinding/exception handling
Date: Sun, 09 Oct 2011 11:10:00 -0000	[thread overview]
Message-ID: <4E9180F5.3050203@ubuntu.com> (raw)
In-Reply-To: <201109131348.13087.paul@codesourcery.com>

This did break libobjc and libjava on arm-linux-gnueabi.

libobjc now has an undefined reference to _Unwind_decode_target2, which can be
avoided with

--- libobjc/exception.c.orig    2011-07-21 15:33:57.000000000 +0000
+++ libobjc/exception.c 2011-10-09 10:53:12.554940776 +0000
@@ -182,7 +182,7 @@
   _Unwind_Ptr ptr;

   ptr = (_Unwind_Ptr) (info->TType - (i * 4));
-  ptr = _Unwind_decode_target2 (ptr);
+  ptr = _Unwind_decode_typeinfo_ptr (info->ttype_base, (_Unwind_Word) ptr);

   /* NULL ptr means catch-all.  Note that if the class is not found,
      this will abort the program.  */

libjava fails to build, the same change doesn't work for libjava/exception.cc,
because the struct lsda_header_info in exception.cc is missing the ttype_base
member. Any suggestions?

On 09/13/2011 02:48 PM, Paul Brook wrote:
>> C6X uses an unwinding/exception handling echeme very similar to that
>> defined by the ARM EABI.  The core of the unwinder is the same, so I've
>> pulled it out into a common file.
>>
>> Other than the obvious target specific bits, the main compiler visible
>> difference is that the C6X assembler generates the unwinding tables from
>> DWARF .cfi directives, rather than the separate set of directives used by
>> the ARM assembler.
>>
>> The libstdc++ changes probably deserve a bit of explanation. The ttype_base
>> field was clearly used in an early draft of the ARM EABI, and the current
>> ARM definition is a compatible subset of that used by C6X.
>> _GLIBCXX_OVERRIDE_TTYPE_ENCODING is an unfortunate hack because when doing
>> the ARM implementation I failed to realise ttype_encoding was the same
>> thing as R_ARM_TARGET2.  We now have a lot of ARM binaries floating around
>> with that field set incorrectly, so it's either this or an ABI bump.
> 
> I've updated the patch to accomodate the move to libgcc/, done a quick sanity 
> recheck of arm-linux and c6x-elf and applied to svn.
> 
> P.S. in case it's not clear from my description, the libstdc++ changes aren't 
> really a new hack, it's just making an old one more obvious.
> 
> Paul
> 
> 2011-09-13  Paul Brook  <paul@codesourcery.com>
>  
> 	gcc/
> 	* config/arm/arm.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
> 	(ARM_TARGET2_DWARF_FORMAT): Provide default definition.
> 	* config/arm/linux-eabi.h (ARM_TARGET2_DWARF_FORMAT): Define.
> 	* config/arm/symbian.h (ARM_TARGET2_DWARF_FORMAT): Define.
> 	* config/arm/uclinux-eabi.h(ARM_TARGET2_DWARF_FORMAT): Define.
> 	* config/arm/t-bpabi (EXTRA_HEADERS): Add unwind-arm-common.h.
> 	* config/arm/t-symbian (EXTRA_HEADERS): Add unwind-arm-common.h.
> 	* config/c6x/c6x.c (c6x_output_file_unwind): Don't rely on dwarf2 code
> 	enabling unwind tables.
> 	(c6x_debug_unwind_info): New function.
> 	(TARGET_ARM_EABI_UNWINDER): Define.
> 	(TARGET_DEBUG_UNWIND_INFO): Define.
> 	* config/c6x/c6x.h (DWARF_FRAME_RETURN_COLUMN): Define.
> 	(TARGET_EXTRA_CFI_SECTION): Remove.
> 	* config/c6x/t-c6x-elf (EXTRA_HEADERS): Set.
> 	* ginclude/unwind-arm-common.h: New file.
> 
> 	libgcc/
> 	* config.host (tic6x-*-*): Add c6x/t-c6x-elf.  Set unwind_header.
> 	* unwind-c.c (PERSONALITY_FUNCTION): Use UNWIND_POINTER_REG.
> 	* unwind-arm-common.inc: New file.
> 	* config/arm/unwind-arm.c: Use unwind-arm-common.inc.
> 	* config/arm/unwind-arm.h: Use unwind-arm-common.h.
> 	(_GLIBCXX_OVERRIDE_TTYPE_ENCODING): Define.
> 	* config/c6x/libunwind.S: New file.
> 	* config/c6x/pr-support.c: New file.
> 	* config/c6x/unwind-c6x.c: New file.
> 	* config/c6x/unwind-c6x.h: New file.
> 	* config/c6x/t-c6x-elf: New file.
> 
> 
> 	libstdc++-v3/
> 	* libsupc++/eh_arm.cc (__cxa_end_cleanup): Add C6X implementation.
> 	* libsupc++/eh_call.cc (__cxa_call_unexpected): Set rtti_base.
> 	* libsupc++/eh_personality.cc (NO_SIZE_OF_ENCODED_VALUE): Remove
> 	__ARM_EABI_UNWINDER__ check.
> 	(parse_lsda_header): Check _GLIBCXX_OVERRIDE_TTYPE_ENCODING.
> 	(get_ttype_entry): Use generic implementation on ARM EABI.
> 	(check_exception_spec): Use _Unwind_decode_typeinfo_ptr and
> 	UNWIND_STACK_REG.
> 	(PERSONALITY_FUNCTION): Set ttype_base.

       reply	other threads:[~2011-10-09 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201108041531.58790.paul@codesourcery.com>
     [not found] ` <201109131348.13087.paul@codesourcery.com>
2011-10-09 11:10   ` Matthias Klose [this message]
2011-10-10 10:33     ` Andrew Haley
2011-10-10 11:27       ` Matthias Klose
2011-10-10 12:23         ` Paul Brook
2011-10-17 11:01           ` Matthias Klose
2011-10-17 11:21             ` Andrew Haley
2011-10-17 11:27               ` Matthias Klose
2011-10-17 13:49             ` Paul Brook
2011-10-17 14:11               ` Nicola Pero
2011-10-20 12:29                 ` Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9180F5.3050203@ubuntu.com \
    --to=doko@ubuntu.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java@gcc.gnu.org \
    --cc=nicola.pero@meta-innovation.com \
    --cc=paul@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).