This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
- From: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- To: Petar Jovanovic <petar dot jovanovic at rt-rk dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "'Maciej W. Rozycki'" <macro at linux-mips dot org>
- Cc: "Moore, Catherine (Catherine_Moore at mentor dot com)" <Catherine_Moore at mentor dot com>
- Date: Thu, 5 Feb 2015 20:51:30 +0000
- Subject: RE: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
- Authentication-results: sourceware.org; auth=none
- References: <003e01d04179$ccc38bc0$664aa340$ at rt-rk dot com>
Hi Petar,
I've put your patch inline below and switched to plain text. I suspect
your post was bounced by gcc-patches.
I'm OK with this change but I'd like Catherine to comment before committing.
It seems a shame to duplicate the block of code but it is probably just as
ugly to define a macro for the la/dla instruction.
For future reference, it is best not to include changelog content in a patch
but instead just paste into the email. Also the ChangeLog you need for this
change is gcc/ChangeLog (as confusing as that may be at first).
Thanks,
Matthew
> From: Petar Jovanovic [mailto:petar.jovanovic@rt-rk.com]
> Sent: 05 February 2015 19:28
> To: gcc-patches@gcc.gnu.org; 'Maciej W. Rozycki'; Matthew Fortune
> Subject: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
>
> v2:
> - add ChangeLog entry
> - use DLA instead of LA for n64
>
> PTAL. Thanks.
>
> Regards,
> Petar
---
ChangeLog | 5 +++++
gcc/config/mips/mips.h | 23 +++++++++++++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5c61c66..3a15f4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-05 Petar Jovanovic <petar.jovanovic@rt-rk.com>
+
+ * config/mips/mips.h (CRT_CALL_STATIC_FUNCTION): Fix the macro to use
+ la/jalr instead of jal.
+
2015-02-02 Janis Johnson <janis.marie.johnson@gmail.com>
* MAINTAINERS (Various Maintainers: testsuite): Remove myself.
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index ec69ed5..4bd83f5 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3034,11 +3034,11 @@ while (0)
nop\n\
1: .cpload $31\n\
.set reorder\n\
- jal " USER_LABEL_PREFIX #FUNC "\n\
+ la $25, " USER_LABEL_PREFIX #FUNC "\n\
+ jalr $25\n\
.set pop\n\
" TEXT_SECTION_ASM_OP);
-#elif ((defined _ABIN32 && _MIPS_SIM == _ABIN32) \
- || (defined _ABI64 && _MIPS_SIM == _ABI64))
+#elif (defined _ABIN32 && _MIPS_SIM == _ABIN32)
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
asm (SECTION_OP "\n\
.set push\n\
@@ -3048,7 +3048,22 @@ while (0)
nop\n\
1: .set reorder\n\
.cpsetup $31, $2, 1b\n\
- jal " USER_LABEL_PREFIX #FUNC "\n\
+ la $25, " USER_LABEL_PREFIX #FUNC "\n\
+ jalr $25\n\
+ .set pop\n\
+ " TEXT_SECTION_ASM_OP);
+#elif (defined _ABI64 && _MIPS_SIM == _ABI64)
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n\
+ .set push\n\
+ .set nomips16\n\
+ .set noreorder\n\
+ bal 1f\n\
+ nop\n\
+1: .set reorder\n\
+ .cpsetup $31, $2, 1b\n\
+ dla $25, " USER_LABEL_PREFIX #FUNC "\n\
+ jalr $25\n\
.set pop\n\
" TEXT_SECTION_ASM_OP);
#endif
--
1.8.2.1