summaryrefslogtreecommitdiff
path: root/debian/patches/zero-x32.diff
blob: 4f46f1f753b417a82fa79952c46d16e7fb439203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# DP: Add support for x32

--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -1911,7 +1911,7 @@ void * os::dll_load(const char *filename
 
   #if  (defined IA32)
     static  Elf32_Half running_arch_code=EM_386;
-  #elif   (defined AMD64)
+  #elif  (defined AMD64) || (defined X32)
     static  Elf32_Half running_arch_code=EM_X86_64;
   #elif  (defined IA64)
     static  Elf32_Half running_arch_code=EM_IA_64;
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -41,7 +41,6 @@
 #endif
 #ifdef __linux__
 #include <unistd.h>
-#include <sys/sysctl.h>
 #include <sys/utsname.h>
 #include <netinet/ip.h>
 
--- a/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
@@ -43,7 +43,6 @@
 #endif
 #ifdef __linux__
 #include <unistd.h>
-#include <sys/sysctl.h>
 #endif
 
 #include "jvm.h"
--- a/common/autoconf/platform.m4
+++ b/common/autoconf/platform.m4
@@ -31,10 +31,17 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU
   # First argument is the cpu name from the trip/quad
   case "$1" in
     x86_64)
-      VAR_CPU=x86_64
-      VAR_CPU_ARCH=x86
-      VAR_CPU_BITS=64
-      VAR_CPU_ENDIAN=little
+      if test "`dpkg-architecture -qDEB_HOST_ARCH`" = x32 ; then
+        VAR_CPU=x32
+        VAR_CPU_ARCH=x86
+        VAR_CPU_BITS=32
+        VAR_CPU_ENDIAN=little
+      else
+        VAR_CPU=x86_64
+        VAR_CPU_ARCH=x86
+        VAR_CPU_BITS=64
+        VAR_CPU_ENDIAN=little
+      fi
       ;;
     i?86)
       VAR_CPU=x86
@@ -446,7 +453,13 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
     ppc64)   ZERO_ARCHDEF=PPC64 ;;
     s390*)   ZERO_ARCHDEF=S390  ;;
     sparc*)  ZERO_ARCHDEF=SPARC ;;
-    x86_64*) ZERO_ARCHDEF=AMD64 ;;
+    x86_64*)
+      if test "`dpkg-architecture -qDEB_HOST_ARCH`" = x32 ; then
+        ZERO_ARCHDEF=X32
+      else
+        ZERO_ARCHDEF=AMD64
+      fi
+      ;;
     x86)     ZERO_ARCHDEF=IA32  ;;
     *)      ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z)
   esac
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk
@@ -91,9 +91,11 @@ ifneq ($(COMPILE_TYPE), cross)
 	$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
 
   # use -m32/-m64 only if the compiler supports it
+  ifneq ($(OPENJDK_TARGET_CPU),x32)
   ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG), true)
     MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
   endif
+  endif
 
   # Compile the C code into an executable.
   $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c