Browse Source

build: add x32 support

This commit adds preliminary x32 support.  Configure with:

    $ ./configure --dest-cpu=x32

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
archived-io.js-v0.12
Ben Noordhuis 10 years ago
parent
commit
a08f8e28ca
  1. 4
      common.gypi
  2. 2
      configure
  3. 25
      deps/openssl/config/opensslconf.h
  4. 6
      src/string_bytes.cc

4
common.gypi

@ -185,6 +185,10 @@
'cflags': [ '-m32' ], 'cflags': [ '-m32' ],
'ldflags': [ '-m32' ], 'ldflags': [ '-m32' ],
}], }],
[ 'target_arch=="x32"', {
'cflags': [ '-mx32' ],
'ldflags': [ '-mx32' ],
}],
[ 'target_arch=="x64"', { [ 'target_arch=="x64"', {
'cflags': [ '-m64' ], 'cflags': [ '-m64' ],
'ldflags': [ '-m64' ], 'ldflags': [ '-m64' ],

2
configure

@ -31,7 +31,7 @@ parser.add_option('--debug',
parser.add_option('--dest-cpu', parser.add_option('--dest-cpu',
action='store', action='store',
dest='dest_cpu', dest='dest_cpu',
help='CPU architecture to build for. Valid values are: arm, ia32, x64') help='CPU architecture to build for. Valid values are: arm, ia32, x32, x64')
parser.add_option('--dest-os', parser.add_option('--dest-os',
action='store', action='store',

25
deps/openssl/config/opensslconf.h

@ -190,10 +190,8 @@
* boundary. See crypto/rc4/rc4_enc.c for further details. * boundary. See crypto/rc4/rc4_enc.c for further details.
*/ */
# undef RC4_CHUNK # undef RC4_CHUNK
# if (defined(_M_X64) || defined(__x86_64__)) && defined(_WIN32) # if defined(_M_X64) || defined(__x86_64__)
# define RC4_CHUNK unsigned long long # define RC4_CHUNK unsigned long long
# elif (defined(_M_X64) || defined(__x86_64__)) && !defined(_WIN32)
# define RC4_CHUNK unsigned long
# elif defined(__arm__) # elif defined(__arm__)
# define RC4_CHUNK unsigned long # define RC4_CHUNK unsigned long
# else # else
@ -205,21 +203,12 @@
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
* %20 speed up (longs are 8 bytes, int's are 4). */ * %20 speed up (longs are 8 bytes, int's are 4). */
# undef DES_LONG # undef DES_LONG
# if defined(_M_X64) || defined(__x86_64__) || defined(__arm__) || defined(__mips__) # define DES_LONG unsigned int
# define DES_LONG unsigned int
# elif defined(_M_IX86) || defined(__i386__)
# define DES_LONG unsigned long
# endif
#endif #endif
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
# define CONFIG_HEADER_BN_H # define CONFIG_HEADER_BN_H
# undef BL_LLONG
# if defined(_M_IX86) || defined(__i386__) || defined(__arm__)
# define BL_LLONG
# endif
/* Should we define BN_DIV2W here? */ /* Should we define BN_DIV2W here? */
/* Only one for the following should be defined */ /* Only one for the following should be defined */
@ -231,10 +220,12 @@
# undef THIRTY_TWO_BIT # undef THIRTY_TWO_BIT
# undef SIXTEEN_BIT # undef SIXTEEN_BIT
# undef EIGHT_BIT # undef EIGHT_BIT
# if (defined(_M_X64) || defined(__x86_64__)) && defined(_WIN32) # if defined(_M_X64) || defined(__x86_64__)
# define SIXTY_FOUR_BIT # if defined(_WIN64) || defined(_LP64)
# elif (defined(_M_X64) || defined(__x86_64__)) && !defined(_WIN32) # define SIXTY_FOUR_BIT_LONG
# define SIXTY_FOUR_BIT_LONG # else
# define SIXTY_FOUR_BIT
# endif
# elif defined(_M_IX86) || defined(__i386__) || defined(__arm__) || defined(__mips__) # elif defined(_M_IX86) || defined(__i386__) || defined(__arm__) || defined(__mips__)
# define THIRTY_TWO_BIT # define THIRTY_TWO_BIT
# endif # endif

6
src/string_bytes.cc

@ -526,8 +526,7 @@ static bool contains_non_ascii(const char* src, size_t len) {
} }
#if defined(__x86_64__) || defined(_WIN64) || defined(__PPC64__) || \ #if defined(_WIN64) || defined(_LP64)
defined(_ARCH_PPC64)
const uintptr_t mask = 0x8080808080808080ll; const uintptr_t mask = 0x8080808080808080ll;
#else #else
const uintptr_t mask = 0x80808080l; const uintptr_t mask = 0x80808080l;
@ -582,8 +581,7 @@ static void force_ascii(const char* src, char* dst, size_t len) {
} }
} }
#if defined(__x86_64__) || defined(_WIN64) || defined(__PPC64__) || \ #if defined(_WIN64) || defined(_LP64)
defined(_ARCH_PPC64)
const uintptr_t mask = ~0x8080808080808080ll; const uintptr_t mask = ~0x8080808080808080ll;
#else #else
const uintptr_t mask = ~0x80808080l; const uintptr_t mask = ~0x80808080l;

Loading…
Cancel
Save