r1306, r1307, r1308, r1309, r1310, r1311, r1322, r1325 merge:
Sun Studio related fixes
This commit is contained in:
parent
03e366afc3
commit
10f0b17058
68
auto/cc/sunc
68
auto/cc/sunc
|
@ -2,8 +2,10 @@
|
|||
# Copyright (C) Igor Sysoev
|
||||
|
||||
|
||||
# Sun C 5.7 Patch 117837-04 2005/05/11
|
||||
# Sun C 5.8 2005/10/13
|
||||
# Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10
|
||||
# Sun C 5.8 2005/10/13 Sun Studio 11
|
||||
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
|
||||
# Sun C 5.9 SunOS_sparc 2007/05/03
|
||||
|
||||
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
|
||||
| sed -e 's/^.* Sun C \(.*\)/\1/'`
|
||||
|
@ -13,6 +15,33 @@ echo " + Sun C version: $NGX_SUNC_VER"
|
|||
have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
|
||||
|
||||
|
||||
cat << END > $NGX_AUTOTEST.c
|
||||
|
||||
int main() { printf("%d", __SUNPRO_C); }
|
||||
|
||||
END
|
||||
|
||||
eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
|
||||
|
||||
if [ -x $NGX_AUTOTEST ]; then
|
||||
ngx_sunc_ver=`$NGX_AUTOTEST`
|
||||
fi
|
||||
|
||||
rm $NGX_AUTOTEST*
|
||||
|
||||
# 1424 == 0x590, Sun Studio 12
|
||||
|
||||
if [ "$ngx_sunc_ver" -ge 1424 ]; then
|
||||
ngx_sparc32="-m32"
|
||||
ngx_sparc64="-m64"
|
||||
ngx_amd64="-m64"
|
||||
|
||||
else
|
||||
ngx_sparc32="-xarch=v8plus"
|
||||
ngx_sparc64="-xarch=v9"
|
||||
ngx_amd64="-amd64"
|
||||
fi
|
||||
|
||||
case "$NGX_MACHINE" in
|
||||
|
||||
i86pc)
|
||||
|
@ -35,9 +64,6 @@ case "$NGX_MACHINE" in
|
|||
;;
|
||||
|
||||
sun4u | sun4v)
|
||||
# "-xarch=v9" enables the "casa" assembler instruction
|
||||
CFLAGS="$CFLAGS -xarch=v9"
|
||||
CORE_LINK="$CORE_LINK -xarch=v9"
|
||||
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
|
||||
;;
|
||||
|
||||
|
@ -46,7 +72,9 @@ esac
|
|||
|
||||
# optimizations
|
||||
|
||||
CFLAGS="$CFLAGS -fast"
|
||||
IPO=-xipo
|
||||
CFLAGS="$CFLAGS -fast $IPO"
|
||||
CORE_LINK="$CORE_LINK -fast $IPO"
|
||||
|
||||
|
||||
case $CPU in
|
||||
|
@ -81,11 +109,29 @@ case $CPU in
|
|||
CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
|
||||
;;
|
||||
|
||||
sparc32)
|
||||
# build 32-bit UltraSparc binary
|
||||
CPU_OPT="$ngx_sparc32"
|
||||
CORE_LINK="$CORE_LINK $ngx_sparc32"
|
||||
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32"
|
||||
NGX_CPU_CACHE_LINE=64
|
||||
;;
|
||||
|
||||
sparc64)
|
||||
# build 64-bit UltraSparc binary
|
||||
CPU_OPT="$ngx_sparc64"
|
||||
CORE_LINK="$CORE_LINK $ngx_sparc64"
|
||||
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64"
|
||||
NGX_CPU_CACHE_LINE=64
|
||||
;;
|
||||
|
||||
amd64)
|
||||
# build 64-bit amd64 binary
|
||||
CPU_OPT="-xarch=amd64"
|
||||
CORE_LINK="$CORE_LINK -xarch=amd64"
|
||||
CPU_OPT="$ngx_amd64"
|
||||
CORE_LINK="$CORE_LINK $ngx_amd64"
|
||||
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64"
|
||||
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
|
||||
NGX_CPU_CACHE_LINE=64
|
||||
;;
|
||||
|
||||
esac
|
||||
|
@ -95,15 +141,15 @@ CFLAGS="$CFLAGS $CPU_OPT"
|
|||
|
||||
|
||||
if [ ".$PCRE_OPT" = "." ]; then
|
||||
PCRE_OPT="-fast $CPU_OPT"
|
||||
PCRE_OPT="-fast $IPO $CPU_OPT"
|
||||
fi
|
||||
|
||||
if [ ".$MD5_OPT" = "." ]; then
|
||||
MD5_OPT="-fast $CPU_OPT"
|
||||
MD5_OPT="-fast $IPO $CPU_OPT"
|
||||
fi
|
||||
|
||||
if [ ".$ZLIB_OPT" = "." ]; then
|
||||
ZLIB_OPT="-fast $CPU_OPT"
|
||||
ZLIB_OPT="-fast $IPO $CPU_OPT"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ if [ $PCRE != NONE ]; then
|
|||
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
|
||||
;;
|
||||
|
||||
icc* | sunc )
|
||||
icc* )
|
||||
have=NGX_PCRE . auto/have
|
||||
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
|
||||
|
||||
|
@ -25,13 +25,18 @@ if [ $PCRE != NONE ]; then
|
|||
|
||||
echo $ngx_n "checking for PCRE library ...$ngx_c"
|
||||
|
||||
if [ -e $PCRE/pcre.h ]; then
|
||||
if [ -f $PCRE/pcre.h ]; then
|
||||
ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
|
||||
| sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
|
||||
|
||||
else
|
||||
else if [ -f $PCRE/configure.in ]; then
|
||||
ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
|
||||
| sed -e 's/^.*=\(.*\)$/\1/'`
|
||||
|
||||
else
|
||||
ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
|
||||
| sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
|
||||
fi
|
||||
fi
|
||||
|
||||
echo " $ngx_pcre_ver major version found"
|
||||
|
|
|
@ -105,21 +105,21 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
|
|||
u_char *
|
||||
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
||||
{
|
||||
u_char *p, zero, *last, temp[NGX_INT64_LEN + 1];
|
||||
u_char *p, zero, *last, temp[NGX_INT64_LEN + 1];
|
||||
/*
|
||||
* really we need temp[NGX_INT64_LEN] only,
|
||||
* but icc issues the warning
|
||||
*/
|
||||
int d;
|
||||
size_t len;
|
||||
uint32_t ui32;
|
||||
int64_t i64;
|
||||
uint64_t ui64;
|
||||
ngx_msec_t ms;
|
||||
ngx_str_t *s;
|
||||
ngx_uint_t width, sign, hexadecimal, max_width;
|
||||
static u_char hex[] = "0123456789abcdef";
|
||||
static u_char HEX[] = "0123456789ABCDEF";
|
||||
int d;
|
||||
size_t len;
|
||||
uint32_t ui32;
|
||||
int64_t i64;
|
||||
uint64_t ui64;
|
||||
ngx_msec_t ms;
|
||||
ngx_uint_t width, sign, hexadecimal, max_width;
|
||||
ngx_variable_value_t *v;
|
||||
static u_char hex[] = "0123456789abcdef";
|
||||
static u_char HEX[] = "0123456789ABCDEF";
|
||||
|
||||
if (max == 0) {
|
||||
return buf;
|
||||
|
@ -188,12 +188,12 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||
switch (*fmt) {
|
||||
|
||||
case 'V':
|
||||
s = va_arg(args, ngx_str_t *);
|
||||
v = va_arg(args, ngx_variable_value_t *);
|
||||
|
||||
len = s->len & 0xffff;
|
||||
len = v->len;
|
||||
len = (buf + len < last) ? len : (size_t) (last - buf);
|
||||
|
||||
buf = ngx_cpymem(buf, s->data, len);
|
||||
buf = ngx_cpymem(buf, v->data, len);
|
||||
fmt++;
|
||||
|
||||
continue;
|
||||
|
|
|
@ -13,17 +13,28 @@
|
|||
|
||||
|
||||
typedef struct {
|
||||
size_t len;
|
||||
u_char *data;
|
||||
size_t len;
|
||||
u_char *data;
|
||||
} ngx_str_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_str_t key;
|
||||
ngx_str_t value;
|
||||
ngx_str_t key;
|
||||
ngx_str_t value;
|
||||
} ngx_keyval_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned len:29;
|
||||
|
||||
unsigned valid:1;
|
||||
unsigned no_cachable:1;
|
||||
unsigned not_found:1;
|
||||
|
||||
u_char *data;
|
||||
} ngx_variable_value_t;
|
||||
|
||||
|
||||
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
|
||||
#define ngx_null_string { 0, NULL }
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||
{
|
||||
u_char *ct;
|
||||
ngx_int_t charset, source_charset;
|
||||
ngx_str_t *mc, *from, *to;
|
||||
ngx_str_t *mc, *from, *to, s;
|
||||
ngx_uint_t n;
|
||||
ngx_http_charset_t *charsets;
|
||||
ngx_http_charset_ctx_t *ctx;
|
||||
|
@ -256,8 +256,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
charset = ngx_http_charset_get_charset(charsets, n,
|
||||
(ngx_str_t *) vv);
|
||||
s.len = vv->len;
|
||||
s.data = vv->data;
|
||||
|
||||
charset = ngx_http_charset_get_charset(charsets, n, &s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,8 +305,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
source_charset = ngx_http_charset_get_charset(charsets, n,
|
||||
(ngx_str_t *) vv);
|
||||
s.len = vv->len;
|
||||
s.data = vv->data;
|
||||
|
||||
source_charset = ngx_http_charset_get_charset(charsets, n, &s);
|
||||
}
|
||||
|
||||
if (charset != NGX_HTTP_NO_CHARSET) {
|
||||
|
@ -373,17 +377,16 @@ static ngx_int_t
|
|||
ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n,
|
||||
ngx_str_t *charset)
|
||||
{
|
||||
size_t len;
|
||||
ngx_uint_t i;
|
||||
|
||||
len = charset->len & 0xffff;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (charsets[i].name.len != len) {
|
||||
if (charsets[i].name.len != charset->len) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ngx_strncasecmp(charsets[i].name.data, charset->data, len) == 0) {
|
||||
if (ngx_strncasecmp(charsets[i].name.data, charset->data, charset->len)
|
||||
== 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,11 +197,14 @@ ngx_http_ssl_static_variable(ngx_http_request_t *r,
|
|||
{
|
||||
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
||||
|
||||
size_t len;
|
||||
size_t len;
|
||||
ngx_str_t s;
|
||||
|
||||
if (r->connection->ssl) {
|
||||
|
||||
(void) handler(r->connection, NULL, (ngx_str_t *) v);
|
||||
(void) handler(r->connection, NULL, &s);
|
||||
|
||||
v->data = s.data;
|
||||
|
||||
for (len = 0; v->data[len]; len++) { /* void */ }
|
||||
|
||||
|
@ -225,11 +228,17 @@ ngx_http_ssl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||
{
|
||||
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
||||
|
||||
ngx_str_t s;
|
||||
|
||||
if (r->connection->ssl) {
|
||||
if (handler(r->connection, r->pool, (ngx_str_t *) v) != NGX_OK) {
|
||||
|
||||
if (handler(r->connection, r->pool, &s) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
v->len = s.len;
|
||||
v->data = s.data;
|
||||
|
||||
if (v->len) {
|
||||
v->valid = 1;
|
||||
v->no_cachable = 0;
|
||||
|
|
|
@ -501,7 +501,7 @@ ngx_http_variable_request_set_size(ngx_http_request_t *r,
|
|||
ssize_t s, *sp;
|
||||
ngx_str_t val;
|
||||
|
||||
val.len = v->len & 0xffff;
|
||||
val.len = v->len;
|
||||
val.data = v->data;
|
||||
|
||||
s = ngx_parse_size(&val);
|
||||
|
|
|
@ -14,15 +14,7 @@
|
|||
#include <ngx_http.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned len:29;
|
||||
|
||||
unsigned valid:1;
|
||||
unsigned no_cachable:1;
|
||||
unsigned not_found:1;
|
||||
|
||||
u_char *data;
|
||||
} ngx_http_variable_value_t;
|
||||
typedef ngx_variable_value_t ngx_http_variable_value_t;
|
||||
|
||||
#define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, (u_char *) v }
|
||||
|
||||
|
|
|
@ -87,10 +87,17 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
|
|||
ngx_atomic_int_t
|
||||
ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add);
|
||||
|
||||
/*
|
||||
* Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
|
||||
* so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_x86.il
|
||||
*/
|
||||
|
||||
void
|
||||
ngx_cpu_pause(void);
|
||||
|
||||
/* the code in src/os/unix/ngx_sunpro_x86.il */
|
||||
|
||||
#define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
|
||||
#define ngx_cpu_pause() __asm ("pause")
|
||||
|
||||
|
||||
#else /* ( __GNUC__ || __INTEL_COMPILER ) */
|
||||
|
@ -121,10 +128,17 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
|
|||
ngx_atomic_int_t
|
||||
ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add);
|
||||
|
||||
/*
|
||||
* Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
|
||||
* so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_amd64.il
|
||||
*/
|
||||
|
||||
void
|
||||
ngx_cpu_pause(void);
|
||||
|
||||
/* the code in src/os/unix/ngx_sunpro_amd64.il */
|
||||
|
||||
#define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
|
||||
#define ngx_cpu_pause() __asm ("pause")
|
||||
|
||||
|
||||
#else /* ( __GNUC__ || __INTEL_COMPILER ) */
|
||||
|
@ -136,7 +150,7 @@ ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add);
|
|||
#endif
|
||||
|
||||
|
||||
#elif ( __sparc__ || __sparcv9 )
|
||||
#elif ( __sparc__ || __sparc || __sparcv9 )
|
||||
|
||||
#if (NGX_PTR_SIZE == 8)
|
||||
|
||||
|
|
|
@ -28,3 +28,10 @@
|
|||
lock
|
||||
xaddq %rax, (%rdi)
|
||||
.end
|
||||
|
||||
|
||||
/ ngx_cpu_pause()
|
||||
|
||||
.inline ngx_cpu_pause,0
|
||||
pause
|
||||
.end
|
||||
|
|
|
@ -29,3 +29,10 @@
|
|||
lock
|
||||
xaddl %eax, (%ecx)
|
||||
.end
|
||||
|
||||
|
||||
/ ngx_cpu_pause()
|
||||
|
||||
.inline ngx_cpu_pause,0
|
||||
pause
|
||||
.end
|
||||
|
|
Loading…
Reference in New Issue