Skip to content

[clang] Add support for SerenityOS - #187941

Merged
MaskRay merged 17 commits into
llvm:mainfrom
LucasChollet:clang-front-end-2
Apr 14, 2026
Merged

MaskRay merged 17 commits into
llvm:mainfrom
LucasChollet:clang-front-end-2

Conversation

@LucasChollet

Copy link
Copy Markdown
Contributor

Adds support for the $arch-unknown-serenity target to the Clang front end. This makes the compiler look for libraries and headers in the right places, and enables some security mitigations like stack-smashing protection and position-independent code by default.


A first attempt at upstreaming this patch was made here. I hope I fixed everything mentioned there.

I intentionally kept /usr/local/ in the default lookup path. I consider it the more practical option, and I’d prefer to have the patch merged as is and revisit the FIXME later. If this is absolutely unacceptable to the maintainers, I will happily drop it and keep it as a local patch until we address the underlying issue.

@MaskRay, @brad0 as you already reviewed the original patch.

Adds support for the $arch-unknown-serenity target to the Clang front
end. This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.

Co-authored-by: Daniel Bertalan <[email protected]>
Co-authored-by: kleines Filmröllchen <[email protected]>
Co-authored-by: Andrew Kaster <[email protected]>
Co-authored-by: Dan Klishch <[email protected]>
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 22, 2026
@llvmbot

llvmbot commented Mar 22, 2026 •

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-clang-driver

Author: Lucas Chollet (LucasChollet)

Changes

Adds support for the $arch-unknown-serenity target to the Clang front end. This makes the compiler look for libraries and headers in the right places, and enables some security mitigations like stack-smashing protection and position-independent code by default.


A first attempt at upstreaming this patch was made here. I hope I fixed everything mentioned there.

I intentionally kept /usr/local/ in the default lookup path. I consider it the more practical option, and I’d prefer to have the patch merged as is and revisit the FIXME later. If this is absolutely unacceptable to the maintainers, I will happily drop it and keep it as a local patch until we address the underlying issue.

@MaskRay, @brad0 as you already reviewed the original patch.


Patch is 33.43 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/187941.diff

20 Files Affected:

  • (modified) clang/lib/Basic/Targets.cpp (+10)
  • (modified) clang/lib/Basic/Targets/OSTargets.h (+17)
  • (modified) clang/lib/Driver/CMakeLists.txt (+1)
  • (modified) clang/lib/Driver/Driver.cpp (+4)
  • (modified) clang/lib/Driver/ToolChain.cpp (+4-1)
  • (added) clang/lib/Driver/ToolChains/Serenity.cpp (+206)
  • (added) clang/lib/Driver/ToolChains/Serenity.h (+90)
  • (modified) clang/lib/Lex/InitHeaderSearch.cpp (+1)
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtbegin.o ()
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtend.o ()
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtbegin.o ()
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtend.o ()
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o ()
  • (added) clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o ()
  • (added) clang/test/Driver/Inputs/serenity_tree/usr/include/c++/v1/.keep ()
  • (added) clang/test/Driver/Inputs/serenity_tree/usr/lib/crt0.o ()
  • (added) clang/test/Driver/Inputs/serenity_tree/usr/local/.keep ()
  • (modified) clang/test/Driver/pic.c (+8)
  • (modified) clang/test/Driver/save-stats.c (+2)
  • (added) clang/test/Driver/serenity.cpp (+254)
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index dc6ef6ed8f3f8..b24794d26c7c3 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -177,6 +177,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
     case llvm::Triple::Hurd:
       return std::make_unique<HurdTargetInfo<AArch64leTargetInfo>>(Triple,
                                                                    Opts);
+    case llvm::Triple::Serenity:
+      return std::make_unique<SerenityTargetInfo<AArch64leTargetInfo>>(Triple,
+                                                                       Opts);
     case llvm::Triple::Win32:
       switch (Triple.getEnvironment()) {
       case llvm::Triple::GNU:
@@ -477,6 +480,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
                                                                      Opts);
     case llvm::Triple::Hurd:
       return std::make_unique<HurdTargetInfo<RISCV64TargetInfo>>(Triple, Opts);
+
+    case llvm::Triple::Serenity:
+      return std::make_unique<SerenityTargetInfo<RISCV64TargetInfo>>(Triple,
+                                                                     Opts);
     default:
       return std::make_unique<RISCV64TargetInfo>(Triple, Opts);
     }
@@ -664,6 +671,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
     case llvm::Triple::Managarm:
       return std::make_unique<ManagarmTargetInfo<X86_64TargetInfo>>(Triple,
                                                                     Opts);
+    case llvm::Triple::Serenity:
+      return std::make_unique<SerenityTargetInfo<X86_64TargetInfo>>(Triple,
+                                                                    Opts);
     default:
       return std::make_unique<X86_64TargetInfo>(Triple, Opts);
     }
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 16337d56f82c3..9e2916eace079 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -1104,6 +1104,23 @@ class LLVM_LIBRARY_VISIBILITY QURTTargetInfo : public OSTargetInfo<Target> {
   using OSTargetInfo<Target>::OSTargetInfo;
 };
 
+// SerenityOS target
+template <typename Target>
+class LLVM_LIBRARY_VISIBILITY SerenityTargetInfo : public OSTargetInfo<Target> {
+protected:
+  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+                    MacroBuilder &Builder) const override {
+    Builder.defineMacro("__serenity__");
+    DefineStd(Builder, "unix", Opts);
+  }
+
+public:
+  SerenityTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+      : OSTargetInfo<Target>(Triple, Opts) {
+    this->WIntType = TargetInfo::UnsignedInt;
+  }
+};
+
 } // namespace targets
 } // namespace clang
 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index e3eff21986181..ff8557e8ced97 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -81,6 +81,7 @@ add_clang_library(clangDriver
   ToolChains/OHOS.cpp
   ToolChains/OpenBSD.cpp
   ToolChains/PS4CPU.cpp
+  ToolChains/Serenity.cpp
   ToolChains/Solaris.cpp
   ToolChains/SPIRV.cpp
   ToolChains/SPIRVOpenMP.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index c559855ac91f5..a57a0e2676052 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -46,6 +46,7 @@
 #include "ToolChains/SPIRV.h"
 #include "ToolChains/SPIRVOpenMP.h"
 #include "ToolChains/SYCL.h"
+#include "ToolChains/Serenity.h"
 #include "ToolChains/Solaris.h"
 #include "ToolChains/TCE.h"
 #include "ToolChains/UEFI.h"
@@ -7012,6 +7013,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
     case llvm::Triple::Managarm:
       TC = std::make_unique<toolchains::Managarm>(*this, Target, Args);
       break;
+    case llvm::Triple::Serenity:
+      TC = std::make_unique<toolchains::Serenity>(*this, Target, Args);
+      break;
     case llvm::Triple::Solaris:
       TC = std::make_unique<toolchains::Solaris>(*this, Target, Args);
       break;
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 94913837f5339..6c99b4ca837e9 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -724,6 +724,8 @@ StringRef ToolChain::getOSLibName() const {
     return "sunos";
   case llvm::Triple::AIX:
     return "aix";
+  case llvm::Triple::Serenity:
+    return "serenity";
   default:
     return getOS();
   }
@@ -1365,7 +1367,8 @@ ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
   else if (LibName == "platform" || LibName == "") {
     ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
     if (RtLibType == ToolChain::RLT_CompilerRT) {
-      if (getTriple().isAndroid() || getTriple().isOSAIX())
+      if (getTriple().isAndroid() || getTriple().isOSAIX() ||
+          getTriple().isOSSerenity())
         unwindLibType = ToolChain::UNW_CompilerRT;
       else
         unwindLibType = ToolChain::UNW_None;
diff --git a/clang/lib/Driver/ToolChains/Serenity.cpp b/clang/lib/Driver/ToolChains/Serenity.cpp
new file mode 100644
index 0000000000000..a61f2f81d1f66
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Serenity.cpp
@@ -0,0 +1,206 @@
+//===---- Serenity.cpp - SerenityOS ToolChain Implementation ----*- C++ -*-===//
+//
+// 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 "Serenity.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "clang/Options/Options.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include <string>
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang;
+using namespace llvm::opt;
+
+void tools::serenity::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+                                           const InputInfo &Output,
+                                           const InputInfoList &Inputs,
+                                           const ArgList &Args,
+                                           const char *LinkingOutput) const {
+  const auto &TC = cast<Generic_ELF const&>(getToolChain());
+  const auto &D = TC.getDriver();
+  const bool IsShared = Args.hasArg(options::OPT_shared);
+  const bool IsStatic =
+      Args.hasArg(options::OPT_static) && !Args.hasArg(options::OPT_static_pie);
+  const bool IsStaticPIE = Args.hasArg(options::OPT_static_pie);
+  ArgStringList CmdArgs;
+
+  if (!D.SysRoot.empty())
+    CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
+
+  if (IsShared)
+    CmdArgs.push_back("-shared");
+
+  if (IsStaticPIE) {
+    CmdArgs.push_back("-static");
+    CmdArgs.push_back("-pie");
+    CmdArgs.push_back("--no-dynamic-linker");
+    CmdArgs.push_back("-z");
+    CmdArgs.push_back("text");
+  } else if (IsStatic) {
+    CmdArgs.push_back("-static");
+  } else if (!Args.hasArg(options::OPT_r)) {
+    if (Args.hasArg(options::OPT_rdynamic))
+      CmdArgs.push_back("-export-dynamic");
+    if (!IsShared) {
+      Arg *A = Args.getLastArg(options::OPT_pie, options::OPT_no_pie,
+                               options::OPT_nopie);
+      bool IsPIE = A ? A->getOption().matches(options::OPT_pie) :
+                  TC.isPIEDefault(Args);
+      if (IsPIE)
+        CmdArgs.push_back("-pie");
+      CmdArgs.push_back("-dynamic-linker");
+      CmdArgs.push_back(Args.MakeArgString(TC.getDynamicLinker(Args)));
+    }
+  }
+
+  CmdArgs.push_back("--eh-frame-hdr");
+
+  assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
+  if (Output.isFilename()) {
+    CmdArgs.push_back("-o");
+    CmdArgs.push_back(Output.getFilename());
+  }
+
+  CmdArgs.push_back("-z");
+  CmdArgs.push_back("pack-relative-relocs");
+
+  bool HasNoStdLib = Args.hasArg(options::OPT_nostdlib, options::OPT_r);
+  bool HasNoStdLibXX = Args.hasArg(options::OPT_nostdlibxx);
+  bool HasNoLibC = Args.hasArg(options::OPT_nolibc);
+  bool HasNoStartFiles = Args.hasArg(options::OPT_nostartfiles);
+  bool HasNoDefaultLibs = Args.hasArg(options::OPT_nodefaultlibs);
+
+  bool ShouldLinkStartFiles = !HasNoStartFiles && !HasNoStdLib;
+  bool ShouldLinkCompilerRuntime = !HasNoDefaultLibs && !HasNoStdLib;
+  bool ShouldLinkLibC = !HasNoLibC && !HasNoStdLib && !HasNoDefaultLibs;
+  bool ShouldLinkLibCXX =
+      D.CCCIsCXX() && !HasNoStdLibXX && !HasNoStdLib && !HasNoDefaultLibs;
+
+  if (ShouldLinkStartFiles) {
+    if (!IsShared)
+      CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt0.o")));
+
+    std::string crtbegin_path;
+    if (TC.GetRuntimeLibType(Args) == ToolChain::RLT_CompilerRT) {
+      std::string crtbegin =
+          TC.getCompilerRT(Args, "crtbegin", ToolChain::FT_Object);
+      if (TC.getVFS().exists(crtbegin))
+        crtbegin_path = crtbegin;
+    }
+    if (crtbegin_path.empty())
+      crtbegin_path = TC.GetFilePath("crtbeginS.o");
+    CmdArgs.push_back(Args.MakeArgString(crtbegin_path));
+  }
+
+  Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_u});
+
+  TC.AddFilePathLibArgs(Args, CmdArgs);
+
+  if (D.isUsingLTO())
+    addLTOOptions(TC, Args, CmdArgs, Output, Inputs,
+                  D.getLTOMode() == LTOK_Thin);
+
+  Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
+                            options::OPT_t, options::OPT_r});
+
+  addLinkerCompressDebugSectionsOption(TC, Args, CmdArgs);
+
+  AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA);
+
+  if (ShouldLinkCompilerRuntime) {
+    AddRunTimeLibs(TC, D, CmdArgs, Args);
+
+    // We supply our own sanitizer runtimes that output errors to the
+    // Kernel debug log as well as stderr.
+    // FIXME: Properly port clang/gcc sanitizers and use those instead.
+    const SanitizerArgs &Sanitize = TC.getSanitizerArgs(Args);
+    if (Sanitize.needsUbsanRt())
+      CmdArgs.push_back("-lubsan");
+  }
+
+  if (ShouldLinkLibCXX) {
+    bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
+                               !Args.hasArg(options::OPT_static);
+    CmdArgs.push_back("--push-state");
+    CmdArgs.push_back("--as-needed");
+    if (OnlyLibstdcxxStatic)
+      CmdArgs.push_back("-Bstatic");
+    TC.AddCXXStdlibLibArgs(Args, CmdArgs);
+    if (OnlyLibstdcxxStatic)
+      CmdArgs.push_back("-Bdynamic");
+    CmdArgs.push_back("--pop-state");
+  }
+
+  // FIXME: This is currently required to building Ports, but we should take
+  //        care of that in the Port's build system rather than here.
+  CmdArgs.push_back("-L=/usr/local/lib");
+
+  // Silence warnings when linking C code with a C++ '-stdlib' argument.
+  Args.ClaimAllArgs(options::OPT_stdlib_EQ);
+
+  if (ShouldLinkLibC)
+    CmdArgs.push_back("-lc");
+
+  if (ShouldLinkStartFiles) {
+    std::string crtend_path;
+    if (TC.GetRuntimeLibType(Args) == ToolChain::RLT_CompilerRT) {
+      std::string crtend =
+          TC.getCompilerRT(Args, "crtend", ToolChain::FT_Object);
+      if (TC.getVFS().exists(crtend))
+        crtend_path = crtend;
+    }
+    if (crtend_path.empty())
+      crtend_path = TC.GetFilePath("crtendS.o");
+    CmdArgs.push_back(Args.MakeArgString(crtend_path));
+  }
+
+  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
+  C.addCommand(std::make_unique<Command>(JA, *this,
+                                         ResponseFileSupport::AtFileCurCP(),
+                                         Exec, CmdArgs, Inputs, Output));
+}
+
+SanitizerMask Serenity::getSupportedSanitizers() const {
+  return ToolChain::getSupportedSanitizers() | SanitizerKind::KernelAddress;
+}
+
+Serenity::Serenity(const Driver &D, const llvm::Triple &Triple,
+                   const ArgList &Args)
+    : Generic_ELF(D, Triple, Args) {
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib"));
+}
+
+Tool *Serenity::buildLinker() const {
+  return new tools::serenity::Linker(*this);
+}
+
+void Serenity::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+                                         ArgStringList &CC1Args) const {
+  const Driver &D = getDriver();
+
+  if (DriverArgs.hasArg(options::OPT_nostdinc))
+    return;
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc))
+    addSystemInclude(DriverArgs, CC1Args, concat(D.ResourceDir, "/include"));
+
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+    return;
+
+  // FIXME: See FIXME about "/usr/local/lib" in Linker::ConstructJob.
+  addSystemInclude(DriverArgs, CC1Args,
+                   concat(D.SysRoot, "/usr/local/include"));
+
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, "/usr/include"));
+}
diff --git a/clang/lib/Driver/ToolChains/Serenity.h b/clang/lib/Driver/ToolChains/Serenity.h
new file mode 100644
index 0000000000000..dcf94f016dc6a
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Serenity.h
@@ -0,0 +1,90 @@
+//===---- Serenity.h - SerenityOS ToolChain Implementation ------*- C++ -*-===//
+//
+// 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 LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SERENITY_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SERENITY_H
+
+#include "Gnu.h"
+#include "clang/Basic/LangOptions.h"
+#include "clang/Driver/Tool.h"
+#include "clang/Driver/ToolChain.h"
+
+namespace clang {
+namespace driver {
+namespace tools {
+namespace serenity {
+
+class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
+public:
+  Linker(const ToolChain &TC) : Tool("serenity::Linker", "linker", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+  bool isLinkJob() const override { return true; }
+
+  void ConstructJob(Compilation &C, const JobAction &JA,
+                    const InputInfo &Output, const InputInfoList &Inputs,
+                    const llvm::opt::ArgList &TCArgs,
+                    const char *LinkingOutput) const override;
+};
+} // end namespace serenity
+} // end namespace tools
+
+namespace toolchains {
+
+class LLVM_LIBRARY_VISIBILITY Serenity final : public Generic_ELF {
+public:
+  Serenity(const Driver &D, const llvm::Triple &Triple,
+           const llvm::opt::ArgList &Args);
+
+  void
+  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+                            llvm::opt::ArgStringList &CC1Args) const override;
+
+  RuntimeLibType GetDefaultRuntimeLibType() const override {
+    return ToolChain::RLT_CompilerRT;
+  }
+
+  CXXStdlibType GetDefaultCXXStdlibType() const override {
+    return ToolChain::CST_Libcxx;
+  }
+
+  const char *getDefaultLinker() const override { return "ld.lld"; }
+
+  std::string getDynamicLinker(const llvm::opt::ArgList &) const override {
+    return "/usr/lib/Loader.so";
+  }
+
+  bool HasNativeLLVMSupport() const override { return true; }
+
+  bool isPICDefault() const override { return true; }
+  bool isPIEDefault(const llvm::opt::ArgList &) const override { return true; }
+  bool isPICDefaultForced() const override { return false; }
+
+  SanitizerMask getSupportedSanitizers() const override;
+
+  bool IsMathErrnoDefault() const override { return false; }
+
+  UnwindTableLevel
+  getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override {
+    return UnwindTableLevel::Asynchronous;
+  }
+
+  LangOptions::StackProtectorMode
+  GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
+    return LangOptions::SSPStrong;
+  }
+
+protected:
+  Tool *buildLinker() const override;
+};
+
+} // end namespace toolchains
+} // end namespace driver
+} // end namespace clang
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SERENITY_H
diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index 3b0e0704ff8c4..e894086b66e76 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -227,6 +227,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
   case llvm::Triple::PS4:
   case llvm::Triple::PS5:
   case llvm::Triple::RTEMS:
+  case llvm::Triple::Serenity:
   case llvm::Triple::Solaris:
   case llvm::Triple::UEFI:
   case llvm::Triple::WASI:
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtbegin.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtend.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-serenity/clang_rt.crtend.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtbegin.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtend.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-serenity/clang_rt.crtend.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/serenity_tree/usr/include/c++/v1/.keep b/clang/test/Driver/Inputs/serenity_tree/usr/include/c++/v1/.keep
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/serenity_tree/usr/lib/crt0.o b/clang/test/Driver/Inputs/serenity_tree/usr/lib/crt0.o
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/Inputs/serenity_tree/usr/local/.keep b/clang/test/Driver/Inputs/serenity_tree/usr/local/.keep
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/pic.c b/clang/test/Driver/pic.c
index f5d0745422790..7a63e79742f85 100644
--- a/clang/test/Driver/pic.c
+++ b/clang/test/Driver/pic.c
@@ -329,3 +329,11 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 // RUN: %clang -c %s --target=i586-pc-haiku -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+
+// Serenity has PIC and PIE by default
+// RUN: %clang -c %s --target=x86_64-unkown-serenity -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s --target=aarch64-unkown-serenity -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s --target=riscv64-unkown-serenity -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
diff --git a/clang/test/Driver/save-stats.c b/clang/test/Driver/save-stats.c
index ad7867a991686..4821a2f175c32 100644
--- a/clang/test/Driver/save-stats.c
+++ b/clang/test/Driver/save-stats.c
@@ -30,6 +30,8 @@
 // RUN: %clang --target=x86_64-unknown-fuchsia -save-stats -flto -o obj/dir/save-stats.exe -Wl,-plugin-opt=-dummy %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-LTO
 // RUN: %clang --target=x86_64-unknown-haiku -save-stats -flto -o obj/dir/save-stats.exe %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-LTO
 // RUN: %clang --target=x86_64-unknown-haiku -save-stats -flto -o obj/dir/save-stats.exe -Wl,-plugin-opt=-dummy %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-LTO
+// RUN: %clang --target=x86_64-unknown-serenity -save-stats -flto -o obj/dir/save-stats.exe %s -### 2>&1 | F...
[truncated]

@github-actions

github-actions Bot commented Mar 22, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions

github-actions Bot commented Mar 22, 2026 •

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 115445 tests passed
  • 4581 tests skipped

✅ The build succeeded and all tests passed.

@github-actions

github-actions Bot commented Mar 22, 2026 •

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 55255 tests passed
  • 2431 tests skipped

✅ The build succeeded and all tests passed.

@LucasChollet

Copy link
Copy Markdown
Contributor Author

Weekly ping @MaskRay @brad0

Comment thread clang/test/Driver/pic.c Resolved
Comment thread clang/test/Driver/serenity.cpp Resolved
Comment thread clang/test/Driver/save-stats.c Resolved
Comment thread clang/lib/Basic/Targets/OSTargets.h Resolved
@LucasChollet

Copy link
Copy Markdown
Contributor Author

Thanks for the review @MaskRay!

@LucasChollet

Copy link
Copy Markdown
Contributor Author

@MaskRay Weekly ping.
I made the requested change (for all but one, see comment above), can you give it another look?

@MaskRay

MaskRay commented Apr 9, 2026

Copy link
Copy Markdown
Member

You should click "Re-request review". I read https://github.com/pulls/review-requested for PRs that require my attention.

@LucasChollet

Copy link
Copy Markdown
Contributor Author

Noted!

@LucasChollet
LucasChollet requested a review from MaskRay April 9, 2026 06:25
@llvm-ci

llvm-ci commented Apr 14, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve-vla running on linaro-g3-04 while building clang at step 14 "test-suite".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/17/builds/15418

Here is the relevant piece of the build log for the reference
Step 14 (test-suite) failure: test (failure)
...
size..init_array: 16 
size..interp: 27 
size..note.ABI-tag: 32 
size..plt: 992 
size..rela.dyn: 2976 
size..rela.plt: 1440 
size..rodata: 26278 
size..text: 721536 
********************
NOEXE: test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_01.test (1556 of 10406)
******************** TEST 'test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_01.test' FAILED ********************
Executable '/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/test/sandbox/build/Fortran/cray/OpenMP/5.0/depend_iterator_01' is missing
********************
PASS: test-suite :: Fortran/UnitTests/finalization/block_end.test (1557 of 10406)
********** TEST 'test-suite :: Fortran/UnitTests/finalization/block_end.test' RESULTS **********
compile_time: 0.0000 
exec_time: 0.0008 
hash: "39c2fabc21edf16f57dde9e22300c100" 
link_time: 0.0000 
size: 1153480 
size..bss: 336 
size..comment: 258 
size..data: 728 
size..data.rel.ro: 1128 
size..dynamic: 496 
size..dynstr: 659 
size..dynsym: 1680 
size..eh_frame: 48808 
size..eh_frame_hdr: 12236 
size..fini: 20 
size..fini_array: 8 
size..gnu.hash: 28 
size..gnu.version: 140 
size..gnu.version_r: 96 
size..got: 232 
size..got.plt: 504 
size..init: 24 
size..init_array: 16 
size..interp: 27 
size..note.ABI-tag: 32 
size..plt: 992 
size..rela.dyn: 2976 
size..rela.plt: 1440 
size..rodata: 26015 
size..text: 719456 
********************
PASS: test-suite :: Fortran/UnitTests/finalization/allocatable_component.test (1558 of 10406)
********** TEST 'test-suite :: Fortran/UnitTests/finalization/allocatable_component.test' RESULTS **********
compile_time: 0.0000 

@llvm-ci

llvm-ci commented Apr 14, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve-vls running on linaro-g3-04 while building clang at step 14 "test-suite".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/15127

Here is the relevant piece of the build log for the reference
Step 14 (test-suite) failure: test (failure)
...
size..init_array: 16 
size..interp: 27 
size..note.ABI-tag: 32 
size..plt: 1280 
size..rela.dyn: 3408 
size..rela.plt: 1872 
size..rodata: 28448 
size..text: 746288 
********************
NOEXE: test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_01.test (1559 of 10406)
******************** TEST 'test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_01.test' FAILED ********************
Executable '/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/sandbox/build/Fortran/cray/OpenMP/5.0/depend_iterator_01' is missing
********************
NOEXE: test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_02.test (1560 of 10406)
******************** TEST 'test-suite :: Fortran/cray/OpenMP/5.0/depend_iterator_02.test' FAILED ********************
Executable '/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/sandbox/build/Fortran/cray/OpenMP/5.0/depend_iterator_02' is missing
********************
PASS: test-suite :: Fortran/UnitTests/fcvs21_f95/FM907.test (1561 of 10406)
********** TEST 'test-suite :: Fortran/UnitTests/fcvs21_f95/FM907.test' RESULTS **********
compile_time: 0.0000 
exec_time: 0.0008 
hash: "b36d8e3e89918e87f50fa946234038cd" 
link_time: 0.0000 
size: 1159640 
size..bss: 336 
size..comment: 258 
size..data: 928 
size..data.rel.ro: 416 
size..dynamic: 496 
size..dynstr: 659 
size..dynsym: 1680 
size..eh_frame: 48568 
size..eh_frame_hdr: 12164 
size..fini: 20 
size..fini_array: 8 
size..gnu.hash: 28 
size..gnu.version: 140 
size..gnu.version_r: 96 
size..got: 472 
size..got.plt: 504 
size..init: 24 
size..init_array: 16 
size..interp: 27 
size..note.ABI-tag: 32 
size..plt: 992 
size..rela.dyn: 3576 
size..rela.plt: 1440 
size..rodata: 27794 
size..text: 721296 

@llvm-ci

llvm-ci commented Apr 15, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building clang at step 7 "test-stage1-compiler".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/6956

Here is the relevant piece of the build log for the reference
Step 7 (test-stage1-compiler) failure: build (failure)
...
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using ld.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using lld-link: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/lld-link
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using ld.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using lld-link: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/lld-link
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
-- Testing: 93176 tests, 72 workers --
Testing:  0.. 10
FAIL: Clang :: Driver/serenity.cpp (14118 of 93176)
******************** TEST 'Clang :: Driver/serenity.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 4
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 8
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 12
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 23
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nostdinc 2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDINC
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nostdinc
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDINC
# RUN: at line 30
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nobuiltininc 2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOBUILTIN
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nobuiltininc
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOBUILTIN
# RUN: at line 41
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -### /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nostdlibinc 2>&1 | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDLIBINC
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang '-###' /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nostdlibinc
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDLIBINC
# RUN: at line 52
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -c /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unkown-serenity -### 2>&1    | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -c /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unkown-serenity '-###'
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# RUN: at line 54
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -c /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unkown-serenity -### 2>&1    | /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/clang -c /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unkown-serenity '-###'
# executed command: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/FileCheck /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# RUN: at line 56

@nico

nico commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/6956

This one was fixed by #192231.

All issues reported on this PR are fixed now, I believe. Please shout if that's not the case :)

@jakeegan

Copy link
Copy Markdown
Member

Hi, serenity.cpp is still failing on the AIX bot:

******************** TEST 'Clang :: Driver/serenity.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 4
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 8
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 12
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATHS
# RUN: at line 23
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nostdinc 2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDINC
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nostdinc
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDINC
# RUN: at line 30
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nobuiltininc 2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOBUILTIN
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nobuiltininc
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOBUILTIN
# RUN: at line 40
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree    -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir    -fsyntax-only -nostdlibinc 2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDLIBINC
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity --sysroot=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/serenity_tree -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir -fsyntax-only -nostdlibinc
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=PATH_NOSTDLIBINC
# RUN: at line 51
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unkown-serenity -### 2>&1    | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unkown-serenity '-###'
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# RUN: at line 53
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unkown-serenity -### 2>&1    | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=aarch64-unkown-serenity '-###'
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# RUN: at line 55
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unkown-serenity -### 2>&1    | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -c /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=riscv64-unkown-serenity '-###'
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=CHECK-PIE2
# RUN: at line 63
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang -### /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir 2>&1 | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=SERENITY_X86_64,DEFAULT_LINKER
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang '-###' /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --target=x86_64-unknown-serenity -resource-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir
# executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp --check-prefix=SERENITY_X86_64,DEFAULT_LINKER
# .---command stderr------------
# | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp:77:25: error: DEFAULT_LINKER-SAME: expected string not found in input
# | // DEFAULT_LINKER-SAME: "crt0.o"
# |                         ^
# | <stdin>:7:114: note: scanning from here
# |  "ld.lld" "-pie" "-dynamic-linker" "/usr/lib/Loader.so" "--eh-frame-hdr" "-o" "a.out" "-z" "pack-relative-relocs" "/usr/lib/crt0.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o" "-L/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity" "-L/usr/lib" "/tmp/lit-tmp-6v4wsa63/serenity-07a7a1.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/libclang_rt.builtins.a" "--as-needed" "-lunwind" "--no-as-needed" "-lc" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o"
# |                                                                                                                  ^
# | <stdin>:7:124: note: possible intended match here
# |  "ld.lld" "-pie" "-dynamic-linker" "/usr/lib/Loader.so" "--eh-frame-hdr" "-o" "a.out" "-z" "pack-relative-relocs" "/usr/lib/crt0.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o" "-L/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity" "-L/usr/lib" "/tmp/lit-tmp-6v4wsa63/serenity-07a7a1.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/libclang_rt.builtins.a" "--as-needed" "-lunwind" "--no-as-needed" "-lc" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o"
# |                                                                                                                            ^
# | 
# | Input file: <stdin>
# | Check file: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            1: clang version 23.0.0git 
# |            2: Target: x86_64-unknown-serenity 
# |            3: Thread model: posix 
# |            4: InstalledDir: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin 
# |            5: Build config: +assertions 
# |            6:  "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/bin/clang-23" "-cc1" "-triple" "x86_64-unknown-serenity" "-emit-obj" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "serenity.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/tools/clang/test/Driver" "-fcoverage-compilation-dir=/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/build/tools/clang/test/Driver" "-resource-dir" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir" "-internal-isystem" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/include" "-internal-isystem" "/usr/include" "-fdeprecated-macro" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions" "-faddrsig" "-fdwarf2-cfi-asm" "-o" "/tmp/lit-tmp-6v4wsa63/serenity-07a7a1.o" "-x" "c++" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/serenity.cpp" 
# |            7:  "ld.lld" "-pie" "-dynamic-linker" "/usr/lib/Loader.so" "--eh-frame-hdr" "-o" "a.out" "-z" "pack-relative-relocs" "/usr/lib/crt0.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtbegin.o" "-L/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity" "-L/usr/lib" "/tmp/lit-tmp-6v4wsa63/serenity-07a7a1.o" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/libclang_rt.builtins.a" "--as-needed" "-lunwind" "--no-as-needed" "-lc" "/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-flang-ppc64-aix/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-serenity/clang_rt.crtend.o" 
# | same:77'0                                                                                                                      X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | same:77'1                                                                                                                                ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           possible intended match
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

@LucasChollet

Copy link
Copy Markdown
Contributor Author

Hi, serenity.cpp is still failing on the AIX bot

Oh sorry about that, I should be able to open a PR tomorow.

(Note to self: the aix buildbot is in the staging area https://lab.llvm.org/staging/#/builders/231)

mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 13, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 16, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 17, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 20, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 23, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 26, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Aug 31, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 5, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 8, 2026
github-actions Bot pushed a commit to tamnd/zig that referenced this pull request Sep 9, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 13, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 15, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 20, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Sep 22, 2026
github-actions Bot pushed a commit to tamnd/zig that referenced this pull request Sep 30, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Oct 5, 2026
mirror-repo-sync Bot pushed a commit to mirrormode/mirror-zig that referenced this pull request Oct 6, 2026
github-actions Bot pushed a commit to tamnd/zig that referenced this pull request Oct 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 17, 2026
… r=davidtwco

compiler: Add `{x86_64,aarch64}-unknown-serenity` targets

This patch aims to add `x86_64-unknown-serenity` and `aarch64-unknown-serenity` targets as tier 3.

SerenityOS is a Unix-like hobbyist operating system with a UI that echoes back to the late '90s. The userspace libraries, applications and OS Kernel are entirely NIH, with only data dependencies on third parties (such as the UCD/CLDR for unicode support).

RISC-V is also supported, but I decided not to include it in this patch due to my lack of familiarity with the target. A follow-up adding it is likely.

Previous work in 2022 allowed us to write rust applications with std support as part of the base OS image, but those patches have bitrotted since. This is the first step of upstreaming that work.

cc @nico

<details>

<summary>Tier 3 Target Policy and responses</summary>

>Tier 3 target policy

>At this tier, the Rust project provides no official support for a target, so we
>place minimal requirements on the introduction of targets.

>A proposed new tier 3 target must be reviewed and approved by a member of the
>compiler team based on these requirements. The reviewer may choose to gauge
>broader compiler team consensus via a [Major Change Proposal (MCP)][MCP].

>A proposed target or target-specific patch that substantially changes code
>shared with other targets (not just target-specific code) must be reviewed and
>approved by the appropriate team for that shared code before acceptance.

>- A tier 3 target must have a designated developer or developers (the "target
>  maintainers") on record to be CCed when issues arise regarding the target.
>  (The mechanism to track and CC such developers may evolve over time.)

The maintainers will be @ADKaster and @nico

> - Targets must use naming consistent with any existing targets; for instance, a
>   target for the same CPU or OS as an existing Rust target should use the same
>  name for that CPU or OS. Targets should normally use the same names and
>  naming conventions as used elsewhere in the broader ecosystem beyond Rust
>  (such as in other toolchains), unless they have a very good reason to
>  diverge. Changing the name of a target can be highly disruptive, especially
>  once the target reaches a higher tier, so getting the name right is important
>  even for a tier 3 target.
>  - Target names should not introduce undue confusion or ambiguity unless
>    absolutely necessary to maintain ecosystem compatibility. For example, if
>    the name of the target makes people extremely likely to form incorrect
>    beliefs about what it targets, the name should be changed or augmented to
>    disambiguate it.
>  - If possible, use only letters, numbers, dashes and underscores for the name.
>    Periods (`.`) are known to cause issues in Cargo.

The target triples are `<arch>-unknown-serenity`. This is supported in LLVM and the upstream sources for config.sub and config.guess. GCC patches have not been upstreamed.

> - Tier 3 targets may have unusual requirements to build or use, but must not
>   create legal issues or impose onerous legal terms for the Rust project or for
>   Rust developers or users.
>   - The target must not introduce license incompatibilities.
>   - Anything added to the Rust repository must be under the standard Rust
>     license (`MIT OR Apache-2.0`).
>   - The target must not cause the Rust tools or libraries built for any other
>     host (even when supporting cross-compilation to the target) to depend
>    on any new dependency less permissive than the Rust licensing policy. This
>    applies whether the dependency is a Rust crate that would require adding
>    new license exceptions (as specified by the `tidy` tool in the
>    rust-lang/rust repository), or whether the dependency is a native library
>    or binary. In other words, the introduction of the target must not cause a
>    user installing or running a version of Rust or the Rust tools to be
>    subject to any new license requirements.
>  - Compiling, linking, and emitting functional binaries, libraries, or other
>    code for the target (whether hosted on the target itself or cross-compiling
>    from another target) must not depend on proprietary (non-FOSS) libraries.
>    Host tools built for the target itself may depend on the ordinary runtime
>    libraries supplied by the platform and commonly used by other applications
>    built for the target, but those libraries must not be required for code
>    generation for the target; cross-compilation to the target must not require
>    such libraries at all. For instance, `rustc` built for the target may
>    depend on a common proprietary C runtime library or console output library,
>    but must not depend on a proprietary code generation library or code
>    optimization library. Rust's license permits such combinations, but the
>    Rust project has no interest in maintaining such combinations within the
>    scope of Rust itself, even at tier 3.
>  - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
>    legal/licensing terms include but are *not* limited to: non-disclosure
>    requirements, non-compete requirements, contributor license agreements
>    (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
>    requirements conditional on the employer or employment of any particular
>    Rust developers, revocable terms, any requirements that create liability
>    for the Rust project or its developers or users, or any requirements that
>    adversely affect the livelihood or prospects of the Rust project or its
>    developers or users.

All the source code for the OS Kernel and Userland libraries is BSD 2-Clause licensed.

> - Neither this policy nor any decisions made regarding targets shall create any
>  binding agreement or estoppel by any party. If any member of an approving
>  Rust team serves as one of the maintainers of a target, or has any legal or
>  employment requirement (explicit or implicit) that might affect their
>  decisions regarding a target, they must recuse themselves from any approval
>  decisions regarding the target's tier status, though they may otherwise
>  participate in discussions.
>  - This requirement does not prevent part or all of this policy from being
>    cited in an explicit contract or work agreement (e.g. to implement or
>    maintain support for a target). This requirement exists to ensure that a
>    developer or team responsible for reviewing and approving a target does not
>    face any legal threats or obligations that would prevent them from freely
>    exercising their judgment in such approval, even if such judgment involves
>    subjective matters or goes beyond the letter of these requirements.

Understood.

>- Tier 3 targets should attempt to implement as much of the standard libraries
>  as possible and appropriate (`core` for most targets, `alloc` for targets
>  that can support dynamic memory allocation, `std` for targets with an
>  operating system or equivalent layer of system-provided functionality), but
>  may leave some code unimplemented (either unavailable or stubbed out as
>  appropriate), whether because the target makes it impossible to implement or
>  challenging to implement. The authors of pull requests are not obligated to
>  avoid calling any portions of the standard library on the basis of a tier 3
>  target not implementing those portions.

This patch is based on previous work from 2022 that included full std support, including rust-lang/libc patches. Those patches will be updated to work with current main and uploaded for review after this patch.

>- The target must provide documentation for the Rust community explaining how
>  to build for the target, using cross-compilation if possible. If the target
>  supports running binaries, or running tests (even if they do not pass), the
>  documentation must explain how to run such binaries or tests for the target,
>  using emulation if possible or dedicated hardware if necessary.

The [BuildInstructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md) document includes host prerequisites and how to use the `Meta/serenity.sh` script to build a cross-compilation toolchain and launch a QEMU VM instance (with hardware acceleration if supported). The Ports/ subtree has information on building ported software. Out of tree applications have been known to work, but are not a primary target for OS developers.

>- Tier 3 targets must not impose burden on the authors of pull requests, or
>  other developers in the community, to maintain the target. In particular,
>  do not post comments (automated or manual) on a PR that derail or suggest a
>  block on the PR based on a tier 3 target. Do not send automated messages or
>  notifications (via any medium, including via `@`) to a PR author or others
>  involved with a PR regarding a tier 3 target, unless they have opted into
>  such messages.
>  - Backlinks such as those generated by the issue/PR tracker when linking to
>    an issue or PR are not considered a violation of this policy, within
>    reason. However, such messages (even on a separate repository) must not
>    generate notifications to anyone involved with a PR who has not requested
>    such notifications.

Understood

>- Patches adding or updating tier 3 targets must not break any existing tier 2
>  or tier 1 target, and must not knowingly break another tier 3 target without
>  approval of either the compiler team or the maintainers of the other tier 3
>  target.
>  - In particular, this may come up when working on closely related targets,
>    such as variations of the same architecture with different features. Avoid
>    introducing unconditional uses of features that another variation of the
>    target may not have; use conditional compilation or runtime detection, as
>    appropriate, to let each target run code supported by that target.

This should not be an issue.

>- Tier 3 targets must be able to produce assembly using at least one of
>  rustc's supported backends from any host target. (Having support in a fork
>  of the backend is not sufficient, it must be upstream.)

Clang Driver support landed in LLVM 23. llvm/llvm-project#187941
There are several patches still in SerenityOS/serenity's Toolchain/Patches/llvm folder, but they are all related to hosting llvm and libcxx.

>If a tier 3 target stops meeting these requirements, or the target maintainers
>no longer have interest or time, or the target shows no signs of activity and
>has not built for some time, or removing the target would improve the quality
>of the Rust codebase, we may post a PR to remove it; any such PR will be CCed
>to the target maintainers (and potentially other people who have previously
>worked on the target), to check potential interest in improving the situation.

Understood.

</details>
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 18, 2026
Rollup merge of #164483 - ADKaster:serenity-initial-support, r=davidtwco

compiler: Add `{x86_64,aarch64}-unknown-serenity` targets

This patch aims to add `x86_64-unknown-serenity` and `aarch64-unknown-serenity` targets as tier 3.

SerenityOS is a Unix-like hobbyist operating system with a UI that echoes back to the late '90s. The userspace libraries, applications and OS Kernel are entirely NIH, with only data dependencies on third parties (such as the UCD/CLDR for unicode support).

RISC-V is also supported, but I decided not to include it in this patch due to my lack of familiarity with the target. A follow-up adding it is likely.

Previous work in 2022 allowed us to write rust applications with std support as part of the base OS image, but those patches have bitrotted since. This is the first step of upstreaming that work.

cc @nico

<details>

<summary>Tier 3 Target Policy and responses</summary>

>Tier 3 target policy

>At this tier, the Rust project provides no official support for a target, so we
>place minimal requirements on the introduction of targets.

>A proposed new tier 3 target must be reviewed and approved by a member of the
>compiler team based on these requirements. The reviewer may choose to gauge
>broader compiler team consensus via a [Major Change Proposal (MCP)][MCP].

>A proposed target or target-specific patch that substantially changes code
>shared with other targets (not just target-specific code) must be reviewed and
>approved by the appropriate team for that shared code before acceptance.

>- A tier 3 target must have a designated developer or developers (the "target
>  maintainers") on record to be CCed when issues arise regarding the target.
>  (The mechanism to track and CC such developers may evolve over time.)

The maintainers will be @ADKaster and @nico

> - Targets must use naming consistent with any existing targets; for instance, a
>   target for the same CPU or OS as an existing Rust target should use the same
>  name for that CPU or OS. Targets should normally use the same names and
>  naming conventions as used elsewhere in the broader ecosystem beyond Rust
>  (such as in other toolchains), unless they have a very good reason to
>  diverge. Changing the name of a target can be highly disruptive, especially
>  once the target reaches a higher tier, so getting the name right is important
>  even for a tier 3 target.
>  - Target names should not introduce undue confusion or ambiguity unless
>    absolutely necessary to maintain ecosystem compatibility. For example, if
>    the name of the target makes people extremely likely to form incorrect
>    beliefs about what it targets, the name should be changed or augmented to
>    disambiguate it.
>  - If possible, use only letters, numbers, dashes and underscores for the name.
>    Periods (`.`) are known to cause issues in Cargo.

The target triples are `<arch>-unknown-serenity`. This is supported in LLVM and the upstream sources for config.sub and config.guess. GCC patches have not been upstreamed.

> - Tier 3 targets may have unusual requirements to build or use, but must not
>   create legal issues or impose onerous legal terms for the Rust project or for
>   Rust developers or users.
>   - The target must not introduce license incompatibilities.
>   - Anything added to the Rust repository must be under the standard Rust
>     license (`MIT OR Apache-2.0`).
>   - The target must not cause the Rust tools or libraries built for any other
>     host (even when supporting cross-compilation to the target) to depend
>    on any new dependency less permissive than the Rust licensing policy. This
>    applies whether the dependency is a Rust crate that would require adding
>    new license exceptions (as specified by the `tidy` tool in the
>    rust-lang/rust repository), or whether the dependency is a native library
>    or binary. In other words, the introduction of the target must not cause a
>    user installing or running a version of Rust or the Rust tools to be
>    subject to any new license requirements.
>  - Compiling, linking, and emitting functional binaries, libraries, or other
>    code for the target (whether hosted on the target itself or cross-compiling
>    from another target) must not depend on proprietary (non-FOSS) libraries.
>    Host tools built for the target itself may depend on the ordinary runtime
>    libraries supplied by the platform and commonly used by other applications
>    built for the target, but those libraries must not be required for code
>    generation for the target; cross-compilation to the target must not require
>    such libraries at all. For instance, `rustc` built for the target may
>    depend on a common proprietary C runtime library or console output library,
>    but must not depend on a proprietary code generation library or code
>    optimization library. Rust's license permits such combinations, but the
>    Rust project has no interest in maintaining such combinations within the
>    scope of Rust itself, even at tier 3.
>  - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
>    legal/licensing terms include but are *not* limited to: non-disclosure
>    requirements, non-compete requirements, contributor license agreements
>    (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
>    requirements conditional on the employer or employment of any particular
>    Rust developers, revocable terms, any requirements that create liability
>    for the Rust project or its developers or users, or any requirements that
>    adversely affect the livelihood or prospects of the Rust project or its
>    developers or users.

All the source code for the OS Kernel and Userland libraries is BSD 2-Clause licensed.

> - Neither this policy nor any decisions made regarding targets shall create any
>  binding agreement or estoppel by any party. If any member of an approving
>  Rust team serves as one of the maintainers of a target, or has any legal or
>  employment requirement (explicit or implicit) that might affect their
>  decisions regarding a target, they must recuse themselves from any approval
>  decisions regarding the target's tier status, though they may otherwise
>  participate in discussions.
>  - This requirement does not prevent part or all of this policy from being
>    cited in an explicit contract or work agreement (e.g. to implement or
>    maintain support for a target). This requirement exists to ensure that a
>    developer or team responsible for reviewing and approving a target does not
>    face any legal threats or obligations that would prevent them from freely
>    exercising their judgment in such approval, even if such judgment involves
>    subjective matters or goes beyond the letter of these requirements.

Understood.

>- Tier 3 targets should attempt to implement as much of the standard libraries
>  as possible and appropriate (`core` for most targets, `alloc` for targets
>  that can support dynamic memory allocation, `std` for targets with an
>  operating system or equivalent layer of system-provided functionality), but
>  may leave some code unimplemented (either unavailable or stubbed out as
>  appropriate), whether because the target makes it impossible to implement or
>  challenging to implement. The authors of pull requests are not obligated to
>  avoid calling any portions of the standard library on the basis of a tier 3
>  target not implementing those portions.

This patch is based on previous work from 2022 that included full std support, including rust-lang/libc patches. Those patches will be updated to work with current main and uploaded for review after this patch.

>- The target must provide documentation for the Rust community explaining how
>  to build for the target, using cross-compilation if possible. If the target
>  supports running binaries, or running tests (even if they do not pass), the
>  documentation must explain how to run such binaries or tests for the target,
>  using emulation if possible or dedicated hardware if necessary.

The [BuildInstructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md) document includes host prerequisites and how to use the `Meta/serenity.sh` script to build a cross-compilation toolchain and launch a QEMU VM instance (with hardware acceleration if supported). The Ports/ subtree has information on building ported software. Out of tree applications have been known to work, but are not a primary target for OS developers.

>- Tier 3 targets must not impose burden on the authors of pull requests, or
>  other developers in the community, to maintain the target. In particular,
>  do not post comments (automated or manual) on a PR that derail or suggest a
>  block on the PR based on a tier 3 target. Do not send automated messages or
>  notifications (via any medium, including via `@`) to a PR author or others
>  involved with a PR regarding a tier 3 target, unless they have opted into
>  such messages.
>  - Backlinks such as those generated by the issue/PR tracker when linking to
>    an issue or PR are not considered a violation of this policy, within
>    reason. However, such messages (even on a separate repository) must not
>    generate notifications to anyone involved with a PR who has not requested
>    such notifications.

Understood

>- Patches adding or updating tier 3 targets must not break any existing tier 2
>  or tier 1 target, and must not knowingly break another tier 3 target without
>  approval of either the compiler team or the maintainers of the other tier 3
>  target.
>  - In particular, this may come up when working on closely related targets,
>    such as variations of the same architecture with different features. Avoid
>    introducing unconditional uses of features that another variation of the
>    target may not have; use conditional compilation or runtime detection, as
>    appropriate, to let each target run code supported by that target.

This should not be an issue.

>- Tier 3 targets must be able to produce assembly using at least one of
>  rustc's supported backends from any host target. (Having support in a fork
>  of the backend is not sufficient, it must be upstream.)

Clang Driver support landed in LLVM 23. llvm/llvm-project#187941
There are several patches still in SerenityOS/serenity's Toolchain/Patches/llvm folder, but they are all related to hosting llvm and libcxx.

>If a tier 3 target stops meeting these requirements, or the target maintainers
>no longer have interest or time, or the target shows no signs of activity and
>has not built for some time, or removing the target would improve the quality
>of the Rust codebase, we may post a PR to remove it; any such PR will be CCed
>to the target maintainers (and potentially other people who have previously
>worked on the target), to check potential interest in improving the situation.

Understood.

</details>
TDecking pushed a commit to TDecking/miri that referenced this pull request Nov 18, 2026
compiler: Add `{x86_64,aarch64}-unknown-serenity` targets

This patch aims to add `x86_64-unknown-serenity` and `aarch64-unknown-serenity` targets as tier 3.

SerenityOS is a Unix-like hobbyist operating system with a UI that echoes back to the late '90s. The userspace libraries, applications and OS Kernel are entirely NIH, with only data dependencies on third parties (such as the UCD/CLDR for unicode support).

RISC-V is also supported, but I decided not to include it in this patch due to my lack of familiarity with the target. A follow-up adding it is likely.

Previous work in 2022 allowed us to write rust applications with std support as part of the base OS image, but those patches have bitrotted since. This is the first step of upstreaming that work.

cc @nico

<details>

<summary>Tier 3 Target Policy and responses</summary>

>Tier 3 target policy

>At this tier, the Rust project provides no official support for a target, so we
>place minimal requirements on the introduction of targets.

>A proposed new tier 3 target must be reviewed and approved by a member of the
>compiler team based on these requirements. The reviewer may choose to gauge
>broader compiler team consensus via a [Major Change Proposal (MCP)][MCP].

>A proposed target or target-specific patch that substantially changes code
>shared with other targets (not just target-specific code) must be reviewed and
>approved by the appropriate team for that shared code before acceptance.

>- A tier 3 target must have a designated developer or developers (the "target
>  maintainers") on record to be CCed when issues arise regarding the target.
>  (The mechanism to track and CC such developers may evolve over time.)

The maintainers will be @ADKaster and @nico

> - Targets must use naming consistent with any existing targets; for instance, a
>   target for the same CPU or OS as an existing Rust target should use the same
>  name for that CPU or OS. Targets should normally use the same names and
>  naming conventions as used elsewhere in the broader ecosystem beyond Rust
>  (such as in other toolchains), unless they have a very good reason to
>  diverge. Changing the name of a target can be highly disruptive, especially
>  once the target reaches a higher tier, so getting the name right is important
>  even for a tier 3 target.
>  - Target names should not introduce undue confusion or ambiguity unless
>    absolutely necessary to maintain ecosystem compatibility. For example, if
>    the name of the target makes people extremely likely to form incorrect
>    beliefs about what it targets, the name should be changed or augmented to
>    disambiguate it.
>  - If possible, use only letters, numbers, dashes and underscores for the name.
>    Periods (`.`) are known to cause issues in Cargo.

The target triples are `<arch>-unknown-serenity`. This is supported in LLVM and the upstream sources for config.sub and config.guess. GCC patches have not been upstreamed.

> - Tier 3 targets may have unusual requirements to build or use, but must not
>   create legal issues or impose onerous legal terms for the Rust project or for
>   Rust developers or users.
>   - The target must not introduce license incompatibilities.
>   - Anything added to the Rust repository must be under the standard Rust
>     license (`MIT OR Apache-2.0`).
>   - The target must not cause the Rust tools or libraries built for any other
>     host (even when supporting cross-compilation to the target) to depend
>    on any new dependency less permissive than the Rust licensing policy. This
>    applies whether the dependency is a Rust crate that would require adding
>    new license exceptions (as specified by the `tidy` tool in the
>    rust-lang/rust repository), or whether the dependency is a native library
>    or binary. In other words, the introduction of the target must not cause a
>    user installing or running a version of Rust or the Rust tools to be
>    subject to any new license requirements.
>  - Compiling, linking, and emitting functional binaries, libraries, or other
>    code for the target (whether hosted on the target itself or cross-compiling
>    from another target) must not depend on proprietary (non-FOSS) libraries.
>    Host tools built for the target itself may depend on the ordinary runtime
>    libraries supplied by the platform and commonly used by other applications
>    built for the target, but those libraries must not be required for code
>    generation for the target; cross-compilation to the target must not require
>    such libraries at all. For instance, `rustc` built for the target may
>    depend on a common proprietary C runtime library or console output library,
>    but must not depend on a proprietary code generation library or code
>    optimization library. Rust's license permits such combinations, but the
>    Rust project has no interest in maintaining such combinations within the
>    scope of Rust itself, even at tier 3.
>  - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
>    legal/licensing terms include but are *not* limited to: non-disclosure
>    requirements, non-compete requirements, contributor license agreements
>    (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
>    requirements conditional on the employer or employment of any particular
>    Rust developers, revocable terms, any requirements that create liability
>    for the Rust project or its developers or users, or any requirements that
>    adversely affect the livelihood or prospects of the Rust project or its
>    developers or users.

All the source code for the OS Kernel and Userland libraries is BSD 2-Clause licensed.

> - Neither this policy nor any decisions made regarding targets shall create any
>  binding agreement or estoppel by any party. If any member of an approving
>  Rust team serves as one of the maintainers of a target, or has any legal or
>  employment requirement (explicit or implicit) that might affect their
>  decisions regarding a target, they must recuse themselves from any approval
>  decisions regarding the target's tier status, though they may otherwise
>  participate in discussions.
>  - This requirement does not prevent part or all of this policy from being
>    cited in an explicit contract or work agreement (e.g. to implement or
>    maintain support for a target). This requirement exists to ensure that a
>    developer or team responsible for reviewing and approving a target does not
>    face any legal threats or obligations that would prevent them from freely
>    exercising their judgment in such approval, even if such judgment involves
>    subjective matters or goes beyond the letter of these requirements.

Understood.

>- Tier 3 targets should attempt to implement as much of the standard libraries
>  as possible and appropriate (`core` for most targets, `alloc` for targets
>  that can support dynamic memory allocation, `std` for targets with an
>  operating system or equivalent layer of system-provided functionality), but
>  may leave some code unimplemented (either unavailable or stubbed out as
>  appropriate), whether because the target makes it impossible to implement or
>  challenging to implement. The authors of pull requests are not obligated to
>  avoid calling any portions of the standard library on the basis of a tier 3
>  target not implementing those portions.

This patch is based on previous work from 2022 that included full std support, including rust-lang/libc patches. Those patches will be updated to work with current main and uploaded for review after this patch.

>- The target must provide documentation for the Rust community explaining how
>  to build for the target, using cross-compilation if possible. If the target
>  supports running binaries, or running tests (even if they do not pass), the
>  documentation must explain how to run such binaries or tests for the target,
>  using emulation if possible or dedicated hardware if necessary.

The [BuildInstructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md) document includes host prerequisites and how to use the `Meta/serenity.sh` script to build a cross-compilation toolchain and launch a QEMU VM instance (with hardware acceleration if supported). The Ports/ subtree has information on building ported software. Out of tree applications have been known to work, but are not a primary target for OS developers.

>- Tier 3 targets must not impose burden on the authors of pull requests, or
>  other developers in the community, to maintain the target. In particular,
>  do not post comments (automated or manual) on a PR that derail or suggest a
>  block on the PR based on a tier 3 target. Do not send automated messages or
>  notifications (via any medium, including via `@`) to a PR author or others
>  involved with a PR regarding a tier 3 target, unless they have opted into
>  such messages.
>  - Backlinks such as those generated by the issue/PR tracker when linking to
>    an issue or PR are not considered a violation of this policy, within
>    reason. However, such messages (even on a separate repository) must not
>    generate notifications to anyone involved with a PR who has not requested
>    such notifications.

Understood

>- Patches adding or updating tier 3 targets must not break any existing tier 2
>  or tier 1 target, and must not knowingly break another tier 3 target without
>  approval of either the compiler team or the maintainers of the other tier 3
>  target.
>  - In particular, this may come up when working on closely related targets,
>    such as variations of the same architecture with different features. Avoid
>    introducing unconditional uses of features that another variation of the
>    target may not have; use conditional compilation or runtime detection, as
>    appropriate, to let each target run code supported by that target.

This should not be an issue.

>- Tier 3 targets must be able to produce assembly using at least one of
>  rustc's supported backends from any host target. (Having support in a fork
>  of the backend is not sufficient, it must be upstream.)

Clang Driver support landed in LLVM 23. llvm/llvm-project#187941
There are several patches still in SerenityOS/serenity's Toolchain/Patches/llvm folder, but they are all related to hosting llvm and libcxx.

>If a tier 3 target stops meeting these requirements, or the target maintainers
>no longer have interest or time, or the target shows no signs of activity and
>has not built for some time, or removing the target would improve the quality
>of the Rust codebase, we may post a PR to remove it; any such PR will be CCed
>to the target maintainers (and potentially other people who have previously
>worked on the target), to check potential interest in improving the situation.

Understood.

</details>
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Nov 19, 2026
compiler: Add `{x86_64,aarch64}-unknown-serenity` targets

This patch aims to add `x86_64-unknown-serenity` and `aarch64-unknown-serenity` targets as tier 3.

SerenityOS is a Unix-like hobbyist operating system with a UI that echoes back to the late '90s. The userspace libraries, applications and OS Kernel are entirely NIH, with only data dependencies on third parties (such as the UCD/CLDR for unicode support).

RISC-V is also supported, but I decided not to include it in this patch due to my lack of familiarity with the target. A follow-up adding it is likely.

Previous work in 2022 allowed us to write rust applications with std support as part of the base OS image, but those patches have bitrotted since. This is the first step of upstreaming that work.

cc @nico

<details>

<summary>Tier 3 Target Policy and responses</summary>

>Tier 3 target policy

>At this tier, the Rust project provides no official support for a target, so we
>place minimal requirements on the introduction of targets.

>A proposed new tier 3 target must be reviewed and approved by a member of the
>compiler team based on these requirements. The reviewer may choose to gauge
>broader compiler team consensus via a [Major Change Proposal (MCP)][MCP].

>A proposed target or target-specific patch that substantially changes code
>shared with other targets (not just target-specific code) must be reviewed and
>approved by the appropriate team for that shared code before acceptance.

>- A tier 3 target must have a designated developer or developers (the "target
>  maintainers") on record to be CCed when issues arise regarding the target.
>  (The mechanism to track and CC such developers may evolve over time.)

The maintainers will be @ADKaster and @nico

> - Targets must use naming consistent with any existing targets; for instance, a
>   target for the same CPU or OS as an existing Rust target should use the same
>  name for that CPU or OS. Targets should normally use the same names and
>  naming conventions as used elsewhere in the broader ecosystem beyond Rust
>  (such as in other toolchains), unless they have a very good reason to
>  diverge. Changing the name of a target can be highly disruptive, especially
>  once the target reaches a higher tier, so getting the name right is important
>  even for a tier 3 target.
>  - Target names should not introduce undue confusion or ambiguity unless
>    absolutely necessary to maintain ecosystem compatibility. For example, if
>    the name of the target makes people extremely likely to form incorrect
>    beliefs about what it targets, the name should be changed or augmented to
>    disambiguate it.
>  - If possible, use only letters, numbers, dashes and underscores for the name.
>    Periods (`.`) are known to cause issues in Cargo.

The target triples are `<arch>-unknown-serenity`. This is supported in LLVM and the upstream sources for config.sub and config.guess. GCC patches have not been upstreamed.

> - Tier 3 targets may have unusual requirements to build or use, but must not
>   create legal issues or impose onerous legal terms for the Rust project or for
>   Rust developers or users.
>   - The target must not introduce license incompatibilities.
>   - Anything added to the Rust repository must be under the standard Rust
>     license (`MIT OR Apache-2.0`).
>   - The target must not cause the Rust tools or libraries built for any other
>     host (even when supporting cross-compilation to the target) to depend
>    on any new dependency less permissive than the Rust licensing policy. This
>    applies whether the dependency is a Rust crate that would require adding
>    new license exceptions (as specified by the `tidy` tool in the
>    rust-lang/rust repository), or whether the dependency is a native library
>    or binary. In other words, the introduction of the target must not cause a
>    user installing or running a version of Rust or the Rust tools to be
>    subject to any new license requirements.
>  - Compiling, linking, and emitting functional binaries, libraries, or other
>    code for the target (whether hosted on the target itself or cross-compiling
>    from another target) must not depend on proprietary (non-FOSS) libraries.
>    Host tools built for the target itself may depend on the ordinary runtime
>    libraries supplied by the platform and commonly used by other applications
>    built for the target, but those libraries must not be required for code
>    generation for the target; cross-compilation to the target must not require
>    such libraries at all. For instance, `rustc` built for the target may
>    depend on a common proprietary C runtime library or console output library,
>    but must not depend on a proprietary code generation library or code
>    optimization library. Rust's license permits such combinations, but the
>    Rust project has no interest in maintaining such combinations within the
>    scope of Rust itself, even at tier 3.
>  - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
>    legal/licensing terms include but are *not* limited to: non-disclosure
>    requirements, non-compete requirements, contributor license agreements
>    (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
>    requirements conditional on the employer or employment of any particular
>    Rust developers, revocable terms, any requirements that create liability
>    for the Rust project or its developers or users, or any requirements that
>    adversely affect the livelihood or prospects of the Rust project or its
>    developers or users.

All the source code for the OS Kernel and Userland libraries is BSD 2-Clause licensed.

> - Neither this policy nor any decisions made regarding targets shall create any
>  binding agreement or estoppel by any party. If any member of an approving
>  Rust team serves as one of the maintainers of a target, or has any legal or
>  employment requirement (explicit or implicit) that might affect their
>  decisions regarding a target, they must recuse themselves from any approval
>  decisions regarding the target's tier status, though they may otherwise
>  participate in discussions.
>  - This requirement does not prevent part or all of this policy from being
>    cited in an explicit contract or work agreement (e.g. to implement or
>    maintain support for a target). This requirement exists to ensure that a
>    developer or team responsible for reviewing and approving a target does not
>    face any legal threats or obligations that would prevent them from freely
>    exercising their judgment in such approval, even if such judgment involves
>    subjective matters or goes beyond the letter of these requirements.

Understood.

>- Tier 3 targets should attempt to implement as much of the standard libraries
>  as possible and appropriate (`core` for most targets, `alloc` for targets
>  that can support dynamic memory allocation, `std` for targets with an
>  operating system or equivalent layer of system-provided functionality), but
>  may leave some code unimplemented (either unavailable or stubbed out as
>  appropriate), whether because the target makes it impossible to implement or
>  challenging to implement. The authors of pull requests are not obligated to
>  avoid calling any portions of the standard library on the basis of a tier 3
>  target not implementing those portions.

This patch is based on previous work from 2022 that included full std support, including rust-lang/libc patches. Those patches will be updated to work with current main and uploaded for review after this patch.

>- The target must provide documentation for the Rust community explaining how
>  to build for the target, using cross-compilation if possible. If the target
>  supports running binaries, or running tests (even if they do not pass), the
>  documentation must explain how to run such binaries or tests for the target,
>  using emulation if possible or dedicated hardware if necessary.

The [BuildInstructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md) document includes host prerequisites and how to use the `Meta/serenity.sh` script to build a cross-compilation toolchain and launch a QEMU VM instance (with hardware acceleration if supported). The Ports/ subtree has information on building ported software. Out of tree applications have been known to work, but are not a primary target for OS developers.

>- Tier 3 targets must not impose burden on the authors of pull requests, or
>  other developers in the community, to maintain the target. In particular,
>  do not post comments (automated or manual) on a PR that derail or suggest a
>  block on the PR based on a tier 3 target. Do not send automated messages or
>  notifications (via any medium, including via `@`) to a PR author or others
>  involved with a PR regarding a tier 3 target, unless they have opted into
>  such messages.
>  - Backlinks such as those generated by the issue/PR tracker when linking to
>    an issue or PR are not considered a violation of this policy, within
>    reason. However, such messages (even on a separate repository) must not
>    generate notifications to anyone involved with a PR who has not requested
>    such notifications.

Understood

>- Patches adding or updating tier 3 targets must not break any existing tier 2
>  or tier 1 target, and must not knowingly break another tier 3 target without
>  approval of either the compiler team or the maintainers of the other tier 3
>  target.
>  - In particular, this may come up when working on closely related targets,
>    such as variations of the same architecture with different features. Avoid
>    introducing unconditional uses of features that another variation of the
>    target may not have; use conditional compilation or runtime detection, as
>    appropriate, to let each target run code supported by that target.

This should not be an issue.

>- Tier 3 targets must be able to produce assembly using at least one of
>  rustc's supported backends from any host target. (Having support in a fork
>  of the backend is not sufficient, it must be upstream.)

Clang Driver support landed in LLVM 23. llvm/llvm-project#187941
There are several patches still in SerenityOS/serenity's Toolchain/Patches/llvm folder, but they are all related to hosting llvm and libcxx.

>If a tier 3 target stops meeting these requirements, or the target maintainers
>no longer have interest or time, or the target shows no signs of activity and
>has not built for some time, or removing the target would improve the quality
>of the Rust codebase, we may post a PR to remove it; any such PR will be CCed
>to the target maintainers (and potentially other people who have previously
>worked on the target), to check potential interest in improving the situation.

Understood.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants