Compare commits
5 Commits
rawhide
...
main-riscv
Author | SHA1 | Date | |
---|---|---|---|
6c80616d3b | |||
c38b0fe304 | |||
9dd8259b3a | |||
330d97b3a1 | |||
7d8edf4b4e |
87
b2357a4f9ed42d85e2b7dfaab8802ae2b05af475-stage1.patch
Normal file
87
b2357a4f9ed42d85e2b7dfaab8802ae2b05af475-stage1.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From b2357a4f9ed42d85e2b7dfaab8802ae2b05af475 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alex@alexrp.com>
|
||||
Date: Mon, 23 Sep 2024 22:07:48 +0200
|
||||
Subject: [PATCH] zig.h: Improve portability of zig_trap() and
|
||||
zig_breakpoint().
|
||||
|
||||
---
|
||||
stage1/zig.h | 52 +++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 35 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/stage1/zig.h b/stage1/zig.h
|
||||
index 05529feec783..603c9246315f 100644
|
||||
--- a/stage1/zig.h
|
||||
+++ b/stage1/zig.h
|
||||
@@ -248,37 +248,55 @@ typedef char bool;
|
||||
|
||||
#if zig_has_builtin(trap)
|
||||
#define zig_trap() __builtin_trap()
|
||||
-#elif _MSC_VER && (_M_IX86 || _M_X64)
|
||||
+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#define zig_trap() __ud2()
|
||||
-#elif _MSC_VER
|
||||
-#define zig_trap() __fastfail(0)
|
||||
-#elif defined(__i386__) || defined(__x86_64__)
|
||||
-#define zig_trap() __asm__ volatile("ud2");
|
||||
+#elif defined(_MSC_VER)
|
||||
+#define zig_trap() __fastfail(7)
|
||||
+#elif defined(__thumb__)
|
||||
+#define zig_trap() __asm__ volatile("udf #0xfe")
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
-#define zig_trap() __asm__ volatile("udf #0");
|
||||
+#define zig_trap() __asm__ volatile("udf #0xfdee")
|
||||
+#elif defined(__loongarch__) || defined(__powerpc__)
|
||||
+#define zig_trap() __asm__ volatile(".word 0x0")
|
||||
+#elif defined(__mips__)
|
||||
+#define zig_trap() __asm__ volatile(".word 0x3d")
|
||||
+#elif defined(__riscv)
|
||||
+#define zig_trap() __asm__ volatile("unimp")
|
||||
+#elif defined(__s390__)
|
||||
+#define zig_trap() __asm__ volatile("j 0x2")
|
||||
+#elif defined(__sparc__)
|
||||
+#define zig_trap() __asm__ volatile("illtrap")
|
||||
+#elif defined(__i386__) || defined(__x86_64__)
|
||||
+#define zig_trap() __asm__ volatile("ud2")
|
||||
#else
|
||||
-#include <stdlib.h>
|
||||
-#define zig_trap() abort()
|
||||
+#define zig_trap() zig_trap_unavailable
|
||||
#endif
|
||||
|
||||
#if zig_has_builtin(debugtrap)
|
||||
#define zig_breakpoint() __builtin_debugtrap()
|
||||
#elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define zig_breakpoint() __debugbreak()
|
||||
-#elif defined(__i386__) || defined(__x86_64__)
|
||||
-#define zig_breakpoint() __asm__ volatile("int $0x03");
|
||||
#elif defined(__arm__)
|
||||
-#define zig_breakpoint() __asm__ volatile("bkpt #0");
|
||||
+#define zig_breakpoint() __asm__ volatile("bkpt #0x0")
|
||||
#elif defined(__aarch64__)
|
||||
-#define zig_breakpoint() __asm__ volatile("brk #0");
|
||||
-#else
|
||||
-#include <signal.h>
|
||||
-#if defined(SIGTRAP)
|
||||
-#define zig_breakpoint() raise(SIGTRAP)
|
||||
+#define zig_breakpoint() __asm__ volatile("brk #0xf000")
|
||||
+#elif defined(__loongarch__)
|
||||
+#define zig_breakpoint() __asm__ volatile("break 0x0")
|
||||
+#elif defined(__mips__)
|
||||
+#define zig_breakpoint() __asm__ volatile("break")
|
||||
+#elif defined(__powerpc__)
|
||||
+#define zig_breakpoint() __asm__ volatile("trap")
|
||||
+#elif defined(__riscv)
|
||||
+#define zig_breakpoint() __asm__ volatile("ebreak")
|
||||
+#elif defined(__s390__)
|
||||
+#define zig_breakpoint() __asm__ volatile("j 0x6")
|
||||
+#elif defined(__sparc__)
|
||||
+#define zig_breakpoint() __asm__ volatile("ta 0x1")
|
||||
+#elif defined(__i386__) || defined(__x86_64__)
|
||||
+#define zig_breakpoint() __asm__ volatile("int $0x3")
|
||||
#else
|
||||
#define zig_breakpoint() zig_breakpoint_unavailable
|
||||
#endif
|
||||
-#endif
|
||||
|
||||
#if zig_has_builtin(return_address) || defined(zig_gnuc)
|
||||
#define zig_return_address() __builtin_extract_return_addr(__builtin_return_address(0))
|
87
b2357a4f9ed42d85e2b7dfaab8802ae2b05af475.patch
Normal file
87
b2357a4f9ed42d85e2b7dfaab8802ae2b05af475.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From b2357a4f9ed42d85e2b7dfaab8802ae2b05af475 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alex@alexrp.com>
|
||||
Date: Mon, 23 Sep 2024 22:07:48 +0200
|
||||
Subject: [PATCH] zig.h: Improve portability of zig_trap() and
|
||||
zig_breakpoint().
|
||||
|
||||
---
|
||||
lib/zig.h | 52 +++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 35 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/lib/zig.h b/lib/zig.h
|
||||
index 05529feec783..603c9246315f 100644
|
||||
--- a/lib/zig.h
|
||||
+++ b/lib/zig.h
|
||||
@@ -248,37 +248,55 @@ typedef char bool;
|
||||
|
||||
#if zig_has_builtin(trap)
|
||||
#define zig_trap() __builtin_trap()
|
||||
-#elif _MSC_VER && (_M_IX86 || _M_X64)
|
||||
+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#define zig_trap() __ud2()
|
||||
-#elif _MSC_VER
|
||||
-#define zig_trap() __fastfail(0)
|
||||
-#elif defined(__i386__) || defined(__x86_64__)
|
||||
-#define zig_trap() __asm__ volatile("ud2");
|
||||
+#elif defined(_MSC_VER)
|
||||
+#define zig_trap() __fastfail(7)
|
||||
+#elif defined(__thumb__)
|
||||
+#define zig_trap() __asm__ volatile("udf #0xfe")
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
-#define zig_trap() __asm__ volatile("udf #0");
|
||||
+#define zig_trap() __asm__ volatile("udf #0xfdee")
|
||||
+#elif defined(__loongarch__) || defined(__powerpc__)
|
||||
+#define zig_trap() __asm__ volatile(".word 0x0")
|
||||
+#elif defined(__mips__)
|
||||
+#define zig_trap() __asm__ volatile(".word 0x3d")
|
||||
+#elif defined(__riscv)
|
||||
+#define zig_trap() __asm__ volatile("unimp")
|
||||
+#elif defined(__s390__)
|
||||
+#define zig_trap() __asm__ volatile("j 0x2")
|
||||
+#elif defined(__sparc__)
|
||||
+#define zig_trap() __asm__ volatile("illtrap")
|
||||
+#elif defined(__i386__) || defined(__x86_64__)
|
||||
+#define zig_trap() __asm__ volatile("ud2")
|
||||
#else
|
||||
-#include <stdlib.h>
|
||||
-#define zig_trap() abort()
|
||||
+#define zig_trap() zig_trap_unavailable
|
||||
#endif
|
||||
|
||||
#if zig_has_builtin(debugtrap)
|
||||
#define zig_breakpoint() __builtin_debugtrap()
|
||||
#elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define zig_breakpoint() __debugbreak()
|
||||
-#elif defined(__i386__) || defined(__x86_64__)
|
||||
-#define zig_breakpoint() __asm__ volatile("int $0x03");
|
||||
#elif defined(__arm__)
|
||||
-#define zig_breakpoint() __asm__ volatile("bkpt #0");
|
||||
+#define zig_breakpoint() __asm__ volatile("bkpt #0x0")
|
||||
#elif defined(__aarch64__)
|
||||
-#define zig_breakpoint() __asm__ volatile("brk #0");
|
||||
-#else
|
||||
-#include <signal.h>
|
||||
-#if defined(SIGTRAP)
|
||||
-#define zig_breakpoint() raise(SIGTRAP)
|
||||
+#define zig_breakpoint() __asm__ volatile("brk #0xf000")
|
||||
+#elif defined(__loongarch__)
|
||||
+#define zig_breakpoint() __asm__ volatile("break 0x0")
|
||||
+#elif defined(__mips__)
|
||||
+#define zig_breakpoint() __asm__ volatile("break")
|
||||
+#elif defined(__powerpc__)
|
||||
+#define zig_breakpoint() __asm__ volatile("trap")
|
||||
+#elif defined(__riscv)
|
||||
+#define zig_breakpoint() __asm__ volatile("ebreak")
|
||||
+#elif defined(__s390__)
|
||||
+#define zig_breakpoint() __asm__ volatile("j 0x6")
|
||||
+#elif defined(__sparc__)
|
||||
+#define zig_breakpoint() __asm__ volatile("ta 0x1")
|
||||
+#elif defined(__i386__) || defined(__x86_64__)
|
||||
+#define zig_breakpoint() __asm__ volatile("int $0x3")
|
||||
#else
|
||||
#define zig_breakpoint() zig_breakpoint_unavailable
|
||||
#endif
|
||||
-#endif
|
||||
|
||||
#if zig_has_builtin(return_address) || defined(zig_gnuc)
|
||||
#define zig_return_address() __builtin_extract_return_addr(__builtin_return_address(0))
|
13
zig.spec
13
zig.spec
@ -4,20 +4,20 @@
|
||||
%global public_key RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
|
||||
|
||||
# note here at which Fedora or EL release we need to use compat LLVM packages
|
||||
%if 0%{?fedora} >= 42 || 0%{?rhel} >= 9
|
||||
%if 0%{?fedora} >= 41 || 0%{?rhel} >= 9
|
||||
%define llvm_compat 18
|
||||
%endif
|
||||
|
||||
%global llvm_version 18.0.0
|
||||
|
||||
%bcond bootstrap 0
|
||||
%bcond bootstrap 1
|
||||
%bcond docs %{without bootstrap}
|
||||
%bcond macro %{without bootstrap}
|
||||
%bcond test 1
|
||||
|
||||
Name: zig
|
||||
Version: 0.13.0
|
||||
Release: 2%{?dist}
|
||||
Release: 2.0.riscv64%{?dist}
|
||||
Summary: Programming language for maintaining robust, optimal, and reusable software
|
||||
|
||||
License: MIT and NCSA and LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL and ZPLv2.1
|
||||
@ -38,6 +38,10 @@ Patch: 0003-fetch-prevent-global-cache-from-being-copied.patch
|
||||
Patch: 0004-cmake-correct-PIE-support-detection-add-error-output.patch
|
||||
# Remove native libr directories from rpath
|
||||
Patch: 0005-remove-native-lib-directories-from-rpath.patch
|
||||
# Backport from upstream to fix riscv64 bootstrap
|
||||
# https://github.com/ziglang/zig/pull/21474
|
||||
Patch: b2357a4f9ed42d85e2b7dfaab8802ae2b05af475.patch
|
||||
Patch: b2357a4f9ed42d85e2b7dfaab8802ae2b05af475-stage1.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -192,6 +196,9 @@ install -D -pv -m 0644 %{SOURCE2} %{buildroot}%{_rpmmacrodir}/macros.%{name}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Aug 01 2024 David Abdurachmanov <davidlt@rivosinc.com> - 0.13.0-2.0.riscv64
|
||||
- Bootstrap (riscv64)
|
||||
|
||||
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user