@@ -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
b/gcc/testsuite/gcc.target/mips/call-from-init.c
new file mode 100644
@@ -0,0 +1,11 @@
+/* Check that __do_global_ctors_aux can be reached from .init section that
+ is in a different (256MB) region. */
+/* { dg-do run { target { "mips*-*-linux*" } } } */
+/* { dg-skip-if "" { "mips*-sde-elf mips*-mti-elf mips*-img-elf" } } */
+/* { dg-options "-Wl,--section-start=.init=0x0FFF0000" } */
+/* { dg-options "-Wl,--section-start=.text=0x10000000" } */
+
+int
+main (void) {
+ return 0;
+}
b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -254,6 +254,7 @@ set mips_option_groups {
madd "HAS_MADD"
maddps "HAS_MADDPS"
lsa "(|!)HAS_LSA"
+ section_start "-Wl,--section-start=.*"
}
for { set option 0 } { $option < 32 } { incr option } {