ubsan.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _LIB_UBSAN_H
  2. #define _LIB_UBSAN_H
  3. enum {
  4. type_kind_int = 0,
  5. type_kind_float = 1,
  6. type_unknown = 0xffff
  7. };
  8. struct type_descriptor {
  9. u16 type_kind;
  10. u16 type_info;
  11. char type_name[1];
  12. };
  13. struct source_location {
  14. const char *file_name;
  15. union {
  16. unsigned long reported;
  17. struct {
  18. u32 line;
  19. u32 column;
  20. };
  21. };
  22. };
  23. struct overflow_data {
  24. struct source_location location;
  25. struct type_descriptor *type;
  26. };
  27. struct type_mismatch_data {
  28. struct source_location location;
  29. struct type_descriptor *type;
  30. unsigned long alignment;
  31. unsigned char type_check_kind;
  32. };
  33. struct nonnull_arg_data {
  34. struct source_location location;
  35. struct source_location attr_location;
  36. int arg_index;
  37. };
  38. struct nonnull_return_data {
  39. struct source_location location;
  40. struct source_location attr_location;
  41. };
  42. struct vla_bound_data {
  43. struct source_location location;
  44. struct type_descriptor *type;
  45. };
  46. struct out_of_bounds_data {
  47. struct source_location location;
  48. struct type_descriptor *array_type;
  49. struct type_descriptor *index_type;
  50. };
  51. struct shift_out_of_bounds_data {
  52. struct source_location location;
  53. struct type_descriptor *lhs_type;
  54. struct type_descriptor *rhs_type;
  55. };
  56. struct unreachable_data {
  57. struct source_location location;
  58. };
  59. struct invalid_value_data {
  60. struct source_location location;
  61. struct type_descriptor *type;
  62. };
  63. #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
  64. typedef __int128 s_max;
  65. typedef unsigned __int128 u_max;
  66. #else
  67. typedef s64 s_max;
  68. typedef u64 u_max;
  69. #endif
  70. #endif