This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
x86-64 configuration files take III
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com, patches at x86-64 dot org
- Subject: x86-64 configuration files take III
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 1 Oct 2001 18:39:05 +0200
Hi,
now it is my round with the patch. I've made some changes needed to actually
build the x86-64 compiler:
1) I've added biarch64.h file, that needs to be includes first and defines
constant needed to get compiler in biarch 64bit mode.
I don't think this fits in linux64 nor x86-64.h, as we want to be able
later to compile 64bit-only compiler for perofrmance reasons.
2) I've moved ASM_QUAD to att.h, as it belongs there
3) added configury bits to override_options to enable stuff required
for 64bit compilation.
4) I've added some bits in i386.h
Bootstrapped i386 and used to build (at least partly) working x86_64
compiler together with next patch.
There are some bits in x86_64.h I am not quite happy with. They are
equivalent for netbsd/freebsd, but for instance windows port will need
them different.
Also some bits should go to gas.h, but it is true about the existing
files too, so I want to do it in the followup patch to cleanup definitions.
Honza
2001-09-23 Bo Thorsen <bo@suse.co.uk>,
Andreas Jaeger <aj@suse.de>,
Jan Hubicka <jh@suse.cz>
* doc/invoke.texi (i386 Options): Document x86-64 options.
(i386 and x86-64 Options): Rename i386 options section.
* config/i386/i386.h (TARGET_UNWIND_INFO): New.
(TARGET_SWITCHES): Add -munwind-info.
(MASK_NO_UNWIND_INFO): New.
(NO_BUILTIN_SIZE_TYPE, NO_BUILTIN_PTRDIFF_TYPE): Define for
biarch compilation.
(ASM_OUTPUT_DOUBLE_INT): New.
* config/i386/linux64.h: New spec file for Linux x86-64 support.
* config.gcc: Fix tm_file settings for x86-64.
* config/i386/x86-64.h: New file with OS independent x86-64
definitions.
* config/i386/biarch64.h: New file used to configure compiler
to biarch/64bit compilation.
* config/i386/i386.c: (override_options): Set flags default
for 64bit compilation.
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config.gcc,v
retrieving revision 1.91
diff -c -3 -p -r1.91 config.gcc
*** config.gcc 2001/09/18 21:51:52 1.91
--- config.gcc 2001/10/01 16:26:34
*************** c*-convex-*)
*** 222,227 ****
--- 222,230 ----
i[34567]86-*-*)
cpu_type=i386
;;
+ x86_64-*-*)
+ cpu_type=i386
+ ;;
hppa*-*-* | parisc*-*-*)
cpu_type=pa
;;
*************** i[34567]86-*-linux*) # Intel 80386's run
*** 1132,1137 ****
--- 1135,1153 ----
# aka GNU/Linux C library 6
xmake_file=x-linux
tm_file="i386/i386.h i386/att.h linux.h i386/linux.h"
+ tmake_file="t-slibgcc-elf-ver t-linux i386/t-crtstuff"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
+ float_format=i386
+ if test x$enable_threads = xyes; then
+ thread_file='posix'
+ fi
+ ;;
+ x86_64-*-linux*)
+ xmake_file=x-linux
+ tm_file="i386/biarch64.h i386/i386.h i386/att.h linux.h i386/x86-64.h \
+ i386/linux64.h"
+ xm_defines="TARGET_64BIT_DEFAULT NO_BUILTIN_SIZE_TYPE TARGET_BI_ARCH"
tmake_file="t-slibgcc-elf-ver t-linux i386/t-crtstuff"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
gnu_ld=yes
Index: config/i386/att.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/att.h,v
retrieving revision 1.7
diff -c -3 -p -r1.7 att.h
*** att.h 2001/05/20 19:54:04 1.7
--- att.h 2001/10/01 16:26:37
*************** Boston, MA 02111-1307, USA. */
*** 32,37 ****
--- 32,38 ----
#define ASM_SHORT "\t.value\t"
#define ASM_LONG "\t.long\t"
+ #define ASM_QUAD "\t.quad\t"
/* How to output an ASCII string constant. */
Index: config/i386/biarch64.h
===================================================================
RCS file: biarch64.h
diff -N biarch64.h
*** /dev/null Tue May 5 13:32:27 1998
--- biarch64.h Mon Oct 1 09:26:37 2001
***************
*** 0 ****
--- 1,25 ----
+ /* Make configure files to produce biarch compiler defaulting to 64bit mode.
+ This file must be included very first, while the OS specific file later
+ to overwrite otherwise wrong defaults.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Jan Hubicka <jh@suse.cz>.
+
+ This file is part of GNU CC.
+
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ #define TARGET_64BIT_DEFAULT
+ #define TARGET_BI_ARCH
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.313
diff -c -3 -p -r1.313 i386.c
*** i386.c 2001/10/01 13:24:12 1.313
--- i386.c 2001/10/01 16:26:40
*************** override_options ()
*** 984,989 ****
--- 984,999 ----
if (flag_unsafe_math_optimizations)
target_flags &= ~MASK_IEEE_FP;
+ if (TARGET_64BIT)
+ {
+ if (TARGET_ALIGN_DOUBLE)
+ error ("-malign-double makes no sense in the 64bit mode.");
+ if (TARGET_RTD)
+ error ("-mrtd calling convention not supported in the 64bit mode.");
+ /* Enable by default the SSE and MMX builtins. */
+ target_flags |= MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE;
+ }
+
/* It makes no sense to ask for just SSE builtins, so MMX is also turned
on by -msse. */
if (TARGET_SSE)
*************** i386_dwarf_output_addr_const (file, x)
*** 5141,5147 ****
--- 5177,5189 ----
FILE *file;
rtx x;
{
+ #ifdef ASM_QUAD
+ fprintf (file, "%s", TARGET_64BIT ? ASM_QUAD : INT_ASM_OP);
+ #else
+ if (TARGET_64BIT)
+ abort ();
fprintf (file, "%s", INT_ASM_OP);
+ #endif
if (flag_pic)
output_pic_addr_const (file, x, '\0');
else
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.206
diff -c -3 -p -r1.206 i386.h
*** i386.h 2001/09/28 18:00:35 1.206
--- i386.h 2001/10/01 16:26:40
*************** extern int ix86_arch;
*** 484,489 ****
--- 484,494 ----
#endif
#endif /* CPP_CPU_DEFAULT_SPEC */
+ #ifdef TARGET_BI_ARCH
+ #define NO_BUILTIN_SIZE_TYPE
+ #define NO_BUILTIN_PTRDIFF_TYPE
+ #endif
+
#ifdef NO_BUILTIN_SIZE_TYPE
#define CPP_CPU32_SIZE_TYPE_SPEC \
" -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
*************** extern int ix86_arch;
*** 653,659 ****
the stack, which results in aligned frames for functions called from
main, though it does nothing for the alignment of main itself. */
#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \
! (ix86_preferred_stack_boundary > STACK_BOUNDARY)
/* Allocation boundary for the code of a function. */
#define FUNCTION_BOUNDARY 16
--- 658,664 ----
the stack, which results in aligned frames for functions called from
main, though it does nothing for the alignment of main itself. */
#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \
! (ix86_preferred_stack_boundary > STACK_BOUNDARY && !TARGET_64BIT)
/* Allocation boundary for the code of a function. */
#define FUNCTION_BOUNDARY 16
*************** do { long l; \
*** 2907,2912 ****
--- 2912,2922 ----
#define ASM_OUTPUT_INT(FILE,VALUE) \
( fputs (ASM_LONG, FILE), \
+ output_addr_const (FILE,(VALUE)), \
+ putc('\n',FILE))
+
+ #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
+ ( fprintf (FILE, "%s\t", ASM_QUAD), \
output_addr_const (FILE,(VALUE)), \
putc('\n',FILE))
Index: config/i386/linux64.h
===================================================================
RCS file: linux64.h
diff -N linux64.h
*** /dev/null Tue May 5 13:32:27 1998
--- linux64.h Mon Oct 1 09:26:44 2001
***************
*** 0 ****
--- 1,48 ----
+ /* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
+
+ This file is part of GNU CC.
+
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ #define LINUX_DEFAULT_ELF
+
+ #undef TARGET_VERSION
+ #define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
+
+ #undef CPP_PREDEFINES
+ #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dlinux -Asystem(posix)"
+
+ #undef CPP_SPEC
+ #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} %{!m32:-D__LONG_MAX__=9223372036854775807L}"
+
+ /* Provide a LINK_SPEC. Here we provide support for the special GCC
+ options -static and -shared, which allow us to link things in one
+ of these three modes by applying the appropriate combinations of
+ options at link-time.
+
+ When the -shared link option is used a final link is not being
+ done. */
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} {shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}} \
+ %{static:-static}}"
+
Index: config/i386/x86-64.h
===================================================================
RCS file: x86-64.h
diff -N x86-64.h
*** /dev/null Tue May 5 13:32:27 1998
--- x86-64.h Mon Oct 1 09:26:44 2001
***************
*** 0 ****
--- 1,118 ----
+ /* OS independent definitions for AMD x86-64.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by Bo Thorsen <bo@suse.de>.
+
+ This file is part of GNU CC.
+
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ /* The svr4 ABI for the i386 says that records and unions are returned
+ in memory. */
+ #undef DEFAULT_PCC_STRUCT_RETURN
+ #define DEFAULT_PCC_STRUCT_RETURN 1
+
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START "#"
+
+ /* This is how to output an element of a case-vector that is relative.
+ This is only used for PIC code. See comments by the `casesi' insn in
+ i386.md for an explanation of the expression this outputs. */
+ #undef ASM_OUTPUT_ADDR_DIFF_ELT
+ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+ if (TARGET_64BIT) \
+ fprintf (FILE, "\t.long %s%d-.+4+(.-%s%d)\n", LPREFIX, VALUE, LPREFIX, REL); \
+ else \
+ fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
+
+ /* Indicate that jump tables go in the text section. This is
+ necessary when compiling PIC code. */
+ #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic && !TARGET_64BIT)
+
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(n) \
+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+ /* Output assembler code to FILE to call the profiler. */
+ #define NO_PROFILE_COUNTERS
+
+ #undef FUNCTION_PROFILER
+ #define FUNCTION_PROFILER(FILE, LABELNO) \
+ { \
+ if (TARGET_64BIT && flag_pic) \
+ fprintf (FILE, "\tcall\t*mcount@PLT\n"); \
+ else if (flag_pic) \
+ fprintf (FILE, "\tcall\t*mcount@GOT(%%ebx)\n"); \
+ else \
+ fprintf (FILE, "\tcall\tmcount\n"); \
+ }
+
+ #undef SIZE_TYPE
+ #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
+
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
+
+ #undef CC1_SPEC
+ #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
+
+ #undef ASM_SPEC
+ #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
+ %{Wa,*:%*} %{m32:--32}"
+
+ /* A C statement (sans semicolon) to output to the stdio stream
+ FILE the assembler definition of uninitialized global DECL named
+ NAME whose size is SIZE bytes and alignment is ALIGN bytes.
+ Try to use asm_output_aligned_bss to implement this macro. */
+
+ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
+ /* A C statement to output to the stdio stream FILE an assembler
+ command to advance the location counter to a multiple of 1<<LOG
+ bytes if it is within MAX_SKIP bytes.
+
+ This is used to align code labels according to Intel recommendations. */
+
+ #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+ #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
+ do { \
+ if ((LOG) != 0) { \
+ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
+ } \
+ } while (0)
+ #endif
+
+
+ /* i386 System V Release 4 uses DWARF debugging info.
+ x86-64 ABI specifies DWARF2. */
+
+ #undef DWARF2_DEBUGGING_INFO
+ #undef DWARF_DEBUGGING_INFO
+ #define DWARF2_DEBUGGING_INFO
+ #define DWARF2_UNWIND_INFO 1
+ /* Incorrectly autodetected in cross compilation. */
+ #undef HAVE_AS_DWARF2_DEBUG_LINE
+ #define HAVE_AS_DWARF2_DEBUG_LINE
+
+ #undef PREFERRED_DEBUGGING_TYPE
+ #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/invoke.texi,v
retrieving revision 1.56
diff -c -3 -p -r1.56 invoke.texi
*** invoke.texi 2001/09/29 16:33:20 1.56
--- invoke.texi 2001/10/01 16:26:47
*************** in the following sections.
*** 464,470 ****
-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol
-mfix7000 -mno-crt0}
! @emph{i386 Options}
@gccoptlist{
-mcpu=@var{cpu-type} -march=@var{cpu-type} @gol
-mintel-syntax -mieee-fp -mno-fancy-math-387 @gol
--- 464,470 ----
-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol
-mfix7000 -mno-crt0}
! @emph{i386 and x86-64 Options}
@gccoptlist{
-mcpu=@var{cpu-type} -march=@var{cpu-type} @gol
-mintel-syntax -mieee-fp -mno-fancy-math-387 @gol
*************** in the following sections.
*** 474,480 ****
-mmmx -msse -m3dnow @gol
-mthreads -mno-align-stringops -minline-all-stringops @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
! -m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer}
@emph{HPPA Options}
@gccoptlist{
--- 474,482 ----
-mmmx -msse -m3dnow @gol
-mthreads -mno-align-stringops -minline-all-stringops @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
! -m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol
! -mno-red-zone@gol
! -m32 -m64}
@emph{HPPA Options}
@gccoptlist{
*************** that macro, which enables you to change
*** 5077,5083 ****
* RS/6000 and PowerPC Options::
* RT Options::
* MIPS Options::
! * i386 Options::
* HPPA Options::
* Intel 960 Options::
* DEC Alpha Options::
--- 5079,5085 ----
* RS/6000 and PowerPC Options::
* RT Options::
* MIPS Options::
! * i386 and x86-64 Options::
* HPPA Options::
* Intel 960 Options::
* DEC Alpha Options::
*************** options is also defined by that macro, w
*** 7416,7427 ****
defaults.
@end ifset
! @node i386 Options
! @subsection Intel 386 Options
@cindex i386 Options
@cindex Intel 386 Options
! These @samp{-m} options are defined for the i386 family of computers:
@table @gcctabopt
@item -mcpu=@var{cpu-type}
--- 7418,7432 ----
defaults.
@end ifset
! @node i386 and x86-64 Options
! @subsection Intel 386 and AMD x86-64 Options
@cindex i386 Options
+ @cindex x86-64 Options
@cindex Intel 386 Options
+ @cindex AMD x86-64 Options
! These @samp{-m} options are defined for the i386 and x86-64 family of
! computers:
@table @gcctabopt
@item -mcpu=@var{cpu-type}
*************** avoids the instructions to save, set up
*** 8023,8028 ****
--- 8028,8056 ----
makes an extra register available in leaf functions. The option
@option{-fomit-frame-pointer} removes the frame pointer for all functions
which might make debugging harder.
+ @end table
+
+ These @samp{-m} switches are supported in addition to the above
+ on AMD x86-64 processors in 64-bit environments.
+
+ @table @gcctabopt
+ @item -m32
+ @itemx -m64
+ @opindex m32
+ @opindex m64
+ Generate code for a 32-bit or 64-bit environment.
+ The 32-bit environment sets int, long and pointer to 32 bits and
+ generates code that runs on any i386 system.
+ The 64-bit environment sets int to 32 bits and long and pointer
+ to 64 bits and generates code for AMD's x86-64 architecture.
+
+ @item -mno-red-zone
+ @opindex no-red-zone
+ Do not use a so called red zone for x86-64 code. The red zone is mandated
+ by the x86-64 ABI, it is a 128-byte area beyond the location of the
+ stack pointer that will not be modified by signal or interrupt handlers
+ and therefore can be used for temporary data without adjusting the stack
+ pointer. The flag @option{-mno-red-zone} disables this red zone.
@end table
@node HPPA Options