core: fix Sun Studio build
authorSpencer Thomason <spencer@whiteskycommunications.com>
Thu, 30 Jun 2016 19:44:11 +0000 (12:44 -0700)
committerSpencer Thomason <spencer@whiteskycommunications.com>
Fri, 1 Jul 2016 14:33:27 +0000 (07:33 -0700)
- update Makefile.defs for recent versions of Solaris Studio

Makefile.defs
action.c
atomic/atomic_sparc64.h
io_wait.h
ip_addr.h
sr_module.h
tls_hooks.h

index bf84f88..af5fd45 100644 (file)
@@ -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/' )
index 9e9db97..a88751d 100644 (file)
--- a/action.c
+++ b/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); \
index dd87994..5927315 100644 (file)
@@ -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 && \
index 0485e39..3325094 100644 (file)
--- a/io_wait.h
+++ b/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{
index c2b724c..f0a5317 100644 (file)
--- a/ip_addr.h
+++ b/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;
 }
 
 
index 6eb42fb..e42ccdf 100644 (file)
@@ -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 */
 };
 
index 3ac5bd2..a789a49 100644 (file)
@@ -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)