Browse code

core: fix Sun Studio build

- update Makefile.defs for recent versions of Solaris Studio

(cherry picked from commit 2a3915d456289cfc1685b081ab351fc00c1e3dfb)

Spencer Thomason authored on 30/06/2016 19:44:11 • Daniel-Constantin Mierla committed on 05/07/2016 09:51:04
Showing 7 changed files
... ...
@@ -254,6 +254,7 @@ ifneq (, $(findstring Sun, $(CC_LONGVER)))
254 254
 					sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
255 255
 	CC_VER=$(CC) $(CC_SHORTVER)
256 256
 	MKDEP=$(CC) -xM1
257
+	CC_MKDEP_OPTS=-xMMD
257 258
 endif
258 259
 
259 260
 ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
... ...
@@ -1093,9 +1094,12 @@ endif			#CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1093 1094
 
1094 1095
 else		#CC_NAME, gcc
1095 1096
 ifeq		($(CC_NAME), suncc)
1097
+			C_DEFS+=-DCC_GCC_LIKE_ASM
1096 1098
 			C_DEFS+=-DSPARC64_MODE
1097
-			CFLAGS+= -m64 -g -xO5 -fast -native -xarch=v9 -xCC \
1099
+			CFLAGS+= -m64 -g -xO3 -xtarget=native -xmemalign=8i \
1100
+					-fma=fused -fns=yes \
1098 1101
 					-xc99 # C99 support
1102
+			LDFLAGS+=-m64
1099 1103
 			# -Dinline="" # add this if cc < 5.3 (define inline as null)
1100 1104
 else
1101 1105
 				#other compilers
... ...
@@ -1159,7 +1163,9 @@ endif			#CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
1159 1163
 
1160 1164
 else		#CC_NAME, gcc
1161 1165
 ifeq		($(CC_NAME), suncc)
1162
-			CFLAGS+= -g -xO5 -fast -native -xCC \
1166
+			C_DEFS+=-DCC_GCC_LIKE_ASM
1167
+			CFLAGS+= -g -xO3 -xtarget=native -xmemalign=4i \
1168
+					-fma=fused -fns=yes \
1163 1169
 					-xc99 # C99 support
1164 1170
 			# -Dinline="" # add this if cc < 5.3 (define inline as null)
1165 1171
 else
... ...
@@ -1589,11 +1595,11 @@ ifeq	($(CC_NAME), icc)
1589 1595
 endif
1590 1596
 ifeq	($(CC_NAME), suncc)
1591 1597
 	# -dy?
1592
-	LDFLAGS+=-xO5 $(PROFILE)
1598
+	LDFLAGS+=-xO3 $(PROFILE)
1593 1599
 	MOD_LDFLAGS:=-G $(LDFLAGS)
1594 1600
 	LIB_LDFLAGS:=-G $(LDFLAGS)
1595
-	LIB_SONAME="-h "
1596
-	LD_RPATH=-"-R "
1601
+	LIB_SONAME=-Wl,-h,
1602
+	LD_RPATH=-Wl,-R,
1597 1603
 endif
1598 1604
 	# we need -fPIC -DPIC only for shared objects, we don't need them for
1599 1605
 	# the executable file, because it's always loaded at a fixed address
... ...
@@ -1650,8 +1656,8 @@ ifeq	($(CC_NAME), suncc)
1650 1656
 		LDFLAGS+=-g $(PROFILE)
1651 1657
 		MOD_LDFLAGS:=-G $(LDFLAGS)
1652 1658
 		LIB_LDFLAGS:=-G $(LDFLAGS)
1653
-		LIB_SONAME="-h "
1654
-		LD_RPATH=-"-R "
1659
+		LIB_SONAME=-Wl,-h,
1660
+		LD_RPATH=-Wl,-R,
1655 1661
 endif
1656 1662
 
1657 1663
 endif #mode=release
... ...
@@ -1680,9 +1686,8 @@ MOD_CFLAGS=-Kpic $(CFLAGS)
1680 1686
 LIB_CFLAGS=-Kpic $(CFLAGS)
1681 1687
 endif
1682 1688
 ifeq	($(CC_NAME), suncc)
1683
-# FIMXE: use -KPIC instead -xcode ?
1684
-MOD_CFLAGS=-xcode=pic32  $(CFLAGS)
1685
-LIB_CFLAGS=-xcode=pic32  $(CFLAGS)
1689
+MOD_CFLAGS=-xcode=pic32 $(CFLAGS)
1690
+LIB_CFLAGS=-xcode=pic32 $(CFLAGS)
1686 1691
 endif
1687 1692
 ifeq    ($(CC_NAME), clang)
1688 1693
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
... ...
@@ -1823,7 +1828,7 @@ ifeq  ($(OS), solaris)
1823 1828
 	YACC=yacc
1824 1829
 
1825 1830
 ifeq ($(CC_NAME), suncc)
1826
-	LIBS= -lfast -ldl -lresolv
1831
+	LIBS= -ldl -lresolv
1827 1832
 endif
1828 1833
 	OLD_SOLARIS= $(shell echo "$(OSREL)" | \
1829 1834
 				sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
... ...
@@ -229,7 +229,7 @@ char *get_cfg_crt_name(void)
229 229
 #define MODF_CALL(f_type, h, msg, src, ...) \
230 230
 	do { \
231 231
 		cmd=(src)[0].u.data; \
232
-		ret=((f_type)cmd->function)((msg), __VAR_ARGS__); \
232
+		ret=((f_type)cmd->function)((msg), __VA_ARGS__); \
233 233
 		MODF_HANDLE_RETCODE(h, ret); \
234 234
 	} while (0)
235 235
 #else  /* ! __SUNPRO_C  (gcc, icc a.s.o) */
... ...
@@ -263,7 +263,7 @@ char *get_cfg_crt_name(void)
263 263
 	do { \
264 264
 		cmd=(src)[0].u.data; \
265 265
 		MODF_RVE_PARAM_CONVERT(h, msg, cmd, src, dst); \
266
-		ret=((f_type)cmd->function)((msg), __VAR_ARGS__); \
266
+		ret=((f_type)cmd->function)((msg), __VA_ARGS__); \
267 267
 		MODF_HANDLE_RETCODE(h, ret); \
268 268
 		/* free strings allocated by us or fixups */ \
269 269
 		MODF_RVE_PARAM_FREE(cmd, src, dst); \
... ...
@@ -46,6 +46,9 @@
46 46
 #define HAVE_ASM_INLINE_MEMBAR
47 47
 
48 48
 
49
+#ifdef __SUNPRO_C
50
+#pragma error_messages (off,E_ASM_UNUSED_PARAM)
51
+#endif
49 52
 
50 53
 /* try to guess if in SPARC64_MODE */
51 54
 #if ! defined SPARC64_MODE && \
... ...
@@ -106,6 +106,10 @@ typedef int fd_type;
106 106
 #define FD_TYPE_DEFINED
107 107
 #endif
108 108
 
109
+#ifdef __SUNPRO_C
110
+#pragma weak handle_io
111
+#endif
112
+
109 113
 /* maps a fd to some other structure; used in almost all cases
110 114
  * except epoll and maybe kqueue or /dev/poll */
111 115
 struct fd_map{
... ...
@@ -658,7 +658,6 @@ static inline int ip_addr2sbuf(struct ip_addr* ip, char* buff, int len)
658 658
 			LM_CRIT("unknown address family %d\n", ip->af);
659 659
 			return 0;
660 660
 	}
661
-	return 0;
662 661
 }
663 662
 
664 663
 
... ...
@@ -208,7 +208,7 @@ struct ser_cmd_export_ {
208 208
 	int param_no;           /**< number of parameters used by the function */
209 209
 	fixup_function fixup;   /**< pointer to the function called to "fix" the
210 210
 							   parameters */
211
-	int flags;              /**< Function flags */
211
+	unsigned int flags;     /**< Function flags */
212 212
 };
213 213
 
214 214
 
... ...
@@ -221,7 +221,7 @@ struct kam_cmd_export_ {
221 221
 							   parameters */
222 222
 	free_fixup_function free_fixup; /**< function called to free the "fixed"
223 223
 									   parameters */
224
-	int flags;              /**< Function flags */
224
+	unsigned int flags;     /**< Function flags */
225 225
 };
226 226
 
227 227
 /** sip-router version */
... ...
@@ -233,8 +233,8 @@ struct sr31_cmd_export_ {
233 233
 							   parameters */
234 234
 	free_fixup_function free_fixup; /**< function called to free the "fixed"
235 235
 									   parameters */
236
-	int flags;              /**< Function flags */
237
-	int fixup_flags;
236
+	unsigned int flags;     /**< Function flags */
237
+	unsigned int fixup_flags;
238 238
 	void* module_exports; /**< pointer to module structure */
239 239
 };
240 240
 
... ...
@@ -84,7 +84,7 @@ extern struct tls_hooks tls_hook;
84 84
 #ifdef __SUNPRO_C
85 85
 	#define tls_hook_call(name, ret_not_set, ...) \
86 86
 		((tls_hook.name)?(tls_hook.name(__VA_ARGS__)): (ret_not_set))
87
-	#define tls_hook_call_v(name, __VA_ARGS__) \
87
+	#define tls_hook_call_v(name, ...) \
88 88
 		do{ \
89 89
 			if (tls_hook.name) tls_hook.name(__VA_ARGS__); \
90 90
 		}while(0)