ptlongjmp.c 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Linuxthreads - a simple clone()-based implementation of Posix */
  2. /* threads for Linux. */
  3. /* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
  4. /* */
  5. /* This program is free software; you can redistribute it and/or */
  6. /* modify it under the terms of the GNU Library General Public License */
  7. /* as published by the Free Software Foundation; either version 2 */
  8. /* of the License, or (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU Library General Public License for more details. */
  14. /* Redefine siglongjmp and longjmp so that they interact correctly
  15. with cleanup handlers */
  16. /* Derived from linuxthreads/ptlongjmp.c & added AltiVec/VMX versioning. */
  17. #include "pthread.h"
  18. #include <setjmp.h>
  19. #include <bits/wordsize.h>
  20. #include <shlib-compat.h>
  21. #if defined SHARED
  22. # if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3_4)
  23. /* These functions are not declared anywhere since they shouldn't be
  24. used at another place but here. */
  25. extern void __novmx__libc_siglongjmp (sigjmp_buf env, int val)
  26. __attribute__ ((noreturn));
  27. extern void __novmx__libc_longjmp (sigjmp_buf env, int val)
  28. __attribute__ ((noreturn));
  29. void __novmx_siglongjmp (sigjmp_buf env, int val)
  30. {
  31. __novmx__libc_siglongjmp (env, val);
  32. }
  33. void __novmx_longjmp (jmp_buf env, int val)
  34. {
  35. __novmx__libc_longjmp (env, val);
  36. }
  37. # if __WORDSIZE == 64
  38. symbol_version (__novmx_longjmp,longjmp,GLIBC_2.3);
  39. symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.3);
  40. # else
  41. symbol_version (__novmx_longjmp,longjmp,GLIBC_2.0);
  42. symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.0);
  43. # endif
  44. # endif /* SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3_4) ) */
  45. /* These functions are not declared anywhere since they shouldn't be
  46. used at another place but here. */
  47. extern void __vmx__libc_siglongjmp (sigjmp_buf env, int val)
  48. __attribute__ ((noreturn));
  49. extern void __vmx__libc_longjmp (sigjmp_buf env, int val)
  50. __attribute__ ((noreturn));
  51. void __vmx_siglongjmp (sigjmp_buf env, int val)
  52. {
  53. __vmx__libc_siglongjmp (env, val);
  54. }
  55. void __vmx_longjmp (jmp_buf env, int val)
  56. {
  57. __vmx__libc_longjmp (env, val);
  58. }
  59. default_symbol_version (__vmx_longjmp,longjmp,GLIBC_2.3.4);
  60. default_symbol_version (__vmx_siglongjmp,siglongjmp,GLIBC_2.3.4);
  61. #endif /* SHARED */