Add win4lin

This commit is contained in:
Mario Fetka
2022-11-19 21:49:12 +01:00
parent 1bf994041f
commit dcd0ea6843
77 changed files with 3687 additions and 50 deletions

View File

@@ -1,3 +1,5 @@
AUX cc65-mrustc.patch 1007 BLAKE2B a1755003730fef8df2af5644585e8411cc2ca64a5572c86b8425157d3de37d4ccb915852ad3b8c502bfab536c796e6219aa73db8d0803c3bb23f0424a4df30e1 SHA512 ba3d4c10ddef6d7e977d68c6df24e20f7c2964aff9f98f527aa09575c31b9cb3d0c58255f630fc56dc8b1c33a8470b76c5d5f8ac8aab896a8116d802f5f1eb41
AUX mrustc-cc65.patch 10372 BLAKE2B d50da4c3fb8d2dc93f6581a5494636501afed87c8f2ca4bd45b2f06772fd01c5e4b43b04f68a3b4bd224876f872bde815b09afe88061926c03a678eddd9a95c4 SHA512 df653d8001117172ef90162b6e040b0a72d2737f30f448ff13c9d368006e6e8f96faec1576114d958173428d4829a66b8e82f154c7875e74dd4343f22da588b9
DIST cc65-sources-2.19.tar.gz 2284735 BLAKE2B c1c845417e38113c99a9ec8fbff1b90e292798582ac2b394e40419eff3eea62d838ea52165188516efc6157ef02aa7fc23c5a6510fd40d1012ad2b5231d78097 SHA512 e893359249588247d262ff19b8b7efbbcb10a274964aaa18cfe21830cce39da53831262bcc8ee4678158c0e0ab56905411b037699d1097aa5fc03edf7d6bea8f
EBUILD cc65-2.19.ebuild 1564 BLAKE2B 042c86577e8d47556505c70fc7fd1ab8cfad1b808627360a221bcd892e4ff5f8484f9ccf3cb1c2579962f359665826f0352739ac02c39cf9fa3df0fbb6a97c8b SHA512 4df5eb661a1239f372121c66f8e42ec3c5f7b978c0fdf5a42bd782b0f18840a6bda72757708b63162e9f648d61ecbec13884a12663633f6be53e3c38bc232e11
MISC ChangeLog 3554 BLAKE2B 69591f3bf392915244406476078889781f4cc22f05f1267f489086af3d2822db62a7fe3fed3453845d9e92a7ca5d129f8b134287a26d7245a8ae4326845c1835 SHA512 62fb31a4e177d616a286524bb021b847ccf8ca932b90f118fd8d899a46b236a75479e9f4098040e5e14fffa3cb4a7fdcf05fb1aae291071296de6c50a90095d2

View File

@@ -0,0 +1,34 @@
From 4799c47cc89913d7a17ad36ffd6dd4a0ded7f0d6 Mon Sep 17 00:00:00 2001
From: Tibor Nagy <xnagytibor@gmail.com>
Date: Fri, 8 Feb 2019 16:33:07 +0100
Subject: [PATCH] Patches for mrustc
---
src/ca65/scanner.c | 2 +-
src/cc65/ident.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c
index f80fe2bca9..5822421daf 100644
--- a/src/ca65/scanner.c
+++ b/src/ca65/scanner.c
@@ -647,7 +647,7 @@ int IsIdChar (int C)
return IsAlNum (C) ||
(C == '_') ||
(C == '@' && AtInIdents) ||
- (C == '$' && DollarInIdents);
+ (C == '$');
}
diff --git a/src/cc65/ident.c b/src/cc65/ident.c
index 7748095c7f..6836482257 100644
--- a/src/cc65/ident.c
+++ b/src/cc65/ident.c
@@ -50,5 +50,5 @@
int IsIdent (char c)
/* Return true if the given char may start an identifier */
{
- return (IsAlpha (c) || c == '_');
+ return (IsAlpha (c) || c == '_' || c == '$');
}

View File

@@ -0,0 +1,208 @@
From c9cbda11fe60d76b0864a6e992170a0e8005c437 Mon Sep 17 00:00:00 2001
From: Tibor Nagy <xnagytibor@gmail.com>
Date: Fri, 8 Feb 2019 16:35:42 +0100
Subject: [PATCH] Patches for cc65
---
src/trans/codegen_c.cpp | 57 ++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
index 84a538d57..0ac6598ec 100644
--- a/src/trans/codegen_c.cpp
+++ b/src/trans/codegen_c.cpp
@@ -238,10 +238,10 @@ namespace {
{
case Compiler::Gcc:
m_of
- << "#include <stdatomic.h>\n" // atomic_*
+ //<< "#include <stdatomic.h>\n" // atomic_*
<< "#include <stdlib.h>\n" // abort
<< "#include <string.h>\n" // mem*
- << "#include <math.h>\n" // round, ...
+ //<< "#include <math.h>\n" // round, ...
<< "#include <setjmp.h>\n" // setjmp/jmp_buf
;
break;
@@ -282,7 +282,7 @@ namespace {
{
case Compiler::Gcc:
m_of
- << "extern void _Unwind_Resume(void) __attribute__((noreturn));\n"
+ << "static void _Unwind_Resume(void) { }\n"
<< "#define ALIGNOF(t) __alignof__(t)\n"
;
break;
@@ -299,10 +299,11 @@ namespace {
{
case Compiler::Gcc:
m_of
- << "extern __thread jmp_buf* mrustc_panic_target;\n"
- << "extern __thread void* mrustc_panic_value;\n"
+ << "extern jmp_buf* mrustc_panic_target;\n"
+ << "extern void* mrustc_panic_value;\n"
;
// 64-bit bit ops (gcc intrinsics)
+ /*
m_of
<< "static inline uint64_t __builtin_clz64(uint64_t v) {\n"
<< "\treturn (v >> 32 != 0 ? __builtin_clz(v>>32) : 32 + __builtin_clz(v));\n"
@@ -311,6 +312,7 @@ namespace {
<< "\treturn ((v&0xFFFFFFFF) == 0 ? __builtin_ctz(v>>32) + 32 : __builtin_ctz(v));\n"
<< "}\n"
;
+ */
break;
case Compiler::Msvc:
m_of
@@ -525,6 +527,7 @@ namespace {
else
{
// GCC-only
+ /*
m_of
<< "typedef unsigned __int128 uint128_t;\n"
<< "typedef signed __int128 int128_t;\n"
@@ -540,27 +543,29 @@ namespace {
<< "\treturn (v == 0 ? 128 : ((v&0xFFFFFFFFFFFFFFFF) == 0 ? __builtin_ctz64(v>>64) + 64 : __builtin_ctz64(v)));\n"
<< "}\n"
;
+ */
}
// Common helpers
m_of
<< "\n"
- << "static inline int slice_cmp(SLICE_PTR l, SLICE_PTR r) {\n"
+ << "static int slice_cmp(SLICE_PTR l, SLICE_PTR r) {\n"
<< "\tint rv = memcmp(l.PTR, r.PTR, l.META < r.META ? l.META : r.META);\n"
<< "\tif(rv != 0) return rv;\n"
<< "\tif(l.META < r.META) return -1;\n"
<< "\tif(l.META > r.META) return 1;\n"
<< "\treturn 0;\n"
<< "}\n"
- << "static inline SLICE_PTR make_sliceptr(void* ptr, size_t s) { SLICE_PTR rv = { ptr, s }; return rv; }\n"
- << "static inline TRAITOBJ_PTR make_traitobjptr(void* ptr, void* vt) { TRAITOBJ_PTR rv = { ptr, vt }; return rv; }\n"
+ << "static SLICE_PTR make_sliceptr(void* ptr, size_t s) { SLICE_PTR rv; rv.PTR = ptr; rv.META = s; return rv; }\n"
+ //<< "static TRAITOBJ_PTR make_traitobjptr(void* ptr, void* vt) { TRAITOBJ_PTR rv = { ptr, vt }; return rv; }\n"
<< "\n"
- << "static inline size_t mrustc_max(size_t a, size_t b) { return a < b ? b : a; }\n"
- << "static inline void noop_drop(tUNIT *p) { }\n"
+ << "static size_t mrustc_max(size_t a, size_t b) { return a < b ? b : a; }\n"
+ << "static void noop_drop(tUNIT *p) { }\n"
<< "\n"
// A linear (fast-fail) search of a list of strings
- << "static inline size_t mrustc_string_search_linear(SLICE_PTR val, size_t count, SLICE_PTR* options) {\n"
- << "\tfor(size_t i = 0; i < count; i ++) {\n"
+ << "static size_t mrustc_string_search_linear(SLICE_PTR val, size_t count, SLICE_PTR* options) {\n"
+ << "\tsize_t i = 0;\n"
+ << "\tfor(i = 0; i < count; i ++) {\n"
<< "\t\tint cmp = slice_cmp(val, options[i]);\n"
<< "\t\tif(cmp < 0) break;\n"
<< "\t\tif(cmp == 0) return i;\n"
@@ -583,7 +588,7 @@ namespace {
// TODO: Define this function in MIR.
if( is_executable )
{
- m_of << "int main(int argc, const char* argv[]) {\n";
+ m_of << "int main(int argc, char* argv[]) {\n";
auto c_start_path = m_resolve.m_crate.get_lang_item_path_opt("mrustc-start");
if( c_start_path == ::HIR::SimplePath() )
{
@@ -600,8 +605,8 @@ namespace {
if( m_compiler == Compiler::Gcc )
{
m_of
- << "__thread jmp_buf* mrustc_panic_target;\n"
- << "__thread void* mrustc_panic_value;\n"
+ << "jmp_buf* mrustc_panic_target;\n"
+ << "void* mrustc_panic_value;\n"
;
}
}
@@ -877,7 +882,7 @@ namespace {
emit_type_fn(ty); m_of << "\n";
)
else TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Array, te,
- m_of << "typedef struct "; emit_ctype(ty); m_of << " "; emit_ctype(ty); m_of << ";\n";
+ //m_of << "typedef struct "; emit_ctype(ty); m_of << " "; emit_ctype(ty); m_of << ";\n";
)
else TU_IFLET( ::HIR::TypeRef::Data, ty.m_data, Path, te,
TU_MATCHA( (te.binding), (tpb),
@@ -1154,7 +1159,7 @@ namespace {
if( true && repr->size > 0 && !has_unsized )
{
// TODO: Handle unsized (should check the size of the fixed-size region)
- m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(struct s_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
+ //m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(struct s_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
//m_of << "typedef char alignof_assert_" << Trans_Mangle(p) << "[ (ALIGNOF(struct s_" << Trans_Mangle(p) << ") == " << repr->align << ") ? 1 : -1 ];\n";
}
@@ -1226,7 +1231,7 @@ namespace {
m_of << "};\n";
if( true && repr->size > 0 )
{
- m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(union u_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
+ //m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(union u_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
}
// Drop glue (calls destructor if there is one)
@@ -1412,7 +1417,7 @@ namespace {
m_of << "};\n";
if( true && repr->size > 0 )
{
- m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(struct e_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
+ //m_of << "typedef char sizeof_assert_" << Trans_Mangle(p) << "[ (sizeof(struct e_" << Trans_Mangle(p) << ") == " << repr->size << ") ? 1 : -1 ];\n";
}
// ---
@@ -3526,7 +3531,7 @@ namespace {
if( (*ve)[i] == INT64_MIN )
m_of << "INT64_MIN";
else
- m_of << (*ve)[i] << "ll";
+ m_of << (*ve)[i] << "l";
m_of << ": "; cb(i); m_of << " break;\n";
}
m_of << indent << "\tdefault: "; cb(SIZE_MAX); m_of << "\n";
@@ -5441,17 +5446,17 @@ namespace {
case ::HIR::CoreType::I64:
case ::HIR::CoreType::Isize:
m_of << c.v;
- m_of << "ll";
+ m_of << "l";
break;
case ::HIR::CoreType::I128:
if( m_options.emulated_i128 )
{
- m_of << "make128s(" << c.v << "ll)";
+ m_of << "make128s(" << c.v << "l)";
}
else
{
m_of << c.v;
- m_of << "ll";
+ m_of << "l";
}
break;
default:
@@ -5474,16 +5479,16 @@ namespace {
break;
case ::HIR::CoreType::U64:
case ::HIR::CoreType::Usize:
- m_of << ::std::hex << "0x" << c.v << "ull" << ::std::dec;
+ m_of << ::std::hex << "0x" << c.v << "ul" << ::std::dec;
break;
case ::HIR::CoreType::U128:
if( m_options.emulated_i128 )
{
- m_of << "make128(" << ::std::hex << "0x" << c.v << "ull)" << ::std::dec;
+ m_of << "make128(" << ::std::hex << "0x" << c.v << "ul)" << ::std::dec;
}
else
{
- m_of << ::std::hex << "0x" << c.v << "ull" << ::std::dec;
+ m_of << ::std::hex << "0x" << c.v << "ul" << ::std::dec;
}
break;
case ::HIR::CoreType::Char: