ubsan.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 type_mismatch_data_v1 {
  34. struct source_location location;
  35. struct type_descriptor *type;
  36. unsigned char log_alignment;
  37. unsigned char type_check_kind;
  38. };
  39. struct type_mismatch_data_common {
  40. struct source_location *location;
  41. struct type_descriptor *type;
  42. unsigned long alignment;
  43. unsigned char type_check_kind;
  44. };
  45. struct nonnull_arg_data {
  46. struct source_location location;
  47. struct source_location attr_location;
  48. int arg_index;
  49. };
  50. struct nonnull_return_data {
  51. struct source_location location;
  52. struct source_location attr_location;
  53. };
  54. struct vla_bound_data {
  55. struct source_location location;
  56. struct type_descriptor *type;
  57. };
  58. struct out_of_bounds_data {
  59. struct source_location location;
  60. struct type_descriptor *array_type;
  61. struct type_descriptor *index_type;
  62. };
  63. struct shift_out_of_bounds_data {
  64. struct source_location location;
  65. struct type_descriptor *lhs_type;
  66. struct type_descriptor *rhs_type;
  67. };
  68. struct unreachable_data {
  69. struct source_location location;
  70. };
  71. struct invalid_value_data {
  72. struct source_location location;
  73. struct type_descriptor *type;
  74. };
  75. #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
  76. typedef __int128 s_max;
  77. typedef unsigned __int128 u_max;
  78. #else
  79. typedef s64 s_max;
  80. typedef u64 u_max;
  81. #endif
  82. #endif