clang: remove obsolete patch

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.)

(From OE-Core rev: 426504625c67dd8235a72a1128452c1592462ff3)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2025-10-15 16:41:28 +01:00
committed by Richard Purdie
parent 2de0de4c34
commit 12e142d5e6
2 changed files with 0 additions and 91 deletions

View File

@@ -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)

View File

@@ -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 \