From eedb1ed9f0f01d146dca1c804e30590494de142a Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Thu, 13 Oct 2016 00:03:49 +0200 Subject: [PATCH 1/3] Add generic platform support for Linux/m68k --- configure.ac | 11 +++++++++++ src/common/classes/DbImplementation.cpp | 8 +++++--- src/common/common.h | 4 ++++ src/jrd/inf_pub.h | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index cec267f5057..97a8a201cae 100644 --- a/configure.ac +++ b/configure.ac @@ -361,6 +361,17 @@ dnl CPU_TYPE=ppc64 SHRLIB_EXT=so ;; + m68k*-*-linux*) + MAKEFILE_PREFIX=linux_generic + INSTALL_PREFIX=linux + PLATFORM=LINUX + AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) + AC_DEFINE(M68K, 1, [Define this if CPU is M68k]) + LOCK_MANAGER_FLG=Y + EDITLINE_FLG=Y + SHRLIB_EXT=so + ;; + *-*-linux* | *-*-gnu*) MAKEFILE_PREFIX=linux_generic INSTALL_PREFIX=linux diff --git a/src/common/classes/DbImplementation.cpp b/src/common/classes/DbImplementation.cpp index 84cead1de69..9c60caa04d8 100644 --- a/src/common/classes/DbImplementation.cpp +++ b/src/common/classes/DbImplementation.cpp @@ -48,6 +48,7 @@ static const UCHAR CpuHppa = 13; static const UCHAR CpuAlpha = 14; static const UCHAR CpuArm64 = 15; static const UCHAR CpuPowerPc64el = 16; +static const UCHAR CpuM68k = 17; static const UCHAR OsWindows = 0; static const UCHAR OsLinux = 1; @@ -87,7 +88,8 @@ const char* hardware[] = { "HPPA", "Alpha", "ARM64", - "PowerPC64el" + "PowerPC64el", + "M68k" }; const char* operatingSystem[] = { @@ -128,8 +130,8 @@ const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] = const UCHAR backEndianess[FB_NELEM(hardware)] = { -// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el - 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 +// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k + 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1 }; } // anonymous namespace diff --git a/src/common/common.h b/src/common/common.h index 7f5c697eefe..2cf877a804c 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -195,6 +195,10 @@ #define FB_CPU CpuPowerPc64 #endif /* PPC64 */ +#ifdef M68K +#define FB_CPU CpuM68k +#endif /* M68K */ + #endif /* LINUX */ diff --git a/src/jrd/inf_pub.h b/src/jrd/inf_pub.h index d25ffead3cc..9c3b0c2e858 100644 --- a/src/jrd/inf_pub.h +++ b/src/jrd/inf_pub.h @@ -241,6 +241,7 @@ enum info_db_implementations isc_info_db_impl_linux_arm64 = 84, isc_info_db_impl_linux_ppc64el = 85, isc_info_db_impl_linux_ppc64 = 86, + isc_info_db_impl_linux_m68k = 87, isc_info_db_impl_last_value // Leave this LAST! From af61ad500e539f72b904d02fb1b33033ca3cdc9e Mon Sep 17 00:00:00 2001 From: Michael Karcher Date: Thu, 13 Oct 2016 00:04:44 +0200 Subject: [PATCH 2/3] Include sem_t when determining values for FB_ALIGNMENT and FB_DOUBLE_ALIGN On m68k, 'long long' is 16-bit aligned while 'sem_t' is 32-bit aligned and we must therefore include 'sem_t' when determining the values for FB_ALIGNMENT and FB_DOUBLE_ALIGN. Otherwise, the futex system call will fail on these systems. --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 97a8a201cae..68bda21e8a8 100644 --- a/configure.ac +++ b/configure.ac @@ -1008,10 +1008,11 @@ AC_CHECK_MEMBER([struct dirent.d_type], dnl EKU: try to determine the alignment of long and double dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h AC_MSG_CHECKING(alignment of long) -AC_RUN_IFELSE([AC_LANG_SOURCE([[main () { +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +main () { struct s { char a; - long long b; + union { long long x; sem_t y; } b; }; exit((int)&((struct s*)0)->b); }]])],[ac_cv_c_alignment=$ac_status],[ac_cv_c_alignment=$ac_status],[]) From 6bf0abd9e9ca07df94a551cfe594104097539812 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Thu, 13 Oct 2016 21:11:32 +0200 Subject: [PATCH 3/3] Make sure that the version scripts include _IO_stdin_used on Linux The GNU C library supports two ABIs for libio, one is the pre-2.1 ABI and the other is the current one. In order to determine which ABI is to be used, the C library checks whether the _IO_stdin_used symbol is exported by the executable. In case the symbol is present, the new ABI is assumed, if the symbol is missing, the old ABI is assumed. Thus, if an application is linked against a modern version of glibc, it must export the _IO_stdin_used symbol as otherwise the executable can crash or provoke other unexpected behavior on some architectures like PowerPC or MIPS because the C library is using the old ABI in this case. --- builds/posix/vers.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/builds/posix/vers.sh.in b/builds/posix/vers.sh.in index 69bd6560477..15d86a78597 100644 --- a/builds/posix/vers.sh.in +++ b/builds/posix/vers.sh.in @@ -57,6 +57,7 @@ platform_linux() { echo "${TAB}$i;" done + echo "${TAB}_IO_stdin_used;" echo 'local:' echo "${TAB}*;" echo '};'