-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[libc++] Fix locale-related compilation errors on NetBSD #143055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
cc @ldionne |
@llvm/pr-subscribers-libcxx Author: Alex Rønne Petersen (alexrp) ChangesTo my knowledge, NetBSD is mostly like other BSDs, but doesn't have Full diff: https://github.com/llvm/llvm-project/pull/143055.diff 5 Files Affected:
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index bbc30b1cfe03f..c0ef6865fdee0 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -117,6 +117,8 @@
# include <__locale_dir/support/apple.h>
# elif defined(__FreeBSD__)
# include <__locale_dir/support/freebsd.h>
+# elif defined(__NetBSD__)
+# include <__locale_dir/support/netbsd.h>
# elif defined(_LIBCPP_MSVCRT_LIKE)
# include <__locale_dir/support/windows.h>
# elif defined(__Fuchsia__)
diff --git a/libcxx/include/__locale_dir/support/apple.h b/libcxx/include/__locale_dir/support/apple.h
index 62eb79c30d435..5216ed2ba758a 100644
--- a/libcxx/include/__locale_dir/support/apple.h
+++ b/libcxx/include/__locale_dir/support/apple.h
@@ -15,6 +15,8 @@
# pragma GCC system_header
#endif
+#include <xlocale.h>
+
#include <__locale_dir/support/bsd_like.h>
#endif // _LIBCPP___LOCALE_DIR_SUPPORT_APPLE_H
diff --git a/libcxx/include/__locale_dir/support/bsd_like.h b/libcxx/include/__locale_dir/support/bsd_like.h
index 54eb397358d7a..e9168c91b4fb3 100644
--- a/libcxx/include/__locale_dir/support/bsd_like.h
+++ b/libcxx/include/__locale_dir/support/bsd_like.h
@@ -24,8 +24,6 @@
# include <wctype.h>
#endif
-#include <xlocale.h>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/__locale_dir/support/freebsd.h b/libcxx/include/__locale_dir/support/freebsd.h
index 5c6e21e387271..5e24cbd29bb5a 100644
--- a/libcxx/include/__locale_dir/support/freebsd.h
+++ b/libcxx/include/__locale_dir/support/freebsd.h
@@ -15,6 +15,8 @@
# pragma GCC system_header
#endif
+#include <xlocale.h>
+
#include <__locale_dir/support/bsd_like.h>
#endif // _LIBCPP___LOCALE_DIR_SUPPORT_FREEBSD_H
diff --git a/libcxx/include/__locale_dir/support/netbsd.h b/libcxx/include/__locale_dir/support/netbsd.h
new file mode 100644
index 0000000000000..190857f6f84fe
--- /dev/null
+++ b/libcxx/include/__locale_dir/support/netbsd.h
@@ -0,0 +1,20 @@
+//===-----------------------------------------------------------------------===//
+//
+// 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_DIR_SUPPORT_NETBSD_H
+#define _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#include <__locale_dir/support/bsd_like.h>
+
+#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
|
nit: we don't use trailing period in commit messages :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meta comment: the reason this code was removed is that it was seen as dead code. We don't have CI builders for NetBSD and we also don't officially support that platform (https://libcxx.llvm.org/#platform-and-compiler-support). It's not that we don't want to, but we require at least one CI runner to exist in order to officially support a platform so that we can ensure that stuff works.
Is that something that NetBSD would be able to provide?
I have no idea; I'm not affiliated with the NetBSD project. But we should probably still try to keep things working, given that NetBSD is listed here: https://llvm.org/docs/GettingStarted.html#hardware |
That is unrelated to the platforms libc++ supports. They are listed at https://libcxx.llvm.org/#platform-and-compiler-support. |
eb8fa17
to
c64b80f
Compare
27e4d97
to
4fffd93
Compare
…143549) Even for EABI, NetBSD uses DWARF EH, not EHABI. This change matches the Clang frontend behavior, and fixes link errors caused by incorrect references to `__cxa_end_cleanup` rather than `_Unwind_Resume`. With this change and #143055, I was able to run [zig-bootstrap](https://github.com/ziglang/zig-bootstrap) to completion for `arm-netbsd10.1-eabihf`.
…lvm#143549) Even for EABI, NetBSD uses DWARF EH, not EHABI. This change matches the Clang frontend behavior, and fixes link errors caused by incorrect references to `__cxa_end_cleanup` rather than `_Unwind_Resume`. With this change and llvm#143055, I was able to run [zig-bootstrap](https://github.com/ziglang/zig-bootstrap) to completion for `arm-netbsd10.1-eabihf`.
…lvm#143549) Even for EABI, NetBSD uses DWARF EH, not EHABI. This change matches the Clang frontend behavior, and fixes link errors caused by incorrect references to `__cxa_end_cleanup` rather than `_Unwind_Resume`. With this change and llvm#143055, I was able to run [zig-bootstrap](https://github.com/ziglang/zig-bootstrap) to completion for `arm-netbsd10.1-eabihf`.
To my knowledge, NetBSD is mostly like other BSDs, but doesn't have xlocale.h. I think c664a7f may have inadvertently broken this.
@ldionne @philnik777 we would like to see this patch upstreamed in time for LLVM 21. Are there any outstanding concerns here? |
To my knowledge, NetBSD is mostly like other BSDs, but doesn't have
xlocale.h
. I think c664a7f may have inadvertently broken this.With this change, I was able to run zig-bootstrap to completion for
x86_64-netbsd10.1-none
.