浏览代码

core: fix Sun Studio build

- update Makefile.defs for recent versions of Solaris Studio
Spencer Thomason 9 年之前
父节点
当前提交
2a3915d456
共有 7 个文件被更改,包括 30 次插入19 次删除
  1. 16 11
      Makefile.defs
  2. 2 2
      action.c
  3. 3 0
      atomic/atomic_sparc64.h
  4. 4 0
      io_wait.h
  5. 0 1
      ip_addr.h
  6. 4 4
      sr_module.h
  7. 1 1
      tls_hooks.h

+ 16 - 11
Makefile.defs

@@ -254,6 +254,7 @@ ifneq (, $(findstring Sun, $(CC_LONGVER)))
 					sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
 	CC_VER=$(CC) $(CC_SHORTVER)
 	MKDEP=$(CC) -xM1
+	CC_MKDEP_OPTS=-xMMD
 endif
 
 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
@@ -1093,9 +1094,12 @@ endif			#CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
 
 else		#CC_NAME, gcc
 ifeq		($(CC_NAME), suncc)
+			C_DEFS+=-DCC_GCC_LIKE_ASM
 			C_DEFS+=-DSPARC64_MODE
-			CFLAGS+= -m64 -g -xO5 -fast -native -xarch=v9 -xCC \
+			CFLAGS+= -m64 -g -xO3 -xtarget=native -xmemalign=8i \
+					-fma=fused -fns=yes \
 					-xc99 # C99 support
+			LDFLAGS+=-m64
 			# -Dinline="" # add this if cc < 5.3 (define inline as null)
 else
 				#other compilers
@@ -1159,7 +1163,9 @@ endif			#CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
 
 else		#CC_NAME, gcc
 ifeq		($(CC_NAME), suncc)
-			CFLAGS+= -g -xO5 -fast -native -xCC \
+			C_DEFS+=-DCC_GCC_LIKE_ASM
+			CFLAGS+= -g -xO3 -xtarget=native -xmemalign=4i \
+					-fma=fused -fns=yes \
 					-xc99 # C99 support
 			# -Dinline="" # add this if cc < 5.3 (define inline as null)
 else
@@ -1589,11 +1595,11 @@ ifeq	($(CC_NAME), icc)
 endif
 ifeq	($(CC_NAME), suncc)
 	# -dy?
-	LDFLAGS+=-xO5 $(PROFILE)
+	LDFLAGS+=-xO3 $(PROFILE)
 	MOD_LDFLAGS:=-G $(LDFLAGS)
 	LIB_LDFLAGS:=-G $(LDFLAGS)
-	LIB_SONAME="-h "
-	LD_RPATH=-"-R "
+	LIB_SONAME=-Wl,-h,
+	LD_RPATH=-Wl,-R,
 endif
 	# we need -fPIC -DPIC only for shared objects, we don't need them for
 	# the executable file, because it's always loaded at a fixed address
@@ -1650,8 +1656,8 @@ ifeq	($(CC_NAME), suncc)
 		LDFLAGS+=-g $(PROFILE)
 		MOD_LDFLAGS:=-G $(LDFLAGS)
 		LIB_LDFLAGS:=-G $(LDFLAGS)
-		LIB_SONAME="-h "
-		LD_RPATH=-"-R "
+		LIB_SONAME=-Wl,-h,
+		LD_RPATH=-Wl,-R,
 endif
 
 endif #mode=release
@@ -1680,9 +1686,8 @@ MOD_CFLAGS=-Kpic $(CFLAGS)
 LIB_CFLAGS=-Kpic $(CFLAGS)
 endif
 ifeq	($(CC_NAME), suncc)
-# FIMXE: use -KPIC instead -xcode ?
-MOD_CFLAGS=-xcode=pic32  $(CFLAGS)
-LIB_CFLAGS=-xcode=pic32  $(CFLAGS)
+MOD_CFLAGS=-xcode=pic32 $(CFLAGS)
+LIB_CFLAGS=-xcode=pic32 $(CFLAGS)
 endif
 ifeq    ($(CC_NAME), clang)
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
@@ -1823,7 +1828,7 @@ ifeq  ($(OS), solaris)
 	YACC=yacc
 
 ifeq ($(CC_NAME), suncc)
-	LIBS= -lfast -ldl -lresolv
+	LIBS= -ldl -lresolv
 endif
 	OLD_SOLARIS= $(shell echo "$(OSREL)" | \
 				sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )

+ 2 - 2
action.c

@@ -229,7 +229,7 @@ char *get_cfg_crt_name(void)
 #define MODF_CALL(f_type, h, msg, src, ...) \
 	do { \
 		cmd=(src)[0].u.data; \
-		ret=((f_type)cmd->function)((msg), __VAR_ARGS__); \
+		ret=((f_type)cmd->function)((msg), __VA_ARGS__); \
 		MODF_HANDLE_RETCODE(h, ret); \
 	} while (0)
 #else  /* ! __SUNPRO_C  (gcc, icc a.s.o) */
@@ -263,7 +263,7 @@ char *get_cfg_crt_name(void)
 	do { \
 		cmd=(src)[0].u.data; \
 		MODF_RVE_PARAM_CONVERT(h, msg, cmd, src, dst); \
-		ret=((f_type)cmd->function)((msg), __VAR_ARGS__); \
+		ret=((f_type)cmd->function)((msg), __VA_ARGS__); \
 		MODF_HANDLE_RETCODE(h, ret); \
 		/* free strings allocated by us or fixups */ \
 		MODF_RVE_PARAM_FREE(cmd, src, dst); \

+ 3 - 0
atomic/atomic_sparc64.h

@@ -37,6 +37,9 @@
 #define HAVE_ASM_INLINE_MEMBAR
 
 
+#ifdef __SUNPRO_C
+#pragma error_messages (off,E_ASM_UNUSED_PARAM)
+#endif
 
 /* try to guess if in SPARC64_MODE */
 #if ! defined SPARC64_MODE && \

+ 4 - 0
io_wait.h

@@ -106,6 +106,10 @@ typedef int fd_type;
 #define FD_TYPE_DEFINED
 #endif
 
+#ifdef __SUNPRO_C
+#pragma weak handle_io
+#endif
+
 /* maps a fd to some other structure; used in almost all cases
  * except epoll and maybe kqueue or /dev/poll */
 struct fd_map{

+ 0 - 1
ip_addr.h

@@ -658,7 +658,6 @@ static inline int ip_addr2sbuf(struct ip_addr* ip, char* buff, int len)
 			LM_CRIT("unknown address family %d\n", ip->af);
 			return 0;
 	}
-	return 0;
 }
 
 

+ 4 - 4
sr_module.h

@@ -208,7 +208,7 @@ struct ser_cmd_export_ {
 	int param_no;           /**< number of parameters used by the function */
 	fixup_function fixup;   /**< pointer to the function called to "fix" the
 							   parameters */
-	int flags;              /**< Function flags */
+	unsigned int flags;     /**< Function flags */
 };
 
 
@@ -221,7 +221,7 @@ struct kam_cmd_export_ {
 							   parameters */
 	free_fixup_function free_fixup; /**< function called to free the "fixed"
 									   parameters */
-	int flags;              /**< Function flags */
+	unsigned int flags;     /**< Function flags */
 };
 
 /** sip-router version */
@@ -233,8 +233,8 @@ struct sr31_cmd_export_ {
 							   parameters */
 	free_fixup_function free_fixup; /**< function called to free the "fixed"
 									   parameters */
-	int flags;              /**< Function flags */
-	int fixup_flags;
+	unsigned int flags;     /**< Function flags */
+	unsigned int fixup_flags;
 	void* module_exports; /**< pointer to module structure */
 };
 

+ 1 - 1
tls_hooks.h

@@ -84,7 +84,7 @@ extern struct tls_hooks tls_hook;
 #ifdef __SUNPRO_C
 	#define tls_hook_call(name, ret_not_set, ...) \
 		((tls_hook.name)?(tls_hook.name(__VA_ARGS__)): (ret_not_set))
-	#define tls_hook_call_v(name, __VA_ARGS__) \
+	#define tls_hook_call_v(name, ...) \
 		do{ \
 			if (tls_hook.name) tls_hook.name(__VA_ARGS__); \
 		}while(0)