Changeset 11913


Ignore:
Timestamp:
Apr 9, 2009, 1:35:20 AM (10 years ago)
Author:
gb
Message:

pmcl-kernel.c: don't define objc_personality_v0, since in the Wacky World
Of Mach-O this can have the effect of shadowing the real ObjC runtime symbol.

x86-spentry64.s: in ffcall_return_registers: after saving return registers
relative to %csave0, restore them from there (not from %csave3). Most
callers don't care (will just look at the register buffer that csave0
pointed to), but if we're returning/raising an ObjC exception we want to get
it from the right place.

In the ObjC exception gunk, reference the new 'lisp_objc_personality' via
a 64-bit absolute address. This seems to be OK with the Leopard linker;
we'll see about other versions.

objc-support.lisp: in SETUP-OBJC-EXCEPTION-GLOBALS, try to ensure that
this only happens once per session (since we're using a kludge to
detect whether or not indirection is necessary.)

Location:
trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r11908 r11913  
    14961496#ifdef DARWIN
    14971497#if WORD_SIZE==64
    1498 void *__objc_personality_v0 = NULL;
     1498void *lisp_objc_personality = NULL;
    14991499#endif
    15001500#endif
     
    17661766#ifdef DARWIN
    17671767#if WORD_SIZE==64
    1768   lisp_global(OBJC_2_PERSONALITY) = (LispObj) &__objc_personality_v0;
     1768  lisp_global(OBJC_2_PERSONALITY) = (LispObj) &lisp_objc_personality;
    17691769#endif
    17701770#endif
  • trunk/source/lisp-kernel/x86-spentry64.s

    r11911 r11913  
    42694269            contains the linear tcr address.  Preserve %rax/%rdx here. */
    42704270         __(set_gs_base(%csave1))
    4271          __(movq (%csave3),%rax)
    4272          __(movq 8(%csave3),%rdx)
    4273          __(movsd 16(%csave3),%xmm0)
    4274          __(movsd 24(%csave3),%xmm1)
     4271         __(movq (%csave0),%rax)
     4272         __(movq 8(%csave0),%rdx)
     4273         __(movsd 16(%csave0),%xmm0)
     4274         __(movsd 24(%csave0),%xmm1)
    42754275        __endif
    42764276        __ifdef([WINDOWS])
     
    50995099        .byte   0x78    /* sleb128 -8; CIE Data Alignment Factor */
    51005100        .byte   0x10    /* CIE RA Column */
    5101         .byte   0x7
    5102         .byte   0x9b
    5103         .long   ___objc_personality_v0+4@GOTPCREL
     5101        .byte   0xb
     5102        .byte   0x8c
     5103        .quad   _lisp_objc_personality
    51045104        .byte   0x10    /* LSDA Encoding (pcrel) */
    51055105        .byte   0x10    /* FDE Encoding (pcrel) */
  • trunk/source/objc-bridge/objc-support.lisp

    r11907 r11913  
    141141#+apple-objc-2.0
    142142(progn
     143(defloadvar *objc-exception-globals-setup* nil) 
    143144(defun setup-objc-exception-globals ()
    144145  (flet ((set-global (offset name)
    145            (with-macptrs (p (%int-to-ptr (+ (target-nil-value) (%kernel-global-offset offset))))
    146             (unless (%null-ptr-p (%get-ptr p))
    147               (%setf-macptr p (%get-ptr p)))
    148             (setf (%get-ptr p)
    149                   (foreign-symbol-address name)))))
    150     (set-global 'objc-2-personality "___objc_personality_v0")
    151     (set-global 'objc-2-begin-catch "_objc_begin_catch")
    152     (set-global 'objc-2-end-catch "_objc_end_catch")
    153     (set-global 'unwind-resume "__Unwind_Resume")))
     146           (let* ((p (%int-to-ptr (+ (target-nil-value) (%kernel-global-offset offset))))
     147                  (q (%get-ptr p)))
     148             (unless (%null-ptr-p q)
     149               (setq p q))
     150             (setf (%get-ptr p)
     151                   (foreign-symbol-address name)))))
     152    (unless *objc-exception-globals-setup*
     153      (setq *objc-exception-globals-setup* t)
     154      (set-global 'objc-2-personality "___objc_personality_v0")
     155      (set-global 'objc-2-begin-catch "_objc_begin_catch")
     156      (set-global 'objc-2-end-catch "_objc_end_catch")
     157      (set-global 'unwind-resume "__Unwind_Resume"))))
    154158
    155159
     
    157161  (setup-objc-exception-globals))
    158162
    159 (setup-objc-exception-globals)
    160163)
    161164
Note: See TracChangeset for help on using the changeset viewer.