Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/csu/arch/mips Deal with O32 callling sequences.



details:   https://anonhg.NetBSD.org/src/rev/2352c8fd8ec8
branches:  trunk
changeset: 787597:2352c8fd8ec8
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jun 25 16:51:14 2013 +0000

description:
Deal with O32 callling sequences.

diffstat:

 lib/csu/arch/mips/crtbegin.h |  37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 5c657a73618c -r 2352c8fd8ec8 lib/csu/arch/mips/crtbegin.h
--- a/lib/csu/arch/mips/crtbegin.h      Tue Jun 25 16:47:47 2013 +0000
+++ b/lib/csu/arch/mips/crtbegin.h      Tue Jun 25 16:51:14 2013 +0000
@@ -28,10 +28,41 @@
  */
 
 __asm( "\n\t"
-       ".pushsection .init, \"ax\", @progbits" "\n\t"
-       "jal    __do_global_ctors_aux"          "\n\t"
+       ".pushsection .init, \"ax\", @progbits"                 "\n\t"
+#ifdef __mips_o32
+       ".set noreorder"                                        "\n\t"
+       ".set nomacro"                                          "\n\t"
+       "lw     $28,16($sp)"                                    "\n\t"
+       "nop"                                                   "\n\t"
+       "lw     $25,%got(__do_global_ctors_aux)($28)"           "\n\t"
+       "nop"                                                   "\n\t"
+       "addiu   $25,$25,%lo(__do_global_ctors_aux)"            "\n\t"
+       ".reloc 1f,R_MIPS_JALR,__do_global_ctors_aux"           "\n\t"
+       "1:     jalr    $25"                                    "\n\t"
+        "nop"                                                  "\n\t"
+       ".set macro"                                            "\n\t"
+       ".set reorder"                                          "\n\t"
+#else
+       "jal    __do_global_ctors_aux"                          "\n\t"
+#endif
        ".popsection");
+
 __asm( "\n\t"
        ".pushsection .fini, \"ax\", @progbits" "\n\t"
-       "jal    __do_global_dtors_aux"          "\n\t"
+#ifdef __mips_o32
+       ".set noreorder"                                        "\n\t"
+       ".set nomacro"                                          "\n\t"
+       "lw     $28,16($sp)"                                    "\n\t"
+       "nop"                                                   "\n\t"
+       "lw     $25,%got(__do_global_dtors_aux)($28)"           "\n\t"
+       "nop"                                                   "\n\t"
+       "addiu   $25,$25,%lo(__do_global_dtors_aux)"            "\n\t"
+       ".reloc 1f,R_MIPS_JALR,__do_global_dtors_aux"           "\n\t"
+       "1:     jalr    $25"                                    "\n\t"
+        "nop"                                                  "\n\t"
+       ".set macro"                                            "\n\t"
+       ".set reorder"                                          "\n\t"
+#else
+       "jal    __do_global_dtors_aux"                          "\n\t"
+#endif
        ".popsection");



Home | Main Index | Thread Index | Old Index