Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
futurejones authored Mar 1, 2024
1 parent b4be93b commit ea01bb8
Showing 1 changed file with 17 additions and 34 deletions.
51 changes: 17 additions & 34 deletions test-patches/amazonlinux-lld-UnixToolchains.patch
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
diff --git a/lib/Driver/UnixToolChains.cpp b/lib/Driver/UnixToolChains.cpp
index 61498c144a2..f1952d57620 100644
index 61498c144a2..f9f540ec144 100644
--- a/lib/Driver/UnixToolChains.cpp
+++ b/lib/Driver/UnixToolChains.cpp
@@ -10,6 +10,9 @@
//
//===----------------------------------------------------------------------===//

+#include <iostream>
+#include "llvm/TargetParser/Triple.h"
+
#include "ToolChains.h"

#include "swift/Basic/Dwarf.h"
@@ -111,8 +114,23 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation(
}

std::string toolchains::GenericUnix::getDefaultLinker() const {
+ std::cout << "We need to check for Amazon Linux and set default to lld\n";
+ std::cout << "getTriple().getArch(): " << getTriple().getArch() << std::endl;
+ std::cout << "getTriple().getVendorName(): " << getTriple().getVendorName() << std::endl;
+ std::cout << "getTriple().isAndroid(): " << getTriple().isAndroid() << std::endl;
+ std::cout << "getTriple().getArchName(): " << getTriple().getArchName() << std::endl;
+ std::cout << "getTriple().getOSName(): " << getTriple().getOSName() << std::endl;
+ std::cout << "getTriple().getOS(): " << getTriple().getOS() << std::endl;
+ std::cout << "getTriple().getOSMajorVersion(): " << getTriple().getOSMajorVersion() << std::endl;
+ std::cout << "getTriple().getOSMinorVersion(): " << getTriple().getOSMinorVersion() << std::endl;
+
if (getTriple().isAndroid())
return "lld";
+ // Check for Amazon Linux and default to lld
+ if (getTriple().getVendorName() == "amazon") {
+ std::cout << "We are using Amazon Linux so default to lld\n";
@@ -125,14 +125,14 @@ std::string toolchains::GenericUnix::getDefaultLinker() const {
// section on these targets, it also generates COPY relocations for
// final executables, as such, unless specified, we default to gold
// linker.
- return "gold";
+ return "lld";
+ }

switch (getTriple().getArch()) {
case llvm::Triple::arm:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
case llvm::Triple::systemz:
// BFD linker has issues wrt relocations against protected symbols.
- return "gold";
+ return "lld";
default:
// Otherwise, use the default BFD linker.
return "";

0 comments on commit ea01bb8

Please sign in to comment.