#!/bin/sh # hack up an assembly file, from stdin, for use in SPIM # # This is fragile -- small changes to gcc will easily break this. # It would be really nice if SPIM could handle more of gcc's assembly # output, so that this file could be done away with. # # No, I'm not volunteering. :) # # $Id: hackforspim,v 1.1 2002/08/25 05:06:41 shivers Exp $ # # # hacks performed: # # ".section rodata" is changed to ".data", since SPIM doesn't have rodata # other .section directives are removed # all alignments are set to 4 -- SPIM seems to have more alignment errors than a real MIPS # all statements refering to $gp are removed # all .size directives are removed # all .comm directives are removed -- they make spim segfault! # # sed -e "s/.section[ ]*.rodata/.data/" \ -e "s/.align[ ][0-9]*/.align 4/" \ | fgrep -v .section \ | fgrep -v '$gp' \ | fgrep -v '%gp' \ | fgrep -v '.size' \ | fgrep -v '.comm'