Patch to support x86-linux --enable-targets=all
Joseph S. Myers
joseph@codesourcery.com
Sun Oct 22 20:30:00 GMT 2006
This patch allows i?86-*-linux* configurations to be built with 64-bit
support, using the same --enable-targets=all option that enables this
for powerpc-linux configurations. (Using this feature needs my recent
binutils patch
<http://sourceware.org/ml/binutils/2006-10/msg00156.html>.)
Bootstrapped with no regressions on i686-pc-linux-gnu (without the new
option) and tested on i686-pc-linux-gnu with the new option. OK to
commit?
The fixincludes change is because such biarch configurations have
wrapper files <asm/*.h> that look something like
#ifndef __ASM_STUB_POSIX_TYPES_H__
# define __ASM_STUB_POSIX_TYPES_H__
# if defined __x86_64__
# include <asm-x86_64/posix_types.h>
# endif
# if defined __i386__
# include <asm-i386/posix_types.h>
# endif
#endif
and this wrongly matches a fix for an old pre-x86_64 i386
<asm/posix_types.h> file.
gcc:
2006-10-22 Joseph Myers <joseph@codesourcery.com>
* config.gcc (i[34567]86-*-linux*): Handle --enable-targets=all.
Handle tuning for bi-arch i[34567]86-*-linux* like that for
i[34567]86-*-solaris2.1[0-9]*.
* config/i386/linux64.h (TARGET_VERSION, MULTILIB_DEFAULTS):
Define conditionally depending on TARGET_64BIT_DEFAULT.
(SPEC_32, SPEC_64): Define.
(LINK_SPEC): Use them.
* doc/install.texi (--enable-targets=all): Document for x86-linux.
libcpp:
2006-10-22 Joseph Myers <joseph@codesourcery.com>
* configure.ac (need_64bit_hwint): Set for i[34567]86-*-linux*
depending on --enable-targets=all.
* configure: Regenerate.
fixincludes:
2006-10-22 Joseph Myers <joseph@codesourcery.com>
* inclhack.def (AAB_fd_zero_asm_posix_types_h): Bypass on x86_64.
* fixincl.x: Regenerate.
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi (revision 117956)
+++ gcc/doc/install.texi (working copy)
@@ -1154,7 +1154,7 @@
option enables the 32-bit target to be a bi-arch compiler, which is
useful when you want a bi-arch compiler that defaults to 32-bit, and
you are building a bi-arch or multi-arch binutils in a combined tree.
-Currently, this option only affects powerpc-linux.
+Currently, this option only affects powerpc-linux and x86-linux.
@item --enable-secureplt
This option enables @option{-msecure-plt} by default for powerpc-linux.
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc (revision 117956)
+++ gcc/config.gcc (working copy)
@@ -1075,10 +1075,34 @@
i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
# Intel 80386's running GNU/*
# with ELF format using glibc 2
- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h"
case ${target} in
- i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
- i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
+ i[34567]86-*-linux*)
+ if test x$enable_targets = xall; then
+ tm_file="${tm_file} i386/x86-64.h i386/linux64.h"
+ tm_defines="${tm_defines} TARGET_BI_ARCH=1"
+ tmake_file="${tmake_file} i386/t-linux64"
+ need_64bit_hwint=yes
+ # FIXME: -m64 for i[34567]86-*-* should be allowed just
+ # like -m32 for x86_64-*-*.
+ case X"${with_cpu}" in
+ Xgeneric|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx)
+ ;;
+ X)
+ with_cpu=generic
+ ;;
+ *)
+ echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
+ echo "generic nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ tm_file="${tm_file} i386/linux.h"
+ fi
+ ;;
+ i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} i386/linux.h knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
+ i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} i386/linux.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
esac
tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtfm t-dfprules"
;;
Index: gcc/config/i386/linux64.h
===================================================================
--- gcc/config/i386/linux64.h (revision 117956)
+++ gcc/config/i386/linux64.h (working copy)
@@ -19,7 +19,11 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+#if TARGET_64BIT_DEFAULT
#define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
+#else
+#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
+#endif
#define TARGET_OS_CPP_BUILTINS() \
do \
@@ -52,14 +56,22 @@
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#if TARGET_64BIT_DEFAULT
+#define SPEC_32 "m32"
+#define SPEC_64 "!m32"
+#else
+#define SPEC_32 "!m64"
+#define SPEC_64 "m64"
+#endif
+
#undef LINK_SPEC
-#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
+#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
%{shared:-shared} \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
- %{m32:%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
- %{!m32:%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
+ %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
+ %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
%{static:-static}}"
/* Similar to standard Linux, but adding -ffast-math support. */
@@ -68,7 +80,11 @@
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+#if TARGET_64BIT_DEFAULT
#define MULTILIB_DEFAULTS { "m64" }
+#else
+#define MULTILIB_DEFAULTS { "m32" }
+#endif
#undef NEED_INDICATE_EXEC_STACK
#define NEED_INDICATE_EXEC_STACK 1
Index: libcpp/configure.ac
===================================================================
--- libcpp/configure.ac (revision 117956)
+++ libcpp/configure.ac (working copy)
@@ -130,6 +130,13 @@
sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \
sh[123456789l]*-*-*)
need_64bit_hwint=yes ;;
+ i[34567]86-*-linux*)
+ if test "x$enable_targets" = xall; then
+ need_64bit_hwint=yes
+ else
+ need_64bit_hwint=no
+ fi
+ ;;
*)
need_64bit_hwint=no ;;
esac
Index: fixincludes/inclhack.def
===================================================================
--- fixincludes/inclhack.def (revision 117956)
+++ fixincludes/inclhack.def (working copy)
@@ -140,6 +140,7 @@
files = asm/posix_types.h;
mach = 'i[34567]86-*-linux*';
bypass = '} while';
+ bypass = 'x86_64';
/*
* Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list