diff options
author | Ayke van Laethem <[email protected]> | 2023-09-23 15:06:27 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-01-05 21:13:30 +0100 |
commit | 6984af43a08b7fa1c1020700c42ce8c417d1f542 (patch) | |
tree | 79e9b9bfe07c1d9a67913585a39ec17321715ce4 /builder/cc1as.cpp | |
parent | 81c56c3ab89fe0598361c00f03eb0498d2ea0924 (diff) | |
download | tinygo-6984af43a08b7fa1c1020700c42ce8c417d1f542.tar.gz tinygo-6984af43a08b7fa1c1020700c42ce8c417d1f542.zip |
all: statically link to LLVM 17 instead of LLVM 16
We can now finally do it, now that Espressif has updated their fork.
Diffstat (limited to 'builder/cc1as.cpp')
-rw-r--r-- | builder/cc1as.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/builder/cc1as.cpp b/builder/cc1as.cpp index 8b28426b0..9f9e377fa 100644 --- a/builder/cc1as.cpp +++ b/builder/cc1as.cpp @@ -1,5 +1,12 @@ //go:build byollvm +// Source: https://github.com/llvm/llvm-project/blob/main/clang/tools/driver/cc1as_main.cpp +// This file needs to be updated each LLVM release. +// There are a few small modifications to make, like: +// * ExecuteAssembler is made non-static. +// * The struct AssemblerImplementation is moved to cc1as.h so it can be +// included elsewhere. + //===-- cc1as.cpp - Clang Assembler --------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. @@ -21,8 +28,8 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/ADT/Triple.h" #include "llvm/IR/DataLayout.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" @@ -46,7 +53,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" @@ -55,6 +61,8 @@ #include "llvm/Support/TargetSelect.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/TargetParser/Host.h" +#include "llvm/TargetParser/Triple.h" #include <memory> #include <optional> #include <system_error> @@ -151,8 +159,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) { auto Split = StringRef(Arg).split('='); - Opts.DebugPrefixMap.insert( - {std::string(Split.first), std::string(Split.second)}); + Opts.DebugPrefixMap.emplace_back(Split.first, Split.second); } // Frontend Options @@ -225,6 +232,9 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, .Case("default", EmitDwarfUnwindType::Default); } + Opts.EmitCompactUnwindNonCanonical = + Args.hasArg(OPT_femit_compact_unwind_non_canonical); + Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file); return Success; @@ -260,8 +270,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true); if (std::error_code EC = Buffer.getError()) { - Error = EC.message(); - return Diags.Report(diag::err_fe_error_reading) << Opts.InputFile; + return Diags.Report(diag::err_fe_error_reading) + << Opts.InputFile << EC.message(); } SourceMgr SrcMgr; @@ -278,6 +288,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, MCTargetOptions MCOptions; MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind; + MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical; MCOptions.AsSecureLogFile = Opts.AsSecureLogFile; std::unique_ptr<MCAsmInfo> MAI( |