From b018058e93491373dd0f3363b5cae771fd67d5e8 Mon Sep 17 00:00:00 2001 From: Neil Jones Date: Fri, 1 Mar 2024 23:39:50 +0900 Subject: [PATCH] Add files via upload --- .../amazonlinux-lld-UnixToolchains-v2.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test-patches/amazonlinux-lld-UnixToolchains-v2.patch diff --git a/test-patches/amazonlinux-lld-UnixToolchains-v2.patch b/test-patches/amazonlinux-lld-UnixToolchains-v2.patch new file mode 100644 index 0000000..f10a5df --- /dev/null +++ b/test-patches/amazonlinux-lld-UnixToolchains-v2.patch @@ -0,0 +1,38 @@ +diff --git a/lib/Driver/UnixToolChains.cpp b/lib/Driver/UnixToolChains.cpp +index 61498c144a2..99d2c479849 100644 +--- a/lib/Driver/UnixToolChains.cpp ++++ b/lib/Driver/UnixToolChains.cpp +@@ -9,6 +9,8 @@ + // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors + // + //===----------------------------------------------------------------------===// ++#include ++#include + + #include "ToolChains.h" + +@@ -111,6 +113,24 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation( + } + + std::string toolchains::GenericUnix::getDefaultLinker() const { ++ // Check if we are on Amazon Linux and set default linker to lld. ++ if (getTriple().isOSLinux()) { ++ std::string getLinuxDistro() { ++ std::ifstream file("/etc/os-release"); ++ std::string line; ++ ++ while (std::getline(file, line)) { ++ if (line.substr(0, 3) == "ID=") { ++ return line.substr(3); ++ } ++ } ++ return "unknown"; // Return "unknown" if the ID field is not found ++ } ++ if (getLinuxDistro() == "amzn") { ++ return "lld"; ++ } ++ } ++ + if (getTriple().isAndroid()) + return "lld"; +