mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
4b70bff39a
In addition to being rebased, LLVM driver no longer ever tries to link crti.o, crtn.o, or crt0_shared.o. The code that handles -pie / -static / -shared flags has been simplified as per MaskRay's suggestion (I made changes similar to llvm/llvm-project@ae623d16). Tests have been updated to match the current behavior of the driver. Note, however, that I didn't run them with non-default CLANG_DEFAULT_* options. The commit also removes Daniel's -fvisibility-inlines-hidden-function-templates patch since this functionality was never actually used and I feel like such features should either live in upstream or be deleted.
127 lines
5.6 KiB
Diff
127 lines
5.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Bertalan <dani@danielbertalan.dev>
|
|
Date: Thu, 14 Apr 2022 10:17:13 +0200
|
|
Subject: [PATCH] [libcxx] Add support for SerenityOS
|
|
|
|
This commit teaches libc++ about what features are available in our
|
|
LibC, namely:
|
|
* We do not have locale support, so no-op shims should be used in place
|
|
of the C locale API.
|
|
* The number of errno constants defined by us is given by the value of
|
|
the `ELAST` macro.
|
|
* Multithreading is implemented though the pthread library.
|
|
* Use libc++'s builtin character type table instead of the one provided
|
|
by LibC as there's a lot of extra porting work to convince the rest of
|
|
locale.cpp to use our character type table properly.
|
|
---
|
|
libcxx/include/CMakeLists.txt | 1 +
|
|
libcxx/include/__config | 5 +++--
|
|
libcxx/include/__locale_dir/locale_base_api.h | 2 ++
|
|
.../__locale_dir/locale_base_api/serenity.h | 22 +++++++++++++++++++
|
|
libcxx/include/locale | 2 +-
|
|
libcxx/src/include/config_elast.h | 2 ++
|
|
6 files changed, 31 insertions(+), 3 deletions(-)
|
|
create mode 100644 libcxx/include/__locale_dir/locale_base_api/serenity.h
|
|
|
|
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
|
|
index 32579272858a..016163984660 100644
|
|
--- a/libcxx/include/CMakeLists.txt
|
|
+++ b/libcxx/include/CMakeLists.txt
|
|
@@ -491,6 +491,7 @@ set(files
|
|
__locale_dir/locale_base_api/musl.h
|
|
__locale_dir/locale_base_api/newlib.h
|
|
__locale_dir/locale_base_api/openbsd.h
|
|
+ __locale_dir/locale_base_api/serenity.h
|
|
__locale_dir/locale_base_api/win32.h
|
|
__math/abs.h
|
|
__math/copysign.h
|
|
diff --git a/libcxx/include/__config b/libcxx/include/__config
|
|
index 661af5be3c22..634cabbbbefd 100644
|
|
--- a/libcxx/include/__config
|
|
+++ b/libcxx/include/__config
|
|
@@ -817,7 +817,8 @@ typedef __char32_t char32_t;
|
|
defined(__APPLE__) || \
|
|
defined(__MVS__) || \
|
|
defined(_AIX) || \
|
|
- defined(__EMSCRIPTEN__)
|
|
+ defined(__EMSCRIPTEN__) || \
|
|
+ defined(__serenity__)
|
|
// clang-format on
|
|
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
|
# elif defined(__Fuchsia__)
|
|
@@ -890,7 +891,7 @@ typedef __char32_t char32_t;
|
|
# endif
|
|
|
|
# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \
|
|
- defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
|
|
+ defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__serenity__)
|
|
# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
|
# endif
|
|
|
|
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
|
|
index 8c000c558c52..bb5745019fc5 100644
|
|
--- a/libcxx/include/__locale_dir/locale_base_api.h
|
|
+++ b/libcxx/include/__locale_dir/locale_base_api.h
|
|
@@ -25,6 +25,8 @@
|
|
# include <__locale_dir/locale_base_api/fuchsia.h>
|
|
#elif defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
|
# include <__locale_dir/locale_base_api/musl.h>
|
|
+#elif defined(__serenity__)
|
|
+# include <__locale_dir/locale_base_api/serenity.h>
|
|
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
|
# include <xlocale.h>
|
|
#endif
|
|
diff --git a/libcxx/include/__locale_dir/locale_base_api/serenity.h b/libcxx/include/__locale_dir/locale_base_api/serenity.h
|
|
new file mode 100644
|
|
index 000000000000..4644fca4ae95
|
|
--- /dev/null
|
|
+++ b/libcxx/include/__locale_dir/locale_base_api/serenity.h
|
|
@@ -0,0 +1,22 @@
|
|
+//===----------------------------------------------------------------------===//
|
|
+//
|
|
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
+// See https://llvm.org/LICENSE.txt for license information.
|
|
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
+//
|
|
+//===----------------------------------------------------------------------===//
|
|
+
|
|
+#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_SERENITY_H
|
|
+#define _LIBCPP___LOCALE_LOCALE_BASE_API_SERENITY_H
|
|
+
|
|
+#include <stddef.h>
|
|
+
|
|
+#include <__support/xlocale/__nop_locale_mgmt.h>
|
|
+#include <__support/xlocale/__posix_l_fallback.h>
|
|
+#include <__support/xlocale/__strtonum_fallback.h>
|
|
+#include <clocale>
|
|
+#include <cstdlib>
|
|
+#include <ctype.h>
|
|
+#include <cwctype>
|
|
+
|
|
+#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_SERENITY_H
|
|
diff --git a/libcxx/include/locale b/libcxx/include/locale
|
|
index 573910a85bef..ae19777a5346 100644
|
|
--- a/libcxx/include/locale
|
|
+++ b/libcxx/include/locale
|
|
@@ -220,7 +220,7 @@ template <class charT> class messages_byname;
|
|
|
|
# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
|
// Most unix variants have catopen. These are the specific ones that don't.
|
|
-# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
|
|
+# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) && !defined(__serenity__)
|
|
# define _LIBCPP_HAS_CATOPEN 1
|
|
# include <nl_types.h>
|
|
# endif
|
|
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
|
|
index 899e124ad261..11d930bc8a3c 100644
|
|
--- a/libcxx/src/include/config_elast.h
|
|
+++ b/libcxx/src/include/config_elast.h
|
|
@@ -35,6 +35,8 @@
|
|
# define _LIBCPP_ELAST 4095
|
|
#elif defined(__APPLE__)
|
|
// No _LIBCPP_ELAST needed on Apple
|
|
+#elif defined(__serenity__)
|
|
+// No _LIBCPP_ELAST needed on SerenityOS
|
|
#elif defined(__MVS__)
|
|
# define _LIBCPP_ELAST 1160
|
|
#elif defined(_LIBCPP_MSVCRT_LIKE)
|