< prev index next >

src/os/linux/vm/os_linux.cpp

Print this page
rev 13486 : 8186723: Add SuperH as new architecture for linux


1731   } arch_t;
1732 
1733 #ifndef EM_486
1734   #define EM_486          6               /* Intel 80486 */
1735 #endif
1736 #ifndef EM_AARCH64
1737   #define EM_AARCH64    183               /* ARM AARCH64 */
1738 #endif
1739 
1740   static const arch_t arch_array[]={
1741     {EM_386,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1742     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1743     {EM_IA_64,       EM_IA_64,   ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
1744     {EM_X86_64,      EM_X86_64,  ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},
1745     {EM_SPARC,       EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1746     {EM_SPARC32PLUS, EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1747     {EM_SPARCV9,     EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
1748     {EM_PPC,         EM_PPC,     ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
1749 #if defined(VM_LITTLE_ENDIAN)
1750     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2LSB, (char*)"Power PC 64 LE"},

1751 #else
1752     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},

1753 #endif
1754     {EM_ARM,         EM_ARM,     ELFCLASS32,   ELFDATA2LSB, (char*)"ARM"},
1755     {EM_S390,        EM_S390,    ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
1756     {EM_ALPHA,       EM_ALPHA,   ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
1757     {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
1758     {EM_MIPS,        EM_MIPS,    ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
1759     {EM_PARISC,      EM_PARISC,  ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
1760     {EM_68K,         EM_68K,     ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
1761     {EM_AARCH64,     EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
1762   };
1763 
1764 #if  (defined IA32)
1765   static  Elf32_Half running_arch_code=EM_386;
1766 #elif   (defined AMD64)
1767   static  Elf32_Half running_arch_code=EM_X86_64;
1768 #elif  (defined IA64)
1769   static  Elf32_Half running_arch_code=EM_IA_64;
1770 #elif  (defined __sparc) && (defined _LP64)
1771   static  Elf32_Half running_arch_code=EM_SPARCV9;
1772 #elif  (defined __sparc) && (!defined _LP64)


1774 #elif  (defined __powerpc64__)
1775   static  Elf32_Half running_arch_code=EM_PPC64;
1776 #elif  (defined __powerpc__)
1777   static  Elf32_Half running_arch_code=EM_PPC;
1778 #elif  (defined AARCH64)
1779   static  Elf32_Half running_arch_code=EM_AARCH64;
1780 #elif  (defined ARM)
1781   static  Elf32_Half running_arch_code=EM_ARM;
1782 #elif  (defined S390)
1783   static  Elf32_Half running_arch_code=EM_S390;
1784 #elif  (defined ALPHA)
1785   static  Elf32_Half running_arch_code=EM_ALPHA;
1786 #elif  (defined MIPSEL)
1787   static  Elf32_Half running_arch_code=EM_MIPS_RS3_LE;
1788 #elif  (defined PARISC)
1789   static  Elf32_Half running_arch_code=EM_PARISC;
1790 #elif  (defined MIPS)
1791   static  Elf32_Half running_arch_code=EM_MIPS;
1792 #elif  (defined M68K)
1793   static  Elf32_Half running_arch_code=EM_68K;


1794 #else
1795     #error Method os::dll_load requires that one of following is defined:\
1796         AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, S390, __sparc
1797 #endif
1798 
1799   // Identify compatability class for VM's architecture and library's architecture
1800   // Obtain string descriptions for architectures
1801 
1802   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
1803   int running_arch_index=-1;
1804 
1805   for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
1806     if (running_arch_code == arch_array[i].code) {
1807       running_arch_index    = i;
1808     }
1809     if (lib_arch.code == arch_array[i].code) {
1810       lib_arch.compat_class = arch_array[i].compat_class;
1811       lib_arch.name         = arch_array[i].name;
1812     }
1813   }
1814 
1815   assert(running_arch_index != -1,
1816          "Didn't find running architecture code (running_arch_code) in arch_array");




1731   } arch_t;
1732 
1733 #ifndef EM_486
1734   #define EM_486          6               /* Intel 80486 */
1735 #endif
1736 #ifndef EM_AARCH64
1737   #define EM_AARCH64    183               /* ARM AARCH64 */
1738 #endif
1739 
1740   static const arch_t arch_array[]={
1741     {EM_386,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1742     {EM_486,         EM_386,     ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
1743     {EM_IA_64,       EM_IA_64,   ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
1744     {EM_X86_64,      EM_X86_64,  ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},
1745     {EM_SPARC,       EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1746     {EM_SPARC32PLUS, EM_SPARC,   ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
1747     {EM_SPARCV9,     EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
1748     {EM_PPC,         EM_PPC,     ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
1749 #if defined(VM_LITTLE_ENDIAN)
1750     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2LSB, (char*)"Power PC 64 LE"},
1751     {EM_SH,          EM_SH,      ELFCLASS32, ELFDATA2LSB, (char*)"SuperH"},
1752 #else
1753     {EM_PPC64,       EM_PPC64,   ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
1754     {EM_SH,          EM_SH,      ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
1755 #endif
1756     {EM_ARM,         EM_ARM,     ELFCLASS32,   ELFDATA2LSB, (char*)"ARM"},
1757     {EM_S390,        EM_S390,    ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
1758     {EM_ALPHA,       EM_ALPHA,   ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
1759     {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
1760     {EM_MIPS,        EM_MIPS,    ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
1761     {EM_PARISC,      EM_PARISC,  ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
1762     {EM_68K,         EM_68K,     ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
1763     {EM_AARCH64,     EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
1764   };
1765 
1766 #if  (defined IA32)
1767   static  Elf32_Half running_arch_code=EM_386;
1768 #elif   (defined AMD64)
1769   static  Elf32_Half running_arch_code=EM_X86_64;
1770 #elif  (defined IA64)
1771   static  Elf32_Half running_arch_code=EM_IA_64;
1772 #elif  (defined __sparc) && (defined _LP64)
1773   static  Elf32_Half running_arch_code=EM_SPARCV9;
1774 #elif  (defined __sparc) && (!defined _LP64)


1776 #elif  (defined __powerpc64__)
1777   static  Elf32_Half running_arch_code=EM_PPC64;
1778 #elif  (defined __powerpc__)
1779   static  Elf32_Half running_arch_code=EM_PPC;
1780 #elif  (defined AARCH64)
1781   static  Elf32_Half running_arch_code=EM_AARCH64;
1782 #elif  (defined ARM)
1783   static  Elf32_Half running_arch_code=EM_ARM;
1784 #elif  (defined S390)
1785   static  Elf32_Half running_arch_code=EM_S390;
1786 #elif  (defined ALPHA)
1787   static  Elf32_Half running_arch_code=EM_ALPHA;
1788 #elif  (defined MIPSEL)
1789   static  Elf32_Half running_arch_code=EM_MIPS_RS3_LE;
1790 #elif  (defined PARISC)
1791   static  Elf32_Half running_arch_code=EM_PARISC;
1792 #elif  (defined MIPS)
1793   static  Elf32_Half running_arch_code=EM_MIPS;
1794 #elif  (defined M68K)
1795   static  Elf32_Half running_arch_code=EM_68K;
1796 #elif  (defined SH)
1797   static  Elf32_Half running_arch_code=EM_SH;
1798 #else
1799     #error Method os::dll_load requires that one of following is defined:\
1800         AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, S390, SH, __sparc
1801 #endif
1802 
1803   // Identify compatability class for VM's architecture and library's architecture
1804   // Obtain string descriptions for architectures
1805 
1806   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
1807   int running_arch_index=-1;
1808 
1809   for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
1810     if (running_arch_code == arch_array[i].code) {
1811       running_arch_index    = i;
1812     }
1813     if (lib_arch.code == arch_array[i].code) {
1814       lib_arch.compat_class = arch_array[i].compat_class;
1815       lib_arch.name         = arch_array[i].name;
1816     }
1817   }
1818 
1819   assert(running_arch_index != -1,
1820          "Didn't find running architecture code (running_arch_code) in arch_array");


< prev index next >