summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetar Jovanovic <mips32r2@gmail.com>2017-10-10 18:06:14 +0200
committerPetar Jovanovic <mips32r2@gmail.com>2017-10-10 18:06:14 +0200
commitc069589178d54e2ae5a22fab60b7068414598d48 (patch)
tree1fce9995876ab41bef90ce0759a91ba6ad522690
parentPPC64, vpermr, xxperm, xxpermr fix Iop_Perm8x16 selector field (diff)
downloadvalgrind-c069589178d54e2ae5a22fab60b7068414598d48.tar.gz
valgrind-c069589178d54e2ae5a22fab60b7068414598d48.tar.bz2
valgrind-c069589178d54e2ae5a22fab60b7068414598d48.tar.xz
mips: add support for bi-arch build on mips64
If native compiler can build Valgrind for mips32 o32 on native mips64 system, it should do it. This change adds a second architecture for MIPS in a similar way how it has been previously done for amd64 and ppc64.
-rw-r--r--Makefile.all.am12
-rw-r--r--configure.ac187
2 files changed, 119 insertions, 80 deletions
diff --git a/Makefile.all.am b/Makefile.all.am
index 1859a51..faa170d 100644
--- a/Makefile.all.am
+++ b/Makefile.all.am
@@ -230,16 +230,16 @@ AM_CFLAGS_PSO_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
230AM_CCASFLAGS_S390X_LINUX = @FLAG_M64@ -g -mzarch -march=z900 230AM_CCASFLAGS_S390X_LINUX = @FLAG_M64@ -g -mzarch -march=z900
231 231
232AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@ 232AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@
233AM_CFLAGS_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@ 233AM_CFLAGS_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE)
234AM_CFLAGS_PSO_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@ \ 234AM_CFLAGS_PSO_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) \
235 $(AM_CFLAGS_PSO_BASE) 235 $(AM_CFLAGS_PSO_BASE)
236AM_CCASFLAGS_MIPS32_LINUX = @FLAG_M32@ -g @FLAG_MIPS32@ 236AM_CCASFLAGS_MIPS32_LINUX = @FLAG_M32@ -g
237 237
238AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@ 238AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@
239AM_CFLAGS_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@ 239AM_CFLAGS_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
240AM_CFLAGS_PSO_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@ \ 240AM_CFLAGS_PSO_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) \
241 $(AM_CFLAGS_PSO_BASE) 241 $(AM_CFLAGS_PSO_BASE)
242AM_CCASFLAGS_MIPS64_LINUX = @FLAG_M64@ -g @FLAG_MIPS64@ 242AM_CCASFLAGS_MIPS64_LINUX = @FLAG_M64@ -g
243 243
244AM_FLAG_M3264_X86_SOLARIS = @FLAG_M32@ 244AM_FLAG_M3264_X86_SOLARIS = @FLAG_M32@
245AM_CFLAGS_X86_SOLARIS = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \ 245AM_CFLAGS_X86_SOLARIS = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \
diff --git a/configure.ac b/configure.ac
index 392081d..4d45218 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,19 @@ case "$ARCH_MAX-$VGCONF_OS" in
479 AC_MSG_RESULT([no]) 479 AC_MSG_RESULT([no])
480 ]) 480 ])
481 CFLAGS=$safe_CFLAGS;; 481 CFLAGS=$safe_CFLAGS;;
482 mips64-linux)
483 AC_MSG_CHECKING([for 32 bit build support])
484 safe_CFLAGS=$CFLAGS
485 CFLAGS="$CFLAGS -mips32 -mabi=32"
486 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
487 #include <sys/prctl.h>
488 ]], [[]])], [
489 AC_MSG_RESULT([yes])
490 ], [
491 vg_cv_only64bit="yes"
492 AC_MSG_RESULT([no])
493 ])
494 CFLAGS=$safe_CFLAGS;;
482esac 495esac
483 496
484if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then 497if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
@@ -715,6 +728,7 @@ case "$ARCH_MAX-$VGCONF_OS" in
715 ;; 728 ;;
716 mips32-linux) 729 mips32-linux)
717 VGCONF_ARCH_PRI="mips32" 730 VGCONF_ARCH_PRI="mips32"
731 VGCONF_ARCH_SEC=""
718 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX" 732 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
719 VGCONF_PLATFORM_SEC_CAPS="" 733 VGCONF_PLATFORM_SEC_CAPS=""
720 valt_load_address_pri_norml="0x58000000" 734 valt_load_address_pri_norml="0x58000000"
@@ -724,13 +738,32 @@ case "$ARCH_MAX-$VGCONF_OS" in
724 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) 738 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
725 ;; 739 ;;
726 mips64-linux) 740 mips64-linux)
727 VGCONF_ARCH_PRI="mips64"
728 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
729 VGCONF_PLATFORM_SEC_CAPS=""
730 valt_load_address_pri_norml="0x58000000"
731 valt_load_address_pri_inner="0x38000000"
732 valt_load_address_sec_norml="0xUNSET" 741 valt_load_address_sec_norml="0xUNSET"
733 valt_load_address_sec_inner="0xUNSET" 742 valt_load_address_sec_inner="0xUNSET"
743 if test x$vg_cv_only64bit = xyes; then
744 VGCONF_ARCH_PRI="mips64"
745 VGCONF_PLATFORM_SEC_CAPS=""
746 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
747 VGCONF_PLATFORM_SEC_CAPS=""
748 valt_load_address_pri_norml="0x58000000"
749 valt_load_address_pri_inner="0x38000000"
750 elif test x$vg_cv_only32bit = xyes; then
751 VGCONF_ARCH_PRI="mips32"
752 VGCONF_ARCH_SEC=""
753 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x58000000"
756 valt_load_address_pri_inner="0x38000000"
757 else
758 VGCONF_ARCH_PRI="mips64"
759 VGCONF_ARCH_SEC="mips32"
760 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
761 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
762 valt_load_address_pri_norml="0x58000000"
763 valt_load_address_pri_inner="0x38000000"
764 valt_load_address_sec_norml="0x58000000"
765 valt_load_address_sec_inner="0x38000000"
766 fi
734 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) 767 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
735 ;; 768 ;;
736 x86-solaris) 769 x86-solaris)
@@ -816,7 +849,8 @@ AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
816AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X, 849AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
817 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ) 850 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
818AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32, 851AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
819 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX ) 852 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
853 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
820AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64, 854AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
821 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ) 855 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
822 856
@@ -843,7 +877,8 @@ AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
843 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ 877 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
844 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX) 878 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
845AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX, 879AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
846 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX) 880 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
881 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
847AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX, 882AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
848 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX) 883 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
849AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN, 884AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
@@ -1679,91 +1714,94 @@ fi
1679# Checking for supported compiler flags. 1714# Checking for supported compiler flags.
1680#---------------------------------------------------------------------------- 1715#----------------------------------------------------------------------------
1681 1716
1682# does this compiler support -m32 ? 1717case "${host_cpu}" in
1683AC_MSG_CHECKING([if gcc accepts -m32]) 1718 mips*)
1684 1719 # does this compiler support -march=mips32 (mips32 default) ?
1685safe_CFLAGS=$CFLAGS 1720 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
1686CFLAGS="-m32 -Werror"
1687
1688AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1689 return 0;
1690]])], [
1691FLAG_M32="-m32"
1692AC_MSG_RESULT([yes])
1693], [
1694FLAG_M32=""
1695AC_MSG_RESULT([no])
1696])
1697CFLAGS=$safe_CFLAGS
1698
1699AC_SUBST(FLAG_M32)
1700 1721
1722 safe_CFLAGS=$CFLAGS
1723 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
1701 1724
1702# does this compiler support -m64 ? 1725 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1703AC_MSG_CHECKING([if gcc accepts -m64]) 1726 return 0;
1727 ]])], [
1728 FLAG_M32="-mips32 -mabi=32"
1729 AC_MSG_RESULT([yes])
1730 ], [
1731 FLAG_M32=""
1732 AC_MSG_RESULT([no])
1733 ])
1734 CFLAGS=$safe_CFLAGS
1704 1735
1705safe_CFLAGS=$CFLAGS 1736 AC_SUBST(FLAG_M32)
1706CFLAGS="-m64 -Werror"
1707 1737
1708AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1709 return 0;
1710]])], [
1711FLAG_M64="-m64"
1712AC_MSG_RESULT([yes])
1713], [
1714FLAG_M64=""
1715AC_MSG_RESULT([no])
1716])
1717CFLAGS=$safe_CFLAGS
1718 1738
1719AC_SUBST(FLAG_M64) 1739 # does this compiler support -march=mips64r2 (mips64r2 default) ?
1740 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
1720 1741
1742 safe_CFLAGS=$CFLAGS
1743 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
1721 1744
1722# does this compiler support -march=mips32 (mips32 default) ? 1745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1723AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32]) 1746 return 0;
1747 ]])], [
1748 FLAG_M64="-march=mips64r2 -mabi=64"
1749 AC_MSG_RESULT([yes])
1750 ], [
1751 FLAG_M64=""
1752 AC_MSG_RESULT([no])
1753 ])
1754 CFLAGS=$safe_CFLAGS
1724 1755
1725safe_CFLAGS=$CFLAGS 1756 AC_SUBST(FLAG_M64)
1726CFLAGS="$CFLAGS -march=mips32 -mabi=32 -Werror" 1757 ;;
1758 *)
1759 # does this compiler support -m32 ?
1760 AC_MSG_CHECKING([if gcc accepts -m32])
1727 1761
1728AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ 1762 safe_CFLAGS=$CFLAGS
1729 return 0; 1763 CFLAGS="-m32 -Werror"
1730]])], [
1731FLAG_MIPS32="-march=mips32 -mabi=32"
1732AC_MSG_RESULT([yes])
1733], [
1734FLAG_MIPS32=""
1735AC_MSG_RESULT([no])
1736])
1737CFLAGS=$safe_CFLAGS
1738 1764
1739AC_SUBST(FLAG_MIPS32) 1765 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1766 return 0;
1767 ]])], [
1768 FLAG_M32="-m32"
1769 AC_MSG_RESULT([yes])
1770 ], [
1771 FLAG_M32=""
1772 AC_MSG_RESULT([no])
1773 ])
1774 CFLAGS=$safe_CFLAGS
1740 1775
1776 AC_SUBST(FLAG_M32)
1741 1777
1742# does this compiler support -march=mips64r2 (mips64r2 default) ?
1743AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
1744 1778
1745safe_CFLAGS=$CFLAGS 1779 # does this compiler support -m64 ?
1746CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror" 1780 AC_MSG_CHECKING([if gcc accepts -m64])
1747 1781
1748AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ 1782 safe_CFLAGS=$CFLAGS
1749 return 0; 1783 CFLAGS="-m64 -Werror"
1750]])], [
1751FLAG_MIPS64="-march=mips64r2 -mabi=64"
1752AC_MSG_RESULT([yes])
1753], [
1754FLAG_MIPS64=""
1755AC_MSG_RESULT([no])
1756])
1757CFLAGS=$safe_CFLAGS
1758 1784
1759AC_SUBST(FLAG_MIPS64) 1785 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1786 return 0;
1787 ]])], [
1788 FLAG_M64="-m64"
1789 AC_MSG_RESULT([yes])
1790 ], [
1791 FLAG_M64=""
1792 AC_MSG_RESULT([no])
1793 ])
1794 CFLAGS=$safe_CFLAGS
1760 1795
1796 AC_SUBST(FLAG_M64)
1797 ;;
1798esac
1761 1799
1762# does this compiler support -march=octeon (Cavium OCTEON I Specific) ? 1800# does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1763AC_MSG_CHECKING([if gcc accepts -march=octeon]) 1801AC_MSG_CHECKING([if gcc accepts -march=octeon])
1764 1802
1765safe_CFLAGS=$CFLAGS 1803safe_CFLAGS=$CFLAGS
1766CFLAGS="$CFLAGS -march=octeon -Werror" 1804CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
1767 1805
1768AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ 1806AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1769 return 0; 1807 return 0;
@@ -1783,7 +1821,7 @@ AC_SUBST(FLAG_OCTEON)
1783AC_MSG_CHECKING([if gcc accepts -march=octeon2]) 1821AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1784 1822
1785safe_CFLAGS=$CFLAGS 1823safe_CFLAGS=$CFLAGS
1786CFLAGS="$CFLAGS -march=octeon2 -Werror" 1824CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
1787 1825
1788AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ 1826AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1789 return 0; 1827 return 0;
@@ -3953,12 +3991,12 @@ if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
3953 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ 3991 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
3954 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ 3992 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
3955 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ 3993 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3956 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3957 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then 3994 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
3958 mflag_primary=$FLAG_M32 3995 mflag_primary=$FLAG_M32
3959elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ 3996elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
3960 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ 3997 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
3961 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \ 3998 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
3999 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3962 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then 4000 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
3963 mflag_primary=$FLAG_M64 4001 mflag_primary=$FLAG_M64
3964elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then 4002elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
@@ -3970,7 +4008,8 @@ fi
3970mflag_secondary= 4008mflag_secondary=
3971if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ 4009if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
3972 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \ 4010 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3973 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then 4011 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4012 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX ; then
3974 mflag_secondary=$FLAG_M32 4013 mflag_secondary=$FLAG_M32
3975elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then 4014elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3976 mflag_secondary="$FLAG_M32 -arch i386" 4015 mflag_secondary="$FLAG_M32 -arch i386"