mirror of
https://linux.maple.camp/git/ahill/maplelinux-bootstrap.git
synced 2026-02-11 10:13:35 +00:00
Updated sources and moved configuration to its own folder
This commit is contained in:
@@ -1,385 +0,0 @@
|
||||
diff -ruN mrustc-0.11.2.orig/src/ast/ast.cpp mrustc-0.11.2/src/ast/ast.cpp
|
||||
--- mrustc-0.11.2.orig/src/ast/ast.cpp 2025-05-05 19:48:49.015447489 -0400
|
||||
+++ mrustc-0.11.2/src/ast/ast.cpp 2025-05-06 21:59:55.063318921 -0400
|
||||
@@ -243,9 +243,9 @@
|
||||
|
||||
Function::Function(Span sp, ::std::string abi, Flags flags, GenericParams params, TypeRef ret_type, Arglist args, bool is_variadic):
|
||||
m_span(sp),
|
||||
- m_params( move(params) ),
|
||||
- m_rettype( move(ret_type) ),
|
||||
- m_args( move(args) ),
|
||||
+ m_params( std::move(params) ),
|
||||
+ m_rettype( std::move(ret_type) ),
|
||||
+ m_args( std::move(args) ),
|
||||
m_is_variadic(is_variadic),
|
||||
m_abi( mv$(abi) ),
|
||||
m_flags(flags)
|
||||
diff -ruN mrustc-0.11.2.orig/src/ast/ast.hpp mrustc-0.11.2/src/ast/ast.hpp
|
||||
--- mrustc-0.11.2.orig/src/ast/ast.hpp 2025-05-05 19:48:49.015447489 -0400
|
||||
+++ mrustc-0.11.2/src/ast/ast.hpp 2025-05-06 22:00:48.786212819 -0400
|
||||
@@ -101,8 +101,8 @@
|
||||
|
||||
//TypeAlias() {}
|
||||
TypeAlias(GenericParams params, TypeRef type):
|
||||
- m_params( move(params) ),
|
||||
- m_type( move(type) )
|
||||
+ m_params( std::move(params) ),
|
||||
+ m_type( std::move(type) )
|
||||
{}
|
||||
static TypeAlias new_associated_type(GenericParams params, GenericParams type_bounds, TypeRef default_type) {
|
||||
TypeAlias rv { std::move(params), std::move(default_type) };
|
||||
@@ -164,8 +164,8 @@
|
||||
|
||||
Static(Class s_class, TypeRef type, Expr value):
|
||||
m_class(s_class),
|
||||
- m_type( move(type) ),
|
||||
- m_value( move(value) )
|
||||
+ m_type( std::move(type) ),
|
||||
+ m_value( std::move(value) )
|
||||
{}
|
||||
|
||||
const Class& s_class() const { return m_class; }
|
||||
@@ -421,8 +421,8 @@
|
||||
|
||||
Enum() {}
|
||||
Enum( GenericParams params, ::std::vector<EnumVariant> variants ):
|
||||
- m_params( move(params) ),
|
||||
- m_variants( move(variants) )
|
||||
+ m_params( std::move(params) ),
|
||||
+ m_variants( std::move(variants) )
|
||||
{}
|
||||
|
||||
const GenericParams& params() const { return m_params; }
|
||||
@@ -483,11 +483,11 @@
|
||||
{
|
||||
}
|
||||
Struct( GenericParams params, ::std::vector<StructItem> fields ):
|
||||
- m_params( move(params) ),
|
||||
+ m_params( std::move(params) ),
|
||||
m_data( StructData::make_Struct({mv$(fields)}) )
|
||||
{}
|
||||
Struct( GenericParams params, ::std::vector<TupleItem> fields ):
|
||||
- m_params( move(params) ),
|
||||
+ m_params( std::move(params) ),
|
||||
m_data( StructData::make_Tuple({mv$(fields)}) )
|
||||
{}
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
} m_markings;
|
||||
|
||||
Union( GenericParams params, ::std::vector<StructItem> fields ):
|
||||
- m_params( move(params) ),
|
||||
+ m_params( std::move(params) ),
|
||||
m_variants( mv$(fields) )
|
||||
{}
|
||||
|
||||
diff -ruN mrustc-0.11.2.orig/src/ast/expr.hpp mrustc-0.11.2/src/ast/expr.hpp
|
||||
--- mrustc-0.11.2.orig/src/ast/expr.hpp 2025-05-05 19:48:49.015447489 -0400
|
||||
+++ mrustc-0.11.2/src/ast/expr.hpp 2025-05-06 22:01:28.556431607 -0400
|
||||
@@ -76,8 +76,8 @@
|
||||
m_block_type(type),
|
||||
m_yields_final_value(yields_final_value),
|
||||
m_label(""),
|
||||
- m_local_mod( move(local_mod) ),
|
||||
- m_nodes( move(nodes) )
|
||||
+ m_local_mod( std::move(local_mod) ),
|
||||
+ m_nodes( std::move(nodes) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -106,9 +106,9 @@
|
||||
bool m_is_braced;
|
||||
|
||||
ExprNode_Macro(AST::Path name, RcString ident, ::TokenTree&& tokens, bool is_braced=false):
|
||||
- m_path( move(name) ),
|
||||
+ m_path( std::move(name) ),
|
||||
m_ident(ident),
|
||||
- m_tokens( move(tokens) )
|
||||
+ m_tokens( std::move(tokens) )
|
||||
, m_is_braced(is_braced)
|
||||
{}
|
||||
|
||||
@@ -132,11 +132,11 @@
|
||||
::std::vector<::std::string> m_flags;
|
||||
|
||||
ExprNode_Asm(::std::string text, ::std::vector<ValRef> output, ::std::vector<ValRef> input, ::std::vector<::std::string> clobbers, ::std::vector<::std::string> flags):
|
||||
- m_text( move(text) ),
|
||||
- m_output( move(output) ),
|
||||
- m_input( move(input) ),
|
||||
- m_clobbers( move(clobbers) ),
|
||||
- m_flags( move(flags) )
|
||||
+ m_text( std::move(text) ),
|
||||
+ m_output( std::move(output) ),
|
||||
+ m_input( std::move(input) ),
|
||||
+ m_clobbers( std::move(clobbers) ),
|
||||
+ m_flags( std::move(flags) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@
|
||||
|
||||
ExprNode_Asm2(AsmCommon::Options options, std::vector<AsmCommon::Line> lines, std::vector<Param> params)
|
||||
: m_options(options)
|
||||
- , m_lines( move(lines) )
|
||||
- , m_params( move(params) )
|
||||
+ , m_lines( std::move(lines) )
|
||||
+ , m_params( std::move(params) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@
|
||||
|
||||
ExprNode_Flow(Type type, Ident target, ExprNodeP value):
|
||||
m_type(type),
|
||||
- m_target( move(target) ),
|
||||
- m_value( move(value) )
|
||||
+ m_target( std::move(target) ),
|
||||
+ m_value( std::move(value) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -212,10 +212,10 @@
|
||||
::std::pair<unsigned,unsigned> m_letelse_slots;
|
||||
|
||||
ExprNode_LetBinding(Pattern pat, TypeRef type, ExprNodeP value, ExprNodeP else_arm={})
|
||||
- : m_pat( move(pat) )
|
||||
- , m_type( move(type) )
|
||||
- , m_value( move(value) )
|
||||
- , m_else( move(else_arm) )
|
||||
+ : m_pat( std::move(pat) )
|
||||
+ , m_type( std::move(type) )
|
||||
+ , m_value( std::move(value) )
|
||||
+ , m_else( std::move(else_arm) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -237,8 +237,8 @@
|
||||
ExprNode_Assign(): m_op(NONE) {}
|
||||
ExprNode_Assign(Operation op, ExprNodeP slot, ExprNodeP value):
|
||||
m_op(op),
|
||||
- m_slot( move(slot) ),
|
||||
- m_value( move(value) )
|
||||
+ m_slot( std::move(slot) ),
|
||||
+ m_value( std::move(value) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -251,8 +251,8 @@
|
||||
::std::vector<ExprNodeP> m_args;
|
||||
|
||||
ExprNode_CallPath(Path&& path, ::std::vector<ExprNodeP>&& args):
|
||||
- m_path( move(path) ),
|
||||
- m_args( move(args) )
|
||||
+ m_path( std::move(path) ),
|
||||
+ m_args( std::move(args) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -266,9 +266,9 @@
|
||||
::std::vector<ExprNodeP> m_args;
|
||||
|
||||
ExprNode_CallMethod(ExprNodeP obj, PathNode method, ::std::vector<ExprNodeP> args):
|
||||
- m_val( move(obj) ),
|
||||
- m_method( move(method) ),
|
||||
- m_args( move(args) )
|
||||
+ m_val( std::move(obj) ),
|
||||
+ m_method( std::move(method) ),
|
||||
+ m_args( std::move(args) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -282,8 +282,8 @@
|
||||
::std::vector<ExprNodeP> m_args;
|
||||
|
||||
ExprNode_CallObject(ExprNodeP val, ::std::vector< ExprNodeP >&& args):
|
||||
- m_val( move(val) ),
|
||||
- m_args( move(args) )
|
||||
+ m_val( std::move(val) ),
|
||||
+ m_args( std::move(args) )
|
||||
{
|
||||
}
|
||||
NODE_METHODS();
|
||||
@@ -531,9 +531,9 @@
|
||||
t_values m_values;
|
||||
|
||||
ExprNode_StructLiteral(Path path, ExprNodeP base_value, t_values&& values ):
|
||||
- m_path( move(path) ),
|
||||
- m_base_value( move(base_value) ),
|
||||
- m_values( move(values) )
|
||||
+ m_path( std::move(path) ),
|
||||
+ m_base_value( std::move(base_value) ),
|
||||
+ m_values( std::move(values) )
|
||||
{}
|
||||
|
||||
NODE_METHODS();
|
||||
@@ -548,8 +548,8 @@
|
||||
t_values m_values;
|
||||
|
||||
ExprNode_StructLiteralPattern(Path path, t_values&& values)
|
||||
- : m_path( move(path) )
|
||||
- , m_values( move(values) )
|
||||
+ : m_path( std::move(path) )
|
||||
+ , m_values( std::move(values) )
|
||||
{}
|
||||
|
||||
NODE_METHODS();
|
||||
@@ -646,8 +646,8 @@
|
||||
TypeRef m_type;
|
||||
|
||||
ExprNode_Cast(ExprNodeP value, TypeRef&& dst_type):
|
||||
- m_value( move(value) ),
|
||||
- m_type( move(dst_type) )
|
||||
+ m_value( std::move(value) ),
|
||||
+ m_type( std::move(dst_type) )
|
||||
{
|
||||
}
|
||||
NODE_METHODS();
|
||||
@@ -661,8 +661,8 @@
|
||||
TypeRef m_type;
|
||||
|
||||
ExprNode_TypeAnnotation(ExprNodeP value, TypeRef&& dst_type):
|
||||
- m_value( move(value) ),
|
||||
- m_type( move(dst_type) )
|
||||
+ m_value( std::move(value) ),
|
||||
+ m_type( std::move(dst_type) )
|
||||
{
|
||||
}
|
||||
NODE_METHODS();
|
||||
diff -ruN mrustc-0.11.2.orig/src/ast/lifetime_ref.hpp mrustc-0.11.2/src/ast/lifetime_ref.hpp
|
||||
--- mrustc-0.11.2.orig/src/ast/lifetime_ref.hpp 2025-05-05 20:46:46.568398964 -0400
|
||||
+++ mrustc-0.11.2/src/ast/lifetime_ref.hpp 2025-05-05 19:59:44.934652489 -0400
|
||||
@@ -6,6 +6,7 @@
|
||||
* - AST Lifetime reference
|
||||
*/
|
||||
#pragma once
|
||||
+#include <cstdint>
|
||||
#include "../common.hpp"
|
||||
#include "ident.hpp"
|
||||
|
||||
diff -ruN mrustc-0.11.2.orig/src/debug.cpp mrustc-0.11.2/src/debug.cpp
|
||||
--- mrustc-0.11.2.orig/src/debug.cpp 2025-05-05 20:46:46.568562659 -0400
|
||||
+++ mrustc-0.11.2/src/debug.cpp 2025-05-05 19:57:59.149549205 -0400
|
||||
@@ -5,6 +5,7 @@
|
||||
* debug.cpp
|
||||
* - Debug printing (with indenting)
|
||||
*/
|
||||
+#include <cstdint>
|
||||
#include <debug_inner.hpp>
|
||||
#include <debug.hpp>
|
||||
#include <set>
|
||||
diff -ruN mrustc-0.11.2.orig/src/hir/expr.hpp mrustc-0.11.2/src/hir/expr.hpp
|
||||
--- mrustc-0.11.2.orig/src/hir/expr.hpp 2025-05-05 19:48:49.017523096 -0400
|
||||
+++ mrustc-0.11.2/src/hir/expr.hpp 2025-05-06 22:02:51.568333466 -0400
|
||||
@@ -156,8 +156,8 @@
|
||||
ExprNode_Asm2(Span sp, AsmCommon::Options options, std::vector<AsmCommon::Line> lines, std::vector<Param> params)
|
||||
: ExprNode(mv$(sp))
|
||||
, m_options(options)
|
||||
- , m_lines( move(lines) )
|
||||
- , m_params( move(params) )
|
||||
+ , m_lines( std::move(lines) )
|
||||
+ , m_params( std::move(params) )
|
||||
{
|
||||
}
|
||||
|
||||
diff -ruN mrustc-0.11.2.orig/src/hir/generic_ref.hpp mrustc-0.11.2/src/hir/generic_ref.hpp
|
||||
--- mrustc-0.11.2.orig/src/hir/generic_ref.hpp 2025-05-05 20:46:46.568679102 -0400
|
||||
+++ mrustc-0.11.2/src/hir/generic_ref.hpp 2025-05-05 19:59:36.463727568 -0400
|
||||
@@ -6,6 +6,7 @@
|
||||
* - Reference to a generic
|
||||
*/
|
||||
#pragma once
|
||||
+#include <cstdint>
|
||||
#include <rc_string.hpp>
|
||||
|
||||
/// Binding index for a Generic that indicates "Self"
|
||||
diff -ruN mrustc-0.11.2.orig/src/hir/type_ref.hpp mrustc-0.11.2/src/hir/type_ref.hpp
|
||||
--- mrustc-0.11.2.orig/src/hir/type_ref.hpp 2025-05-05 20:46:46.568770980 -0400
|
||||
+++ mrustc-0.11.2/src/hir/type_ref.hpp 2025-05-05 19:59:57.743537961 -0400
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
+#include <cstdint>
|
||||
#include <rc_string.hpp>
|
||||
#include <span.hpp>
|
||||
|
||||
diff -ruN mrustc-0.11.2.orig/src/macro_rules/macro_rules.hpp mrustc-0.11.2/src/macro_rules/macro_rules.hpp
|
||||
--- mrustc-0.11.2.orig/src/macro_rules/macro_rules.hpp 2025-05-05 19:48:49.012008507 -0400
|
||||
+++ mrustc-0.11.2/src/macro_rules/macro_rules.hpp 2025-05-06 22:02:05.491732403 -0400
|
||||
@@ -102,7 +102,7 @@
|
||||
name( op ),
|
||||
name_index(index),
|
||||
tok( mv$(sep) ),
|
||||
- subpats( move(ents) ),
|
||||
+ subpats( std::move(ents) ),
|
||||
type(PAT_LOOP)
|
||||
{
|
||||
}
|
||||
diff -ruN mrustc-0.11.2.orig/src/trans/codegen_c.cpp mrustc-0.11.2/src/trans/codegen_c.cpp
|
||||
--- mrustc-0.11.2.orig/src/trans/codegen_c.cpp 2025-05-05 19:48:49.014366958 -0400
|
||||
+++ mrustc-0.11.2/src/trans/codegen_c.cpp 2025-05-06 22:09:34.173707709 -0400
|
||||
@@ -1287,10 +1287,11 @@
|
||||
break;
|
||||
}
|
||||
// HACK: Work around [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423] by disabling an optimisation stage
|
||||
- if( opt.opt_level > 0 )
|
||||
+ // Disabled for Maple Linux. See build-chroot.sh for details. ~ahill
|
||||
+ /* if( opt.opt_level > 0 )
|
||||
{
|
||||
args.push_back("-fno-tree-sra");
|
||||
- }
|
||||
+ } */
|
||||
if( opt.emit_debug_info )
|
||||
{
|
||||
args.push_back("-g");
|
||||
@@ -4785,7 +4786,8 @@
|
||||
switch (v.first[0])
|
||||
{
|
||||
case '=': m_of << "="; break;
|
||||
- case '+': m_of << "+"; break;
|
||||
+ // Patched for Maple Linux. See build-chroot.sh for details. ~ahill
|
||||
+ case '+': m_of << "="; break;
|
||||
default: MIR_TODO(mir_res, "Handle asm! output leader '" << v.first[0] << "'");
|
||||
}
|
||||
m_of << H::convert_reg(v.first.c_str() + 1);
|
||||
@@ -5428,12 +5430,14 @@
|
||||
if(i != 0) m_of << ",";
|
||||
m_of << " ";
|
||||
m_of << "\"";
|
||||
- if( !p.output && !p.input ) {
|
||||
+ // Patched for Maple Linux. See build-chroot.sh for details. ~ahill
|
||||
+ m_of << "=";
|
||||
+ /*if( !p.output && !p.input ) {
|
||||
m_of << "+";
|
||||
}
|
||||
else {
|
||||
m_of << (p.input ? "+" : "=");
|
||||
- }
|
||||
+ }*/
|
||||
TU_MATCH_HDRA((p.spec), {)
|
||||
TU_ARMA(Class, c)
|
||||
// https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
|
||||
diff -ruN mrustc-0.11.2.orig/src/trans/target.cpp mrustc-0.11.2/src/trans/target.cpp
|
||||
--- mrustc-0.11.2.orig/src/trans/target.cpp 2025-05-05 19:48:49.014366958 -0400
|
||||
+++ mrustc-0.11.2/src/trans/target.cpp 2025-05-06 22:07:39.775297252 -0400
|
||||
@@ -405,7 +405,8 @@
|
||||
TargetSpec init_from_spec_name(const ::std::string& target_name)
|
||||
{
|
||||
// Options for all the fully-GNU environments
|
||||
- #define BACKEND_C_OPTS_GNU {"-ffunction-sections", "-pthread"}, {"-Wl,--start-group"}, {"-Wl,--end-group", "-Wl,--gc-sections", "-l", "atomic"}
|
||||
+ // Patched for Maple Linux. See build-chroot.sh for details. ~ahill
|
||||
+ #define BACKEND_C_OPTS_GNU {"-ffunction-sections", "-pthread"}, {"-Wl,--start-group"}, {"-Wl,--end-group", "-Wl,--gc-sections"}
|
||||
// If there's a '/' or a '\' in the filename, open it as a path, otherwise assume it's a triple.
|
||||
if( target_name.find('/') != ::std::string::npos || target_name.find('\\') != ::std::string::npos )
|
||||
{
|
||||
diff -ruN mrustc-0.11.2.orig/src/trans/codegen_c.cpp mrustc-0.11.2/src/trans/codegen_c.cpp
|
||||
--- mrustc-0.11.2.orig/src/trans/codegen_c.cpp 2024-12-29 22:28:18.000000000 -0500
|
||||
+++ mrustc-0.11.2/src/trans/codegen_c.cpp 2025-05-07 12:57:51.573401275 -0400
|
||||
@@ -1295,6 +1295,7 @@
|
||||
{
|
||||
args.push_back("-g");
|
||||
}
|
||||
+ args.push_back("-fno-delete-null-pointer-checks");
|
||||
// TODO: Why?
|
||||
args.push_back("-fPIC");
|
||||
args.push_back("-o");
|
||||
@@ -1,399 +0,0 @@
|
||||
--- rustc-1.74.0-src.orig/compiler/rustc_codegen_llvm/src/consts.rs 2023-11-12 23:10:51.000000000 -0500
|
||||
+++ rustc-1.74.0-src/compiler/rustc_codegen_llvm/src/consts.rs 2025-05-07 11:37:17.220114783 -0400
|
||||
@@ -371,8 +371,9 @@
|
||||
// otherwise some LLVM optimization passes don't work as expected
|
||||
let mut val_llty = self.val_ty(v);
|
||||
let v = if val_llty == self.type_i1() {
|
||||
- val_llty = self.type_i8();
|
||||
- llvm::LLVMConstZExt(v, val_llty)
|
||||
+ // val_llty = self.type_i8();
|
||||
+ // llvm::LLVMConstZExt(v, val_llty)
|
||||
+ unimplemented!("Const ZExt");
|
||||
} else {
|
||||
v
|
||||
};
|
||||
--- rustc-1.74.0-src.orig/compiler/rustc_codegen_llvm/src/llvm/ffi.rs 2023-11-12 23:10:51.000000000 -0500
|
||||
+++ rustc-1.74.0-src/compiler/rustc_codegen_llvm/src/llvm/ffi.rs 2025-05-07 11:39:59.399988363 -0400
|
||||
@@ -969,7 +969,7 @@
|
||||
ConstantIndices: *const &'a Value,
|
||||
NumIndices: c_uint,
|
||||
) -> &'a Value;
|
||||
- pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
||||
+ // pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
||||
pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
||||
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
||||
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
||||
--- rustc-1.74.0-src.orig/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h 2023-11-12 23:10:51.000000000 -0500
|
||||
+++ rustc-1.74.0-src/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h 2025-05-06 22:48:58.362609469 -0400
|
||||
@@ -23,9 +23,9 @@
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
-#include "llvm/Transforms/Instrumentation.h"
|
||||
+#include "llvm/Transforms/Utils/Instrumentation.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
-#include "llvm/Transforms/Vectorize.h"
|
||||
+#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
|
||||
|
||||
#define LLVM_VERSION_GE(major, minor) \
|
||||
(LLVM_VERSION_MAJOR > (major) || \
|
||||
--- ./rustc-1.74.0-src.orig/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp 2023-11-13 04:10:51.000000000 +0000
|
||||
+++ ./rustc-1.74.0-src/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp 2025-05-08 01:29:24.667035511 +0000
|
||||
@@ -1,3 +1,4 @@
|
||||
+#include <llvm/Pass.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -38,7 +39,7 @@
|
||||
#include "llvm/LTO/LTO.h"
|
||||
#include "llvm/Bitcode/BitcodeWriter.h"
|
||||
|
||||
-#include "llvm/Transforms/Instrumentation.h"
|
||||
+#include "llvm/Transforms/Utils/Instrumentation.h"
|
||||
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
|
||||
#include "llvm/Support/TimeProfiler.h"
|
||||
#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"
|
||||
@@ -50,6 +51,9 @@
|
||||
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
|
||||
#include "llvm/Transforms/Utils.h"
|
||||
|
||||
+#include "llvm-c/TargetMachine.h"
|
||||
+#include "llvm-c/Target.h"
|
||||
+
|
||||
using namespace llvm;
|
||||
|
||||
static codegen::RegisterCodeGenFlags CGF;
|
||||
@@ -331,7 +335,7 @@
|
||||
PrintBackendInfo Print,
|
||||
void* Out) {
|
||||
const TargetMachine *Target = unwrap(TM);
|
||||
- const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
|
||||
+ const Triple::ArchType HostArch = Triple(LLVMGetDefaultTargetTriple()).getArch();
|
||||
const Triple::ArchType TargetArch = Target->getTargetTriple().getArch();
|
||||
|
||||
std::ostringstream Buf;
|
||||
@@ -351,7 +355,7 @@
|
||||
// different arch since that could be wrong or misleading.
|
||||
if (HostArch == TargetArch) {
|
||||
MaxCPULen = std::max(MaxCPULen, (unsigned) std::strlen("native"));
|
||||
- const StringRef HostCPU = sys::getHostCPUName();
|
||||
+ const StringRef HostCPU = LLVMGetHostCPUName();
|
||||
Buf << " " << std::left << std::setw(MaxCPULen) << "native"
|
||||
<< " - Select the CPU of the current host "
|
||||
"(currently " << HostCPU.str() << ").\n";
|
||||
@@ -397,7 +401,7 @@
|
||||
}
|
||||
|
||||
extern "C" const char* LLVMRustGetHostCPUName(size_t *len) {
|
||||
- StringRef Name = sys::getHostCPUName();
|
||||
+ StringRef Name = LLVMGetHostCPUName();
|
||||
*len = Name.size();
|
||||
return Name.data();
|
||||
}
|
||||
@@ -452,7 +456,7 @@
|
||||
if (OutputObjFile) {
|
||||
Options.ObjectFilenameForDebug = OutputObjFile;
|
||||
}
|
||||
-#if LLVM_VERSION_GE(16, 0)
|
||||
+/*#if LLVM_VERSION_GE(16, 0)
|
||||
if (!strcmp("zlib", DebugInfoCompression) && llvm::compression::zlib::isAvailable()) {
|
||||
Options.CompressDebugSections = DebugCompressionType::Zlib;
|
||||
} else if (!strcmp("zstd", DebugInfoCompression) && llvm::compression::zstd::isAvailable()) {
|
||||
@@ -460,9 +464,9 @@
|
||||
} else if (!strcmp("none", DebugInfoCompression)) {
|
||||
Options.CompressDebugSections = DebugCompressionType::None;
|
||||
}
|
||||
-#endif
|
||||
+#endif*/
|
||||
|
||||
- Options.RelaxELFRelocations = RelaxELFRelocations;
|
||||
+ //Options.RelaxELFRelocations = RelaxELFRelocations;
|
||||
Options.UseInitArray = UseInitArray;
|
||||
|
||||
#if LLVM_VERSION_LT(17, 0)
|
||||
@@ -515,8 +519,11 @@
|
||||
assert(buffer_offset == ArgsCstrBuffLen);
|
||||
|
||||
Options.MCOptions.Argv0 = arg0;
|
||||
- Options.MCOptions.CommandLineArgs =
|
||||
- llvm::ArrayRef<std::string>(cmd_arg_strings, num_cmd_arg_strings);
|
||||
+ std::string args = "";
|
||||
+ for (int i = 0; i < num_cmd_arg_strings; i++) {
|
||||
+ args += cmd_arg_strings[i] + " ";
|
||||
+ }
|
||||
+ Options.MCOptions.CommandlineArgs = args;
|
||||
}
|
||||
|
||||
TargetMachine *TM = TheTarget->createTargetMachine(
|
||||
@@ -527,8 +534,8 @@
|
||||
extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) {
|
||||
|
||||
MCTargetOptions& MCOptions = unwrap(TM)->Options.MCOptions;
|
||||
- delete[] MCOptions.Argv0;
|
||||
- delete[] MCOptions.CommandLineArgs.data();
|
||||
+ // delete[] MCOptions.Argv0;
|
||||
+ // delete[] MCOptions.CommandLineArgs.data();
|
||||
|
||||
delete unwrap(TM);
|
||||
}
|
||||
@@ -541,7 +548,7 @@
|
||||
TargetLibraryInfoImpl TLII(TargetTriple);
|
||||
if (DisableSimplifyLibCalls)
|
||||
TLII.disableAllFunctions();
|
||||
- unwrap(PMR)->add(new TargetLibraryInfoWrapperPass(TLII));
|
||||
+ unwrap(PMR)->add(reinterpret_cast<Pass*>(new TargetLibraryInfoWrapperPass(TLII)));
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustSetLLVMOptions(int Argc, char **Argv) {
|
||||
@@ -761,6 +768,7 @@
|
||||
FS,
|
||||
#endif
|
||||
PGOOptions::IRInstr, PGOOptions::NoCSAction,
|
||||
+ PGOOptions::ColdFuncOpt::Default,
|
||||
DebugInfoForProfiling);
|
||||
} else if (PGOUsePath) {
|
||||
assert(!PGOSampleUsePath);
|
||||
@@ -770,6 +778,7 @@
|
||||
FS,
|
||||
#endif
|
||||
PGOOptions::IRUse, PGOOptions::NoCSAction,
|
||||
+ PGOOptions::ColdFuncOpt::Default,
|
||||
DebugInfoForProfiling);
|
||||
} else if (PGOSampleUsePath) {
|
||||
PGOOpt = PGOOptions(PGOSampleUsePath, "", "",
|
||||
@@ -778,6 +787,7 @@
|
||||
FS,
|
||||
#endif
|
||||
PGOOptions::SampleUse, PGOOptions::NoCSAction,
|
||||
+ PGOOptions::ColdFuncOpt::Default,
|
||||
DebugInfoForProfiling);
|
||||
} else if (DebugInfoForProfiling) {
|
||||
PGOOpt = PGOOptions("", "", "",
|
||||
@@ -786,6 +796,7 @@
|
||||
FS,
|
||||
#endif
|
||||
PGOOptions::NoAction, PGOOptions::NoCSAction,
|
||||
+ PGOOptions::ColdFuncOpt::Default,
|
||||
DebugInfoForProfiling);
|
||||
}
|
||||
|
||||
@@ -813,7 +824,7 @@
|
||||
// PassBuilder does not create a pipeline.
|
||||
std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
|
||||
PipelineStartEPCallbacks;
|
||||
- std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
|
||||
+ std::vector<std::function<void(ModulePassManager &, OptimizationLevel, ThinOrFullLTOPhase)>>
|
||||
OptimizerLastEPCallbacks;
|
||||
|
||||
if (!IsLinkerPluginLTO
|
||||
@@ -823,7 +834,7 @@
|
||||
[](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||
MPM.addPass(LowerTypeTestsPass(/*ExportSummary=*/nullptr,
|
||||
/*ImportSummary=*/nullptr,
|
||||
- /*DropTypeTests=*/false));
|
||||
+ /*DropTypeTests=*/llvm::lowertypetests::DropTestKind::None));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -854,7 +865,7 @@
|
||||
// cargo run tests in multhreading mode by default
|
||||
// so use atomics for coverage counters
|
||||
Options.Atomic = true;
|
||||
- MPM.addPass(InstrProfiling(Options, false));
|
||||
+ MPM.addPass(InstrProfilingLoweringPass(Options, false));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -867,7 +878,7 @@
|
||||
/*CompileKernel=*/false,
|
||||
/*EagerChecks=*/true);
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
- [Options](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||
+ [Options](ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase _) {
|
||||
#if LLVM_VERSION_LT(16, 0)
|
||||
MPM.addPass(ModuleMemorySanitizerPass(Options));
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
|
||||
@@ -880,7 +891,7 @@
|
||||
|
||||
if (SanitizerOptions->SanitizeThread) {
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
- [](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||
+ [](ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase _) {
|
||||
MPM.addPass(ModuleThreadSanitizerPass());
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
|
||||
}
|
||||
@@ -889,7 +900,7 @@
|
||||
|
||||
if (SanitizerOptions->SanitizeAddress || SanitizerOptions->SanitizeKernelAddress) {
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
- [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||
+ [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase _) {
|
||||
auto CompileKernel = SanitizerOptions->SanitizeKernelAddress;
|
||||
AddressSanitizerOptions opts = AddressSanitizerOptions{
|
||||
CompileKernel,
|
||||
@@ -908,7 +919,7 @@
|
||||
}
|
||||
if (SanitizerOptions->SanitizeHWAddress) {
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
- [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||
+ [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase _) {
|
||||
HWAddressSanitizerOptions opts(
|
||||
/*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover,
|
||||
/*DisableOptimization=*/false);
|
||||
@@ -945,7 +956,7 @@
|
||||
PB.registerOptimizerLastEPCallback(C);
|
||||
|
||||
// Pass false as we manually schedule ThinLTOBufferPasses below.
|
||||
- MPM = PB.buildO0DefaultPipeline(OptLevel, /* PreLinkLTO */ false);
|
||||
+ MPM = PB.buildO0DefaultPipeline(OptLevel, /* PreLinkLTO */ ThinOrFullLTOPhase::FullLTOPreLink);
|
||||
} else {
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
PB.registerPipelineStartEPCallback(C);
|
||||
@@ -956,7 +967,7 @@
|
||||
|
||||
switch (OptStage) {
|
||||
case LLVMRustOptStage::PreLinkNoLTO:
|
||||
- MPM = PB.buildPerModuleDefaultPipeline(OptLevel, DebugPassManager);
|
||||
+ MPM = PB.buildPerModuleDefaultPipeline(OptLevel, ThinOrFullLTOPhase::FullLTOPreLink);
|
||||
break;
|
||||
case LLVMRustOptStage::PreLinkThinLTO:
|
||||
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
|
||||
@@ -967,7 +978,7 @@
|
||||
if (OptimizerLastEPCallbacks.empty())
|
||||
NeedThinLTOBufferPasses = false;
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
- C(MPM, OptLevel);
|
||||
+ C(MPM, OptLevel, ThinOrFullLTOPhase::None);
|
||||
break;
|
||||
case LLVMRustOptStage::PreLinkFatLTO:
|
||||
MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel);
|
||||
@@ -989,7 +1000,7 @@
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
C(MPM, OptLevel);
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
- C(MPM, OptLevel);
|
||||
+ C(MPM, OptLevel, ThinOrFullLTOPhase::None);
|
||||
}
|
||||
|
||||
if (ExtraPassesLen) {
|
||||
@@ -1218,7 +1229,7 @@
|
||||
// Not 100% sure what these are, but they impact what's internalized and
|
||||
// what's inlined across modules, I believe.
|
||||
#if LLVM_VERSION_GE(18, 0)
|
||||
- DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
|
||||
+ FunctionImporter::ImportListsTy ImportLists;
|
||||
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
|
||||
DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;
|
||||
#else
|
||||
@@ -1407,12 +1418,12 @@
|
||||
TargetMachine &Target = *unwrap(TM);
|
||||
|
||||
bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target);
|
||||
- bool error = renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
|
||||
+ renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
|
||||
|
||||
- if (error) {
|
||||
- LLVMRustSetLastError("renameModuleForThinLTO failed");
|
||||
- return false;
|
||||
- }
|
||||
+ // if (error) {
|
||||
+ // LLVMRustSetLastError("renameModuleForThinLTO failed");
|
||||
+ // return false;
|
||||
+ // }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1629,14 +1640,13 @@
|
||||
// used during the normal linker-plugin incremental thin-LTO process.
|
||||
extern "C" void
|
||||
LLVMRustComputeLTOCacheKey(RustStringRef KeyOut, const char *ModId, LLVMRustThinLTOData *Data) {
|
||||
- SmallString<40> Key;
|
||||
llvm::lto::Config conf;
|
||||
const auto &ImportList = Data->ImportLists.lookup(ModId);
|
||||
const auto &ExportList = Data->ExportLists.lookup(ModId);
|
||||
const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
|
||||
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);
|
||||
- std::set<GlobalValue::GUID> CfiFunctionDefs;
|
||||
- std::set<GlobalValue::GUID> CfiFunctionDecls;
|
||||
+ DenseSet<GlobalValue::GUID> CfiFunctionDefs;
|
||||
+ DenseSet<GlobalValue::GUID> CfiFunctionDecls;
|
||||
|
||||
// Based on the 'InProcessThinBackend' constructor in LLVM
|
||||
for (auto &Name : Data->Index.cfiFunctionDefs())
|
||||
@@ -1646,7 +1656,7 @@
|
||||
CfiFunctionDecls.insert(
|
||||
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name)));
|
||||
|
||||
- llvm::computeLTOCacheKey(Key, conf, Data->Index, ModId,
|
||||
+ std::string Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId,
|
||||
ImportList, ExportList, ResolvedODR, DefinedGlobals, CfiFunctionDefs, CfiFunctionDecls
|
||||
);
|
||||
|
||||
--- rustc-1.74.0-src.orig/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp 2023-11-12 23:10:51.000000000 -0500
|
||||
+++ rustc-1.74.0-src/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp 2025-05-07 11:23:24.661493619 -0400
|
||||
@@ -1081,11 +1081,12 @@
|
||||
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
|
||||
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
|
||||
LLVMBasicBlockRef InsertAtEnd) {
|
||||
- return wrap(Builder->insertDeclare(
|
||||
+ Builder->insertDeclare(
|
||||
unwrap(V), unwrap<DILocalVariable>(VarInfo),
|
||||
Builder->createExpression(llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
|
||||
DebugLoc(cast<MDNode>(unwrap(DL))),
|
||||
- unwrap(InsertAtEnd)));
|
||||
+ unwrap(InsertAtEnd));
|
||||
+ return nullptr; //FIXME: VERY BAD
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(
|
||||
@@ -1105,7 +1106,7 @@
|
||||
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen),
|
||||
unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
|
||||
- unwrapDI<DIType>(ClassTy), "", IsScoped));
|
||||
+ unwrapDI<DIType>(ClassTy), 0, "", IsScoped));
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
|
||||
@@ -1369,8 +1370,8 @@
|
||||
return LLVMPointerTypeKind;
|
||||
case Type::FixedVectorTyID:
|
||||
return LLVMVectorTypeKind;
|
||||
- case Type::X86_MMXTyID:
|
||||
- return LLVMX86_MMXTypeKind;
|
||||
+ // case Type::X86_MMXTyID:
|
||||
+ // return LLVMX86_MMXTypeKind;
|
||||
case Type::TokenTyID:
|
||||
return LLVMTokenTypeKind;
|
||||
case Type::ScalableVectorTyID:
|
||||
@@ -1814,6 +1815,7 @@
|
||||
std::string{}, // ExtName
|
||||
std::string{}, // SymbolName
|
||||
std::string{}, // AliasTarget
|
||||
+ std::string{},
|
||||
ordinal, // Ordinal
|
||||
ordinal_present, // Noname
|
||||
false, // Data
|
||||
@@ -1909,7 +1911,7 @@
|
||||
}
|
||||
}
|
||||
if (DiagnosticHandlerCallback) {
|
||||
- DiagnosticHandlerCallback(DI, DiagnosticHandlerContext);
|
||||
+ DiagnosticHandlerCallback(&DI, DiagnosticHandlerContext);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
--- rustc-1.74.0-src.orig/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs 2023-11-12 23:10:51.000000000 -0500
|
||||
+++ rustc-1.74.0-src/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs 2025-05-07 17:44:10.449613830 -0400
|
||||
@@ -18,8 +18,9 @@
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-linux-musl".into(),
|
||||
pointer_width: 64,
|
||||
- data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
- .into(),
|
||||
+ //data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
+ data_layout:
|
||||
+ "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
|
||||
arch: "x86_64".into(),
|
||||
options: base,
|
||||
}
|
||||
Reference in New Issue
Block a user