Skip to content

Commit a08f8e2

Browse files
committed
build: add x32 support
This commit adds preliminary x32 support. Configure with: $ ./configure --dest-cpu=x32 PR-URL: node-forward/node#24 Reviewed-By: Fedor Indutny <[email protected]>
1 parent 7af8870 commit a08f8e2

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

common.gypi

+4
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@
185185
'cflags': [ '-m32' ],
186186
'ldflags': [ '-m32' ],
187187
}],
188+
[ 'target_arch=="x32"', {
189+
'cflags': [ '-mx32' ],
190+
'ldflags': [ '-mx32' ],
191+
}],
188192
[ 'target_arch=="x64"', {
189193
'cflags': [ '-m64' ],
190194
'ldflags': [ '-m64' ],

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ parser.add_option('--debug',
3131
parser.add_option('--dest-cpu',
3232
action='store',
3333
dest='dest_cpu',
34-
help='CPU architecture to build for. Valid values are: arm, ia32, x64')
34+
help='CPU architecture to build for. Valid values are: arm, ia32, x32, x64')
3535

3636
parser.add_option('--dest-os',
3737
action='store',

deps/openssl/config/opensslconf.h

+8-17
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,8 @@
190190
* boundary. See crypto/rc4/rc4_enc.c for further details.
191191
*/
192192
# undef RC4_CHUNK
193-
# if (defined(_M_X64) || defined(__x86_64__)) && defined(_WIN32)
193+
# if defined(_M_X64) || defined(__x86_64__)
194194
# define RC4_CHUNK unsigned long long
195-
# elif (defined(_M_X64) || defined(__x86_64__)) && !defined(_WIN32)
196-
# define RC4_CHUNK unsigned long
197195
# elif defined(__arm__)
198196
# define RC4_CHUNK unsigned long
199197
# else
@@ -205,21 +203,12 @@
205203
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
206204
* %20 speed up (longs are 8 bytes, int's are 4). */
207205
# undef DES_LONG
208-
# if defined(_M_X64) || defined(__x86_64__) || defined(__arm__) || defined(__mips__)
209-
# define DES_LONG unsigned int
210-
# elif defined(_M_IX86) || defined(__i386__)
211-
# define DES_LONG unsigned long
212-
# endif
206+
# define DES_LONG unsigned int
213207
#endif
214208

215209
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
216210
# define CONFIG_HEADER_BN_H
217211

218-
# undef BL_LLONG
219-
# if defined(_M_IX86) || defined(__i386__) || defined(__arm__)
220-
# define BL_LLONG
221-
# endif
222-
223212
/* Should we define BN_DIV2W here? */
224213

225214
/* Only one for the following should be defined */
@@ -231,10 +220,12 @@
231220
# undef THIRTY_TWO_BIT
232221
# undef SIXTEEN_BIT
233222
# undef EIGHT_BIT
234-
# if (defined(_M_X64) || defined(__x86_64__)) && defined(_WIN32)
235-
# define SIXTY_FOUR_BIT
236-
# elif (defined(_M_X64) || defined(__x86_64__)) && !defined(_WIN32)
237-
# define SIXTY_FOUR_BIT_LONG
223+
# if defined(_M_X64) || defined(__x86_64__)
224+
# if defined(_WIN64) || defined(_LP64)
225+
# define SIXTY_FOUR_BIT_LONG
226+
# else
227+
# define SIXTY_FOUR_BIT
228+
# endif
238229
# elif defined(_M_IX86) || defined(__i386__) || defined(__arm__) || defined(__mips__)
239230
# define THIRTY_TWO_BIT
240231
# endif

src/string_bytes.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,7 @@ static bool contains_non_ascii(const char* src, size_t len) {
526526
}
527527

528528

529-
#if defined(__x86_64__) || defined(_WIN64) || defined(__PPC64__) || \
530-
defined(_ARCH_PPC64)
529+
#if defined(_WIN64) || defined(_LP64)
531530
const uintptr_t mask = 0x8080808080808080ll;
532531
#else
533532
const uintptr_t mask = 0x80808080l;
@@ -582,8 +581,7 @@ static void force_ascii(const char* src, char* dst, size_t len) {
582581
}
583582
}
584583

585-
#if defined(__x86_64__) || defined(_WIN64) || defined(__PPC64__) || \
586-
defined(_ARCH_PPC64)
584+
#if defined(_WIN64) || defined(_LP64)
587585
const uintptr_t mask = ~0x8080808080808080ll;
588586
#else
589587
const uintptr_t mask = ~0x80808080l;

0 commit comments

Comments
 (0)