Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/android-openjdk-build-multiarch
Path: blob/buildjre8/patches/jdk8u_ios.diff
861 views
1
diff --git a/common/autoconf/build-aux/config.sub b/common/autoconf/build-aux/config.sub
2
index a665b00f..eed57c77 100644
3
--- a/common/autoconf/build-aux/config.sub
4
+++ b/common/autoconf/build-aux/config.sub
5
@@ -35,7 +35,8 @@ if echo $* | grep linux-musl >/dev/null ; then
6
fi
7
8
# First, filter out everything that doesn't begin with "aarch64-"
9
-if ! echo $* | grep '^aarch64-' >/dev/null ; then
10
+# or the mobile platforms (ios and android)
11
+if ! echo $* | egrep "^aarch64-|-ios" >/dev/null ; then
12
. $DIR/autoconf-config.sub "$@"
13
# autoconf-config.sub exits, so we never reach here, but just in
14
# case we do:
15
@@ -43,9 +44,13 @@ if ! echo $* | grep '^aarch64-' >/dev/null ; then
16
fi
17
18
while test $# -gt 0 ; do
19
- case $1 in
20
+ case $1 in
21
-- ) # Stop option processing
22
shift; break ;;
23
+ *-ios* )
24
+ echo $1
25
+ exit
26
+ ;;
27
aarch64-* )
28
config=`echo $1 | sed 's/^aarch64-/arm-/'`
29
sub_args="$sub_args $config"
30
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
31
index e2e0c5a6..c5493ebe 100644
32
--- a/common/autoconf/flags.m4
33
+++ b/common/autoconf/flags.m4
34
@@ -729,8 +729,8 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
35
# The macro takes the version with no dots, ex: 1070
36
# Let the flags variables get resolved in make for easier override on make
37
# command line.
38
- CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
39
- LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
40
+ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
41
+ LDFLAGS_JDK="$LDFLAGS_JDK -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
42
elif test "x$TOOLCHAIN_TYPE" = xclang; then
43
# FIXME: This needs to be exported in spec.gmk due to closed legacy code.
44
# FIXME: clean this up, and/or move it elsewhere.
45
@@ -750,8 +750,8 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
46
# The macro takes the version with no dots, ex: 1070
47
# Let the flags variables get resolved in make for easier override on make
48
# command line.
49
- CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
50
- LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
51
+ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
52
+ LDFLAGS_JDK="$LDFLAGS_JDK -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
53
fi
54
fi
55
56
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
57
index a6973629..3365acaa 100644
58
--- a/common/autoconf/generated-configure.sh
59
+++ b/common/autoconf/generated-configure.sh
60
@@ -15651,7 +15651,7 @@ printf "%s\n" "$COMPILE_TYPE" >&6; }
61
OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
62
fi
63
elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then
64
- OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
65
+ OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
66
fi
67
68
69
@@ -15679,7 +15679,7 @@ printf "%s\n" "$COMPILE_TYPE" >&6; }
70
ADD_LP64="-D_LP64=1"
71
fi
72
elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then
73
- OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
74
+ OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
75
fi
76
LP64=$A_LP64
77
78
@@ -45706,8 +45706,8 @@ printf "%s\n" "$supports" >&6; }
79
# The macro takes the version with no dots, ex: 1070
80
# Let the flags variables get resolved in make for easier override on make
81
# command line.
82
- CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
83
- LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
84
+ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
85
+ LDFLAGS_JDK="$LDFLAGS_JDK -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
86
elif test "x$TOOLCHAIN_TYPE" = xclang; then
87
# FIXME: This needs to be exported in spec.gmk due to closed legacy code.
88
# FIXME: clean this up, and/or move it elsewhere.
89
@@ -45727,8 +45727,8 @@ printf "%s\n" "$supports" >&6; }
90
# The macro takes the version with no dots, ex: 1070
91
# Let the flags variables get resolved in make for easier override on make
92
# command line.
93
- CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
94
- LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
95
+ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
96
+ LDFLAGS_JDK="$LDFLAGS_JDK -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
97
fi
98
fi
99
100
diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4
101
index 2cf39678..cf8e880a 100644
102
--- a/common/autoconf/platform.m4
103
+++ b/common/autoconf/platform.m4
104
@@ -388,7 +388,7 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
105
OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
106
fi
107
elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then
108
- OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
109
+ OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
110
fi
111
AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
112
113
@@ -416,7 +416,7 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
114
ADD_LP64="-D_LP64=1"
115
fi
116
elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then
117
- OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
118
+ OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -miphoneos-version-min=\$(MACOSX_VERSION_MIN)"
119
fi
120
AC_SUBST(LP64,$A_LP64)
121
122
diff --git a/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c b/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
123
index 85b07f76..75bdc756 100644
124
--- a/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
125
+++ b/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
126
@@ -38,6 +38,10 @@
127
#include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h"
128
#endif
129
130
+#ifdef aarch64
131
+#include "sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext.h"
132
+#endif
133
+
134
#if defined(sparc) || defined(sparcv9)
135
#include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h"
136
#endif
137
@@ -304,6 +308,9 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_
138
#ifdef amd64
139
#define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG
140
#endif
141
+#ifdef aarch64
142
+#define NPRGREG sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_NPRGREG
143
+#endif
144
#if defined(sparc) || defined(sparcv9)
145
#define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG
146
#endif
147
@@ -407,6 +414,16 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_
148
regs[REG_INDEX(R_O7)] = gregs.u_regs[14];
149
#endif /* sparc */
150
151
+#if defined(aarch64)
152
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_##reg
153
+ {
154
+ int i;
155
+ for (i = 0; i < 31; i++)
156
+ regs[i] = gregs.x[i];
157
+ regs[REG_INDEX(SP)] = gregs.sp;
158
+ regs[REG_INDEX(PC)] = gregs.elr;
159
+ }
160
+#endif /* aarch64 */
161
162
(*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT);
163
return array;
164
diff --git a/hotspot/agent/src/os/bsd/Makefile b/hotspot/agent/src/os/bsd/Makefile
165
index af22b597..4de4565b 100644
166
--- a/hotspot/agent/src/os/bsd/Makefile
167
+++ b/hotspot/agent/src/os/bsd/Makefile
168
@@ -51,7 +51,7 @@ SOURCES = symtab.c \
169
OBJS = $(SOURCES:.c=.o)
170
OBJSPLUS = MacosxDebuggerLocal.o sadis.o $(OBJS)
171
EXTINCLUDE = -I.
172
-EXTCFLAGS = -m64 -D__APPLE__ -framework JavaNativeFoundation
173
+EXTCFLAGS = -m64 -D__APPLE__
174
FOUNDATIONFLAGS = -framework Foundation -framework JavaNativeFoundation -framework Security -framework CoreFoundation
175
LIBSA = $(ARCH)/libsaproc.dylib
176
endif # Darwin
177
@@ -70,7 +70,8 @@ MacosxDebuggerLocal.o: MacosxDebuggerLocal.m
178
echo "OS="$(OS)
179
$(JAVAH) -jni -classpath ../../../build/classes \
180
sun.jvm.hotspot.debugger.x86.X86ThreadContext \
181
- sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
182
+ sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext \
183
+ sun.jvm.hotspot.debugger.aarch64.AARCH64ThreadContext
184
$(GCC) $(CFLAGS) $(FOUNDATIONFLAGS) $<
185
186
sadis.o: ../../share/native/sadis.c
187
diff --git a/hotspot/agent/src/os/bsd/libproc_impl.h b/hotspot/agent/src/os/bsd/libproc_impl.h
188
index 0d3fd166..916a2fff 100644
189
--- a/hotspot/agent/src/os/bsd/libproc_impl.h
190
+++ b/hotspot/agent/src/os/bsd/libproc_impl.h
191
@@ -1,5 +1,6 @@
192
/*
193
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
194
+ * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
195
+ * Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
196
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
197
*
198
* This code is free software; you can redistribute it and/or modify it
199
@@ -30,6 +31,16 @@
200
#include "libproc.h"
201
#include "symtab.h"
202
203
+#define UNSUPPORTED_ARCH "Unsupported architecture!"
204
+
205
+#if defined(__x86_64__) && !defined(amd64)
206
+#define amd64 1
207
+#endif
208
+
209
+#if defined(__arm64__) && !defined(aarch64)
210
+#define aarch64 1
211
+#endif
212
+
213
#ifdef __APPLE__
214
#include <inttypes.h> // for PRIx64, 32, ...
215
#include <pthread.h>
216
diff --git a/hotspot/agent/src/os/bsd/ps_core.c b/hotspot/agent/src/os/bsd/ps_core.c
217
index 8fc6adb3..8b5369a8 100644
218
--- a/hotspot/agent/src/os/bsd/ps_core.c
219
+++ b/hotspot/agent/src/os/bsd/ps_core.c
220
@@ -22,6 +22,7 @@
221
*
222
*/
223
224
+#include <inttypes.h> // for PRIx64, 32, ...
225
#include <jni.h>
226
#include <unistd.h>
227
#include <fcntl.h>
228
@@ -1160,6 +1161,42 @@ static bool core_handle_prstatus(struct ps_prochandle* ph, const char* buf, size
229
//print_debug("\tfs = 0x%lx\n", newthr->regs.fs);
230
//print_debug("\tgs = 0x%lx\n", newthr->regs.gs);
231
#endif
232
+
233
+#ifdef aarch64
234
+ print_debug("\tr0 = 0x%lx\n", newthr->regs.r_r0);
235
+ print_debug("\tr1 = 0x%lx\n", newthr->regs.r_r1);
236
+ print_debug("\tr2 = 0x%lx\n", newthr->regs.r_r2);
237
+ print_debug("\tr3 = 0x%lx\n", newthr->regs.r_r3);
238
+ print_debug("\tr4 = 0x%lx\n", newthr->regs.r_r4);
239
+ print_debug("\tr5 = 0x%lx\n", newthr->regs.r_r5);
240
+ print_debug("\tr6 = 0x%lx\n", newthr->regs.r_r6);
241
+ print_debug("\tr7 = 0x%lx\n", newthr->regs.r_r7);
242
+ print_debug("\tr8 = 0x%lx\n", newthr->regs.r_r8);
243
+ print_debug("\tr9 = 0x%lx\n", newthr->regs.r_r9);
244
+ print_debug("\tr10 = 0x%lx\n", newthr->regs.r_r10);
245
+ print_debug("\tr11 = 0x%lx\n", newthr->regs.r_r11);
246
+ print_debug("\tr12 = 0x%lx\n", newthr->regs.r_r12);
247
+ print_debug("\tr13 = 0x%lx\n", newthr->regs.r_r13);
248
+ print_debug("\tr14 = 0x%lx\n", newthr->regs.r_r14);
249
+ print_debug("\tr15 = 0x%lx\n", newthr->regs.r_r15);
250
+ print_debug("\tr16 = 0x%lx\n", newthr->regs.r_r16);
251
+ print_debug("\tr17 = 0x%lx\n", newthr->regs.r_r17);
252
+ print_debug("\tr18 = 0x%lx\n", newthr->regs.r_r18);
253
+ print_debug("\tr19 = 0x%lx\n", newthr->regs.r_r19);
254
+ print_debug("\tr20 = 0x%lx\n", newthr->regs.r_r20);
255
+ print_debug("\tr21 = 0x%lx\n", newthr->regs.r_r21);
256
+ print_debug("\tr22 = 0x%lx\n", newthr->regs.r_r22);
257
+ print_debug("\tr23 = 0x%lx\n", newthr->regs.r_r23);
258
+ print_debug("\tr24 = 0x%lx\n", newthr->regs.r_r24);
259
+ print_debug("\tr25 = 0x%lx\n", newthr->regs.r_r25);
260
+ print_debug("\tr26 = 0x%lx\n", newthr->regs.r_r26);
261
+ print_debug("\tr27 = 0x%lx\n", newthr->regs.r_r27);
262
+ print_debug("\tr28 = 0x%lx\n", newthr->regs.r_r28);
263
+ print_debug("\tfp = 0x%lx\n", newthr->regs.r_fp);
264
+ print_debug("\tlr = 0x%lx\n", newthr->regs.r_lr);
265
+ print_debug("\tsp = 0x%lx\n", newthr->regs.r_sp);
266
+ print_debug("\tpc = 0x%lx\n", newthr->regs.r_pc);
267
+#endif
268
}
269
270
return true;
271
diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make
272
index b45dd47a..fd94ee45 100644
273
--- a/hotspot/make/bsd/makefiles/gcc.make
274
+++ b/hotspot/make/bsd/makefiles/gcc.make
275
@@ -248,7 +248,8 @@ endif
276
277
# Compiler warnings are treated as errors
278
ifneq ($(COMPILER_WARNINGS_FATAL),false)
279
- WARNINGS_ARE_ERRORS = -Werror
280
+ # WARNINGS_ARE_ERRORS = -Werror
281
+ WARNINGS_ARE_ERRORS = -Werror=implicit-function-declaration
282
endif
283
284
ifeq ($(USE_CLANG), true)
285
@@ -318,7 +319,7 @@ ifeq ($(USE_CLANG), true)
286
# Known to fail with clang <= 7.0;
287
# do no optimize these on later clang until verified
288
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
289
- OPT_CFLAGS/unsafe.o += -O1
290
+ OPT_CFLAGS/unsafe.o += $(OPT_CFLAGS/NOOPT)
291
else
292
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
293
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
294
@@ -348,10 +349,17 @@ ifeq ($(OS_VENDOR), Darwin)
295
MACOSX_VERSION_MIN=10.7.0
296
endif
297
# The macro takes the version with no dots, ex: 1070
298
- CFLAGS += -DMAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(MACOSX_VERSION_MIN)) \
299
+ CFLAGS_TMP = -DMAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(MACOSX_VERSION_MIN)) \
300
-DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \
301
- -mmacosx-version-min=$(MACOSX_VERSION_MIN)
302
- LFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
303
+ -miphoneos-version-min=$(MACOSX_VERSION_MIN)
304
+ LFLAGS_TMP = -miphoneos-version-min=$(MACOSX_VERSION_MIN)
305
+ ifdef CROSS_COMPILE_ARCH
306
+ HOSTCC += $(CFLAGS_TMP)
307
+ HOSTCXX += $(CFLAGS_TMP)
308
+ else
309
+ CFLAGS += $(CFLAGS_TMP)
310
+ LFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
311
+ endif
312
endif
313
314
315
diff --git a/hotspot/make/bsd/makefiles/rules.make b/hotspot/make/bsd/makefiles/rules.make
316
index 31c2e094..dfb1b228 100644
317
--- a/hotspot/make/bsd/makefiles/rules.make
318
+++ b/hotspot/make/bsd/makefiles/rules.make
319
@@ -52,6 +52,8 @@ PREPROCESS.CXX = $(CXX_COMPILE) -E
320
# cross compiling the jvm with c2 requires host compilers to build
321
# adlc tool
322
323
+# iOS build hack
324
+HOSTCXX := ${thehostcxx}
325
HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS)
326
HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c
327
HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS)
328
diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make
329
index 5c837895..284cb2eb 100644
330
--- a/hotspot/make/bsd/makefiles/saproc.make
331
+++ b/hotspot/make/bsd/makefiles/saproc.make
332
@@ -66,7 +66,6 @@ else
333
SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES)
334
SALIBS = -g \
335
-framework Foundation \
336
- -framework JavaNativeFoundation \
337
-framework Security \
338
-framework CoreFoundation
339
#objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
340
diff --git a/hotspot/src/cpu/aarch64/vm/icache_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/icache_aarch64.hpp
341
index 9479eaea..249915d8 100644
342
--- a/hotspot/src/cpu/aarch64/vm/icache_aarch64.hpp
343
+++ b/hotspot/src/cpu/aarch64/vm/icache_aarch64.hpp
344
@@ -27,6 +27,13 @@
345
#ifndef CPU_AARCH64_VM_ICACHE_AARCH64_HPP
346
#define CPU_AARCH64_VM_ICACHE_AARCH64_HPP
347
348
+#ifdef __APPLE__
349
+#include <libkern/OSCacheControl.h>
350
+
351
+#define __clear_cache(start, end) \
352
+ sys_icache_invalidate(start, (char*)end - (char*)start);
353
+#endif
354
+
355
// Interface for updating the instruction cache. Whenever the VM
356
// modifies code, part of the processor instruction cache potentially
357
// has to be flushed.
358
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
359
index bc8fccbd..522ea6a4 100644
360
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
361
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
362
@@ -952,6 +952,14 @@ extern "C" Thread* get_thread() {
363
return ThreadLocalStorage::thread();
364
}
365
366
+//////////////////////////////////////////////////////////////////////////////
367
+// primordial thread
368
+
369
+// Check if current thread is the primordial thread, similar to Solaris thr_main.
370
+bool os::is_primordial_thread(void) {
371
+ return pthread_main_np();
372
+}
373
+
374
375
////////////////////////////////////////////////////////////////////////////////
376
// time support
377
@@ -2208,7 +2216,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
378
// left at the time of mmap(). This could be a potential
379
// problem.
380
bool os::pd_commit_memory(char* addr, size_t size, bool exec) {
381
- int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
382
+ int prot = /* exec ? PROT_READ|PROT_WRITE|PROT_EXEC : */ PROT_READ|PROT_WRITE;
383
#if defined( __OpenBSD__)
384
// XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD
385
if (::mprotect(addr, size, prot) == 0) {
386
@@ -2341,12 +2349,14 @@ static char* anon_mmap(char* requested_addr, size_t bytes, bool fixed, bool exec
387
int flags;
388
389
flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS;
390
+/*
391
#ifdef __APPLE__
392
if (executable) {
393
guarantee(!fixed, "MAP_JIT (for execute) is incompatible with MAP_FIXED");
394
flags |= MAP_JIT;
395
}
396
#endif
397
+*/
398
if (fixed) {
399
assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address");
400
flags |= MAP_FIXED;
401
@@ -2413,6 +2423,7 @@ bool os::protect_memory(char* addr, size_t bytes, ProtType prot,
402
case MEM_PROT_READ: p = PROT_READ; break;
403
case MEM_PROT_RW: p = PROT_READ|PROT_WRITE; break;
404
case MEM_PROT_RWX: p = PROT_READ|PROT_WRITE|PROT_EXEC; break;
405
+ case MEM_PROT_RX: p = PROT_READ|PROT_EXEC; break;
406
default:
407
ShouldNotReachHere();
408
}
409
diff --git a/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.cpp b/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.cpp
410
index 25919960..2b221c63 100644
411
--- a/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.cpp
412
+++ b/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.cpp
413
@@ -211,6 +211,30 @@ JVM_handle_bsd_signal(int sig,
414
int abort_if_unrecognized) {
415
ucontext_t* uc = (ucontext_t*) ucVoid;
416
417
+ if (sig == SIGBUS) {
418
+ address addr = os::Bsd::ucontext_get_pc(uc);
419
+ //address addr = (address) info->si_addr;
420
+ //if (addr >= os::GLOBAL_CODE_CACHE_ADDR && addr < os::GLOBAL_CODE_CACHE_ADDR + 0x270000) {
421
+ // return !mprotect(os::GLOBAL_CODE_CACHE_ADDR, 0x270000, PROT_READ | PROT_EXEC);
422
+ //} else if (addr >= os::GLOBAL_CODE_CACHE_ADDR + 0x270000 && addr < os::GLOBAL_CODE_CACHE_ADDR + 0x270000*2) {
423
+ // return !mprotect(os::GLOBAL_CODE_CACHE_ADDR + 0x270000, 0x270000, PROT_READ | PROT_EXEC);
424
+ if (addr >= os::GLOBAL_CODE_CACHE_ADDR && addr < os::GLOBAL_CODE_CACHE_ADDR + os::GLOBAL_CODE_CACHE_SIZE && addr == info->si_addr) {
425
+ return !mprotect((address) ((uintptr_t)addr & -PAGE_SIZE), PAGE_SIZE, PROT_READ | PROT_EXEC);
426
+ } else { // if (t->is_Compiler_thread() || t->is_VM_thread()) {
427
+ return !mprotect((address) ((uintptr_t)info->si_addr & -PAGE_SIZE), PAGE_SIZE, PROT_READ | PROT_WRITE);
428
+ }
429
+ }
430
+/*
431
+ if (addr >= os::GLOBAL_CODE_CACHE_ADDR - os::GLOBAL_CODE_CACHE_DIFF && addr < os::GLOBAL_CODE_CACHE_ADDR) {
432
+ uc->context_pc = (uint64_t)addr + os::GLOBAL_CODE_CACHE_DIFF;
433
+ return 1;
434
+ } else if (addr >= os::GLOBAL_CODE_CACHE_ADDR && addr < os::GLOBAL_CODE_CACHE_ADDR + os::GLOBAL_CODE_CACHE_DIFF) {
435
+ // try again
436
+ uc->context_pc = (uint64_t)addr - os::GLOBAL_CODE_CACHE_DIFF;
437
+ return 1;
438
+ }
439
+*/
440
+
441
Thread* t = ThreadLocalStorage::get_thread_slow();
442
443
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
444
diff --git a/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.hpp b/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.hpp
445
index 49b579d5..1344de99 100644
446
--- a/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.hpp
447
+++ b/hotspot/src/os_cpu/bsd_aarch64/vm/os_bsd_aarch64.hpp
448
@@ -26,6 +26,11 @@
449
#ifndef OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP
450
#define OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP
451
452
+#include <sys/mman.h>
453
+#include "tcg-apple-jit.h"
454
+
455
+ //extern "C" int mprotect(void *addr, size_t len, int prot);
456
+
457
static void setup_fpu();
458
459
static bool is_allocatable(size_t bytes);
460
@@ -42,10 +47,18 @@
461
private:
462
463
static void current_thread_enable_wx_impl(WXMode mode) {
464
-#pragma clang diagnostic push
465
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
466
- pthread_jit_write_protect_np(mode == WXExec ? true : false);
467
-#pragma clang diagnostic pop
468
+// #pragma clang diagnostic push
469
+// #pragma clang diagnostic ignored "-Wunguarded-availability-new"
470
+ // pthread_jit_write_protect_np(mode == WXExec ? true : false);
471
+ // jit_write_protect(mode == WXExec);
472
+/*
473
+ if (mode == WXExec) {
474
+ mprotect(os::GLOBAL_CODE_CACHE_ADDR, os::GLOBAL_CODE_CACHE_SIZE, PROT_READ | PROT_EXEC);
475
+ } else {
476
+ mprotect(os::GLOBAL_CODE_CACHE_ADDR, os::GLOBAL_CODE_CACHE_SIZE, PROT_READ | PROT_WRITE);
477
+ }
478
+*/
479
+// #pragma clang diagnostic pop
480
}
481
482
public:
483
diff --git a/hotspot/src/os_cpu/bsd_aarch64/vm/tcg-apple-jit.h b/hotspot/src/os_cpu/bsd_aarch64/vm/tcg-apple-jit.h
484
new file mode 100644
485
index 00000000..e8227412
486
--- /dev/null
487
+++ b/hotspot/src/os_cpu/bsd_aarch64/vm/tcg-apple-jit.h
488
@@ -0,0 +1,85 @@
489
+/*
490
+ * Apple Silicon APRR functions for JIT handling
491
+ *
492
+ * Copyright (c) 2020 osy
493
+ *
494
+ * This library is free software; you can redistribute it and/or
495
+ * modify it under the terms of the GNU Lesser General Public
496
+ * License as published by the Free Software Foundation; either
497
+ * version 2.1 of the License, or (at your option) any later version.
498
+ *
499
+ * This library is distributed in the hope that it will be useful,
500
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
501
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
502
+ * Lesser General Public License for more details.
503
+ *
504
+ * You should have received a copy of the GNU Lesser General Public
505
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
506
+ */
507
+
508
+/*
509
+ * Credits to: https://siguza.github.io/APRR/
510
+ * Reversed from /usr/lib/system/libsystem_pthread.dylib
511
+ */
512
+
513
+#ifndef TCG_APPLE_JIT_H
514
+#define TCG_APPLE_JIT_H
515
+
516
+#if defined(__aarch64__) && defined(__APPLE__)
517
+
518
+#define _COMM_PAGE_START_ADDRESS (0x0000000FFFFFC000ULL) /* In TTBR0 */
519
+#define _COMM_PAGE_APRR_SUPPORT (_COMM_PAGE_START_ADDRESS + 0x10C)
520
+#define _COMM_PAGE_APPR_WRITE_ENABLE (_COMM_PAGE_START_ADDRESS + 0x110)
521
+#define _COMM_PAGE_APRR_WRITE_DISABLE (_COMM_PAGE_START_ADDRESS + 0x118)
522
+
523
+static __attribute__((__always_inline__)) bool jit_write_protect_supported(void)
524
+{
525
+ /* Access shared kernel page at fixed memory location. */
526
+ uint8_t aprr_support = *(volatile uint8_t *)_COMM_PAGE_APRR_SUPPORT;
527
+ return aprr_support > 0;
528
+}
529
+
530
+/* write protect enable = write disable */
531
+static __attribute__((__always_inline__)) void jit_write_protect(int enabled)
532
+{
533
+ /* Access shared kernel page at fixed memory location. */
534
+ uint8_t aprr_support = *(volatile uint8_t *)_COMM_PAGE_APRR_SUPPORT;
535
+ if (aprr_support == 0 || aprr_support > 3) {
536
+ return;
537
+ } else if (aprr_support == 1) {
538
+ __asm__ __volatile__ (
539
+ "mov x0, %0\n"
540
+ "ldr x0, [x0]\n"
541
+ "msr S3_4_c15_c2_7, x0\n"
542
+ "isb sy\n"
543
+ :: "r" (enabled ? _COMM_PAGE_APRR_WRITE_DISABLE
544
+ : _COMM_PAGE_APPR_WRITE_ENABLE)
545
+ : "memory", "x0"
546
+ );
547
+ } else {
548
+ __asm__ __volatile__ (
549
+ "mov x0, %0\n"
550
+ "ldr x0, [x0]\n"
551
+ "msr S3_6_c15_c1_5, x0\n"
552
+ "isb sy\n"
553
+ :: "r" (enabled ? _COMM_PAGE_APRR_WRITE_DISABLE
554
+ : _COMM_PAGE_APPR_WRITE_ENABLE)
555
+ : "memory", "x0"
556
+ );
557
+ }
558
+}
559
+
560
+#else /* defined(__aarch64__) && defined(__APPLE__) */
561
+
562
+static __attribute__((__always_inline__)) bool jit_write_protect_supported(void)
563
+{
564
+ return false;
565
+}
566
+
567
+static __attribute__((__always_inline__)) void jit_write_protect(int enabled)
568
+{
569
+}
570
+
571
+#endif
572
+
573
+#endif /* define TCG_APPLE_JIT_H */
574
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
575
index 36d00f9e..76042100 100644
576
--- a/hotspot/src/share/vm/runtime/os.cpp
577
+++ b/hotspot/src/share/vm/runtime/os.cpp
578
@@ -80,6 +80,9 @@ long os::_rand_seed = 1;
579
int os::_processor_count = 0;
580
int os::_initial_active_processor_count = 0;
581
size_t os::_page_sizes[os::page_sizes_max];
582
+address os::GLOBAL_CODE_CACHE_ADDR = NULL;
583
+uintptr_t os::GLOBAL_CODE_CACHE_DIFF = 0;
584
+uint32_t os::GLOBAL_CODE_CACHE_SIZE = 0;
585
586
#ifndef PRODUCT
587
julong os::num_mallocs = 0; // # of calls to malloc/realloc
588
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
589
index a2bb8804..2b49abb5 100644
590
--- a/hotspot/src/share/vm/runtime/os.hpp
591
+++ b/hotspot/src/share/vm/runtime/os.hpp
592
@@ -50,6 +50,7 @@
593
# include <setjmp.h>
594
# ifdef __APPLE__
595
# include <mach/mach_time.h>
596
+# include <sys/mman.h>
597
# endif
598
#endif
599
600
@@ -346,7 +347,7 @@ class os: AllStatic {
601
// are passed.
602
static void pretouch_memory(char* start, char* end);
603
604
- enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
605
+ enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX, MEM_PROT_RX };
606
static bool protect_memory(char* addr, size_t bytes, ProtType prot,
607
bool is_committed = true);
608
609
@@ -475,7 +476,7 @@ class os: AllStatic {
610
// need special-case handling of the primordial thread if it attaches
611
// to the VM.
612
static bool is_primordial_thread(void)
613
-#if defined(_WINDOWS) || defined(BSD)
614
+#if defined(_WINDOWS) //|| defined(BSD)
615
// No way to identify the primordial thread.
616
{ return false; }
617
#else
618
@@ -959,6 +960,9 @@ class os: AllStatic {
619
bool _done;
620
};
621
622
+ static address GLOBAL_CODE_CACHE_ADDR;
623
+ static uintptr_t GLOBAL_CODE_CACHE_DIFF;
624
+ static uint32_t GLOBAL_CODE_CACHE_SIZE;
625
// If the JVM is running in W^X mode, enable write or execute access to
626
// writeable and executable pages. No-op otherwise.
627
static inline void current_thread_enable_wx(WXMode mode) {
628
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
629
index 746f6eac..222a664f 100644
630
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
631
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
632
@@ -278,7 +278,7 @@ class StubRoutines: AllStatic {
633
TRAPS
634
);
635
636
- static CallStub call_stub() { return CAST_TO_FN_PTR(CallStub, _call_stub_entry); }
637
+ static CallStub call_stub() { return CAST_TO_FN_PTR(CallStub, _call_stub_entry + os::GLOBAL_CODE_CACHE_DIFF); }
638
639
// Exceptions
640
static address forward_exception_entry() { return _forward_exception_entry; }
641
diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp
642
index 7f12ce6b..88c0d693 100644
643
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp
644
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp
645
@@ -41,6 +41,19 @@
646
#endif
647
#ifdef TARGET_OS_FAMILY_bsd
648
# include "os_bsd.inline.hpp"
649
+# include "os_bsd.hpp"
650
+# include <mach/mach.h>
651
+extern "C" kern_return_t mach_vm_remap(vm_map_t target_task,
652
+ mach_vm_address_t *target_address,
653
+ mach_vm_size_t size,
654
+ mach_vm_offset_t mask,
655
+ int flags,
656
+ vm_map_t src_task,
657
+ mach_vm_address_t src_address,
658
+ boolean_t copy,
659
+ vm_prot_t *cur_protection,
660
+ vm_prot_t *max_protection,
661
+ vm_inherit_t inheritance);
662
#endif
663
664
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
665
@@ -357,6 +370,14 @@ ReservedCodeSpace::ReservedCodeSpace(size_t r_size,
666
size_t rs_align,
667
bool large) :
668
ReservedSpace(r_size, rs_align, large, /*executable*/ true) {
669
+
670
+ os::GLOBAL_CODE_CACHE_ADDR = (address)base();
671
+ os::GLOBAL_CODE_CACHE_SIZE = r_size;
672
+
673
+ if (!os::protect_memory(base(), r_size, os::MEM_PROT_RW)) {
674
+ fatal("cannot protect protection page for jit (rw)");
675
+ }
676
+
677
MemTracker::record_virtual_memory_type((address)base(), mtCode);
678
}
679
680
diff --git a/jdk/make/CompileLaunchers.gmk b/jdk/make/CompileLaunchers.gmk
681
index 61973b3b..b2e80582 100644
682
--- a/jdk/make/CompileLaunchers.gmk
683
+++ b/jdk/make/CompileLaunchers.gmk
684
@@ -99,7 +99,7 @@ define SetupLauncher
685
endif
686
687
$1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
688
- -framework Cocoa -framework Security -framework ApplicationServices \
689
+ -framework Foundation -framework Security \
690
-sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
691
$1_LDFLAGS_SUFFIX += -pthread
692
endif
693
@@ -250,8 +250,10 @@ BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
694
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
695
ifneq ($(POST_STRIP_CMD), )
696
ifneq ($(STRIP_POLICY), no_strip)
697
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # Darwin does not support?
698
BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(DEBUGINFO_EXT)
699
endif
700
+ endif
701
endif
702
endif
703
704
@@ -571,8 +573,10 @@ BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
705
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
706
ifneq ($(POST_STRIP_CMD), )
707
ifneq ($(STRIP_POLICY), no_strip)
708
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # Darwin does not support?
709
BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(DEBUGINFO_EXT)
710
endif
711
+ endif
712
endif
713
endif
714
715
diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk
716
index a132f617..eeafc003 100644
717
--- a/jdk/make/CopyFiles.gmk
718
+++ b/jdk/make/CopyFiles.gmk
719
@@ -338,9 +338,15 @@ else
720
ifeq ($(CLIENT_AND_SERVER), true)
721
COPY_JVM_CFG_FILE := true
722
else
723
- # For zero, the default jvm.cfg file is sufficient
724
+ # For zero, the default jvm.cfg file is sufficient.
725
ifeq ($(JVM_VARIANT_ZERO), true)
726
COPY_JVM_CFG_FILE := true
727
+ else
728
+ ifeq ($(OPENJDK_TARGET_CPU), aarch32)
729
+ ifeq ($(JVM_VARIANT_CORE), true)
730
+ COPY_JVM_CFG_FILE := true
731
+ endif
732
+ endif
733
endif
734
endif
735
endif
736
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
737
index 01e03690..097ac9f0 100644
738
--- a/jdk/make/lib/Awt2dLibraries.gmk
739
+++ b/jdk/make/lib/Awt2dLibraries.gmk
740
@@ -23,6 +23,8 @@
741
# questions.
742
#
743
744
+X_LIBS :=
745
+
746
WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
747
748
##########################################################################################
749
@@ -223,7 +225,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
750
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
751
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
752
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
753
-else ifneq ($(OPENJDK_TARGET_OS), macosx)
754
+else ifneq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
755
LIBAWT_DIRS += \
756
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
757
endif
758
@@ -477,7 +479,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
759
LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
760
LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
761
LDFLAGS_SUFFIX_aix :=-ljvm $(LIBM) $(LIBDL) -ljava -lm,\
762
- LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
763
+ LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm -ljava $(LIBM), \
764
+ LDFLAGS_SUFFIX_macosx_NOTIOS := -lmlib_image -ljvm $(LIBM) \
765
-framework Cocoa \
766
-framework OpenGL \
767
-framework JavaNativeFoundation \
768
@@ -558,7 +561,8 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
769
LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
770
endif
771
772
- LIBAWT_XAWT_FILES := \
773
+ LIBAWT_XAWT_FILES := list.c
774
+ LIBAWT_XAWT_FILES_Z := \
775
XlibWrapper.c \
776
XWindow.c \
777
XToolkit.c \
778
@@ -616,8 +620,8 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
779
sun_awt_X11_GtkFileDialogPeer.c \
780
XRSurfaceData.c \
781
XRBackendNative.c
782
-
783
- LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
784
+ # -lXext -lX11 -lXrender -lXtst -lXi
785
+ LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt $(LIBDL) -ljava -ljvm -lc
786
787
ifeq ($(OPENJDK_TARGET_OS), linux)
788
# To match old build, add this to LDFLAGS instead of suffix.
789
@@ -762,9 +766,9 @@ BUILD_LIBRARIES += $(BUILD_LIBJPEG)
790
791
##########################################################################################
792
793
-ifeq ($(BUILD_HEADLESS), true)
794
+# ifeq ($(BUILD_HEADLESS), true)
795
# Mac and Windows only use the native AWT lib, do not build libawt_headless
796
- ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
797
+ # ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx_NOTIOS),)
798
799
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \
800
$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
801
@@ -773,7 +777,7 @@ ifeq ($(BUILD_HEADLESS), true)
802
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
803
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
804
805
- ifeq ($(OPENJDK_TARGET_OS), macosx)
806
+ ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
807
LIBAWT_HEADLESS_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/font
808
endif
809
810
@@ -792,15 +796,29 @@ ifeq ($(BUILD_HEADLESS), true)
811
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
812
$(foreach dir, $(LIBAWT_HEADLESS_DIRS), -I$(dir))
813
814
+# X11Renderer.c
815
+# X11PMBlitLoops.c
816
+# X11SurfaceData.c
817
+
818
+# TODO: Port below to GL4ES/Android GLES renderer.
819
+# GLXGraphicsConfig.c
820
+# GLXSurfaceData.c
821
+
822
+# awt_DrawingSurface.c
823
+# awt_GraphicsEnv.c
824
+# awt_UNIXToolkit.c
825
+
826
LIBAWT_HEADLESS_FILES := \
827
+ awt_AWTEvent.c \
828
+ awt_Event.c \
829
awt_Font.c \
830
+ awt_Insets.c \
831
+ awt_Robot.c \
832
+ awt_util.c \
833
HeadlessToolkit.c \
834
fontpath.c \
835
VDrawingArea.c \
836
X11Color.c \
837
- X11Renderer.c \
838
- X11PMBlitLoops.c \
839
- X11SurfaceData.c \
840
X11FontScaler_md.c \
841
X11TextRenderer_md.c \
842
OGLBlitLoops.c \
843
@@ -815,8 +833,6 @@ ifeq ($(BUILD_HEADLESS), true)
844
OGLSurfaceData.c \
845
OGLTextRenderer.c \
846
OGLVertexCache.c \
847
- GLXGraphicsConfig.c \
848
- GLXSurfaceData.c \
849
AccelGlyphCache.c \
850
CUPSfuncs.c
851
852
@@ -840,9 +856,10 @@ ifeq ($(BUILD_HEADLESS), true)
853
$(call SET_SHARED_LIBRARY_ORIGIN), \
854
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
855
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
856
- LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
857
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
858
REORDER := $(LIBAWT_HEADLESS_REORDER), \
859
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
860
+ LDFLAGS_SUFFIX_macosx := -ljvm -lawt -ljava,\
861
LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
862
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
863
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
864
@@ -851,9 +868,8 @@ ifeq ($(BUILD_HEADLESS), true)
865
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
866
867
BUILD_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
868
-
869
- endif
870
-endif
871
+# endif
872
+#endif
873
874
##########################################################################################
875
876
@@ -873,7 +889,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
877
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
878
X11TextRenderer.c
879
LIBFONTMANAGER_OPTIMIZATION := HIGHEST
880
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
881
+else ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
882
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
883
X11TextRenderer.c \
884
fontpath.c \
885
@@ -914,8 +930,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
886
EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
887
AccelGlyphCache.c, \
888
LANG := C++, \
889
- CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
890
- CXXFLAGS := $(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
891
+ CFLAGS := $(CFLAGS_JDKLIB) -fno-rtti $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
892
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) -fno-rtti $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
893
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
894
CFLAGS_windows = -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
895
-DCC_NOEX, \
896
@@ -924,7 +940,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
897
$(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
898
$(call SET_SHARED_LIBRARY_ORIGIN), \
899
LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
900
- LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
901
+ LDFLAGS_SUFFIX_linux := -lawt -lawt_headless $(LIBM) -lsupc++ -ljava -ljvm -lc, \
902
LDFLAGS_SUFFIX_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
903
LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\
904
LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
905
@@ -1044,20 +1060,23 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
906
else # OPENJDK_TARGET_OS not windows
907
908
ifeq ($(OPENJDK_TARGET_OS), macosx)
909
- JAWT_FILES := jawt.m
910
- JAWT_LIBS := -lawt_lwawt
911
+# JAWT_FILES := jawt.m
912
+# JAWT_LIBS := -lawt_lwawt
913
+ JAWT_FILES := jawt.c
914
+ JAWT_LIBS := -lawt_headless
915
+# maybe -lawt_xawt later?
916
else
917
JAWT_FILES := jawt.c
918
JAWT_LIBS :=
919
ifneq ($(OPENJDK_TARGET_OS), solaris)
920
JAWT_LIBS += -lawt
921
endif
922
- ifndef BUILD_HEADLESS_ONLY
923
- JAWT_LIBS += -lawt_xawt
924
- else
925
+ # ifndef BUILD_HEADLESS_ONLY
926
+ # JAWT_LIBS += -lawt_xawt
927
+ # else
928
JAWT_LIBS += -lawt_headless
929
HEADLESS_CFLAG += -DHEADLESS
930
- endif
931
+ # endif
932
endif
933
934
$(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
935
@@ -1079,17 +1098,17 @@ else # OPENJDK_TARGET_OS not windows
936
LDFLAGS_SUFFIX_aix := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
937
LDFLAGS_SUFFIX_solaris := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender, \
938
LDFLAGS_SUFFIX_macosx := -Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
939
- -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX), \
940
+ -framework Foundation $(LDFLAGS_JDKLIB_SUFFIX), \
941
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
942
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
943
944
- ifndef BUILD_HEADLESS_ONLY
945
- $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
946
- else
947
+ # ifndef BUILD_HEADLESS_ONLY
948
+ # $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
949
+ # else
950
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
951
- endif
952
+ # endif
953
954
- ifeq ($(OPENJDK_TARGET_OS), macosx)
955
+ ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
956
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
957
endif
958
959
@@ -1192,7 +1211,7 @@ ifndef BUILD_HEADLESS_ONLY
960
LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
961
endif
962
963
- ifeq ($(OPENJDK_TARGET_OS), macosx)
964
+ ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
965
LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
966
-framework ApplicationServices \
967
-framework Foundation \
968
@@ -1225,9 +1244,9 @@ ifndef BUILD_HEADLESS_ONLY
969
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsplashscreen, \
970
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
971
972
- BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
973
+ # BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
974
975
- ifeq ($(OPENJDK_TARGET_OS), macosx)
976
+ ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
977
$(LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
978
endif
979
980
@@ -1276,7 +1295,7 @@ endif
981
982
##########################################################################################
983
984
-ifeq ($(OPENJDK_TARGET_OS), macosx)
985
+ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
986
987
LIBAWT_LWAWT_FILES := \
988
awt.m \
989
@@ -1382,7 +1401,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
990
-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
991
LDFLAGS := $(LDFLAGS_JDKLIB) \
992
$(call SET_SHARED_LIBRARY_ORIGIN), \
993
- LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
994
+ LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -DEXCLUDE_losxapp -ljvm $(LIBM) \
995
-framework Accelerate \
996
-framework ApplicationServices \
997
-framework AudioToolbox \
998
@@ -1411,7 +1430,7 @@ endif
999
1000
##########################################################################################
1001
1002
-ifeq ($(OPENJDK_TARGET_OS), macosx)
1003
+ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
1004
1005
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
1006
LIBRARY := osxui, \
1007
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
1008
index 0d7e3aae..9d3c92b5 100644
1009
--- a/jdk/make/lib/CoreLibraries.gmk
1010
+++ b/jdk/make/lib/CoreLibraries.gmk
1011
@@ -415,7 +415,6 @@ LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
1012
1013
ifeq ($(OPENJDK_TARGET_OS), macosx)
1014
LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
1015
- LIBJLI_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
1016
endif
1017
1018
ifneq ($(USE_EXTERNAL_LIBZ), true)
1019
@@ -449,7 +448,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
1020
$(call SET_SHARED_LIBRARY_ORIGIN), \
1021
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
1022
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
1023
- LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices -mmacosx-version-min=$(MACOSX_VERSION_MIN), \
1024
+ LDFLAGS_macosx := -framework Foundation -framework Security, \
1025
LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \
1026
LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \
1027
LDFLAGS_SUFFIX_aix := $(LIBZ) $(LIBDL),\
1028
@@ -509,8 +508,8 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
1029
INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
1030
LANG := C, \
1031
OPTIMIZATION := HIGH, \
1032
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) -mmacosx-version-min=$(MACOSX_VERSION_MIN), \
1033
- LDFLAGS := -nostdlib -r -mmacosx-version-min=$(MACOSX_VERSION_MIN), \
1034
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
1035
+ LDFLAGS := -nostdlib -r, \
1036
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
1037
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
1038
1039
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
1040
index 6c9c46a3..11c5e90c 100644
1041
--- a/jdk/make/lib/NioLibraries.gmk
1042
+++ b/jdk/make/lib/NioLibraries.gmk
1043
@@ -170,10 +170,14 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
1044
ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
1045
1046
# Suppress unused parameters required by exported JNI functions.
1047
- SCTP_WERROR := -Werror -Wno-error=unused-parameter
1048
+ # -Werror
1049
+ SCTP_WERROR := -Werror=implicit-function-declaration -Wno-error=unused-parameter
1050
ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
1051
SCTP_WERROR :=
1052
endif
1053
+ ifeq ($(OPENJDK_TARGET_CPU_ARCH), aarch32)
1054
+ SCTP_WERROR :=
1055
+ endif
1056
1057
$(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \
1058
LIBRARY := sctp, \
1059
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
1060
index 49f584b4..9fc79e28 100644
1061
--- a/jdk/make/lib/PlatformLibraries.gmk
1062
+++ b/jdk/make/lib/PlatformLibraries.gmk
1063
@@ -23,7 +23,7 @@
1064
# questions.
1065
#
1066
1067
-ifeq ($(OPENJDK_TARGET_OS), macosx)
1068
+ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
1069
1070
$(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE, \
1071
LIBRARY := AppleScriptEngine, \
1072
@@ -50,7 +50,7 @@ endif
1073
1074
##########################################################################################
1075
1076
-ifeq ($(OPENJDK_TARGET_OS), macosx)
1077
+ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
1078
1079
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP, \
1080
LIBRARY := osxapp, \
1081
@@ -85,7 +85,7 @@ endif
1082
1083
##########################################################################################
1084
1085
-ifeq ($(OPENJDK_TARGET_OS), macosx)
1086
+ifeq ($(OPENJDK_TARGET_OS), macosx_NOTIOS)
1087
1088
LIBOSX_DIRS := \
1089
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
1090
diff --git a/jdk/make/lib/SecurityLibraries.gmk b/jdk/make/lib/SecurityLibraries.gmk
1091
index 84abb7e7..29e55cfb 100644
1092
--- a/jdk/make/lib/SecurityLibraries.gmk
1093
+++ b/jdk/make/lib/SecurityLibraries.gmk
1094
@@ -133,6 +133,7 @@ endif
1095
##########################################################################################
1096
1097
ifneq ($(BUILD_CRYPTO), no)
1098
+ifneq ($(BUILD_IOS), 1)
1099
BUILD_LIBKRB5_NAME :=
1100
ifeq ($(OPENJDK_TARGET_OS), windows)
1101
BUILD_LIBKRB5_NAME := w2k_lsa_auth
1102
@@ -172,6 +173,7 @@ ifneq ($(BUILD_CRYPTO), no)
1103
BUILD_LIBRARIES += $(BUILD_LIBKRB5)
1104
endif
1105
endif
1106
+endif
1107
1108
##########################################################################################
1109
1110
diff --git a/jdk/make/lib/ServiceabilityLibraries.gmk b/jdk/make/lib/ServiceabilityLibraries.gmk
1111
index c951b118..37399b1d 100644
1112
--- a/jdk/make/lib/ServiceabilityLibraries.gmk
1113
+++ b/jdk/make/lib/ServiceabilityLibraries.gmk
1114
@@ -262,7 +262,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
1115
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
1116
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
1117
LDFLAGS_macosx := -Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
1118
- -framework Cocoa -framework Security -framework ApplicationServices, \
1119
+ -framework Foundation -framework Security, \
1120
LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
1121
LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
1122
LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc, \
1123
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
1124
index b59a9462..ca2a3ff7 100644
1125
--- a/jdk/make/lib/SoundLibraries.gmk
1126
+++ b/jdk/make/lib/SoundLibraries.gmk
1127
@@ -84,6 +84,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
1128
-DUSE_PLATFORM_MIDI_IN=TRUE
1129
LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/sun/media/sound
1130
LIBJSOUND_SRC_FILES += \
1131
+ PLATFORM_API_iPhoneOS_Permission.m \
1132
PLATFORM_API_MacOSX_Utils.cpp \
1133
PLATFORM_API_MacOSX_PCM.cpp \
1134
PLATFORM_API_MacOSX_Ports.cpp \
1135
@@ -144,6 +145,10 @@ else
1136
LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC64LE
1137
endif
1138
1139
+ ifeq ($(OPENJDK_TARGET_CPU), aarch32)
1140
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH32
1141
+ endif
1142
+
1143
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
1144
LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH64
1145
endif
1146
@@ -151,6 +156,7 @@ endif
1147
1148
LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
1149
1150
+# -framework AudioUnit
1151
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
1152
LIBRARY := jsound, \
1153
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1154
@@ -165,7 +171,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
1155
LDFLAGS := $(LDFLAGS_JDKLIB) \
1156
$(call SET_SHARED_LIBRARY_ORIGIN), \
1157
LDFLAGS_macosx := -framework CoreAudio -framework CoreFoundation \
1158
- -framework CoreServices -framework AudioUnit $(LIBCXX) \
1159
+ -framework CoreServices -framework AVFoundation $(LIBCXX) \
1160
-framework CoreMIDI -framework AudioToolbox, \
1161
LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
1162
LDFLAGS_SUFFIX_posix := -ljava -ljvm, \
1163
@@ -216,7 +222,7 @@ ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
1164
1165
$(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
1166
1167
- BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
1168
+ # BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
1169
1170
endif
1171
1172
diff --git a/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp b/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp
1173
index 608ee13d..53fee94c 100644
1174
--- a/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp
1175
+++ b/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp
1176
@@ -44,6 +44,9 @@
1177
extern "C" {
1178
#include "Utilities.h"
1179
#include "DirectAudio.h"
1180
+#if TARGET_OS_IPHONE
1181
+void DAUDIO_RequestRecordPermission();
1182
+#endif
1183
}
1184
1185
#if USE_DAUDIO == TRUE
1186
@@ -71,6 +74,9 @@ static inline void PrintStreamDesc(const AudioStreamBasicDescription *inDesc) {
1187
static DeviceList deviceCache;
1188
1189
INT32 DAUDIO_GetDirectAudioDeviceCount() {
1190
+#ifdef TARGET_OS_IPHONE
1191
+ DAUDIO_RequestRecordPermission();
1192
+#endif
1193
deviceCache.Refresh();
1194
int count = deviceCache.GetCount();
1195
if (count > 0) {
1196
@@ -635,7 +641,11 @@ static AudioUnit CreateOutputUnit(AudioDeviceID deviceID, int isSource)
1197
1198
AudioComponentDescription desc;
1199
desc.componentType = kAudioUnitType_Output;
1200
+#if !TARGET_OS_IPHONE
1201
desc.componentSubType = (deviceID == 0 && isSource) ? kAudioUnitSubType_DefaultOutput : kAudioUnitSubType_HALOutput;
1202
+#else
1203
+ desc.componentSubType = kAudioUnitSubType_RemoteIO;
1204
+#endif
1205
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
1206
desc.componentFlags = 0;
1207
desc.componentFlagsMask = 0;
1208
diff --git a/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_iPhoneOS_Permission.m b/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_iPhoneOS_Permission.m
1209
new file mode 100644
1210
index 00000000..4375ef71
1211
--- /dev/null
1212
+++ b/jdk/src/macosx/native/com/sun/media/sound/PLATFORM_API_iPhoneOS_Permission.m
1213
@@ -0,0 +1,15 @@
1214
+#import <AVFAudio/AVFAudio.h>
1215
+
1216
+#if TARGET_OS_IPHONE
1217
+void DAUDIO_RequestRecordPermission() {
1218
+ AVAudioSession *session = AVAudioSession.sharedInstance;
1219
+ if ([session respondsToSelector:@selector(requestRecordPermission:)]) {
1220
+ dispatch_group_t group = dispatch_group_create();
1221
+ dispatch_group_enter(group);
1222
+ [session requestRecordPermission:^(BOOL granted) {
1223
+ dispatch_group_leave(group);
1224
+ }];
1225
+ dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
1226
+ }
1227
+}
1228
+#endif
1229
diff --git a/jdk/src/macosx/native/sun/awt/OSVersion.h b/jdk/src/macosx/native/sun/awt/OSVersion.h
1230
new file mode 100644
1231
index 00000000..65d2f2c2
1232
--- /dev/null
1233
+++ b/jdk/src/macosx/native/sun/awt/OSVersion.h
1234
@@ -0,0 +1,29 @@
1235
+/*
1236
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
1237
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1238
+ *
1239
+ * This code is free software; you can redistribute it and/or modify it
1240
+ * under the terms of the GNU General Public License version 2 only, as
1241
+ * published by the Free Software Foundation. Oracle designates this
1242
+ * particular file as subject to the "Classpath" exception as provided
1243
+ * by Oracle in the LICENSE file that accompanied this code.
1244
+ *
1245
+ * This code is distributed in the hope that it will be useful, but WITHOUT
1246
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1247
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1248
+ * version 2 for more details (a copy is included in the LICENSE file that
1249
+ * accompanied this code).
1250
+ *
1251
+ * You should have received a copy of the GNU General Public License version
1252
+ * 2 along with this work; if not, write to the Free Software Foundation,
1253
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1254
+ *
1255
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1256
+ * or visit www.oracle.com if you need additional information or have any
1257
+ * questions.
1258
+ */
1259
+
1260
+// Support for detecting Mac OS X versions
1261
+
1262
+double getOSXMajorVersion();
1263
+BOOL isSnowLeopardOrLower();
1264
diff --git a/jdk/src/macosx/native/sun/awt/OSVersion.m b/jdk/src/macosx/native/sun/awt/OSVersion.m
1265
new file mode 100644
1266
index 00000000..93951abe
1267
--- /dev/null
1268
+++ b/jdk/src/macosx/native/sun/awt/OSVersion.m
1269
@@ -0,0 +1,61 @@
1270
+/*
1271
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
1272
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1273
+ *
1274
+ * This code is free software; you can redistribute it and/or modify it
1275
+ * under the terms of the GNU General Public License version 2 only, as
1276
+ * published by the Free Software Foundation. Oracle designates this
1277
+ * particular file as subject to the "Classpath" exception as provided
1278
+ * by Oracle in the LICENSE file that accompanied this code.
1279
+ *
1280
+ * This code is distributed in the hope that it will be useful, but WITHOUT
1281
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1282
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1283
+ * version 2 for more details (a copy is included in the LICENSE file that
1284
+ * accompanied this code).
1285
+ *
1286
+ * You should have received a copy of the GNU General Public License version
1287
+ * 2 along with this work; if not, write to the Free Software Foundation,
1288
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1289
+ *
1290
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1291
+ * or visit www.oracle.com if you need additional information or have any
1292
+ * questions.
1293
+ */
1294
+
1295
+// Support for detecting Mac OS X Versions
1296
+
1297
+#include <math.h>
1298
+#include <stdlib.h>
1299
+#include <stdio.h>
1300
+#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
1301
+
1302
+
1303
+// returns 107 for Lion, 106 for SnowLeopard etc.
1304
+int getOSXMajorVersion() {
1305
+ char *ver = JRSCopyOSVersion();
1306
+ if (ver == NULL) {
1307
+ return 0;
1308
+ }
1309
+
1310
+ int len = strlen(ver);
1311
+ int v = 0;
1312
+
1313
+ // Third char must be a '.'
1314
+ if (len >= 3 && ver[2] == '.') {
1315
+ int i;
1316
+
1317
+ v = (ver[0] - '0') * 10 + (ver[1] - '0');
1318
+ for (i = 3; i < len && isdigit(ver[i]); ++i) {
1319
+ v = v * 10 + (ver[i] - '0');
1320
+ }
1321
+ }
1322
+
1323
+ free(ver);
1324
+
1325
+ return v;
1326
+}
1327
+
1328
+BOOL isSnowLeopardOrLower() {
1329
+ return (getOSXMajorVersion() < 107);
1330
+}
1331
diff --git a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java
1332
index 303c96d7..aa555cc2 100644
1333
--- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java
1334
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java
1335
@@ -73,6 +73,18 @@ public class ManifestEntryVerifier {
1336
1337
private CodeSigner[] signers = null;
1338
1339
+ /**
1340
+ * Create a new ManifestEntryVerifier object.
1341
+ */
1342
+ public ManifestEntryVerifier(Manifest man)
1343
+ {
1344
+ createdDigests = new HashMap<String, MessageDigest>(11);
1345
+ digests = new ArrayList<MessageDigest>();
1346
+ manifestHashes = new ArrayList<byte[]>();
1347
+ this.manifestFileName = "default_name";
1348
+ this.man = man;
1349
+ }
1350
+
1351
/**
1352
* Create a new ManifestEntryVerifier object.
1353
*/
1354
diff --git a/jdk/src/solaris/native/java/lang/java_props_macosx.c b/jdk/src/solaris/native/java/lang/java_props_macosx.c
1355
index 80dc483b..c62a0c1d 100644
1356
--- a/jdk/src/solaris/native/java/lang/java_props_macosx.c
1357
+++ b/jdk/src/solaris/native/java/lang/java_props_macosx.c
1358
@@ -23,14 +23,24 @@
1359
* questions.
1360
*/
1361
1362
+#include "TargetConditionals.h"
1363
+
1364
#include <sys/socket.h>
1365
#include <netinet/in.h>
1366
#include <arpa/inet.h>
1367
#include <objc/objc-runtime.h>
1368
1369
+#ifndef TARGET_OS_IOS
1370
#include <Security/AuthSession.h>
1371
+#endif
1372
#include <CoreFoundation/CoreFoundation.h>
1373
+#ifndef TARGET_OS_IOS
1374
#include <SystemConfiguration/SystemConfiguration.h>
1375
+#else
1376
+#include <SystemConfiguration/OSXSCSchemaDefinitions.h>
1377
+#include <SystemConfiguration/SCDynamicStore.h>
1378
+CFDictionaryRef SCDynamicStoreCopyProxies(SCDynamicStoreRef store);
1379
+#endif
1380
#include <Foundation/Foundation.h>
1381
1382
#include "java_props_macosx.h"
1383
@@ -159,6 +169,7 @@ int isInAquaSession() {
1384
// if "true" then tell the caller we're in an Aqua session without actually checking
1385
return 1;
1386
}
1387
+#ifndef TARGET_OS_IOS
1388
// Is the WindowServer available?
1389
SecuritySessionId session_id;
1390
SessionAttributeBits session_info;
1391
@@ -168,6 +179,7 @@ int isInAquaSession() {
1392
return 1;
1393
}
1394
}
1395
+#endif
1396
return 0;
1397
}
1398
1399
diff --git a/jdk/src/solaris/native/sun/awt/awt.h b/jdk/src/solaris/native/sun/awt/awt.h
1400
index df5f6030..f2f12852 100644
1401
--- a/jdk/src/solaris/native/sun/awt/awt.h
1402
+++ b/jdk/src/solaris/native/sun/awt/awt.h
1403
@@ -34,9 +34,9 @@
1404
#include "jni_util.h"
1405
#include "debug_util.h"
1406
1407
-#if !defined(HEADLESS) && !defined(MACOSX)
1408
+#if defined(__ANDROID__) || (!defined(HEADLESS) && !defined(MACOSX))
1409
#include <X11/Intrinsic.h>
1410
-#endif /* !HEADLESS && !MACOSX */
1411
+#endif /* __ANDROID__ (!HEADLESS && !MACOSX) */
1412
1413
1414
/* The JVM instance: defined in awt_MToolkit.c */
1415
@@ -116,9 +116,9 @@ extern void awt_output_flush();
1416
#define AWT_NOTIFY() AWT_NOTIFY_IMPL()
1417
#define AWT_NOTIFY_ALL() AWT_NOTIFY_ALL_IMPL()
1418
1419
-#if !defined(HEADLESS) && !defined(MACOSX)
1420
+#if defined(__ANDROID__) || (!defined(HEADLESS) && !defined(MACOSX))
1421
extern Display *awt_display; /* awt_GraphicsEnv.c */
1422
extern Boolean awt_ModLockIsShiftLock; /* XToolkit.c */
1423
-#endif /* !HEADLESS && !MACOSX */
1424
+#endif /* __ANDROID__ || (!HEADLESS && !MACOSX) */
1425
1426
#endif /* ! _AWT_ */
1427
diff --git a/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c b/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c
1428
index 317e346e..9d7031a5 100644
1429
--- a/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c
1430
+++ b/jdk/src/solaris/native/sun/awt/awt_AWTEvent.c
1431
@@ -29,11 +29,11 @@
1432
* THIS FILE DOES NOT IMPLEMENT ANY OF THE OBSOLETE java.awt.Event
1433
* CLASS. SEE awt_Event.[ch] FOR THAT CLASS' IMPLEMENTATION.
1434
*/
1435
-
1436
+/*
1437
#ifdef HEADLESS
1438
#error This file should not be included in headless library
1439
#endif
1440
-
1441
+*/
1442
#include "awt_p.h"
1443
#include "java_awt_AWTEvent.h"
1444
#include "java_awt_event_InputEvent.h"
1445
diff --git a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
1446
index de7e8488..e3e578c1 100644
1447
--- a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
1448
+++ b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
1449
@@ -23,10 +23,15 @@
1450
* questions.
1451
*/
1452
1453
+/*
1454
#ifdef HEADLESS
1455
#error This file should not be included in headless library
1456
#endif
1457
+*/
1458
1459
+#ifdef __ANDROID__
1460
+# include "awt.h"
1461
+#endif
1462
#include "awt_p.h"
1463
#include "java_awt_Component.h"
1464
1465
@@ -36,14 +41,27 @@
1466
#include <jni_util.h>
1467
#include <jawt_md.h>
1468
1469
+#include "awt_GraphicsEnv.h"
1470
+
1471
+
1472
+// FIXME awt_TopLevel.c not found
1473
+#ifndef __ANDROID__
1474
extern struct ComponentIDs componentIDs;
1475
1476
-#include "awt_GraphicsEnv.h"
1477
extern jfieldID windowID;
1478
extern jfieldID targetID;
1479
extern jfieldID graphicsConfigID;
1480
extern jfieldID drawStateID;
1481
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
1482
+#else
1483
+struct ComponentIDs componentIDs;
1484
+
1485
+jfieldID windowID;
1486
+jfieldID targetID;
1487
+jfieldID graphicsConfigID;
1488
+jfieldID drawStateID;
1489
+struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
1490
+#endif
1491
1492
/*
1493
* Lock the surface of the target component for native rendering.
1494
@@ -160,7 +178,11 @@ JNIEXPORT int32_t JNICALL
1495
JNU_GetLongFieldAsPtr(env, gc_object,
1496
x11GraphicsConfigIDs.aData);
1497
} else {
1498
+#ifndef __ANDROID__
1499
adata = getDefaultConfig(DefaultScreen(awt_display));
1500
+#else
1501
+ adata = getDefaultConfig(0);
1502
+#endif
1503
}
1504
1505
result = adata->AwtColorMatch(r, g, b, adata);
1506
@@ -232,13 +254,29 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds)
1507
1508
/* Set drawable and display */
1509
px->drawable = (*env)->GetLongField(env, peer, windowID);
1510
+/*
1511
+#ifdef __ANDROID__
1512
+ Display fake_awt_display;
1513
+ awt_display = &fake_awt_display;
1514
+ awt_display->proto_major_version = 11;
1515
+ awt_display->proto_minor_version = 7;
1516
+ awt_display->vendor = "Android Xlib";
1517
+#endif
1518
+*/
1519
px->display = awt_display;
1520
1521
/* Get window attributes to set other values */
1522
+#if !defined(__ANDROID__) && !defined(HEADLESS)
1523
XGetWindowAttributes(awt_display, (Window)(px->drawable), &attrs);
1524
1525
- /* Set the other values */
1526
px->visualID = XVisualIDFromVisual(attrs.visual);
1527
+#else
1528
+ px->visualID = TrueColor;
1529
+ attrs.colormap = 1; // FIXME!
1530
+ attrs.depth = 24;
1531
+#endif
1532
+
1533
+ /* Set the other values */
1534
px->colormapID = attrs.colormap;
1535
px->depth = attrs.depth;
1536
px->GetAWTColor = awt_GetColor;
1537
diff --git a/jdk/src/solaris/native/sun/awt/awt_Event.c b/jdk/src/solaris/native/sun/awt/awt_Event.c
1538
index 64424697..af3df03c 100644
1539
--- a/jdk/src/solaris/native/sun/awt/awt_Event.c
1540
+++ b/jdk/src/solaris/native/sun/awt/awt_Event.c
1541
@@ -28,9 +28,12 @@
1542
*** awt_AWTEvent.[ch] FOR THE NEWER EVENT CLASSES.
1543
***
1544
***/
1545
+
1546
+/*
1547
#ifdef HEADLESS
1548
#error This file should not be included in headless library
1549
#endif
1550
+*/
1551
1552
#include "java_awt_Event.h"
1553
#include "jni_util.h"
1554
diff --git a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
1555
index 94f02281..77439ce6 100644
1556
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
1557
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
1558
@@ -886,6 +886,8 @@ Java_sun_awt_X11GraphicsEnvironment_initGLX(JNIEnv *env, jclass x11ge)
1559
AWT_UNLOCK();
1560
1561
return glxAvailable;
1562
+#elif defined(__ANDROID)
1563
+ return JNI_TRUE;
1564
#else
1565
return JNI_FALSE;
1566
#endif /* !HEADLESS */
1567
@@ -900,7 +902,7 @@ JNIEXPORT jint JNICALL
1568
Java_sun_awt_X11GraphicsEnvironment_getNumScreens(JNIEnv *env, jobject this)
1569
{
1570
#ifdef HEADLESS
1571
- return (jint)0;
1572
+ return (jint)1;
1573
#else
1574
return awt_numScreens;
1575
#endif /* !HEADLESS */
1576
diff --git a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
1577
index 59483027..c2298361 100644
1578
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
1579
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
1580
@@ -30,6 +30,7 @@
1581
#include <jni.h>
1582
#include <jni_util.h>
1583
#include <jvm.h>
1584
+#include <stdbool.h>
1585
#include "gdefs.h"
1586
1587
#include <sys/param.h>
1588
@@ -86,8 +87,9 @@ JNIEXPORT jboolean JNICALL AWTIsHeadless() {
1589
*/
1590
1591
#ifdef MACOSX
1592
- #define LWAWT_PATH "/libawt_lwawt.dylib"
1593
- #define DEFAULT_PATH LWAWT_PATH
1594
+ #define XAWT_PATH "/libawt_xawt.dylib"
1595
+ #define DEFAULT_PATH XAWT_PATH
1596
+ #define HEADLESS_PATH "/libawt_headless.dylib"
1597
#else
1598
#define XAWT_PATH "/libawt_xawt.so"
1599
#define DEFAULT_PATH XAWT_PATH
1600
@@ -116,8 +118,13 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
1601
jvm = vm;
1602
1603
/* Get address of this library and the directory containing it. */
1604
- dladdr((void *)AWT_OnLoad, &dlinfo);
1605
- realpath((char *)dlinfo.dli_fname, buf);
1606
+ char *altpath = getenv("JAVA_AWT_PATH");
1607
+ if (altpath != NULL) {
1608
+ realpath(altpath, buf);
1609
+ } else {
1610
+ dladdr((void *)AWT_OnLoad, &dlinfo);
1611
+ realpath((char *)dlinfo.dli_fname, buf);
1612
+ }
1613
len = strlen(buf);
1614
p = strrchr(buf, '/');
1615
1616
@@ -130,7 +137,7 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
1617
fmProp = (*env)->NewStringUTF(env, "sun.font.fontmanager");
1618
CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager property");
1619
1620
-#ifdef MACOSX
1621
+#ifdef MACOSX_NOTIOS
1622
fmanager = (*env)->NewStringUTF(env, "sun.font.CFontManager");
1623
tk = LWAWT_PATH;
1624
#else
1625
@@ -146,11 +153,9 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
1626
CHECK_EXCEPTION_FATAL(env, "Could not allocate set properties");
1627
}
1628
1629
-#ifndef MACOSX
1630
if (AWTIsHeadless()) {
1631
tk = HEADLESS_PATH;
1632
}
1633
-#endif
1634
1635
/* Calculate library name to load */
1636
strncpy(p, tk, MAXPATHLEN-len-1);
1637
diff --git a/jdk/src/solaris/native/sun/awt/awt_Robot.c b/jdk/src/solaris/native/sun/awt/awt_Robot.c
1638
index 35ff9478..b4ff620e 100644
1639
--- a/jdk/src/solaris/native/sun/awt/awt_Robot.c
1640
+++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c
1641
@@ -23,9 +23,11 @@
1642
* questions.
1643
*/
1644
1645
+/*
1646
#ifdef HEADLESS
1647
#error This file should not be included in headless library
1648
#endif
1649
+*/
1650
1651
#include "jvm_md.h"
1652
#include <dlfcn.h>
1653
@@ -68,6 +70,7 @@ static void *xCompositeHandle;
1654
static const char* XCOMPOSITE = JNI_LIB_NAME("Xcomposite");
1655
static const char* XCOMPOSITE_VERSIONED = VERSIONED_JNI_LIB_NAME("Xcomposite", "1");
1656
1657
+#ifndef HEADLESS
1658
static Bool checkXCompositeFunctions(void) {
1659
return (compositeQueryExtension != NULL &&
1660
compositeQueryVersion != NULL &&
1661
@@ -229,6 +232,7 @@ static XImage *getWindowImage(Display * display, Window window,
1662
1663
return image;
1664
}
1665
+#endif
1666
1667
/*********************************************************************************************/
1668
1669
@@ -236,6 +240,7 @@ static XImage *getWindowImage(Display * display, Window window,
1670
JNIEXPORT void JNICALL
1671
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
1672
{
1673
+#ifndef HEADLESS
1674
int32_t xtestAvailable;
1675
jint *tmp;
1676
int i;
1677
@@ -266,6 +271,7 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton
1678
}
1679
1680
AWT_UNLOCK();
1681
+#endif
1682
}
1683
1684
1685
@@ -278,7 +284,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
1686
jint width,
1687
jint height,
1688
jintArray pixelArray) {
1689
-
1690
+#ifndef HEADLESS
1691
XImage *image;
1692
jint *ary; /* Array of jints for sending pixel values back
1693
* to parent process.
1694
@@ -337,13 +343,14 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
1695
XDestroyImage(image);
1696
1697
AWT_UNLOCK();
1698
+#endif
1699
}
1700
1701
JNIEXPORT void JNICALL
1702
Java_sun_awt_X11_XRobotPeer_keyPressImpl (JNIEnv *env,
1703
jclass cls,
1704
jint keycode) {
1705
-
1706
+#ifndef HEADLESS
1707
AWT_LOCK();
1708
1709
DTRACE_PRINTLN1("RobotPeer: keyPressImpl(%i)", keycode);
1710
@@ -356,13 +363,14 @@ Java_sun_awt_X11_XRobotPeer_keyPressImpl (JNIEnv *env,
1711
XSync(awt_display, False);
1712
1713
AWT_UNLOCK();
1714
-
1715
+#endif
1716
}
1717
1718
JNIEXPORT void JNICALL
1719
Java_sun_awt_X11_XRobotPeer_keyReleaseImpl (JNIEnv *env,
1720
jclass cls,
1721
jint keycode) {
1722
+#ifndef HEADLESS
1723
AWT_LOCK();
1724
1725
DTRACE_PRINTLN1("RobotPeer: keyReleaseImpl(%i)", keycode);
1726
@@ -375,6 +383,7 @@ Java_sun_awt_X11_XRobotPeer_keyReleaseImpl (JNIEnv *env,
1727
XSync(awt_display, False);
1728
1729
AWT_UNLOCK();
1730
+#endif
1731
}
1732
1733
JNIEXPORT void JNICALL
1734
@@ -383,7 +392,7 @@ Java_sun_awt_X11_XRobotPeer_mouseMoveImpl (JNIEnv *env,
1735
jobject xgc,
1736
jint root_x,
1737
jint root_y) {
1738
-
1739
+#ifndef HEADLESS
1740
AwtGraphicsConfigDataPtr adata;
1741
1742
AWT_LOCK();
1743
@@ -397,6 +406,7 @@ Java_sun_awt_X11_XRobotPeer_mouseMoveImpl (JNIEnv *env,
1744
XSync(awt_display, False);
1745
1746
AWT_UNLOCK();
1747
+#endif
1748
}
1749
1750
/*
1751
@@ -407,6 +417,7 @@ void mouseAction(JNIEnv *env,
1752
jint buttonMask,
1753
Bool isMousePress)
1754
{
1755
+#ifndef HEADLESS
1756
AWT_LOCK();
1757
1758
DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask);
1759
@@ -444,6 +455,7 @@ void mouseAction(JNIEnv *env,
1760
1761
XSync(awt_display, False);
1762
AWT_UNLOCK();
1763
+#endif
1764
}
1765
1766
JNIEXPORT void JNICALL
1767
@@ -468,7 +480,7 @@ Java_sun_awt_X11_XRobotPeer_mouseWheelImpl (JNIEnv *env,
1768
/* probably could have been hacked into robot_mouseButtonEvent, but it's */
1769
/* cleaner to give it its own command type, in case the implementation */
1770
/* needs to be changed later. -bchristi, 6/20/01 */
1771
-
1772
+#ifndef HEADLESS
1773
int32_t repeat = abs(wheelAmt);
1774
int32_t button = wheelAmt < 0 ? 4 : 5; /* wheel up: button 4 */
1775
/* wheel down: button 5 */
1776
@@ -486,9 +498,12 @@ Java_sun_awt_X11_XRobotPeer_mouseWheelImpl (JNIEnv *env,
1777
XSync(awt_display, False);
1778
1779
AWT_UNLOCK();
1780
+#endif
1781
}
1782
1783
JNIEXPORT void JNICALL
1784
Java_sun_awt_X11_XRobotPeer_loadNativeLibraries (JNIEnv *env, jclass cls) {
1785
+#ifndef HEADLESS
1786
initXCompositeFunctions();
1787
+#endif
1788
}
1789
diff --git a/jdk/src/solaris/native/sun/awt/awt_p.h b/jdk/src/solaris/native/sun/awt/awt_p.h
1790
index d2d1d749..df62cf13 100644
1791
--- a/jdk/src/solaris/native/sun/awt/awt_p.h
1792
+++ b/jdk/src/solaris/native/sun/awt/awt_p.h
1793
@@ -40,7 +40,7 @@
1794
#include <stdlib.h>
1795
#include <string.h>
1796
#include <unistd.h>
1797
-#ifndef HEADLESS
1798
+#ifndef HEADLESS_Z
1799
#include <X11/Intrinsic.h>
1800
#include <X11/IntrinsicP.h>
1801
#include <X11/Shell.h>
1802
@@ -49,28 +49,28 @@
1803
#include <X11/keysym.h>
1804
#include <X11/keysymdef.h>
1805
#include <X11/extensions/Xrender.h>
1806
-#endif /* !HEADLESS */
1807
+#endif /* !HEADLESS_Z */
1808
#include "awt.h"
1809
#include "awt_util.h"
1810
#include "color.h"
1811
#include "colordata.h"
1812
#include "gdefs.h"
1813
1814
-#ifndef HEADLESS
1815
+#ifndef HEADLESS_Z
1816
#ifndef min
1817
#define min(a,b) ((a) <= (b)? (a):(b))
1818
#endif
1819
#ifndef max
1820
#define max(a,b) ((a) >= (b)? (a):(b))
1821
#endif
1822
-#endif /* !HEADLESS */
1823
+#endif // !HEADLESS_Z
1824
1825
#define RepaintPending_NONE 0
1826
#define RepaintPending_REPAINT (1 << 0)
1827
#define RepaintPending_EXPOSE (1 << 1)
1828
#define LOOKUPSIZE 32
1829
1830
-#ifndef HEADLESS
1831
+#ifndef HEADLESS_Z
1832
1833
typedef XRenderPictFormat *
1834
XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
1835
@@ -130,12 +130,12 @@ extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errm
1836
1837
extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen);
1838
extern AwtScreenDataPtr getScreenData(int screen);
1839
-#endif /* !HEADLESS */
1840
+#endif /* !HEADLESS_Z */
1841
1842
/* allocated and initialize a structure */
1843
#define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T)))
1844
1845
-#ifndef HEADLESS
1846
+#ifndef HEADLESS_Z
1847
#define XDISPLAY awt_display;
1848
1849
extern int awt_allocate_colors(AwtGraphicsConfigDataPtr);
1850
@@ -147,5 +147,5 @@ extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr);
1851
extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr);
1852
extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock);
1853
1854
-#endif /* !HEADLESS */
1855
+#endif /* !HEADLESS_Z */
1856
#endif /* _AWT_P_H_ */
1857
diff --git a/jdk/src/solaris/native/sun/awt/awt_util.c b/jdk/src/solaris/native/sun/awt/awt_util.c
1858
index 13ba3779..36eab248 100644
1859
--- a/jdk/src/solaris/native/sun/awt/awt_util.c
1860
+++ b/jdk/src/solaris/native/sun/awt/awt_util.c
1861
@@ -23,9 +23,11 @@
1862
* questions.
1863
*/
1864
1865
+/*
1866
#ifdef HEADLESS
1867
#error This file should not be included in headless library
1868
#endif
1869
+*/
1870
1871
#include "awt_p.h"
1872
#include "color.h"
1873
diff --git a/jdk/src/solaris/native/sun/awt/color.h b/jdk/src/solaris/native/sun/awt/color.h
1874
index 92df41ca..5eebb4b0 100644
1875
--- a/jdk/src/solaris/native/sun/awt/color.h
1876
+++ b/jdk/src/solaris/native/sun/awt/color.h
1877
@@ -28,13 +28,20 @@
1878
#include "awt.h"
1879
#include "colordata.h"
1880
1881
-#if !defined(HEADLESS) && !defined(MACOSX)
1882
+#if defined(__ANDROID__) || (!defined(HEADLESS_IGNORED) && !defined(MACOSX_NOTIOS))
1883
+
1884
+typedef struct {
1885
+ int depth;
1886
+ int bits_per_pixel;
1887
+ int scanline_pad;
1888
+} XPixmapFormatValues_DUP;
1889
+
1890
typedef struct {
1891
unsigned int Depth;
1892
- XPixmapFormatValues wsImageFormat;
1893
+ XPixmapFormatValues_DUP wsImageFormat;
1894
ImgColorData clrdata;
1895
ImgConvertFcn *convert[NUM_IMGCV];
1896
} awtImageData;
1897
-#endif /* !HEADLESS && !MACOSX */
1898
+#endif /* __ANDROID__ || (!HEADLESS && !MACOSX) */
1899
1900
#endif /* _COLOR_H_ */
1901
diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c
1902
index 4caae37a..28777601 100644
1903
--- a/jdk/src/solaris/native/sun/awt/fontpath.c
1904
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c
1905
@@ -501,8 +501,9 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1, jboolean is
1906
1907
char **fcdirs = NULL, **x11dirs = NULL, **knowndirs = NULL, *path = NULL;
1908
1909
+ // mod: NULL -> FALLBACK
1910
/* As of 1.5 we try to use fontconfig on both Solaris and Linux.
1911
- * If its not available NULL is returned.
1912
+ * If its not available FALLBACK is returned.
1913
*/
1914
fcdirs = getFontConfigLocations();
1915
1916
@@ -565,6 +566,7 @@ JNIEXPORT jstring JNICALL Java_sun_awt_FcFontManager_getFontPathNative
1917
if (ptr == NULL) {
1918
ptr = getPlatformFontPathChars(env, noType1, isX11);
1919
}
1920
+
1921
ret = (*env)->NewStringUTF(env, ptr);
1922
return ret;
1923
}
1924
@@ -734,6 +736,18 @@ typedef FcStrList* (*FcConfigGetCacheDirsFuncType)(FcConfig *config);
1925
typedef FcChar8* (*FcStrListNextFuncType)(FcStrList *list);
1926
typedef FcChar8* (*FcStrListDoneFuncType)(FcStrList *list);
1927
1928
+// mod: fallback directories
1929
+static char **getFallbackFontLocations() {
1930
+
1931
+ char **fontdirs = (char**)calloc(3, sizeof(char*));
1932
+ fontdirs[0] = (char *)calloc(1, 4096);
1933
+ fontdirs[1] = (char *)calloc(1, 40);
1934
+ sprintf(fontdirs[0], "%s/lib/fonts", getenv("JAVA_HOME"));
1935
+ sprintf(fontdirs[1], "%s", "/System/Library/Fonts/UnicodeSupport");
1936
+ return fontdirs;
1937
+
1938
+}
1939
+
1940
static char **getFontConfigLocations() {
1941
1942
char **fontdirs;
1943
@@ -759,7 +773,8 @@ static char **getFontConfigLocations() {
1944
void* libfontconfig = openFontConfig();
1945
1946
if (libfontconfig == NULL) {
1947
- return NULL;
1948
+ return getFallbackFontLocations();
1949
+ // original: NULL
1950
}
1951
1952
FcPatternBuild =
1953
@@ -806,7 +821,8 @@ static char **getFontConfigLocations() {
1954
fontSet = (*FcFontList)(NULL, pattern, objset);
1955
if (fontSet == NULL) {
1956
/* FcFontList() may return NULL if fonts are not installed. */
1957
- fontdirs = NULL;
1958
+ fontdirs = getFallbackFontLocations();
1959
+ // original: NULL
1960
} else {
1961
fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
1962
for (f=0; f < fontSet->nfont; f++) {
1963
diff --git a/jdk/src/solaris/native/sun/awt/jawt.c b/jdk/src/solaris/native/sun/awt/jawt.c
1964
index 64284bc6..176df821 100644
1965
--- a/jdk/src/solaris/native/sun/awt/jawt.c
1966
+++ b/jdk/src/solaris/native/sun/awt/jawt.c
1967
@@ -23,6 +23,10 @@
1968
* questions.
1969
*/
1970
1971
+#ifdef __APPLE__
1972
+#include "TargetConditionals.h"
1973
+#endif
1974
+
1975
#include <jawt.h>
1976
1977
#include "awt_DrawingSurface.h"
1978
@@ -33,7 +37,8 @@
1979
*/
1980
JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
1981
{
1982
-#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
1983
+// todo remove check if ios port get x11 support
1984
+#if defined(HEADLESS) || ((defined(__ANDROID__) || defined(TARGET_OS_IOS) || defined(JAVASE_EMBEDDED)) && defined(HEADLESS))
1985
/* there are no AWT libs available at all */
1986
return JNI_FALSE;
1987
#else
1988
@@ -47,6 +52,7 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
1989
return JNI_FALSE;
1990
}
1991
1992
+ // TODO still want port below to Android :v
1993
awt->GetDrawingSurface = awt_GetDrawingSurface;
1994
awt->FreeDrawingSurface = awt_FreeDrawingSurface;
1995
if (awt->version >= JAWT_VERSION_1_4) {
1996
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
1997
index 009139fb..0be692d6 100644
1998
--- a/make/common/NativeCompilation.gmk
1999
+++ b/make/common/NativeCompilation.gmk
2000
@@ -89,6 +89,12 @@ define add_native_source
2001
ifeq (,$$(filter %.s,$2))
2002
# And this is the dependency file for this obj file.
2003
$1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ))
2004
+
2005
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
2006
+ # Workaround for iOS port: dependency file does not exists.
2007
+ $1_$2_DEP:=""
2008
+ endif
2009
+
2010
# Include previously generated dependency information. (if it exists)
2011
-include $$($1_$2_DEP)
2012
2013
@@ -548,6 +554,12 @@ define SetupNativeCompilation
2014
$1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
2015
endif
2016
2017
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
2018
+ # iOS workarounds: dynamic lib and rpath
2019
+ $1_EXTRA_LDFLAGS+="-dynamiclib"
2020
+ $1_EXTRA_LDFLAGS+="-Wl,-install_name,@rpath/$$($1_BASENAME)"
2021
+ endif
2022
+
2023
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
2024
2025
$$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
2026
2027