File openjdk-6-src-b09-s390+s390x.patch of Package java-1_6_0-openjdk

The first two patches are required for s390 and s390x compile to succeed:

--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
@@ -1686,6 +1686,12 @@
     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
     {EM_IA_64,       EM_IA_64,   ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
     {EM_X86_64,      EM_X86_64,  ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},
+    // On S/390, EM_S390 is used by both s390 and s390x (32 and 64bit)
+#ifdef __s390x__
+    {EM_S390,        EM_S390,    ELFCLASS64, ELFDATA2MSB, (char*)"S/390X"},
+#else
+    {EM_S390,        EM_S390,    ELFCLASS32, ELFDATA2MSB, (char*)"S/390"},
+#endif
     {EM_SPARC,       EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
     {EM_SPARC32PLUS, EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
     {EM_SPARCV9,     EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
@@ -1700,6 +1718,11 @@
     static  Elf32_Half running_arch_code=EM_X86_64;
   #elif  (defined IA64)
     static  Elf32_Half running_arch_code=EM_IA_64;
+  // There is no EM_S390X, so we can only check for S/390 overall.
+  // The ELF class (32-bit / 64-bit) is checked separately so we 
+  // don't need to make a distinction beween 32-bit and 64-bit here:
+  #elif  (defined __s390__)
+    static  Elf32_Half running_arch_code=EM_S390;
   #elif  (defined __sparc) && (defined _LP64)
     static  Elf32_Half running_arch_code=EM_SPARCV9;
   #elif  (defined __sparc) && (!defined _LP64)

This is crafted for testing to also see what is going on and make the build succeed
in any case, so apply this only on s390 and s390x for now:

--- openjdk/hotspot/build/linux/makefiles/gcc.make
+++ openjdk/hotspot/build/linux/makefiles/gcc.make
@@ -46,10 +46,10 @@
 # Compiler flags
 
 # position-independent code
-ifneq ($(filter ppc ppc64 sparc sparc64,$(ZERO_LIBARCH)),)
+ifneq ($(filter ppc ppc64 sparc sparc64 s390 s390x,$(ZERO_LIBARCH)),)
 PICFLAG = -fPIC
 else
-PICFLAG = -fpic
+PICFLAG = -fpic -fPIC
 endif
 
 VM_PICFLAG/LIBJVM = $(PICFLAG)

This one is not actually used, but should be submitted upstream as well:

--- contrib/templater/generate.py	2008/04/22 01:52:34	1.1
+++ contrib/templater/generate.py	2008/04/22 01:53:04
@@ -6,8 +6,8 @@
 cpus = {"ia64":  ("little", 64, True),
         "ppc":   ("big",    32, False),
         "ppc64": ("big",    64, False),
-        "s390":  ("little", 32, False),
-        "s390x": ("little", 64, False)}
+        "s390":  ("big",    32, False),
+        "s390x": ("big",    64, False)}
 
 modes = {"ia64":  ("ia64",),
          "ppc":   ("ppc", "ppc64"),
openSUSE Build Service is sponsored by