On Wed, Mar 29, 2006 at 07:44:47AM +0900, Albert Chin wrote:
> We've attempted to build 1.8.4 on HP-UX 11.23/IA with GCC 3.4.3:
> gcc -g -O0  -fPIC  -DRUBY_EXPORT  -I. -I.
> -I/opt/TWWfsw/ncurses54/include
> -I/opt/TWWfsw/ncurses54/include/ncurses
> -I/opt/TWWfsw/libopenssl097/include -I/opt/TWWfsw/zlib11/include
> -I/opt/TWWfsw/tcl84/include -I/opt/TWWfsw/tk84/include -c eval.c
> eval.c: In function `rb_thread_save_context':
> eval.c:10064: error: structure has no member named `sc_ar_bsp'
> gmake: *** [eval.o] Error 1
> 
> The offending line:
>         top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
> 
> The HP-UX 11.23/IA ucontext_t struct is defined as:
>   typedef struct {
>     __opaque128_t __mc_opaque[2976];
>   } __mcontext_t;
>   typedef __mcontext_t mcontext_t;
> 
>   typedef struct __ucontext {
>     __uc_misc_t __uc_misc;
>     double __uc_reserved[__UC_PADDING];
>     mcontext_t __uc_mcontext;
>   }
> 
> __uc_get_ar_bsp() exists on this platform:
>   int __uc_get_ar_bsp(const ucontext_t *ucp, uint64_t *value);
> 
>   Returns (in the value argument) the saved value of the
>   AR.BSP register.  By convention, this value reflects the
>   effects of the br.call instruction used to enter a syscall
>   or the cover instruction used in handling an interruption.
>   To find the value that will be in AR.BSP when the next
>   instruction is executed the caller must:
>   1)  Call __uc_get_reason() to determine whether the context
>       was created in a syscall or while handling an
>       interruption.
>   2)  Call __uc_get_cfm() to fetch the current frame marker.
>   3)  Adjust the AR.BSP value by CFM.sol (for a syscall
>       context) or CFM.sof (for an interruption context).
> 
> VALUE is of type unsigned long though and __uc_get_ar_bsp expects a
> pointer to type unsigned long long.
> 
> Anyone have any ideas?

Replacing:
  top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
with:
  VALUE top;
  __uc_get_ar_bsp(&ctx, &top);

and linking with -luca (apparently necessary according to
__uc_get_ar_bsp(3)) gave:
  ./lib/fileutils.rb:1267: [BUG] Bus Error


-- 
albert chin (china / thewrittenword.com)