Index: Makefile.target =================================================================== --- Makefile.target (revision 5453) +++ Makefile.target (working copy) @@ -92,6 +92,10 @@ OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "") +ifdef STACK_PROTECTOR_PRESENT +OP_CFLAGS += -fno-stack-protector +endif + HELPER_CFLAGS= ifeq ($(ARCH),i386) Index: block-vvfat.c =================================================================== --- block-vvfat.c (revision 5453) +++ block-vvfat.c (working copy) @@ -1052,7 +1052,7 @@ i = strrchr(dirname, ':') - dirname; assert(i >= 3); - if (dirname[i-2] == ':' && isalpha(dirname[i-1])) + if (dirname[i-2] == ':' && isalpha((uint8_t)dirname[i-1])) /* workaround for DOS drive names */ dirname += i-1; else Index: vl.c =================================================================== --- vl.c (revision 5453) +++ vl.c (working copy) @@ -54,16 +54,26 @@ #include #include #include +#include #include #include +#include +#if defined(__NetBSD__) +#include +#endif +#if defined(__linux__) || defined(__Linux__) +#include +#endif +#include #include #include #include -#include #ifdef _BSD #include -#if !defined(__APPLE__) && !defined(__OpenBSD__) +#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__) #include +#else +#include #endif #ifdef __OpenBSD__ #include @@ -72,8 +82,6 @@ #include #else #ifdef __linux__ -#include -#include #include #include #include @@ -3990,7 +3998,7 @@ if (buf[0] == '\0') { saddr->sin_addr.s_addr = 0; } else { - if (isdigit(buf[0])) { + if (isdigit((uint8_t)buf[0])) { if (!inet_aton(buf, &saddr->sin_addr)) return -1; } else { Index: target-ppc/translate_init.c =================================================================== --- target-ppc/translate_init.c (revision 5453) +++ target-ppc/translate_init.c (working copy) @@ -9458,7 +9458,7 @@ p = name; check_pvr: for (i = 0; i < 8; i++) { - if (!isxdigit(*p++)) + if (!isxdigit((uint8_t)*p++)) break; } if (i == 8) Index: audio/audio.c =================================================================== --- audio/audio.c (revision 5453) +++ audio/audio.c (working copy) @@ -215,7 +215,7 @@ pstrcat (r, len + sizeof (qemu_prefix), s); for (i = 0; i < len; ++i) { - u[i] = toupper (u[i]); + u[i] = toupper ((uint8_t)u[i]); } } return r; @@ -470,7 +470,7 @@ /* copy while upper-casing, including trailing zero */ for (i = 0; i <= preflen; ++i) { - optname[i + sizeof (qemu_prefix) - 1] = toupper (prefix[i]); + optname[i + sizeof (qemu_prefix) - 1] = toupper ((uint8_t)prefix[i]); } pstrcat (optname, optlen, "_"); pstrcat (optname, optlen, opt->name); Index: audio/mixeng.c =================================================================== --- audio/mixeng.c (revision 5453) +++ audio/mixeng.c (working copy) @@ -143,56 +143,64 @@ #undef IN_T #undef SHIFT +/* + * Work around ugly XX_t #defines in NetBSD 2.x, + * fixed as typedefs in NetBSD 3.x. Two macros needed to + * get CPP defines expanded properly. + */ +#define _NBglue(x,y,z) x ## y ## z +#define NBglue(x,y,z) _NBglue(x,y,z) + t_sample *mixeng_conv[2][2][2][3] = { { { { - conv_natural_uint8_t_to_mono, - conv_natural_uint16_t_to_mono, - conv_natural_uint32_t_to_mono + NBglue(conv_natural_, uint8_t, _to_mono), + NBglue(conv_natural_, uint16_t, _to_mono), + NBglue(conv_natural_, uint32_t, _to_mono), }, { - conv_natural_uint8_t_to_mono, - conv_swap_uint16_t_to_mono, - conv_swap_uint32_t_to_mono, + NBglue(conv_natural_, uint8_t, _to_mono), + NBglue(conv_swap_, uint16_t, _to_mono), + NBglue(conv_swap_, uint32_t, _to_mono), } }, { { - conv_natural_int8_t_to_mono, - conv_natural_int16_t_to_mono, - conv_natural_int32_t_to_mono + NBglue(conv_natural_, int8_t, _to_mono), + NBglue(conv_natural_, int16_t, _to_mono), + NBglue(conv_natural_, int32_t, _to_mono) }, { - conv_natural_int8_t_to_mono, - conv_swap_int16_t_to_mono, - conv_swap_int32_t_to_mono + NBglue(conv_natural_, int8_t, _to_mono), + NBglue(conv_swap_, int16_t, _to_mono), + NBglue(conv_swap_, int32_t, _to_mono) } } }, { { { - conv_natural_uint8_t_to_stereo, - conv_natural_uint16_t_to_stereo, - conv_natural_uint32_t_to_stereo + NBglue(conv_natural_, uint8_t, _to_stereo), + NBglue(conv_natural_, uint16_t, _to_stereo), + NBglue(conv_natural_, uint32_t, _to_stereo) }, { - conv_natural_uint8_t_to_stereo, - conv_swap_uint16_t_to_stereo, - conv_swap_uint32_t_to_stereo + NBglue(conv_natural_, uint8_t, _to_stereo), + NBglue(conv_swap_, uint16_t, _to_stereo), + NBglue(conv_swap_, uint32_t, _to_stereo) } }, { { - conv_natural_int8_t_to_stereo, - conv_natural_int16_t_to_stereo, - conv_natural_int32_t_to_stereo + NBglue(conv_natural_, int8_t, _to_stereo), + NBglue(conv_natural_, int16_t, _to_stereo), + NBglue(conv_natural_, int32_t, _to_stereo) }, { - conv_natural_int8_t_to_stereo, - conv_swap_int16_t_to_stereo, - conv_swap_int32_t_to_stereo, + NBglue(conv_natural_, int8_t, _to_stereo), + NBglue(conv_swap_, int16_t, _to_stereo), + NBglue(conv_swap_, int32_t, _to_stereo), } } } @@ -202,52 +210,52 @@ { { { - clip_natural_uint8_t_from_mono, - clip_natural_uint16_t_from_mono, - clip_natural_uint32_t_from_mono + NBglue(clip_natural_, uint8_t, _from_mono), + NBglue(clip_natural_, uint16_t, _from_mono), + NBglue(clip_natural_, uint32_t, _from_mono) }, { - clip_natural_uint8_t_from_mono, - clip_swap_uint16_t_from_mono, - clip_swap_uint32_t_from_mono + NBglue(clip_natural_, uint8_t, _from_mono), + NBglue(clip_swap_, uint16_t, _from_mono), + NBglue(clip_swap_, uint32_t, _from_mono) } }, { { - clip_natural_int8_t_from_mono, - clip_natural_int16_t_from_mono, - clip_natural_int32_t_from_mono + NBglue(clip_natural_, int8_t, _from_mono), + NBglue(clip_natural_, int16_t, _from_mono), + NBglue(clip_natural_, int32_t, _from_mono) }, { - clip_natural_int8_t_from_mono, - clip_swap_int16_t_from_mono, - clip_swap_int32_t_from_mono + NBglue(clip_natural_, int8_t, _from_mono), + NBglue(clip_swap_, int16_t, _from_mono), + NBglue(clip_swap_, int32_t, _from_mono) } } }, { { { - clip_natural_uint8_t_from_stereo, - clip_natural_uint16_t_from_stereo, - clip_natural_uint32_t_from_stereo + NBglue(clip_natural_, uint8_t, _from_stereo), + NBglue(clip_natural_, uint16_t, _from_stereo), + NBglue(clip_natural_, uint32_t, _from_stereo) }, { - clip_natural_uint8_t_from_stereo, - clip_swap_uint16_t_from_stereo, - clip_swap_uint32_t_from_stereo + NBglue(clip_natural_, uint8_t, _from_stereo), + NBglue(clip_swap_, uint16_t, _from_stereo), + NBglue(clip_swap_, uint32_t, _from_stereo) } }, { { - clip_natural_int8_t_from_stereo, - clip_natural_int16_t_from_stereo, - clip_natural_int32_t_from_stereo + NBglue(clip_natural_, int8_t, _from_stereo), + NBglue(clip_natural_, int16_t, _from_stereo), + NBglue(clip_natural_, int32_t, _from_stereo) }, { - clip_natural_int8_t_from_stereo, - clip_swap_int16_t_from_stereo, - clip_swap_int32_t_from_stereo + NBglue(clip_natural_, int8_t, _from_stereo), + NBglue(clip_swap_, int16_t, _from_stereo), + NBglue(clip_swap_, int32_t, _from_stereo) } } } Index: bswap.h =================================================================== --- bswap.h (revision 5453) +++ bswap.h (working copy) @@ -5,6 +5,12 @@ #include +#ifdef HAVE_MACHINE_BSWAP_H +#include +#include +#include +#else + #ifdef HAVE_BYTESWAP_H #include #else @@ -58,6 +64,8 @@ return bswap_64(x); } +#endif /* ! HAVE_MACHINE_BSWAP_H */ + static inline void bswap16s(uint16_t *s) { *s = bswap16(*s); Index: dyngen.c =================================================================== --- dyngen.c (revision 5453) +++ dyngen.c (working copy) @@ -1651,6 +1651,7 @@ if(!sym_name) continue; if (*sym_name && + !strstart(sym_name, "bswap64", NULL) && /* HF hack */ !strstart(sym_name, "__op_param", NULL) && !strstart(sym_name, "__op_jmp", NULL) && !strstart(sym_name, "__op_gen_label", NULL)) { Index: monitor.c =================================================================== --- monitor.c (revision 5453) +++ monitor.c (working copy) @@ -1907,7 +1907,7 @@ { if (pch != '\0') { pch++; - while (isspace(*pch)) + while (isspace((uint8_t)*pch)) pch++; } } @@ -1966,7 +1966,7 @@ *q++ = *pch; pch++; } - while (isspace(*pch)) + while (isspace((uint8_t)*pch)) pch++; *q = 0; ret = get_monitor_def(®, buf); @@ -1991,7 +1991,7 @@ expr_error("invalid char in expression"); } pch = p; - while (isspace(*pch)) + while (isspace((uint8_t)*pch)) pch++; break; } @@ -2085,7 +2085,7 @@ *pp = pch; return -1; } - while (isspace(*pch)) + while (isspace((uint8_t)*pch)) pch++; *pval = expr_sum(); *pp = pch; @@ -2100,7 +2100,7 @@ q = buf; p = *pp; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*p == '\0') { fail: @@ -2145,7 +2145,7 @@ } p++; } else { - while (*p != '\0' && !isspace(*p)) { + while (*p != '\0' && !isspace((uint8_t)*p)) { if ((q - buf) < buf_size - 1) { *q++ = *p; } @@ -2191,12 +2191,12 @@ /* extract the command name */ p = cmdline; q = cmdname; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*p == '\0') return; pstart = p; - while (*p != '\0' && *p != '/' && !isspace(*p)) + while (*p != '\0' && *p != '/' && !isspace((uint8_t)*p)) p++; len = p - pstart; if (len > sizeof(cmdname) - 1) @@ -2232,7 +2232,7 @@ int ret; char *str; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*typestr == '?') { typestr++; @@ -2273,15 +2273,15 @@ { int count, format, size; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*p == '/') { /* format found */ p++; count = 1; - if (isdigit(*p)) { + if (isdigit((uint8_t)*p)) { count = 0; - while (isdigit(*p)) { + while (isdigit((uint8_t)*p)) { count = count * 10 + (*p - '0'); p++; } @@ -2320,7 +2320,7 @@ } } next: - if (*p != '\0' && !isspace(*p)) { + if (*p != '\0' && !isspace((uint8_t)*p)) { term_printf("invalid char in format: '%c'\n", *p); goto fail; } @@ -2354,7 +2354,7 @@ { int64_t val; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*typestr == '?' || *typestr == '.') { if (*typestr == '?') { @@ -2365,7 +2365,7 @@ } else { if (*p == '.') { p++; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; has_arg = 1; } else { @@ -2410,7 +2410,7 @@ c = *typestr++; if (c == '\0') goto bad_type; - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; has_option = 0; if (*p == '-') { @@ -2435,7 +2435,7 @@ } } /* check that all arguments were parsed */ - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*p != '\0') { term_printf("%s: extraneous characters at the end of line\n", @@ -2583,7 +2583,7 @@ p = cmdline; nb_args = 0; for(;;) { - while (isspace(*p)) + while (isspace((uint8_t)*p)) p++; if (*p == '\0') break; @@ -2617,7 +2617,7 @@ /* if the line ends with a space, it means we want to complete the next arg */ len = strlen(cmdline); - if (len > 0 && isspace(cmdline[len - 1])) { + if (len > 0 && isspace((uint8_t)cmdline[len - 1])) { if (nb_args >= MAX_ARGS) return; args[nb_args++] = qemu_strdup(""); Index: block.c =================================================================== --- block.c (revision 5453) +++ block.c (working copy) @@ -30,8 +30,10 @@ #include #include #include +#if defined(__FreeBSD__) #include #endif +#endif #define SECTOR_BITS 9 #define SECTOR_SIZE (1 << SECTOR_BITS) Index: configure =================================================================== --- configure (revision 5453) +++ configure (working copy) @@ -68,7 +68,7 @@ mips64) cpu="mips64" ;; - "Power Macintosh"|ppc|ppc64) + "Power Macintosh"|ppc|ppc64|powerpc) cpu="powerpc" ;; s390*) @@ -151,6 +151,7 @@ bsd="yes" audio_drv_list="oss" audio_possible_drivers="oss sdl esd" +oss_lib="-lossaudio" ;; OpenBSD) bsd="yes" @@ -497,7 +498,7 @@ if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then AIOLIBS= elif [ "$bsd" = "yes" ]; then - AIOLIBS="-lpthread" + AIOLIBS="-lrt -lpthread" else # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. AIOLIBS="-lrt -lpthread" @@ -537,6 +538,16 @@ fi fi +# Check for stack protector +cat > $TMPC < /dev/null ; then + stack_protector_present="yes" +else + stack_protector_present="no" +fi + if test ! -x "$(which cgcc 2>/dev/null)"; then sparse="no" fi @@ -1139,6 +1150,15 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h fi + cat > $TMPC << EOF +#include +#include +#include +int main(void) { return bswap32(0); } +EOF + if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then + echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h + fi fi if [ "$openbsd" = "yes" ] ; then @@ -1276,6 +1296,10 @@ echo "#define _BSD 1" >> $config_h fi +if [ "$stack_protector_present" = "yes" ] ; then + echo "STACK_PROTECTOR_PRESENT=yes" >> $config_mak +fi + echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h tools= Index: fpu/softfloat-native.h =================================================================== --- fpu/softfloat-native.h (revision 5453) +++ fpu/softfloat-native.h (working copy) @@ -8,8 +8,7 @@ #include #endif -#ifdef __OpenBSD__ -/* Get OpenBSD version number */ +#if defined(__OpenBSD__) || defined(__NetBSD__) #include #endif @@ -35,6 +34,25 @@ #define unordered(x, y) (isnan(x) || isnan(y)) #endif +#ifdef __NetBSD__ +#ifndef isgreater +#define isgreater(x, y) __builtin_isgreater(x, y) +#endif +#ifndef isgreaterequal +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#endif +#ifndef isless +#define isless(x, y) __builtin_isless(x, y) +#endif +#ifndef islessequal +#define islessequal(x, y) __builtin_islessequal(x, y) +#endif +#ifndef isunordered +#define isunordered(x, y) __builtin_isunordered(x, y) +#endif +#endif + + #define isnormal(x) (fpclass(x) >= FP_NZERO) #define isgreater(x, y) ((!unordered(x, y)) && ((x) > (y))) #define isgreaterequal(x, y) ((!unordered(x, y)) && ((x) >= (y)))