[Lldb-commits] [lldb] [llvm] [lldb] Run the LLDB test suite under MTE on capable Apple HW (PR #185780)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 11 01:46:01 PDT 2026
================
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/WithColor.h"
+#include <dlfcn.h>
+#include <spawn.h>
+#include <string.h>
+#include <vector>
+
+using namespace llvm;
+
+int main(int argc, const char *argv[], const char *envp[]) {
+ const char *program = argv[1];
+
+ posix_spawnattr_t attr;
+ int ret = posix_spawnattr_init(&attr);
+ if (ret != 0) {
+ WithColor::error() << "posix_spawnattr_init failed\n";
+ return EXIT_FAILURE;
+ }
+
+ typedef int (*posix_spawnattr_set_use_sec_transition_shims_np_t)(
+ posix_spawnattr_t *attr, uint32_t flags);
+ posix_spawnattr_set_use_sec_transition_shims_np_t
+ posix_spawnattr_set_use_sec_transition_shims_np_fn =
+ (posix_spawnattr_set_use_sec_transition_shims_np_t)dlsym(
+ RTLD_DEFAULT, "posix_spawnattr_set_use_sec_transition_shims_np");
+
+ if (!posix_spawnattr_set_use_sec_transition_shims_np_fn) {
+ WithColor::error()
+ << "posix_spawnattr_set_use_sec_transition_shims_np not available\n";
+ return EXIT_FAILURE;
+ }
+
+ ret = posix_spawnattr_set_use_sec_transition_shims_np_fn(&attr, /*unused=*/0);
+ if (ret != 0) {
+ WithColor::error()
+ << "posix_spawnattr_set_use_sec_transition_shims_np failed\n";
+ return EXIT_FAILURE;
+ }
+
+ std::vector<char *> new_args;
+ for (int i = 1; i < argc; ++i)
+ new_args.push_back(const_cast<char *>(argv[i]));
+ new_args.push_back(nullptr);
+
+ std::vector<char *> new_envp;
+ for (const char **e = envp; *e; ++e)
+ new_envp.push_back(const_cast<char *>(*e));
+ new_envp.push_back(const_cast<char *>("PYTHONMALLOC=malloc"));
----------------
DavidSpickett wrote:
Comment here with the reason. Link a public bug report if there is one.
https://github.com/llvm/llvm-project/pull/185780
More information about the lldb-commits
mailing list