Skip to content

Instantly share code, notes, and snippets.

@IronBlood
Created February 22, 2017 07:54
Show Gist options
  • Select an option

  • Save IronBlood/5c1304238c32a918852a8cf028bfba0e to your computer and use it in GitHub Desktop.

Select an option

Save IronBlood/5c1304238c32a918852a8cf028bfba0e to your computer and use it in GitHub Desktop.
Changes to compile redis-3.2.8 on Solaris SPARC with Studio 12.5 Sun C 5.14
diff --git a/deps/geohash-int/Makefile b/deps/geohash-int/Makefile
index b7c2595..c2baefc 100644
--- a/deps/geohash-int/Makefile
+++ b/deps/geohash-int/Makefile
@@ -1,6 +1,6 @@
STD=
WARN= -Wall
-OPT= -O2
+OPT= -O -m64
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
R_LDFLAGS= $(LDFLAGS)
diff --git a/deps/linenoise/Makefile b/deps/linenoise/Makefile
index 1dd894b..5b10558 100644
--- a/deps/linenoise/Makefile
+++ b/deps/linenoise/Makefile
@@ -1,6 +1,6 @@
STD=
WARN= -Wall
-OPT= -Os
+OPT= -O -m64
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
R_LDFLAGS= $(LDFLAGS)
diff --git a/deps/lua/src/Makefile b/deps/lua/src/Makefile
index f3bba2f..1d9e29e 100644
--- a/deps/lua/src/Makefile
+++ b/deps/lua/src/Makefile
@@ -8,7 +8,7 @@
PLAT= none
CC?= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS= -m64 $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
@@ -53,10 +53,10 @@ $(LUA_A): $(CORE_O) $(LIB_O)
$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(CC) -m64 -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ $(CC) -m64 -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
diff --git a/deps/Makefile b/deps/Makefile
index 1c10bce..3b42e4d 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -44,7 +44,7 @@ distclean:
hiredis: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
- cd hiredis && $(MAKE) static
+ cd hiredis && $(MAKE) ARCH=-m64 static
.PHONY: hiredis
@@ -57,9 +57,12 @@ linenoise: .make-prerequisites
ifeq ($(uname_S),SunOS)
# Make isinf() available
LUA_CFLAGS= -D__C99FEATURES__=1
endif
-LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' $(CFLAGS)
+LUA_CFLAGS+= -O -m64 -D__C99FEATURES__=1 -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' $(CFLAGS)
LUA_LDFLAGS+= $(LDFLAGS)
# lua's Makefile defines AR="ar rcu", which is unusual, and makes it more
# challenging to cross-compile lua (and redis). These defines make it easier
diff --git a/src/Makefile b/src/Makefile
index fdbe36a..5a5ee64 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -14,12 +14,12 @@
release_hdr := $(shell sh -c './mkreleasehdr.sh')
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
-OPTIMIZATION?=-O2
+OPTIMIZATION?=-xO1
DEPENDENCY_TARGETS=hiredis linenoise lua geohash-int
# Default settings
-STD=-std=c99 -pedantic -DREDIS_STATIC=''
-WARN=-Wall -W
+STD=-xc99 -xmemalign=1i -DREDIS_STATIC=''
+WARN=
OPT=$(OPTIMIZATION)
PREFIX?=/usr/local
@@ -61,8 +61,9 @@ DEBUG=-g -ggdb
ifeq ($(uname_S),SunOS)
# SunOS
INSTALL=cp -pf
- FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6
+ FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 -m64
FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt
+ DEBUG=-g
else
ifeq ($(uname_S),Darwin)
# Darwin
@@ -109,7 +110,7 @@ ifeq ($(MALLOC),jemalloc)
endif
REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
-REDIS_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS)
+REDIS_LD=$(QUIET_LINK)$(CC) -m64 $(FINAL_LDFLAGS)
REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL)
CCCOLOR="\033[34m"
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 640ee19..fe5b10a 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -67,13 +67,13 @@ void zlibc_free(void *ptr) {
#define free(ptr) je_free(ptr)
#endif
-#if defined(__ATOMIC_RELAXED)
+/*#if defined(__ATOMIC_RELAXED)
#define update_zmalloc_stat_add(__n) __atomic_add_fetch(&used_memory, (__n), __ATOMIC_RELAXED)
#define update_zmalloc_stat_sub(__n) __atomic_sub_fetch(&used_memory, (__n), __ATOMIC_RELAXED)
#elif defined(HAVE_ATOMIC)
#define update_zmalloc_stat_add(__n) __sync_add_and_fetch(&used_memory, (__n))
#define update_zmalloc_stat_sub(__n) __sync_sub_and_fetch(&used_memory, (__n))
-#else
+#else*/
#define update_zmalloc_stat_add(__n) do { \
pthread_mutex_lock(&used_memory_mutex); \
used_memory += (__n); \
@@ -86,7 +86,7 @@ void zlibc_free(void *ptr) {
pthread_mutex_unlock(&used_memory_mutex); \
} while(0)
-#endif
+//#endif
#define update_zmalloc_stat_alloc(__n) do { \
size_t _n = (__n); \
@@ -222,13 +222,13 @@ size_t zmalloc_used_memory(void) {
size_t um;
if (zmalloc_thread_safe) {
-#if defined(__ATOMIC_RELAXED) || defined(HAVE_ATOMIC)
- um = update_zmalloc_stat_add(0);
-#else
+//#if defined(__ATOMIC_RELAXED) || defined(HAVE_ATOMIC)
+ //um = update_zmalloc_stat_add(0);
+//#else
pthread_mutex_lock(&used_memory_mutex);
um = used_memory;
pthread_mutex_unlock(&used_memory_mutex);
-#endif
+//#endif
}
else {
um = used_memory;
diff --git a/tests/instances.tcl b/tests/instances.tcl
index 2ba67ac..47164e7 100644
--- a/tests/instances.tcl
+++ b/tests/instances.tcl
@@ -184,7 +184,7 @@ proc pause_on_error {} {
if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]}
foreach_redis_id id {
puts "=== REDIS $id ===="
- puts [exec tail -$count redis_$id/log.txt]
+ puts [exec /usr/xpg4/bin/tail -$count redis_$id/log.txt]
puts "---------------------\n"
}
} elseif {$cmd eq {show-sentinel-logs}} {
@@ -192,7 +192,7 @@ proc pause_on_error {} {
if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]}
foreach_sentinel_id id {
puts "=== SENTINEL $id ===="
- puts [exec tail -$count sentinel_$id/log.txt]
+ puts [exec /usr/xpg4/bin/tail -$count sentinel_$id/log.txt]
puts "---------------------\n"
}
} elseif {$cmd eq {ls}} {
diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl
index 832f996..7671489 100644
--- a/tests/integration/aof.tcl
+++ b/tests/integration/aof.tcl
@@ -88,7 +88,7 @@ tags {"aof"} {
set pattern "*Bad file format reading the append only file*"
set retry 10
while {$retry} {
- set result [exec tail -n1 < [dict get $srv stdout]]
+ set result [exec /usr/xpg4/bin/tail -n1 < [dict get $srv stdout]]
if {[string match $pattern $result]} {
break
}
@@ -113,7 +113,7 @@ tags {"aof"} {
set pattern "*Unexpected end of file reading the append only file*"
set retry 10
while {$retry} {
- set result [exec tail -n1 < [dict get $srv stdout]]
+ set result [exec /usr/xpg4/bin/tail -n1 < [dict get $srv stdout]]
if {[string match $pattern $result]} {
break
}
@@ -137,7 +137,7 @@ tags {"aof"} {
set pattern "*Unexpected end of file reading the append only file*"
set retry 10
while {$retry} {
- set result [exec tail -n1 < [dict get $srv stdout]]
+ set result [exec /usr/xpg4/bin/tail -n1 < [dict get $srv stdout]]
if {[string match $pattern $result]} {
break
}
diff --git a/tests/integration/logging.tcl b/tests/integration/logging.tcl
index c1f4854..8426828 100644
--- a/tests/integration/logging.tcl
+++ b/tests/integration/logging.tcl
@@ -9,7 +9,7 @@ if {$system_name eq {linux} || $system_name eq {darwin}} {
set pattern "*debugCommand*"
set retry 10
while {$retry} {
- set result [exec tail -100 < [srv 0 stdout]]
+ set result [exec /usr/xpg4/bin/tail -100 < [srv 0 stdout]]
if {[string match $pattern $result]} {
break
}
diff --git a/tests/integration/rdb.tcl b/tests/integration/rdb.tcl
index 2ed47cc..869bcdf 100644
--- a/tests/integration/rdb.tcl
+++ b/tests/integration/rdb.tcl
@@ -66,7 +66,7 @@ if {!$isroot} {
test {Server should not start if RDB file can't be open} {
wait_for_condition 50 100 {
[string match {*Fatal error loading*} \
- [exec tail -n1 < [dict get $srv stdout]]]
+ [exec /usr/xpg4/bin/tail -n1 < [dict get $srv stdout]]]
} else {
fail "Server started even if RDB was unreadable!"
}
@@ -90,7 +90,7 @@ start_server_and_kill_it [list "dir" $server_path] {
test {Server should not start if RDB is corrupted} {
wait_for_condition 50 100 {
[string match {*CRC error*} \
- [exec tail -n10 < [dict get $srv stdout]]]
+ [exec /usr/xpg4/bin/tail -n10 < [dict get $srv stdout]]]
} else {
fail "Server started even if RDB was corrupted!"
}
diff --git a/tests/unit/aofrw.tcl b/tests/unit/aofrw.tcl
index 4fdbdc6..a1dbdad 100644
--- a/tests/unit/aofrw.tcl
+++ b/tests/unit/aofrw.tcl
@@ -70,7 +70,7 @@ start_server {tags {"aofrw"}} {
r config set appendonly no
r exec
wait_for_condition 50 100 {
- [string match {*Killing*AOF*child*} [exec tail -n5 < [srv 0 stdout]]]
+ [string match {*Killing*AOF*child*} [exec /usr/xpg4/bin/tail -n5 < [srv 0 stdout]]]
} else {
fail "Can't find 'Killing AOF child' into recent logs"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment