Mercurial > hg > Game > Cerium
view example/get_segment/spe/fixpic.pl @ 460:433892ba596b draft
fix Scheduler.h
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Sep 2009 11:51:25 +0900 |
parents | cebb48da955e |
children | 3aaa9da117f4 |
line wrap: on
line source
#!/usr/bin/perl # # Author: Shinji KONO <kono@ie.u-ryukyu.ac.jp> # v.0.1 Sat May 30 04:41:18 JST 2009 # # fix spu-gcc assembler soruce for DMA loadable PIC code # #$(OVLOBJS): %.o : %.cc # $(SPECC) $(SPECFLAGS) -c $< -S -o $(<:.cc=.s) # perl spe/fixpic.pl $(<:.cc=.s) | $(SPECC) $(SPECFLAGS) -x assembler -c -o $@ - use strict; my %global; my %local; my %weak; my @line; # Basically SPU code is PIC. But linked library is in the fixed # address space. # # rewrite relative to absolute for global branch address # # Target instruction # hbrr -> hbra # br -> bra # brsl -> brasl # brnz cannot be global while(<>) { push(@line,$_); if(/\.global\s+([^\s]+)/) { $global{$1} = 1; } if(/\.weak\s+([^\s]+)/) { $weak{$1} = 1; next; } if(/^([^\s]+):/) { $local{$1} = 1; } } for(@line) { if (! /^#/) { if(/\s(br)\s+([^\s]+)/||/\s(brsl|hbrr)\s+[^\s]+,\s*([^\s]+)/) { my $name = $2; if (! defined $local{$name} || defined $weak{$name} ) { s/hbrr/hbra/ || s/brsl/brasl/ || s/br/bra/ ; } } } print ; } # end