This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix compilation to native x86-64 compiler
- From: Bo Thorsen <bo at sonofthor dot dk>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, patches at x86-64 dot org
- Date: Mon, 3 Dec 2001 14:18:52 +0100
- Subject: Re: Fix compilation to native x86-64 compiler
- Organization: SuSE Labs
- References: <20011130135050.948F1BF8D9@pluto.sonofthor.dk> <20011130133539.F32134@redhat.com>
On Friday 30 November 2001 22:35, Richard Henderson wrote:
> On Fri, Nov 30, 2001 at 02:50:50PM +0100, Bo Thorsen wrote:
> > * config/i386/i386.h (MACHINE_STATE_SAVE): Disable for x86-64.
> > (MACHINE_STATE_RESTORE): Likewise.
>
> Not correct. You're controling based on the host, not the target.
Ok, I have changed that now.
2001-12-03 Bo Thorsen <bo@suse.co.uk>
* config/i386/linux64.h (LINK_SPEC): Fix name of dynamic linker.
* config/i386/i386.h (MACHINE_STATE_SAVE): Disable for x86-64.
(MACHINE_STATE_RESTORE): Likewise.
Index: config/i386/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/linux64.h,v
retrieving revision 1.2
diff -u -r1.2 linux64.h
--- linux64.h 2001/10/16 22:04:20 1.2
+++ linux64.h 2001/12/03 13:14:08
@@ -36,13 +36,17 @@
options at link-time.
When the -shared link option is used a final link is not being
- done. */
+ done.
+ TODO: The x86-64 ABI states the dynamic linker to be placed in
+ /lib, but currently glibc installs it in /lib64. Change this when
+ glibc gets corrected. */
+
#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}} \
+ %{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}} \
%{static:-static}}"
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.218
diff -u -r1.218 i386.h
--- i386.h 2001/11/15 17:55:27 1.218
+++ i386.h 2001/12/03 13:14:21
@@ -1770,30 +1770,45 @@
in the BLOCK_PROFILER macro.
Note that ebx, esi, and edi are callee-save, so we don't have to
- preserve them explicitly. */
+ preserve them explicitly.
+ These macros are not needed for x86-64. */
+
#define MACHINE_STATE_SAVE(ID) \
do { \
- register int eax_ __asm__("eax"); \
- register int ecx_ __asm__("ecx"); \
- register int edx_ __asm__("edx"); \
- __asm__ __volatile__ ("\
+ if (TARGET_64BIT) \
+ { \
+ /* This is a nop on x86-64 */ \
+ } \
+ else \
+ { \
+ register int eax_ __asm__("eax"); \
+ register int ecx_ __asm__("ecx"); \
+ register int edx_ __asm__("edx"); \
+ __asm__ __volatile__ ("\
push{l} %0\n\t\
push{l} %1\n\t\
push{l} %2" \
: : "r"(eax_), "r"(ecx_), "r"(edx_)); \
+ } \
} while (0);
-
#define MACHINE_STATE_RESTORE(ID) \
do { \
- register int eax_ __asm__("eax"); \
- register int ecx_ __asm__("ecx"); \
- register int edx_ __asm__("edx"); \
- __asm__ __volatile__ ("\
+ if (TARGET_64BIT) \
+ { \
+ /* This is a nop on x86-64 */ \
+ } \
+ else \
+ { \
+ register int eax_ __asm__("eax"); \
+ register int ecx_ __asm__("ecx"); \
+ register int edx_ __asm__("edx"); \
+ __asm__ __volatile__ ("\
pop{l} %2\n\t\
pop{l} %1\n\t\
pop{l} %0" \
: "=r"(eax_), "=r"(ecx_), "=r"(edx_)); \
+ } \
} while (0);
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
Bo.
--
Bo Thorsen | Praestevejen 4
Free software developer | 5290 Marslev
SuSE Labs | Denmark