diff mbox series

[2/2] clang: remove obsolete patch

Message ID 20251015154128.119639-2-ross.burton@arm.com
State New
Headers show
Series [1/2] openmp: recipe cleanup | expand

Commit Message

Ross Burton Oct. 15, 2025, 3:41 p.m. UTC
This musl-related fix to TargetLibraryInfo has been obsolete since LLVM
version 5.0 as it was fixed in a different way:

commit d21529fa0df71327aab230786e345b2071f4ac4f
Author: David L. Jones <dlj@google.com>
Date:   Mon Jan 23 23:16:46 2017 +0000

    [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC)

    Summary:
    The LibFunc::Func enum holds enumerators named for libc functions.
    Unfortunately, there are real situations, including libc implementations, where
    function names are actually macros (musl uses "#define fopen64 fopen", for
    example; any other transitively visible macro would have similar effects).

    Strictly speaking, a conforming C++ Standard Library should provide any such
    macros as functions instead (via <cstdio>). However, there are some "library"
    functions which are not part of the standard, and thus not subject to this
    rule (fopen64, for example). So, in order to be both portable and consistent,
    the enum should not use the bare function names.

    The old enum naming used a namespace LibFunc and an enum Func, with bare
    enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
    with "LibFFunc_". (Unfortunately, a scoped enum is not sufficient to override
    macros.)

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 ...ryInfo-Undefine-libc-functions-if-th.patch | 90 -------------------
 meta/recipes-devtools/clang/common.inc        |  1 -
 2 files changed, 91 deletions(-)
 delete mode 100644 meta/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/meta/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
deleted file mode 100644
index 88d1c542222..00000000000
--- a/meta/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ /dev/null
@@ -1,90 +0,0 @@ 
-From 04afd5f5cb10ccb899022a6c72ca2f2378eca409 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 May 2016 00:33:20 +0000
-Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are
- macros
-
-musl defines some functions as macros and not inline functions
-if this is the case then make sure to undefine them
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- .../llvm/Analysis/TargetLibraryInfo.def       | 22 ++++++++++++++++++-
- 1 file changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
-index 014988299d37..ea77dae66482 100644
---- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
-+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
-@@ -1467,6 +1467,9 @@ TLI_DEFINE_STRING_INTERNAL("fopen")
- TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
- 
- /// FILE *fopen64(const char *filename, const char *opentype)
-+#ifdef fopen64
-+#undef fopen64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(fopen64)
- TLI_DEFINE_STRING_INTERNAL("fopen64")
- TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
-@@ -1545,7 +1548,9 @@ TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Long, Int)
- TLI_DEFINE_ENUM_INTERNAL(fseeko)
- TLI_DEFINE_STRING_INTERNAL("fseeko")
- TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, Int)
--
-+#ifdef fseeko64
-+#undef fseeko64
-+#endif
- /// int fseeko64(FILE *stream, off64_t offset, int whence)
- TLI_DEFINE_ENUM_INTERNAL(fseeko64)
- TLI_DEFINE_STRING_INTERNAL("fseeko64")
-@@ -1562,6 +1567,9 @@ TLI_DEFINE_STRING_INTERNAL("fstat")
- TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
- 
- /// int fstat64(int filedes, struct stat64 *buf)
-+#ifdef fstat64
-+#undef fstat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(fstat64)
- TLI_DEFINE_STRING_INTERNAL("fstat64")
- TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
-@@ -1587,6 +1595,9 @@ TLI_DEFINE_STRING_INTERNAL("ftello")
- TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
- 
- /// off64_t ftello64(FILE *stream)
-+#ifdef ftello64
-+#undef ftello64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(ftello64)
- TLI_DEFINE_STRING_INTERNAL("ftello64")
- TLI_DEFINE_SIG_INTERNAL(Int64, Ptr)
-@@ -1827,6 +1838,9 @@ TLI_DEFINE_STRING_INTERNAL("lstat")
- TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
- 
- /// int lstat64(const char *path, struct stat64 *buf);
-+#ifdef lstat64
-+#undef lstat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(lstat64)
- TLI_DEFINE_STRING_INTERNAL("lstat64")
- TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
-@@ -2339,6 +2353,9 @@ TLI_DEFINE_STRING_INTERNAL("stat")
- TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
- 
- /// int stat64(const char *path, struct stat64 *buf);
-+#ifdef stat64
-+#undef stat64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(stat64)
- TLI_DEFINE_STRING_INTERNAL("stat64")
- TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
-@@ -2564,6 +2581,9 @@ TLI_DEFINE_STRING_INTERNAL("tmpfile")
- TLI_DEFINE_SIG_INTERNAL(Ptr)
- 
- /// FILE *tmpfile64(void)
-+#ifdef tmpfile64
-+#undef tmpfile64
-+#endif
- TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
- TLI_DEFINE_STRING_INTERNAL("tmpfile64")
- TLI_DEFINE_SIG_INTERNAL(Ptr)
diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc
index b7adc653404..8a7ac575543 100644
--- a/meta/recipes-devtools/clang/common.inc
+++ b/meta/recipes-devtools/clang/common.inc
@@ -24,7 +24,6 @@  SRC_URI = "\
     file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \
     file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \
     file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \
-    file://0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
     file://0005-llvm-allow-env-override-of-exe-and-libdir-path.patch \
     file://0006-clang-driver-Check-sysroot-for-ldso-path.patch \
     file://0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \