Skip to content

Commit 374b477

Browse files
committed
[rebase this later] Try to compile on windows as well
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 50043de commit 374b477

File tree

21 files changed

+34
-152
lines changed

21 files changed

+34
-152
lines changed

src/hyperlight_guest/build.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,7 @@ fn cargo_main() {
7777
feature = "libc",
7878
feature = "alloca"
7979
)) {
80-
if is_pe {
81-
cfg.define("hidden", "");
82-
cfg.define("weak_alias(old, new) ", " ");
83-
cfg.define("__DEFINED_va_list", None);
84-
cfg.define("__DEFINED___isoc_va_list", None);
85-
}
86-
cfg.define("__x86_64__", None);
87-
cfg.define("__LITTLE_ENDIAN__", None);
88-
cfg.define("HYPERLIGHT", None);
80+
cfg.define("HYPERLIGHT", None); // used in certain musl files for conditional compilation
8981

9082
// silence compiler warnings
9183
cfg.flag("-Wno-unused-command-line-argument") // including .s files makes clang believe arguments are unused
@@ -99,6 +91,8 @@ fn cargo_main() {
9991
.flag("-Wno-string-plus-int");
10092

10193
if is_pe {
94+
cfg.flag("-Wno-unused-label");
95+
cfg.flag("-Wno-unused-variable");
10296
cfg.compiler("clang-cl");
10397
} else {
10498
cfg.flag("-fPIC");

src/hyperlight_guest/third_party/libc/musl/arch/x86_64/bits/alltypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
#ifndef __cplusplus
1717
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
18+
#ifdef _MSC_VER
19+
typedef unsigned short wchar_t;
20+
#else
1821
typedef int wchar_t;
22+
#endif
1923
#define __DEFINED_wchar_t
2024
#endif
2125

src/hyperlight_guest/third_party/libc/musl/arch/x86_64/bits/float.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
#define FLT_EVAL_METHOD 0
55
#endif
66

7+
#ifdef _MSC_VER
8+
#define LDBL_TRUE_MIN 4.9406564584124654e-324
9+
#define LDBL_MIN 2.2250738585072014e-308
10+
#define LDBL_MAX 1.7976931348623158e+308
11+
#define LDBL_EPSILON 2.2204460492503131e-016
12+
13+
#define LDBL_MANT_DIG 53
14+
#define LDBL_MIN_EXP (-1021)
15+
#define LDBL_MAX_EXP 1024
16+
17+
#define LDBL_DIG 15
18+
#define LDBL_MIN_10_EXP (-307)
19+
#define LDBL_MAX_10_EXP308
20+
21+
#define DECIMAL_DIG 17
22+
#else
723
#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
824
#define LDBL_MIN 3.3621031431120935063e-4932L
925
#define LDBL_MAX 1.1897314953572317650e+4932L
@@ -18,3 +34,4 @@
1834
#define LDBL_MAX_10_EXP 4932
1935

2036
#define DECIMAL_DIG 21
37+
#endif

src/hyperlight_guest/third_party/libc/musl/include/math.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern "C" {
1111
#define __NEED_double_t
1212
#include <bits/alltypes.h>
1313

14-
#if 100*__GNUC__+__GNUC_MINOR__ >= 303
14+
#if 100*__GNUC__+__GNUC_MINOR__ >= 303 || defined (HYPERLIGHT)
1515
#define NAN __builtin_nanf("")
1616
#define INFINITY __builtin_inff()
1717
#else

src/hyperlight_guest/third_party/libc/musl/src/fenv/x86_64/fenv.s

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.global feclearexcept
2-
.type feclearexcept,@function
32
feclearexcept:
43
# maintain exceptions in the sse mxcsr, clear x87 exceptions
54
mov %edi,%ecx
@@ -20,7 +19,6 @@ feclearexcept:
2019
ret
2120

2221
.global feraiseexcept
23-
.type feraiseexcept,@function
2422
feraiseexcept:
2523
and $0x3f,%edi
2624
stmxcsr -8(%rsp)
@@ -30,8 +28,6 @@ feraiseexcept:
3028
ret
3129

3230
.global __fesetround
33-
.hidden __fesetround
34-
.type __fesetround,@function
3531
__fesetround:
3632
push %rax
3733
xor %eax,%eax
@@ -49,7 +45,6 @@ __fesetround:
4945
ret
5046

5147
.global fegetround
52-
.type fegetround,@function
5348
fegetround:
5449
push %rax
5550
stmxcsr (%rsp)
@@ -59,15 +54,13 @@ fegetround:
5954
ret
6055

6156
.global fegetenv
62-
.type fegetenv,@function
6357
fegetenv:
6458
xor %eax,%eax
6559
fnstenv (%rdi)
6660
stmxcsr 28(%rdi)
6761
ret
6862

6963
.global fesetenv
70-
.type fesetenv,@function
7164
fesetenv:
7265
xor %eax,%eax
7366
inc %rdi
@@ -86,7 +79,6 @@ fesetenv:
8679
ret
8780

8881
.global fetestexcept
89-
.type fetestexcept,@function
9082
fetestexcept:
9183
and $0x3f,%edi
9284
push %rax

src/hyperlight_guest/third_party/libc/musl/src/include/features.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33

44
#include "../../include/features.h"
55

6-
#ifndef _MSC_VER
76
#define weak __attribute__((__weak__))
87
#define hidden __attribute__((__visibility__("hidden")))
9-
108
#define weak_alias(old, new) \
119
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
12-
#endif
1310

1411
#endif

src/hyperlight_guest/third_party/libc/musl/src/internal/stdio_impl.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
#define _STDIO_IMPL_H
33

44
#include <stdio.h>
5+
#ifndef HYPERLIGHT
56
#include "syscall.h"
67

78
#define UNGET 8
89

910
#define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
1011
#define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
1112
#define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
13+
#endif // HYPERLIGHT
1214

1315
#define F_PERM 1
1416
#define F_NORD 4
@@ -47,6 +49,11 @@ struct _IO_FILE {
4749
struct __locale_struct *locale;
4850
};
4951

52+
hidden int __toread(FILE *);
53+
hidden int __towrite(FILE *);
54+
int __uflow(FILE *);
55+
56+
#ifndef HYPERLIGHT
5057
extern hidden FILE *volatile __stdin_used;
5158
extern hidden FILE *volatile __stdout_used;
5259
extern hidden FILE *volatile __stderr_used;
@@ -60,16 +67,13 @@ hidden size_t __stdout_write(FILE *, const unsigned char *, size_t);
6067
hidden off_t __stdio_seek(FILE *, off_t, int);
6168
hidden int __stdio_close(FILE *);
6269

63-
hidden int __toread(FILE *);
64-
hidden int __towrite(FILE *);
65-
6670
hidden void __stdio_exit(void);
6771
hidden void __stdio_exit_needed(void);
6872

6973
#if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
7074
__attribute__((visibility("protected")))
7175
#endif
72-
int __overflow(FILE *, int), __uflow(FILE *);
76+
int __overflow(FILE *, int);
7377

7478
hidden int __fseeko(FILE *, off_t, int);
7579
hidden int __fseeko_unlocked(FILE *, off_t, int);
@@ -110,3 +114,4 @@ hidden FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t);
110114
hidden int __fclose_ca(FILE *);
111115

112116
#endif
117+
#endif

src/hyperlight_guest/third_party/libc/musl/src/math/x86_64/acosl.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# see ../i386/acos.s
22

33
.global acosl
4-
.type acosl,@function
54
acosl:
65
fldt 8(%rsp)
76
1: fld %st(0)

src/hyperlight_guest/third_party/libc/musl/src/math/x86_64/asinl.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.global asinl
2-
.type asinl,@function
32
asinl:
43
fldt 8(%rsp)
54
1: fld %st(0)

src/hyperlight_guest/third_party/libc/musl/src/math/x86_64/atan2l.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.global atan2l
2-
.type atan2l,@function
32
atan2l:
43
fldt 8(%rsp)
54
fldt 24(%rsp)

0 commit comments

Comments
 (0)