[polyml] 05/13: Add support for 64-bit MIPS

James Clarke jrtc27-guest at moszumanska.debian.org
Sat Mar 12 20:28:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

jrtc27-guest pushed a commit to branch master
in repository polyml.

commit be57de60fae78f104b3268ec76ced229a7b32a1c
Author: James Clarke <jrtc27 at jrtc27.com>
Date:   Fri Mar 11 16:55:22 2016 +0000

    Add support for 64-bit MIPS
---
 debian/changelog           |   1 +
 debian/patches/mips64.diff | 153 +++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series      |   1 +
 3 files changed, 155 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 87f889f..73ab4c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ polyml (5.6-3) UNRELEASED; urgency=low
   * New patches:
     - alpha.diff: Add support for alpha
     - m68k.diff: Add support for m68k
+    - mips64.diff: Add support for mips64/mips64el
 
  -- James Clarke <jrtc27 at jrtc27.com>  Tue, 02 Feb 2016 21:15:49 +0000
 
diff --git a/debian/patches/mips64.diff b/debian/patches/mips64.diff
new file mode 100644
index 0000000..89f8145
--- /dev/null
+++ b/debian/patches/mips64.diff
@@ -0,0 +1,153 @@
+Description: Add support for 64-bit MIPS
+Author: James Clarke <jrtc27 at jrtc27.com>
+Forwarded: https://github.com/polyml/polyml/pull/24
+Applied-Upstream: https://github.com/polyml/polyml/commit/df53130085ed5e9b83b69cafd5810a4415f7285b
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/config.h.in
++++ b/config.h.in
+@@ -572,6 +572,9 @@
+ /* Define if the host is a MIPS (32-bit) */
+ #undef HOSTARCHITECTURE_MIPS
+ 
++/* Define if the host is a MIPS (64-bit) */
++#undef HOSTARCHITECTURE_MIPS64
++
+ /* Define if the host is a PowerPC (32-bit) */
+ #undef HOSTARCHITECTURE_PPC
+ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -451,6 +451,10 @@
+             AC_DEFINE([HOSTARCHITECTURE_M68K], [1], [Define if the host is a Motorola 68000])
+             polyarch=interpret
+             ;;
++      mips64*)
++            AC_DEFINE([HOSTARCHITECTURE_MIPS64], [1], [Define if the host is a MIPS (64-bit)])
++            polyarch=interpret
++            ;;
+       mips*)
+             AC_DEFINE([HOSTARCHITECTURE_MIPS], [1], [Define if the host is a MIPS (32-bit)])
+             polyarch=interpret
+--- a/libpolyml/elfexport.cpp
++++ b/libpolyml/elfexport.cpp
+@@ -154,7 +154,15 @@
+         ElfXX_Rela reloc;
+         // Set the offset within the section we're scanning.
+         setRelocationAddress(relocAddr, &reloc.r_offset);
++#ifdef HOSTARCHITECTURE_MIPS64
++        reloc.r_sym = AreaToSym(addrArea);
++        reloc.r_ssym = 0;
++        reloc.r_type = directReloc;
++        reloc.r_type2 = 0;
++        reloc.r_type3 = 0;
++#else
+         reloc.r_info = ELFXX_R_INFO(AreaToSym(addrArea), directReloc);
++#endif
+         reloc.r_addend = offset;
+         fwrite(&reloc, sizeof(reloc), 1, exportFile);
+         relocationCount++;
+@@ -163,7 +171,15 @@
+     else {
+         ElfXX_Rel reloc;
+         setRelocationAddress(relocAddr, &reloc.r_offset);
++#ifdef HOSTARCHITECTURE_MIPS64
++        reloc.r_sym = AreaToSym(addrArea);
++        reloc.r_ssym = 0;
++        reloc.r_type = directReloc;
++        reloc.r_type2 = 0;
++        reloc.r_type3 = 0;
++#else
+         reloc.r_info = ELFXX_R_INFO(AreaToSym(addrArea), directReloc);
++#endif
+         fwrite(&reloc, sizeof(reloc), 1, exportFile);
+         relocationCount++;
+         return PolyWord::FromUnsigned(offset);
+@@ -285,7 +301,15 @@
+     if (useRela)
+     {
+         ElfXX_Rela reloc;
++#ifdef HOSTARCHITECTURE_MIPS64
++        reloc.r_sym = sym;
++        reloc.r_ssym = 0;
++        reloc.r_type = directReloc;
++        reloc.r_type2 = 0;
++        reloc.r_type3 = 0;
++#else
+         reloc.r_info = ELFXX_R_INFO(sym, directReloc);
++#endif
+         reloc.r_offset = offset;
+         reloc.r_addend = addend;
+         fwrite(&reloc, sizeof(reloc), 1, exportFile);
+@@ -294,7 +318,15 @@
+     else
+     {
+         ElfXX_Rel reloc;
++#ifdef HOSTARCHITECTURE_MIPS64
++        reloc.r_sym = sym;
++        reloc.r_ssym = 0;
++        reloc.r_type = directReloc;
++        reloc.r_type2 = 0;
++        reloc.r_type3 = 0;
++#else
+         reloc.r_info = ELFXX_R_INFO(sym, directReloc);
++#endif
+         reloc.r_offset = offset;
+         fwrite(&reloc, sizeof(reloc), 1, exportFile);
+         relocationCount++;
+@@ -401,6 +433,14 @@
+     fhdr.e_flags = EF_MIPS_CPIC;
+ #endif
+     useRela = true;
++#elif defined(HOSTARCHITECTURE_MIPS64)
++    fhdr.e_machine = EM_MIPS;
++    directReloc = R_MIPS_64;
++    fhdr.e_flags = EF_MIPS_ARCH_64;
++#ifdef __PIC__
++    fhdr.e_flags |= EF_MIPS_CPIC;
++#endif
++    useRela = true;
+ #elif defined(HOSTARCHITECTURE_ALPHA)
+     fhdr.e_machine = EM_ALPHA;
+     directReloc = R_ALPHA_REFQUAD;
+--- a/libpolyml/elfexport.h
++++ b/libpolyml/elfexport.h
+@@ -60,6 +60,38 @@
+ #define ELFCLASSXX              ELFCLASS32
+ #endif
+ 
++#ifdef HOSTARCHITECTURE_MIPS64
++/* MIPS N64 ABI has a different Elf64_Rel/Rela layout */
++
++typedef struct
++{
++  Elf64_Addr r_offset;      /* Address */
++  Elf64_Word r_sym;         /* Symbol index */
++  unsigned char r_ssym;     /* Special symbol */
++  unsigned char r_type3;    /* Third relocation type */
++  unsigned char r_type2;    /* Second relocation type */
++  unsigned char r_type;     /* First relocation type */
++} Elf64_Mips_Rel;
++
++typedef struct
++{
++  Elf64_Addr r_offset;      /* Address */
++  Elf64_Word r_sym;         /* Symbol index */
++  unsigned char r_ssym;     /* Special symbol */
++  unsigned char r_type3;    /* Third relocation type */
++  unsigned char r_type2;    /* Second relocation type */
++  unsigned char r_type;     /* First relocation type */
++  Elf64_Sxword r_addend;    /* Addend */
++} Elf64_Mips_Rela;
++
++#undef  ElfXX_Rel
++#define ElfXX_Rel   Elf64_Mips_Rel
++#undef  ElfXX_Rela
++#define ElfXX_Rela  Elf64_Mips_Rela
++/* Elf64_Mips_Rel/Rela has no r_info, so this macro is meaningless */
++#undef  ELFXX_R_INFO
++#endif
++
+ class TaskData;
+ 
+ class ELFExport: public Exporter, public ScanAddress
diff --git a/debian/patches/series b/debian/patches/series
index 0900b99..7708fe7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,4 @@ fix-heap-ratio-assert.diff
 use-polyunsigned-consistently-for-stream-ids.diff
 alpha.diff
 m68k.diff
+mips64.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/polyml.git



More information about the debian-science-commits mailing list