diff options
Diffstat (limited to 'libc/sysdeps/linux/mips/crt1.S')
| -rw-r--r-- | libc/sysdeps/linux/mips/crt1.S | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index 2e38cf07c..083615515 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -31,9 +31,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <sys/regdef.h> @@ -81,34 +80,17 @@ #endif .type main,@function .type __uClibc_main,@function + .ent __start __start: #ifdef __PIC__ -#if _MIPS_SIM == _MIPS_SIM_ABI32 - .set noreorder - move $0, $31 /* Save old ra. */ - bal 10f /* Find addr of cpload. */ - nop -10: - .cpload $31 - move $31, $0 - .set reorder -#else - move $0, $31; /* Save old ra. */ - .set noreorder - bal 10f /* Find addr of .cpsetup. */ - nop -10: - .set reorder - .cpsetup $31, $25, 10b - move $31, $0 -#endif + SETUP_GPX($0) + SETUP_GPX64($25,$0) #else - la $28, _gp /* Setup GP correctly if we're non-PIC. */ + PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */ move $31, $0 #endif - PTR_LA $4, main /* main */ PTR_L $5, 0($29) /* argc */ PTR_ADDIU $6, $29, PTRSIZE /* argv */ @@ -116,18 +98,18 @@ __start: /* Allocate space on the stack for seven arguments and * make sure the stack is aligned to double words (8 bytes) */ + and $29, -2 * SZREG + #if _MIPS_SIM == _MIPS_SIM_ABI32 - and $29, -2 * 4 - subu $29, 32 - la $7, _init /* init */ - la $8, _fini - sw $8, 16($29) /* fini */ - sw $2, 20($29) /* rtld_fini */ - sw $29, 24($29) /* stack_end */ -#else - and $29, -2 * PTRSIZE + PTR_SUBIU $29, 32 +#endif PTR_LA $7, _init /* init */ - PTR_LA $8, _fini /* fini */ + PTR_LA $8, _fini +#if _MIPS_SIM == _MIPS_SIM_ABI32 + PTR_S $8, 16($29) /* fini */ + PTR_S $2, 20($29) /* rtld_fini */ + PTR_S $29, 24($29) /* stack_end */ +#else move $9, $2 /* rtld_fini */ move $10, $29 /* stack_end */ #endif @@ -136,6 +118,7 @@ hlt: /* Crash if somehow `__uClibc_main' returns anyway. */ b hlt .size __start,.-__start +.end __start /* Define a symbol for the first piece of initialized data. */ .data @@ -145,4 +128,3 @@ __data_start: .weak data_start data_start = __data_start - |
