Changeset e8261bb


Ignore:
Timestamp:
Jun 7, 2021, 11:03:24 PM (3 years ago)
Author:
Henry Xue <y58xue@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
53d34343
Parents:
dac16a0
Message:

Preliminary ARM exception handling support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.c

    rdac16a0 re8261bb  
    2727#include "stdhdr/assert.h"
    2828#include "virtual.h"
    29 
    30 #if defined( __ARM_ARCH )
    31 #warning FIX ME: temporary hack to keep ARM build working
    32 #ifndef _URC_FATAL_PHASE1_ERROR
    33 #define _URC_FATAL_PHASE1_ERROR 3
    34 #endif // ! _URC_FATAL_PHASE1_ERROR
    35 #ifndef _URC_FATAL_PHASE2_ERROR
    36 #define _URC_FATAL_PHASE2_ERROR 2
    37 #endif // ! _URC_FATAL_PHASE2_ERROR
    38 #endif // __ARM_ARCH
    39 
    4029#include "lsda.h"
    4130
     
    301290}
    302291
    303 #if defined( __x86_64 ) || defined( __i386 )
     292#if defined( __x86_64 ) || defined( __i386 ) || defined( __ARM_ARCH )
    304293// This is our personality routine. For every stack frame annotated with
    305294// ".cfi_personality 0x3,__gcfa_personality_v0" this function will be called twice when unwinding.
     
    419408                                    _Unwind_GetCFA(unwind_context) + 24;
    420409#                               elif defined( __ARM_ARCH )
    421 #                                   warning FIX ME: check if anything needed for ARM
    422                                     42;
     410                                    _Unwind_GetCFA(unwind_context) + 40;
    423411#                               endif
    424412                                int (*matcher)(exception_t *) = *(int(**)(exception_t *))match_pos;
     
    537525        // HEADER
    538526        ".LFECFA1:\n"
     527#if defined( __x86_64 ) || defined( __i386 )
    539528        "       .globl  __gcfa_personality_v0\n"
     529#else // defined( __ARM_ARCH )
     530        "       .global __gcfa_personality_v0\n"
     531#endif
    540532        "       .section        .gcc_except_table,\"a\",@progbits\n"
    541533        // TABLE HEADER (important field is the BODY length at the end)
     
    569561        // No clue what this does specifically
    570562        "       .section        .data.rel.local.CFA.ref.__gcfa_personality_v0,\"awG\",@progbits,CFA.ref.__gcfa_personality_v0,comdat\n"
     563#if defined( __x86_64 ) || defined( __i386 )
    571564        "       .align 8\n"
     565#else // defined( __ARM_ARCH )
     566        "       .align 3\n"
     567#endif
    572568        "       .type CFA.ref.__gcfa_personality_v0, @object\n"
    573569        "       .size CFA.ref.__gcfa_personality_v0, 8\n"
     
    575571#if defined( __x86_64 )
    576572        "       .quad __gcfa_personality_v0\n"
    577 #else // then __i386
     573#elif defined( __i386 )
    578574        "       .long __gcfa_personality_v0\n"
     575#else // defined( __ARM_ARCH )
     576        "       .xword __gcfa_personality_v0\n"
    579577#endif
    580578);
     
    583581        // HEADER
    584582        ".LFECFA1:\n"
     583#if defined( __x86_64 ) || defined( __i386 )
    585584        "       .globl  __gcfa_personality_v0\n"
     585#else // defined( __ARM_ARCH )
     586        "       .global __gcfa_personality_v0\n"
     587#endif
    586588        "       .section        .gcc_except_table,\"a\",@progbits\n"
    587589        // TABLE HEADER (important field is the BODY length at the end)
     
    612614#pragma GCC pop_options
    613615
    614 #elif defined( __ARM_ARCH )
    615 _Unwind_Reason_Code __gcfa_personality_v0(
    616                 int version,
    617                 _Unwind_Action actions,
    618                 unsigned long long exception_class,
    619                 struct _Unwind_Exception * unwind_exception,
    620                 struct _Unwind_Context * unwind_context) {
    621         return _URC_CONTINUE_UNWIND;
    622 }
    623 
    624 __attribute__((noinline))
    625 void __cfaehm_try_terminate(void (*try_block)(),
    626                 void (*catch_block)(int index, exception_t * except),
    627                 __attribute__((unused)) int (*match_block)(exception_t * except)) {
    628 }
    629616#else
    630617        #error unsupported hardware architecture
    631 #endif // __x86_64 || __i386
     618#endif // __x86_64 || __i386 || __ARM_ARCH
Note: See TracChangeset for help on using the changeset viewer.