Skip to content

Commit 7ba4616

Browse files
glaubitzAlexPeshkoff
authored andcommitted
Add platform support for Linux/m68k (#51)
* Add generic platform support for Linux/m68k * 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. * Don't try to include headers for __cpuid on non-x86 targets * 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.
1 parent 83899ab commit 7ba4616

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

builds/posix/vers.sh.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ platform_linux() {
5757
echo "${TAB}$i;"
5858
done
5959

60+
echo "${TAB}_IO_stdin_used;"
6061
echo 'local:'
6162
echo "${TAB}*;"
6263
echo '};'

configure.ac

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,17 @@ dnl CPU_TYPE=ppc64
363363
SHRLIB_EXT=so
364364
;;
365365

366+
m68k*-*-linux*)
367+
MAKEFILE_PREFIX=linux_generic
368+
INSTALL_PREFIX=linux
369+
PLATFORM=LINUX
370+
AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
371+
AC_DEFINE(M68K, 1, [Define this if CPU is M68k])
372+
LOCK_MANAGER_FLG=Y
373+
EDITLINE_FLG=Y
374+
SHRLIB_EXT=so
375+
;;
376+
366377
*-*-linux* | *-*-gnu*)
367378
MAKEFILE_PREFIX=linux_generic
368379
INSTALL_PREFIX=linux
@@ -1027,10 +1038,11 @@ AC_CHECK_MEMBER([struct dirent.d_type],
10271038
dnl EKU: try to determine the alignment of long and double
10281039
dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h
10291040
AC_MSG_CHECKING(alignment of long)
1030-
AC_RUN_IFELSE([AC_LANG_SOURCE([[main () {
1041+
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <semaphore.h>
1042+
main () {
10311043
struct s {
10321044
char a;
1033-
long long b;
1045+
union { long long x; sem_t y; } b;
10341046
};
10351047
exit((int)&((struct s*)0)->b);
10361048
}]])],[ac_cv_c_alignment=$ac_status],[ac_cv_c_alignment=$ac_status],[])

src/common/classes/DbImplementation.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static const UCHAR CpuHppa = 13;
4848
static const UCHAR CpuAlpha = 14;
4949
static const UCHAR CpuArm64 = 15;
5050
static const UCHAR CpuPowerPc64el = 16;
51+
static const UCHAR CpuM68k = 17;
5152

5253
static const UCHAR OsWindows = 0;
5354
static const UCHAR OsLinux = 1;
@@ -87,7 +88,8 @@ const char* hardware[] = {
8788
"HPPA",
8889
"Alpha",
8990
"ARM64",
90-
"PowerPC64el"
91+
"PowerPC64el",
92+
"M68k"
9193
};
9294

9395
const char* operatingSystem[] = {
@@ -128,8 +130,8 @@ const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] =
128130

129131
const UCHAR backEndianess[FB_NELEM(hardware)] =
130132
{
131-
// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el
132-
0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0
133+
// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PowerPC64el M68k
134+
0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1
133135
};
134136

135137
} // anonymous namespace

src/common/classes/Hash.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
#include "firebird.h"
2424
#include "../common/classes/Hash.h"
2525

26+
#if defined(_M_IX86) || defined(_M_X64) || defined(__x86_64__) || defined(__i386__)
2627
#ifdef _MSC_VER
2728
#include <intrin.h>
2829
#else
2930
#include <cpuid.h>
3031
#endif
32+
#endif
3133

3234
using namespace Firebird;
3335

src/common/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@
199199
#define FB_CPU CpuPowerPc64
200200
#endif /* PPC64 */
201201

202+
#ifdef M68K
203+
#define FB_CPU CpuM68k
204+
#endif /* M68K */
205+
202206
#endif /* LINUX */
203207

204208

src/jrd/inf_pub.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ enum info_db_implementations
241241
isc_info_db_impl_linux_arm64 = 84,
242242
isc_info_db_impl_linux_ppc64el = 85,
243243
isc_info_db_impl_linux_ppc64 = 86,
244+
isc_info_db_impl_linux_m68k = 87,
244245

245246

246247
isc_info_db_impl_last_value // Leave this LAST!

0 commit comments

Comments
 (0)