authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-06-22 21:55:55+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-29 09:50:41+02:00
loge0b9ebf322341fd17183ab9f0621e9ed985467c1
tree2bf35f1e7009bce1e3185aa299f8d707299cd0e3
parenta59ab5ffa5aacbc2fb372c45c23868bcd92a6385
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

gen_stubs: Add riscv32 handling in a few more places.


1 files changed, 7 insertions(+), 2 deletions(-)

tools/gen_stubs.zig+7-2
...@@ -2,13 +2,14 @@...@@ -2,13 +2,14 @@
2//! ./gen_stubs /path/to/musl/build-all >libc.S2//! ./gen_stubs /path/to/musl/build-all >libc.S
3//!3//!
4//! The directory 'build-all' is expected to contain these subdirectories:4//! The directory 'build-all' is expected to contain these subdirectories:
5//! arm x86 mips mips64 powerpc powerpc64 riscv64 x86_645//! arm x86 mips mips64 powerpc powerpc64 riscv32 riscv64 x86_64
6//!6//!
7//! ...each with 'lib/libc.so' inside of them.7//! ...each with 'lib/libc.so' inside of them.
8//!8//!
9//! When building the resulting libc.S file, these defines are required:9//! When building the resulting libc.S file, these defines are required:
10//! * `-DPTR64`: when the architecture is 64-bit10//! * `-DPTR64`: when the architecture is 64-bit
11//! * One of the following, corresponding to the CPU architecture:11//! * One of the following, corresponding to the CPU architecture:
12//! - `-DARCH_riscv32`
12//! - `-DARCH_riscv64`13//! - `-DARCH_riscv64`
13//! - `-DARCH_mips`14//! - `-DARCH_mips`
14//! - `-DARCH_mips64`15//! - `-DARCH_mips64`
...@@ -68,7 +69,8 @@ const MultiSym = struct {...@@ -68,7 +69,8 @@ const MultiSym = struct {
68 }69 }
6970
70 fn is32Only(ms: MultiSym) bool {71 fn is32Only(ms: MultiSym) bool {
71 return ms.present[archIndex(.riscv64)] == false and72 return ms.present[archIndex(.riscv32)] == true and
73 ms.present[archIndex(.riscv64)] == false and
72 ms.present[archIndex(.mips)] == true and74 ms.present[archIndex(.mips)] == true and
73 ms.present[archIndex(.mips64)] == false and75 ms.present[archIndex(.mips64)] == false and
74 ms.present[archIndex(.x86)] == true and76 ms.present[archIndex(.x86)] == true and
...@@ -110,6 +112,7 @@ const MultiSym = struct {...@@ -110,6 +112,7 @@ const MultiSym = struct {
110112
111 fn isPtrSize(ms: MultiSym) bool {113 fn isPtrSize(ms: MultiSym) bool {
112 const map = .{114 const map = .{
115 .{ .riscv32, 4 },
113 .{ .riscv64, 8 },116 .{ .riscv64, 8 },
114 .{ .mips, 4 },117 .{ .mips, 4 },
115 .{ .mips64, 8 },118 .{ .mips64, 8 },
...@@ -132,6 +135,7 @@ const MultiSym = struct {...@@ -132,6 +135,7 @@ const MultiSym = struct {
132135
133 fn isPtr2Size(ms: MultiSym) bool {136 fn isPtr2Size(ms: MultiSym) bool {
134 const map = .{137 const map = .{
138 .{ .riscv32, 8 },
135 .{ .riscv64, 16 },139 .{ .riscv64, 16 },
136 .{ .mips, 8 },140 .{ .mips, 8 },
137 .{ .mips64, 16 },141 .{ .mips64, 16 },
...@@ -154,6 +158,7 @@ const MultiSym = struct {...@@ -154,6 +158,7 @@ const MultiSym = struct {
154158
155 fn isWeak64(ms: MultiSym) bool {159 fn isWeak64(ms: MultiSym) bool {
156 const map = .{160 const map = .{
161 .{ .riscv32, 1 },
157 .{ .riscv64, 2 },162 .{ .riscv64, 2 },
158 .{ .mips, 1 },163 .{ .mips, 1 },
159 .{ .mips64, 2 },164 .{ .mips64, 2 },