blob: d75c94e9e9365d7d983df9288741e5b03a8bc3f5 [file] [log] [blame]
Brad Bishopf3f93bb2019-10-16 14:33:32 -04001From dbeecdb307be8b783b42cbc89dcb9c5e7f528989 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 21 May 2016 00:33:20 +0000
Brad Bishopf3f93bb2019-10-16 14:33:32 -04004Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are macros
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005
6musl defines some functions as macros and not inline functions
7if this is the case then make sure to undefine them
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
Brad Bishop08902b02019-08-20 09:16:51 -040011 .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012 1 file changed, 21 insertions(+)
13
Brad Bishop08902b02019-08-20 09:16:51 -040014diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
15index afed404f04c..876888656f2 100644
16--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
17+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
18@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 TLI_DEFINE_ENUM_INTERNAL(fopen)
20 TLI_DEFINE_STRING_INTERNAL("fopen")
21 /// FILE *fopen64(const char *filename, const char *opentype)
22+#ifdef fopen64
23+#undef fopen64
24+#endif
25 TLI_DEFINE_ENUM_INTERNAL(fopen64)
26 TLI_DEFINE_STRING_INTERNAL("fopen64")
Brad Bishop19323692019-04-05 15:28:33 -040027 /// int fork();
Brad Bishop08902b02019-08-20 09:16:51 -040028@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029 /// int fseeko(FILE *stream, off_t offset, int whence);
30 TLI_DEFINE_ENUM_INTERNAL(fseeko)
31 TLI_DEFINE_STRING_INTERNAL("fseeko")
32+#ifdef fseeko64
33+#undef fseeko64
34+#endif
35 /// int fseeko64(FILE *stream, off64_t offset, int whence)
36 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
37 TLI_DEFINE_STRING_INTERNAL("fseeko64")
Brad Bishop08902b02019-08-20 09:16:51 -040038@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050039 TLI_DEFINE_ENUM_INTERNAL(fstat)
40 TLI_DEFINE_STRING_INTERNAL("fstat")
41 /// int fstat64(int filedes, struct stat64 *buf)
42+#ifdef fstat64
43+#undef fstat64
44+#endif
45 TLI_DEFINE_ENUM_INTERNAL(fstat64)
46 TLI_DEFINE_STRING_INTERNAL("fstat64")
47 /// int fstatvfs(int fildes, struct statvfs *buf);
Brad Bishop08902b02019-08-20 09:16:51 -040048@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050049 TLI_DEFINE_ENUM_INTERNAL(ftello)
50 TLI_DEFINE_STRING_INTERNAL("ftello")
51 /// off64_t ftello64(FILE *stream)
52+#ifdef ftello64
53+#undef ftello64
54+#endif
55 TLI_DEFINE_ENUM_INTERNAL(ftello64)
56 TLI_DEFINE_STRING_INTERNAL("ftello64")
57 /// int ftrylockfile(FILE *file);
Brad Bishop08902b02019-08-20 09:16:51 -040058@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059 TLI_DEFINE_ENUM_INTERNAL(lstat)
60 TLI_DEFINE_STRING_INTERNAL("lstat")
61 /// int lstat64(const char *path, struct stat64 *buf);
62+#ifdef lstat64
63+#undef lstat64
64+#endif
65 TLI_DEFINE_ENUM_INTERNAL(lstat64)
66 TLI_DEFINE_STRING_INTERNAL("lstat64")
67 /// void *malloc(size_t size);
Brad Bishop08902b02019-08-20 09:16:51 -040068@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050069 TLI_DEFINE_ENUM_INTERNAL(stat)
70 TLI_DEFINE_STRING_INTERNAL("stat")
71 /// int stat64(const char *path, struct stat64 *buf);
72+#ifdef stat64
73+#undef stat64
74+#endif
75 TLI_DEFINE_ENUM_INTERNAL(stat64)
76 TLI_DEFINE_STRING_INTERNAL("stat64")
77 /// int statvfs(const char *path, struct statvfs *buf);
Brad Bishop08902b02019-08-20 09:16:51 -040078@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050079 TLI_DEFINE_ENUM_INTERNAL(tmpfile)
80 TLI_DEFINE_STRING_INTERNAL("tmpfile")
81 /// FILE *tmpfile64(void)
82+#ifdef tmpfile64
83+#undef tmpfile64
84+#endif
85 TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
86 TLI_DEFINE_STRING_INTERNAL("tmpfile64")
87 /// int toascii(int c);