#!/bin/bash GP=`mips-elf-nm ./main.elf | grep _gp | grep -v gpio | cut -b 1-8` cat > loader.s << EOF .text .align 2 .globl _start .ent _start _start: .frame \$sp,16,\$31 # vars= 16, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro li \$gp,0x$GP .end _start EOF