0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. Upstream-Status: Pending
  2. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  3. From dbeecdb307be8b783b42cbc89dcb9c5e7f528989 Mon Sep 17 00:00:00 2001
  4. From: Khem Raj <raj.khem@gmail.com>
  5. Date: Sat, 21 May 2016 00:33:20 +0000
  6. Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are macros
  7. musl defines some functions as macros and not inline functions
  8. if this is the case then make sure to undefine them
  9. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  10. ---
  11. .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++
  12. 1 file changed, 21 insertions(+)
  13. diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
  14. index afed404f04c..876888656f2 100644
  15. --- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
  16. +++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
  17. @@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
  18. TLI_DEFINE_ENUM_INTERNAL(fopen)
  19. TLI_DEFINE_STRING_INTERNAL("fopen")
  20. /// FILE *fopen64(const char *filename, const char *opentype)
  21. +#ifdef fopen64
  22. +#undef fopen64
  23. +#endif
  24. TLI_DEFINE_ENUM_INTERNAL(fopen64)
  25. TLI_DEFINE_STRING_INTERNAL("fopen64")
  26. /// int fork();
  27. @@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
  28. /// int fseeko(FILE *stream, off_t offset, int whence);
  29. TLI_DEFINE_ENUM_INTERNAL(fseeko)
  30. TLI_DEFINE_STRING_INTERNAL("fseeko")
  31. +#ifdef fseeko64
  32. +#undef fseeko64
  33. +#endif
  34. /// int fseeko64(FILE *stream, off64_t offset, int whence)
  35. TLI_DEFINE_ENUM_INTERNAL(fseeko64)
  36. TLI_DEFINE_STRING_INTERNAL("fseeko64")
  37. @@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
  38. TLI_DEFINE_ENUM_INTERNAL(fstat)
  39. TLI_DEFINE_STRING_INTERNAL("fstat")
  40. /// int fstat64(int filedes, struct stat64 *buf)
  41. +#ifdef fstat64
  42. +#undef fstat64
  43. +#endif
  44. TLI_DEFINE_ENUM_INTERNAL(fstat64)
  45. TLI_DEFINE_STRING_INTERNAL("fstat64")
  46. /// int fstatvfs(int fildes, struct statvfs *buf);
  47. @@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
  48. TLI_DEFINE_ENUM_INTERNAL(ftello)
  49. TLI_DEFINE_STRING_INTERNAL("ftello")
  50. /// off64_t ftello64(FILE *stream)
  51. +#ifdef ftello64
  52. +#undef ftello64
  53. +#endif
  54. TLI_DEFINE_ENUM_INTERNAL(ftello64)
  55. TLI_DEFINE_STRING_INTERNAL("ftello64")
  56. /// int ftrylockfile(FILE *file);
  57. @@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
  58. TLI_DEFINE_ENUM_INTERNAL(lstat)
  59. TLI_DEFINE_STRING_INTERNAL("lstat")
  60. /// int lstat64(const char *path, struct stat64 *buf);
  61. +#ifdef lstat64
  62. +#undef lstat64
  63. +#endif
  64. TLI_DEFINE_ENUM_INTERNAL(lstat64)
  65. TLI_DEFINE_STRING_INTERNAL("lstat64")
  66. /// void *malloc(size_t size);
  67. @@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
  68. TLI_DEFINE_ENUM_INTERNAL(stat)
  69. TLI_DEFINE_STRING_INTERNAL("stat")
  70. /// int stat64(const char *path, struct stat64 *buf);
  71. +#ifdef stat64
  72. +#undef stat64
  73. +#endif
  74. TLI_DEFINE_ENUM_INTERNAL(stat64)
  75. TLI_DEFINE_STRING_INTERNAL("stat64")
  76. /// int statvfs(const char *path, struct statvfs *buf);
  77. @@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
  78. TLI_DEFINE_ENUM_INTERNAL(tmpfile)
  79. TLI_DEFINE_STRING_INTERNAL("tmpfile")
  80. /// FILE *tmpfile64(void)
  81. +#ifdef tmpfile64
  82. +#undef tmpfile64
  83. +#endif
  84. TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
  85. TLI_DEFINE_STRING_INTERNAL("tmpfile64")
  86. /// int toascii(int c);