pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
rust195: add a draft fix for LLVM data layout for m68k-unknown-netbsd.
Module Name: pkgsrc-wip
Committed By: Havard Eidnes <he%NetBSD.org@localhost>
Pushed By: he
Date: Wed May 27 14:15:08 2026 +0000
Changeset: 44f9039d0c26e79c762bec1eef1eb78740efc61c
Added Files:
rust195/patches/patch-src_llvm-project_llvm_lib_TargetParser_TargetDataLayout.cpp
Log Message:
rust195: add a draft fix for LLVM data layout for m68k-unknown-netbsd.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=44f9039d0c26e79c762bec1eef1eb78740efc61c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
...ject_llvm_lib_TargetParser_TargetDataLayout.cpp | 94 ++++++++++++++++++++++
1 file changed, 94 insertions(+)
diffs:
diff --git a/rust195/patches/patch-src_llvm-project_llvm_lib_TargetParser_TargetDataLayout.cpp b/rust195/patches/patch-src_llvm-project_llvm_lib_TargetParser_TargetDataLayout.cpp
new file mode 100644
index 0000000000..2d7834b49d
--- /dev/null
+++ b/rust195/patches/patch-src_llvm-project_llvm_lib_TargetParser_TargetDataLayout.cpp
@@ -0,0 +1,94 @@
+$NetBSD$
+
+Tweak the data layout for NetBSD/m68k, as per
+https://github.com/llvm/llvm-project/issues/199826
+
+--- src/llvm-project/llvm/lib/TargetParser/TargetDataLayout.cpp.orig 2026-05-27 13:35:30.929852884 +0000
++++ src/llvm-project/llvm/lib/TargetParser/TargetDataLayout.cpp
+@@ -130,15 +130,24 @@ static std::string computeM68kDataLayout
+ // FIXME how to wire it with the used object format?
+ Ret += "-m:e";
+
+- // M68k pointers are always 32 bit wide even for 16-bit CPUs.
+- // The ABI only specifies 16-bit alignment.
+- // On at least the 68020+ with a 32-bit bus, there is a performance benefit
+- // to having 32-bit alignment.
+- Ret += "-p:32:16:32";
+-
+- // Bytes do not require special alignment, words are word aligned and
+- // long words are word aligned at minimum.
+- Ret += "-i8:8:8-i16:16:16-i32:16:32";
++ // Ref. https://github.com/llvm/llvm-project/issues/199826,
++ // the 16-bit alignment of pointer and i32 is perhaps a linuxism...
++ // For now treat NetBSD specially.
++
++ if (! TT.IsOSNetBSD()) {
++ // M68k pointers are always 32 bit wide even for 16-bit CPUs.
++ // The ABI only specifies 16-bit alignment.
++ // On at least the 68020+ with a 32-bit bus, there is a performance benefit
++ // to having 32-bit alignment.
++ Ret += "-p:32:16:32";
++
++ // Bytes do not require special alignment, words are word aligned and
++ // long words are word aligned at minimum.
++ Ret += "-i8:8:8-i16:16:16-i32:16:32";
++ } else { // NetBSD has 32-bit aligned i32 and pointers:
++ Ret += "-p:32:32:32";
++ Ret += "-i8:8:8-i16:16:16-i32:32:32";
++ }
+
+ // FIXME no floats at the moment
+
+$NetBSD$
+
+--- src/llvm-project/llvm/lib/TargetParser/TargetDataLayout.cpp.orig 2026-05-27 13:35:30.929852884 +0000
++++ src/llvm-project/llvm/lib/TargetParser/TargetDataLayout.cpp
+@@ -130,22 +130,35 @@ static std::string computeM68kDataLayout
+ // FIXME how to wire it with the used object format?
+ Ret += "-m:e";
+
+- // M68k pointers are always 32 bit wide even for 16-bit CPUs.
+- // The ABI only specifies 16-bit alignment.
+- // On at least the 68020+ with a 32-bit bus, there is a performance benefit
+- // to having 32-bit alignment.
+- Ret += "-p:32:16:32";
+-
+- // Bytes do not require special alignment, words are word aligned and
+- // long words are word aligned at minimum.
+- Ret += "-i8:8:8-i16:16:16-i32:16:32";
++ // Ref. https://github.com/llvm/llvm-project/issues/199826,
++ // the 16-bit alignment of pointer and i32 is perhaps a linuxism...
++ // For now treat NetBSD specially.
++
++ if (! TT.IsOSNetBSD()) {
++ // M68k pointers are always 32 bit wide even for 16-bit CPUs.
++ // The ABI only specifies 16-bit alignment.
++ // On at least the 68020+ with a 32-bit bus, there is a performance benefit
++ // to having 32-bit alignment.
++ Ret += "-p:32:16:32";
++
++ // Bytes do not require special alignment, words are word aligned and
++ // long words are word aligned at minimum.
++ Ret += "-i8:8:8-i16:16:16-i32:16:32";
+
+- // FIXME no floats at the moment
++ // The registers can hold 8, 16, 32 bits
++ Ret += "-n8:16:32";
+
+- // The registers can hold 8, 16, 32 bits
+- Ret += "-n8:16:32";
++ Ret += "-a:0:16-S16";
++ } else { // NetBSD has 32-bit aligned i32 and pointers:
++ Ret += "-p:32:32:32";
++ Ret += "-i8:8:8-i16:16:16-i32:32:32";
++ // The registers can hold 8, 16, 32 bits
++ Ret += "-n8:16:32";
++ // object and stack alignment is also different:
++ Ret += "-a:0:32-S32";
++ }
+
+- Ret += "-a:0:16-S16";
++ // FIXME no floats at the moment
+
+ return Ret;
+ }
Home |
Main Index |
Thread Index |
Old Index