public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Santos <daniel.santos@pobox.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	Uros Bizjak <ubizjak@gmail.com>,	Jan Hubicka <hubicka@ucw.cz>,
	Iain Sandoe <iain@codesourcery.com>,
	Ian Lance Taylor <ian@airs.com>,
	Mike Stump <mikestump@comcast.net>,
	Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Cc: Bernd Edlinger <bernd.edlinger@hotmail.de>
Subject: [PATCH 2/2] [libgcc]: PR80759 fixes for Solaris & Darwin
Date: Sun, 02 Jul 2017 05:10:00 -0000	[thread overview]
Message-ID: <20170702051503.7572-2-daniel.santos@pobox.com> (raw)
In-Reply-To: <57df17f5-1714-a618-30a9-086c83ee7623@pobox.com>

The -mcall-ms2sysv-xlogues option is supposed to work on Solaris and
Darwin, but my changes to config.host weren't adding the sav/res stubs
to libgcc and the assembly code wasn't compatible with their assemblers
either.

* Change config.host to build -mcall-ms2sysv-xlogues sav/res stubs on
  Solaris and Darwin.
* Replace .macro/.endm with cpp macros
* Replace .global with .globl
* Append __USER_LABEL_PREFIX__ when defined (via ASMNAME macro).
* Only use .size when __ELF__ is defined.
* Only use .hidden when both __ELF__ and HAVE_GAS_HIDDEN are defined.

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
---
 libgcc/config.host             |  6 +--
 libgcc/config/i386/i386-asm.h  | 89 ++++++++++++++++++++++++++----------------
 libgcc/config/i386/resms64.S   |  2 +-
 libgcc/config/i386/resms64f.S  |  2 +-
 libgcc/config/i386/resms64fx.S |  2 +-
 libgcc/config/i386/resms64x.S  |  2 +-
 libgcc/config/i386/savms64.S   |  2 +-
 libgcc/config/i386/savms64f.S  |  2 +-
 8 files changed, 64 insertions(+), 43 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index cf62e0e54f7..bee3e931106 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -588,12 +588,12 @@ hppa*-*-openbsd*)
 	tmake_file="$tmake_file pa/t-openbsd"
 	;;
 i[34567]86-*-darwin*)
-	tmake_file="$tmake_file i386/t-crtpc t-crtfm"
+	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
 	tm_file="$tm_file i386/darwin-lib.h"
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	;;
 x86_64-*-darwin*)
-	tmake_file="$tmake_file i386/t-crtpc t-crtfm"
+	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
 	tm_file="$tm_file i386/darwin-lib.h"
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	;;
@@ -670,7 +670,7 @@ i[34567]86-*-rtems*)
 	extra_parts="$extra_parts crti.o crtn.o"
 	;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
-	tmake_file="$tmake_file i386/t-crtpc t-crtfm"
+	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tm_file="${tm_file} i386/elf-lib.h"
 	md_unwind_header=i386/sol2-unwind.h
diff --git a/libgcc/config/i386/i386-asm.h b/libgcc/config/i386/i386-asm.h
index c613e9fd83d..1387fd24b4f 100644
--- a/libgcc/config/i386/i386-asm.h
+++ b/libgcc/config/i386/i386-asm.h
@@ -26,22 +26,45 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifndef I386_ASM_H
 #define I386_ASM_H
 
+#include "auto-host.h"
+
+/* These macros currently support GNU/Linux, Solaris and Darwin.  */
+
 #ifdef __ELF__
-# define ELFFN(fn) .type fn,@function
+# define FN_TYPE(fn) .type fn,@function
+# define FN_SIZE(fn) .size fn,.-fn
+# ifdef HAVE_GAS_HIDDEN
+#  define FN_HIDDEN(fn) .hidden fn
+# endif
+#else
+# define FN_TYPE(fn)
+# define FN_SIZE(fn)
+#endif
+
+#ifndef FN_HIDDEN
+# define FN_HIDDEN(fn)
+#endif
+
+#ifdef __USER_LABEL_PREFIX__
+# define ASMNAME2(prefix, name)	prefix ## name
+# define ASMNAME1(prefix, name)	ASMNAME2(prefix, name)
+# define ASMNAME(name)		ASMNAME1(__USER_LABEL_PREFIX__, name)
 #else
-# define ELFFN(fn)
+# define ASMNAME(name)		name
 #endif
 
-#define FUNC_START(fn)	\
-	.global fn;	\
-	ELFFN (fn);	\
-fn:
+#define FUNC_BEGIN(fn)		\
+	.globl ASMNAME(fn);	\
+	FN_TYPE (ASMNAME(fn));	\
+ASMNAME(fn):
 
-#define HIDDEN_FUNC(fn)\
-	FUNC_START (fn)	\
-	.hidden fn;	\
+#define HIDDEN_FUNC(fn)		\
+	.globl ASMNAME(fn);	\
+	FN_TYPE(ASMNAME(fn));	\
+	FN_HIDDEN(ASMNAME(fn));	\
+ASMNAME(fn):
 
-#define FUNC_END(fn) .size fn,.-fn
+#define FUNC_END(fn) FN_SIZE(ASMNAME(fn))
 
 #ifdef __SSE2__
 # ifdef __AVX__
@@ -51,32 +74,30 @@ fn:
 # endif
 
 /* Save SSE registers 6-15. off is the offset of rax to get to xmm6.  */
-.macro SSE_SAVE off=0
-	MOVAPS %xmm15,(\off - 0x90)(%rax)
-	MOVAPS %xmm14,(\off - 0x80)(%rax)
-	MOVAPS %xmm13,(\off - 0x70)(%rax)
-	MOVAPS %xmm12,(\off - 0x60)(%rax)
-	MOVAPS %xmm11,(\off - 0x50)(%rax)
-	MOVAPS %xmm10,(\off - 0x40)(%rax)
-	MOVAPS %xmm9, (\off - 0x30)(%rax)
-	MOVAPS %xmm8, (\off - 0x20)(%rax)
-	MOVAPS %xmm7, (\off - 0x10)(%rax)
-	MOVAPS %xmm6, \off(%rax)
-.endm
+#define SSE_SAVE		   \
+	MOVAPS %xmm15,-0x30(%rax); \
+	MOVAPS %xmm14,-0x20(%rax); \
+	MOVAPS %xmm13,-0x10(%rax); \
+	MOVAPS %xmm12,     (%rax); \
+	MOVAPS %xmm11, 0x10(%rax); \
+	MOVAPS %xmm10, 0x20(%rax); \
+	MOVAPS %xmm9,  0x30(%rax); \
+	MOVAPS %xmm8,  0x40(%rax); \
+	MOVAPS %xmm7,  0x50(%rax); \
+	MOVAPS %xmm6,  0x60(%rax)
 
 /* Restore SSE registers 6-15. off is the offset of rsi to get to xmm6.  */
-.macro SSE_RESTORE off=0
-	MOVAPS (\off - 0x90)(%rsi), %xmm15
-	MOVAPS (\off - 0x80)(%rsi), %xmm14
-	MOVAPS (\off - 0x70)(%rsi), %xmm13
-	MOVAPS (\off - 0x60)(%rsi), %xmm12
-	MOVAPS (\off - 0x50)(%rsi), %xmm11
-	MOVAPS (\off - 0x40)(%rsi), %xmm10
-	MOVAPS (\off - 0x30)(%rsi), %xmm9
-	MOVAPS (\off - 0x20)(%rsi), %xmm8
-	MOVAPS (\off - 0x10)(%rsi), %xmm7
-	MOVAPS \off(%rsi), %xmm6
-.endm
+#define SSE_RESTORE		    \
+	MOVAPS -0x30(%rsi), %xmm15; \
+	MOVAPS -0x20(%rsi), %xmm14; \
+	MOVAPS -0x10(%rsi), %xmm13; \
+	MOVAPS      (%rsi), %xmm12; \
+	MOVAPS  0x10(%rsi), %xmm11; \
+	MOVAPS  0x20(%rsi), %xmm10; \
+	MOVAPS  0x30(%rsi), %xmm9 ; \
+	MOVAPS  0x40(%rsi), %xmm8 ; \
+	MOVAPS  0x50(%rsi), %xmm7 ; \
+	MOVAPS  0x60(%rsi), %xmm6
 
 #endif /* __SSE2__ */
 #endif /* I386_ASM_H */
diff --git a/libgcc/config/i386/resms64.S b/libgcc/config/i386/resms64.S
index f47e2f066fb..f842c20a77a 100644
--- a/libgcc/config/i386/resms64.S
+++ b/libgcc/config/i386/resms64.S
@@ -43,7 +43,7 @@ HIDDEN_FUNC(__resms64_13)
 	mov	-0x48(%rsi),%rbx
 HIDDEN_FUNC(__resms64_12)
 	mov	-0x40(%rsi),%rdi
-	SSE_RESTORE off=0x60
+	SSE_RESTORE
 	mov	-0x38(%rsi),%rsi
 	ret
 FUNC_END(__resms64_12)
diff --git a/libgcc/config/i386/resms64f.S b/libgcc/config/i386/resms64f.S
index 817da60cf15..81946cda944 100644
--- a/libgcc/config/i386/resms64f.S
+++ b/libgcc/config/i386/resms64f.S
@@ -42,7 +42,7 @@ HIDDEN_FUNC(__resms64f_13)
 	mov	-0x48(%rsi),%rbx
 HIDDEN_FUNC(__resms64f_12)
 	mov	-0x40(%rsi),%rdi
-	SSE_RESTORE off=0x60
+	SSE_RESTORE
 	mov	-0x38(%rsi),%rsi
 	ret
 FUNC_END(__resms64f_12)
diff --git a/libgcc/config/i386/resms64fx.S b/libgcc/config/i386/resms64fx.S
index 5dba5848dee..acf34fa0837 100644
--- a/libgcc/config/i386/resms64fx.S
+++ b/libgcc/config/i386/resms64fx.S
@@ -43,7 +43,7 @@ HIDDEN_FUNC(__resms64fx_13)
 	mov	-0x48(%rsi),%rbx
 HIDDEN_FUNC(__resms64fx_12)
 	mov	-0x40(%rsi),%rdi
-	SSE_RESTORE off=0x60
+	SSE_RESTORE
 	mov	-0x38(%rsi),%rsi
 	leaveq
 	ret
diff --git a/libgcc/config/i386/resms64x.S b/libgcc/config/i386/resms64x.S
index 7770447cf38..e27aab7d881 100644
--- a/libgcc/config/i386/resms64x.S
+++ b/libgcc/config/i386/resms64x.S
@@ -44,7 +44,7 @@ HIDDEN_FUNC(__resms64x_13)
 	mov	-0x48(%rsi),%rbx
 HIDDEN_FUNC(__resms64x_12)
 	mov	-0x40(%rsi),%rdi
-	SSE_RESTORE off=0x60
+	SSE_RESTORE
 	mov	-0x38(%rsi),%rsi
 	mov	%r10,%rsp
 	ret
diff --git a/libgcc/config/i386/savms64.S b/libgcc/config/i386/savms64.S
index 2067dd8614f..44dda46ec54 100644
--- a/libgcc/config/i386/savms64.S
+++ b/libgcc/config/i386/savms64.S
@@ -44,7 +44,7 @@ HIDDEN_FUNC(__savms64_13)
 HIDDEN_FUNC(__savms64_12)
 	mov	%rdi,-0x40(%rax)
 	mov	%rsi,-0x38(%rax)
-	SSE_SAVE off=0x60
+	SSE_SAVE
 	ret
 FUNC_END(__savms64_12)
 FUNC_END(__savms64_13)
diff --git a/libgcc/config/i386/savms64f.S b/libgcc/config/i386/savms64f.S
index 81583b6eb68..64e91ac0394 100644
--- a/libgcc/config/i386/savms64f.S
+++ b/libgcc/config/i386/savms64f.S
@@ -43,7 +43,7 @@ HIDDEN_FUNC(__savms64f_13)
 HIDDEN_FUNC(__savms64f_12)
 	mov	%rdi,-0x40(%rax)
 	mov	%rsi,-0x38(%rax)
-	SSE_SAVE off=0x60
+	SSE_SAVE
 	ret
 FUNC_END(__savms64f_12)
 FUNC_END(__savms64f_13)
-- 
2.11.0

  parent reply	other threads:[~2017-07-02  5:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19  6:29 [PATCH 0/2] [testsuite] PR80759 Fix test breakages on i386-pc-solaris2.* Daniel Santos
2017-05-19  6:29 ` [PATCH 1/2] [testsuite] Move non-standard parallelization support into new lib and fix flaw Daniel Santos
2017-05-19  6:50 ` [PATCH 2/2] [testsuite] PR 80759 Remove gas extensions from do-test.S, fix other problems Daniel Santos
2017-05-19  8:54   ` Rainer Orth
2017-05-20  0:38     ` Daniel Santos
2017-05-19  9:04 ` [PATCH 0/2] [testsuite] PR80759 Fix test breakages on i386-pc-solaris2.* Rainer Orth
2017-07-02  5:06 ` [PATCH v2 0/2] [testsuite, libgcc] PR80759 Fix FAILs on Solaris and Darwin Daniel Santos
2017-07-02  5:10   ` [PATCH 1/2] [testsuite] PR80759 fix tests " Daniel Santos
2017-07-02  5:10   ` Daniel Santos [this message]
2017-07-17 16:11   ` PING: [PATCH v2 0/2] [testsuite, libgcc] PR80759 Fix FAILs " Daniel Santos
2017-07-17 16:38     ` Mike Stump
2017-07-17 18:50     ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170702051503.7572-2-daniel.santos@pobox.com \
    --to=daniel.santos@pobox.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=iain@codesourcery.com \
    --cc=ian@airs.com \
    --cc=mikestump@comcast.net \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).