components/snort/patches/solaris-build.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 05 Aug 2013 23:01:17 -0700
changeset 1422 77fbb0a4cf53
parent 1345 ee87318d9935
child 2198 168b8acace5f
permissions -rw-r--r--
Added tag s12-28 for changeset 84f647a496ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1345
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
This patch does three things:
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
1/ Uses gethrtime() rather than trying to read the %tick register (the
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
   latter has issues in MP environments)
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
2/ Allows Studio to compile in 64-bit and normal optimization.
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
3/ Removed the need to define lines like "CFLAGS += -Du_int8_t=uint8_t"
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
   in the snort component Makefile.
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
It has been sent upstream for consideration by the snort maintainers for 
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
a future release.
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
--- snort-2.9.2/configure.in.orig	2013-06-04 14:05:22.814684109 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
+++ snort-2.9.2/configure.in	2013-06-04 14:41:42.703306013 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
@@ -686,27 +686,8 @@
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
     AC_MSG_RESULT(no)
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
 fi
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
 
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
-# check for sparc %time register
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
-if eval "echo $host_cpu|grep -i sparc >/dev/null"; then
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
-    OLD_CFLAGS="$CFLAGS"
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
-    CFLAGS="$CFLAGS -mcpu=v9 "
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
-    AC_MSG_CHECKING([for sparc %time register])
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
-    AC_RUN_IFELSE(
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
-    [AC_LANG_PROGRAM(
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
-    [[]],
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
-    [[
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
-        int val;
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
-        __asm__ __volatile__("rd %%tick, %0" : "=r"(val));
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
-    ]])],
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
-    [sparcv9="yes"],
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
-    [sparcv9="no"])
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
-    AC_MSG_RESULT($sparcv9)
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
-    if test "x$sparcv9" = "xyes"; then
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
-        AC_DEFINE([SPARCV9],[1],[For sparc v9 with %time register])
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
-    else
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
-        CFLAGS="$OLD_CFLAGS"
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
-    fi
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
-fi
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
+# Check for the presence of the Solaris gethrtime routine.
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    40
+AC_CHECK_FUNCS(gethrtime)
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    41
 
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
 # modified from gnulib/m4/visibility.m4
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
 AC_DEFUN([CC_VISIBILITY],
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
--- snort-2.9.2/src/cpuclock.h.orig	2013-06-04 12:30:59.362777817 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
+++ snort-2.9.2/src/cpuclock.h	2013-06-04 14:19:42.869930833 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
@@ -83,26 +83,15 @@
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
     val = ((uint64_t)tbl) | (((uint64_t)tbu0) << 32);  \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
 }
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
 #else
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
-/* SPARC */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
-#ifdef SPARCV9
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
-#ifdef _LP64
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
+/* SOLARIS */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
+#ifdef HAVE_GETHRTIME
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
 #define get_clockticks(val) \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
 { \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
-    __asm__ __volatile__("rd %%tick, %0" : "=r"(val)); \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
+    val = gethrtime(); \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
 }
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
 #else
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
-#define get_clockticks(val) \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
-{ \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
-    uint32_t a, b; \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
-    __asm__ __volatile__("rd %%tick, %0\n" \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
-                         "srlx %0, 32, %1" \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
-                         : "=r"(a), "=r"(b)); \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
-    val = ((uint64_t)a) | (((uint64_t)b) << 32); \
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
-}
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
-#endif /* _LP64 */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
-#else
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
 #define get_clockticks(val)
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
-#endif /* SPARC */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
+#endif /* HAVE_GETTHRTIME */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
 #endif /* POWERPC || PPC */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
 #endif /* IA64 && HPUX */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
 #endif /* IA64 && GNUC */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
--- snort-2.9.2/src/sfutil/sf_ip.h.orig	2013-06-04 12:33:38.923475148 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
+++ snort-2.9.2/src/sfutil/sf_ip.h	2013-06-04 12:33:52.951704625 -0700
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
@@ -38,6 +38,7 @@
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
 #endif
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
 
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
 #include "snort_debug.h" /* for inline definition */
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
+#include "sf_types.h"
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
 
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
 /* define SFIP_ROBUST to check pointers passed into the sfip libs.
ee87318d9935 PSARC 2013/113 snort 2.9.2
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
  * Robustification should not be enabled if the client code is trustworthy.