Skip to content

Commit 4680c1a

Browse files
authored
Merge pull request #753 from KenDickey/Cog
Support for OpenBSD
2 parents 1c9faad + 10b1b17 commit 4680c1a

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

  • building
    • linux64ARMv8/squeak.cog.spur/build
    • linux64x64/squeak.cog.spur/build
  • platforms/unix/vm

building/linux64ARMv8/squeak.cog.spur/build/mvm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -D_GNU_SOURCE -DUSEEVDEV"
99
##OPT="-g -O3 -DMUSL -DNDEBUG -DDEBUGVM=0"
1010

1111
if [ `uname` = "OpenBSD" ]; then
12+
OPT="$OPT -DMUSL"
13+
CFLAGS="$CFLAGS $OPT -I/usr/local/include"
14+
LIBS="$LIBS -lexecinfo"
15+
LDFLAGS="$LDFLAGS -L/usr/local/lib"
1216
DUALMAP="-DDUAL_MAPPED_CODE_ZONE=0"
1317
# librt and libpthread functions now supplied by libc.
1418
# Many Linux systems supply empty library files but

building/linux64x64/squeak.cog.spur/build/mvm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ if [ -n "$(command -v clang || true)" ]; then CC=clang; else CC=gcc; fi
1313
# but OpenBSD does not.
1414
if [ `uname` = "OpenBSD" ]; then LIBRT=""; else LIBRT="-lrt"; fi
1515

16-
CFLAGS="$OPT -msse2 -DCOGMTVM=0"
17-
LIBS=$LIBRT
18-
LDFLAGS=""
19-
2016
# Special treatment for OpenBSD Linux
2117
if [ `uname` = "OpenBSD" ]; then
22-
CFLAGS="$CFLAGS -I/usr/local/include"
18+
OPT="$OPT -DMUSL"
19+
CFLAGS="$CFLAGS $OPT -I/usr/local/include"
2320
LIBS="$LIBS -lexecinfo"
2421
LDFLAGS="$LDFLAGS -L/usr/local/lib"
22+
else
23+
CFLAGS="$CFLAGS $OPT -msse2 -DCOGMTVM=0"
24+
LIBS="$LIBS -lrt"
25+
LDFLAGS="$LDFLAGS"
2526
fi
2627

2728
if [ $# -ge 1 ]; then

platforms/unix/vm/sqUnixMemory.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ int mmapErrno = 0;
8787
#endif
8888

8989
#define MAP_PROT (PROT_READ | PROT_WRITE)
90+
#ifdef __OpenBSD__
91+
#define MAP_FLAGS (MAP_ANON | MAP_PRIVATE | MAP_STACK)
92+
#else
9093
#define MAP_FLAGS (MAP_ANON | MAP_PRIVATE)
94+
#endif
9195

9296
extern int useMmap;
9397
/* Since Cog needs to make memory executable via mprotect, and since mprotect

0 commit comments

Comments
 (0)