+#elif defined(__native_client__)
+ /* Target must be bundle-aligned */
+ g_assert (((guint32)addr & kNaClAlignmentMask) == 0);
+
+ /* 0xe8 = call <DISP>, 0xe9 = jump <DISP> */
+ if ((orig_code [-5] == 0xe8) || orig_code [-6] == 0xe9) {
+ int ret;
+ gint32 offset = (gint32)addr - (gint32)orig_code;
+ guint8 buf[sizeof(gint32)];
+ *((gint32*)(buf)) = offset;
+ ret = nacl_dyncode_modify (orig_code - sizeof(gint32), buf, sizeof(gint32));
+ g_assert (ret == 0);
+ } else {
+ printf ("Invalid trampoline sequence %p: %02x %02x %02x %02x %02x\n", orig_code, orig_code [-5], orig_code [-4], orig_code [-3], orig_code [-2], orig_code[-1]);
+ g_assert_not_reached ();
+ }
+#endif