1 #include "libgcc_tm.h" 2 3 /* This shim is special, it needs to be built for Mac OSX 10.6 4 regardless of the current system version. 5 We must also build it to use the unwinder layout that was 6 present for 10.6 (and not update that). 7 So we copy the referenced structures from unwind-dw2-fde.h 8 to avoid pulling in newer system headers and/or changed 9 layouts. */ 10 struct dwarf_eh_bases 11 { 12 void *tbase; 13 void *dbase; 14 void *func; 15 }; 16 17 typedef int sword __attribute__ ((mode (SI))); 18 typedef unsigned int uword __attribute__ ((mode (SI))); 19 20 /* The first few fields of an FDE. */ 21 struct dwarf_fde 22 { 23 uword length; 24 sword CIE_delta; 25 unsigned char pc_begin[]; 26 } __attribute__ ((packed, aligned (__alignof__ (void *)))); 27 28 typedef struct dwarf_fde fde; 29 30 extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *); 31 32 void * _darwin10_Unwind_FindEnclosingFunction(void * pc)33_darwin10_Unwind_FindEnclosingFunction (void *pc) 34 { 35 struct dwarf_eh_bases bases; 36 const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases); 37 if (fde) 38 return bases.func; 39 return (void *) 0; 40 } 41