[polyml] 06/07: Add support for S/390
James Clarke
jrtc27-guest at moszumanska.debian.org
Thu Jan 28 09:52:39 UTC 2016
This is an automated email from the git hooks/post-receive script.
jrtc27-guest pushed a commit to branch master
in repository polyml.
commit b980271c20b6744644c8bb9f427baab3b77b568b
Author: James Clarke <jrtc27 at jrtc27.com>
Date: Mon Jan 25 23:02:27 2016 +0000
Add support for S/390
---
debian/changelog | 5 +++
debian/patches/ioctl-int.diff | 63 ++++++++++++++++++++++++++++++++++
debian/patches/s390.diff | 54 +++++++++++++++++++++++++++++
debian/patches/series | 3 ++
debian/patches/streamtoken-endian.diff | 22 ++++++++++++
5 files changed, 147 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 9e90f70..dc33dd0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,13 @@ polyml (5.6-1) UNRELEASED; urgency=medium
* Removed patches applied upstream
* Rename libpolyml6 to libpolyml7
* New patches:
+ - ioctl-int.diff: Use int instead of unsigned long for ioctl calls. Fixes
+ Tests/Succeed/Test083.ML on 64-bit big-endian architectures.
+ - s390.diff: Add support for S/390 (both s390 and s390x).
- soft-float-rounding.diff: Don't support rounding modes for soft-float
systems. Skips Tests/Succeed/Test121.ML on armel.
+ - streamtoken-endian.diff: Use a POLYUNSIGNED for StreamToken.streamNo.
+ Fixes stream issues on 64-bit big-endian architectures.
-- James Clarke <jrtc27 at jrtc27.com> Mon, 25 Jan 2016 18:45:49 +0000
diff --git a/debian/patches/ioctl-int.diff b/debian/patches/ioctl-int.diff
new file mode 100644
index 0000000..e0deed8
--- /dev/null
+++ b/debian/patches/ioctl-int.diff
@@ -0,0 +1,63 @@
+Description: Use int instead of unsigned long for ioctl calls
+ On 64-bit big-endian machines, int is 32-bit but unsigned long is
+ 64-bit. ioctl is supposed to take a pointer to an int; on little-endian
+ machines it does not matter if you give it a pointer to a longer type,
+ but on big-endian machines ioctl ends up seeing the leading 4 bytes of
+ zeroes when passing it a pointer to an unsigned long set to 1, and ends
+ up effectively multiplying the output by 2^32 when given an out pointer
+ to an unsigned long.
+Author: James Clarke <jrtc27 at jrtc27.com>
+Forwarded: https://github.com/polyml/polyml/17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libpolyml/network.cpp
++++ b/libpolyml/network.cpp
+@@ -553,7 +553,6 @@
+ int af = get_C_int(taskData, DEREFHANDLE(args)->Get(0));
+ int type = get_C_int(taskData, DEREFHANDLE(args)->Get(1));
+ int proto = get_C_int(taskData, DEREFHANDLE(args)->Get(2));
+- unsigned long onOff = 1;
+ SOCKET skt = socket(af, type, proto);
+ if (skt == INVALID_SOCKET)
+ {
+@@ -574,8 +573,10 @@
+ }
+ /* Set the socket to non-blocking mode. */
+ #if (defined(_WIN32) && ! defined(__CYGWIN__))
++ unsigned long onOff = 1;
+ if (ioctlsocket(skt, FIONBIO, &onOff) != 0)
+ #else
++ int onOff = 1;
+ if (ioctl(skt, FIONBIO, &onOff) < 0)
+ #endif
+ {
+@@ -759,12 +760,13 @@
+ case 44: /* Find number of bytes available. */
+ {
+ PIOSTRUCT strm = get_stream(args->WordP());
+- unsigned long readable;
+ if (strm == NULL) raise_syscall(taskData, "Stream is closed", EBADF);
+ #if (defined(_WIN32) && ! defined(__CYGWIN__))
++ unsigned long readable;
+ if (ioctlsocket(strm->device.sock, FIONREAD, &readable) != 0)
+ raise_syscall(taskData, "ioctlsocket failed", GETERROR);
+ #else
++ int readable;
+ if (ioctl(strm->device.sock, FIONREAD, &readable) < 0)
+ raise_syscall(taskData, "ioctl failed", GETERROR);
+ #endif
+@@ -774,12 +776,13 @@
+ case 45: /* Find out if we are at the mark. */
+ {
+ PIOSTRUCT strm = get_stream(args->WordP());
+- unsigned long atMark;
+ if (strm == NULL) raise_syscall(taskData, "Stream is closed", EBADF);
+ #if (defined(_WIN32) && ! defined(__CYGWIN__))
++ unsigned long atMark;
+ if (ioctlsocket(strm->device.sock, SIOCATMARK, &atMark) != 0)
+ raise_syscall(taskData, "ioctlsocket failed", GETERROR);
+ #else
++ int atMark;
+ if (ioctl(strm->device.sock, SIOCATMARK, &atMark) < 0)
+ raise_syscall(taskData, "ioctl failed", GETERROR);
+ #endif
diff --git a/debian/patches/s390.diff b/debian/patches/s390.diff
new file mode 100644
index 0000000..1143546
--- /dev/null
+++ b/debian/patches/s390.diff
@@ -0,0 +1,54 @@
+Description: Add support for S/390
+Author: James Clarke <jrtc27 at jrtc27.com>
+Forwarded: https://github.com/polyml/polyml/17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/config.h.in
++++ b/config.h.in
+@@ -572,6 +572,12 @@
+ /* Define if the host is a PowerPC (64-bit) */
+ #undef HOSTARCHITECTURE_PPC64
+
++/* Define if the host is an S/390 (32-bit) */
++#undef HOSTARCHITECTURE_S390
++
++/* Define if the host is an S/390 (64-bit) */
++#undef HOSTARCHITECTURE_S390X
++
+ /* Define if the host is a Sparc (32-bit) */
+ #undef HOSTARCHITECTURE_SPARC
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -451,6 +451,14 @@
+ AC_DEFINE([HOSTARCHITECTURE_MIPS], [1], [Define if the host is a MIPS (32-bit)])
+ polyarch=interpret
+ ;;
++ s390x*)
++ AC_DEFINE([HOSTARCHITECTURE_S390X], [1], [Define if the host is an S/390 (64-bit)])
++ polyarch=interpret
++ ;;
++ s390*)
++ AC_DEFINE([HOSTARCHITECTURE_S390], [1], [Define if the host is an S/390 (32-bit)])
++ polyarch=interpret
++ ;;
+ *) AC_MSG_ERROR([Poly/ML is not supported for this architecture]) ;;
+ esac
+
+--- a/libpolyml/elfexport.cpp
++++ b/libpolyml/elfexport.cpp
+@@ -348,6 +348,14 @@
+ fhdr.e_machine = EM_PPC64;
+ directReloc = R_PPC64_ADDR64;
+ useRela = true;
++#elif defined(HOSTARCHITECTURE_S390)
++ fhdr.e_machine = EM_S390;
++ directReloc = R_390_32;
++ useRela = true;
++#elif defined(HOSTARCHITECTURE_S390X)
++ fhdr.e_machine = EM_S390;
++ directReloc = R_390_64;
++ useRela = true;
+ #elif defined(HOSTARCHITECTURE_SPARC)
+ fhdr.e_machine = EM_SPARC;
+ directReloc = R_SPARC_32;
diff --git a/debian/patches/series b/debian/patches/series
index ee4beb8..8506c3e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,4 @@
soft-float-rounding.diff
+streamtoken-endian.diff
+ioctl-int.diff
+s390.diff
diff --git a/debian/patches/streamtoken-endian.diff b/debian/patches/streamtoken-endian.diff
new file mode 100644
index 0000000..acf90d9
--- /dev/null
+++ b/debian/patches/streamtoken-endian.diff
@@ -0,0 +1,22 @@
+Description: Use a POLYUNSIGNED for StreamToken.streamNo
+ On a 64-bit big-endian architecture with sizeof(unsigned) == 4, streamNo
+ is set for stdin/stdout/stderr in add_word_to_io_area by treating it as
+ a PolyWord, which is a 64-bit value. However, streamNo is a 32-bit
+ value, so any code that uses it sees 4 bytes of zeroes, as the
+ least-significant bits are in the next 4 bytes. By using a POLYUNSIGNED,
+ the sizes match.
+Author: James Clarke <jrtc27 at jrtc27.com>
+Forwarded: https://github.com/polyml/polyml/17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libpolyml/globals.h
++++ b/libpolyml/globals.h
+@@ -399,7 +399,7 @@
+ class StreamToken: public PolyObject
+ {
+ public:
+- unsigned streamNo;
++ POLYUNSIGNED streamNo;
+ };
+
+ /* Macro to round a number of bytes up to a number of words. */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/polyml.git
More information about the debian-science-commits
mailing list