Skip to content

Commit c176768

Browse files
committed
win: Fix the build on Windows on ARM
* Avoid to build x86_64 intrinsics for ARM. * Use general Windows macro instead of x86_64 specific.
1 parent e7dedbf commit c176768

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ if( ${TARGET_OS} STREQUAL "Linux" )
3333
elseif( ${TARGET_OS} STREQUAL "Darwin" )
3434
set(OS "OSX")
3535
set(OSNAME "macOS")
36+
elseif( ${TARGET_OS} STREQUAL "Windows" )
37+
set(OS "WIN")
38+
set(OSNAME "Windows")
39+
add_definitions(-DWIN32 -DWIN64 -DWINNT -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
3640
else()
3741
message("Unsupported OS: ${TARGET_OS}" )
3842
return()

lib/scutil/host-fp-folding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <stdint.h>
2525
#include <stdlib.h>
2626
#include <string.h>
27-
#ifdef _WIN64
27+
#if defined(_WIN64) && !defined(_M_ARM64)
2828
#include <mmintrin.h>
2929
#endif
3030

runtime/flang/async.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Fio_asy_close - called from close
1818
*/
1919

20-
#if !defined(TARGET_WIN_X8664)
20+
#if !defined(TARGET_WIN)
2121
#include <unistd.h>
2222
#include <stdlib.h>
2323
#include <errno.h>
@@ -42,7 +42,7 @@ struct asy_transaction_data {
4242
seekoffx_t off;
4343
};
4444

45-
#if defined(TARGET_WIN_X8664)
45+
#if defined(TARGET_WIN)
4646
struct asy {
4747
FILE *fp;
4848
int fd;
@@ -82,7 +82,7 @@ static int slime;
8282

8383
/* internal wait for asynch i/o */
8484

85-
#if defined(TARGET_WIN_X8664)
85+
#if defined(TARGET_WIN)
8686
static int
8787
asy_wait(struct asy *asy)
8888
{
@@ -239,7 +239,7 @@ int
239239
Fio_asy_open(FILE *fp, struct asy **pasy)
240240
{
241241
struct asy *asy;
242-
#if defined(TARGET_WIN_X8664)
242+
#if defined(TARGET_WIN)
243243
HANDLE temp_handle;
244244
#endif
245245
asy = (struct asy *)calloc(sizeof(struct asy), 1);
@@ -249,7 +249,7 @@ Fio_asy_open(FILE *fp, struct asy **pasy)
249249
}
250250
asy->fp = fp;
251251
asy->fd = __io_getfd(fp);
252-
#if defined(TARGET_WIN_X8664)
252+
#if defined(TARGET_WIN)
253253
temp_handle = _get_osfhandle(asy->fd);
254254
asy->handle =
255255
ReOpenFile(temp_handle, GENERIC_READ | GENERIC_WRITE,
@@ -273,13 +273,13 @@ Fio_asy_read(struct asy *asy, void *adr, long len)
273273
int n;
274274
int tn;
275275

276-
#if defined(TARGET_WIN_X8664)
276+
#if defined(TARGET_WIN)
277277
union Converter converter;
278278
#endif
279279
if (slime)
280280
printf("--Fio_asy_read %d %p %ld\n", asy->fd, adr, len);
281281

282-
#if defined(TARGET_WIN_X8664)
282+
#if defined(TARGET_WIN)
283283
if (asy->flags & ASY_IOACT) { /* i/o active? */
284284
if (asy_wait(asy) == -1) { /* ..yes, wait */
285285
return (-1);
@@ -326,14 +326,14 @@ Fio_asy_write(struct asy *asy, void *adr, long len)
326326
{
327327
int n;
328328
int tn;
329-
#if defined(TARGET_WIN_X8664)
329+
#if defined(TARGET_WIN)
330330
union Converter converter;
331331
#endif
332332

333333
if (slime)
334334
printf("--Fio_asy_write %d %p %ld\n", asy->fd, adr, len);
335335

336-
#if defined(TARGET_WIN_X8664)
336+
#if defined(TARGET_WIN)
337337
if (asy->flags & ASY_IOACT) { /* i/o active? */
338338
if (asy_wait(asy) == -1) { /* ..yes, wait */
339339
return (-1);
@@ -394,7 +394,7 @@ Fio_asy_close(struct asy *asy)
394394
if (asy->flags & ASY_IOACT) { /* i/o active? */
395395
n = asy_wait(asy);
396396
}
397-
#if defined(TARGET_WIN_X8664)
397+
#if defined(TARGET_WIN)
398398
/* Close the Re-opened handle that we created. */
399399
CloseHandle(asy->handle);
400400
#endif

tools/flang2/flang2exe/upper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ gethexchar(FILE *file)
19671967
return val;
19681968
} /* gethexchar */
19691969

1970-
#if defined(TARGET_WIN_X86) && defined(PGFTN)
1970+
#if defined(TARGET_WIN) && defined(PGFTN)
19711971
/*
19721972
* convert to upper case
19731973
*/

0 commit comments

Comments
 (0)