ppc map file is unordered
Giovanni Caterina
giova@idtech.be
Thu Aug 31 00:17:00 GMT 2000
I had the same problem with map files generated for h8300hms target. So I
have written a program that takes the map file as stdin and outputs to
stdout the sorted map file.
Since I was in a hurry when doing this, it's written in a "straitforward"
manner but here is it and may be it will give ideas to someone to re-write
it in a nicer manner.
I give it "as is" without any warranty that it will work with other map
files than "mines".
Hope this helps.
/*
mapsort.c
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char Tmp[256];
char Lines[256][256];
int
comp(const void * el1, const void * el2)
{
return strncmp((char *)el1 + 18, (char *)el2 + 18, 8);
}
int
main(void)
{
int LineCount, Index;
while(gets(Tmp) != NULL){
puts(Tmp);
if(strncmp(Tmp, "Linker script", 13) == 0){
break;
}
}
LineCount = 0;
while(gets(Tmp) != NULL){
if(
(strlen(Tmp) == 0)
||
(strncmp(Tmp, " ", 2) != 0)
){
if(LineCount > 1){
qsort(Lines, LineCount, 256, comp);
}
for(Index = 0; Index < LineCount;
puts(Lines[Index++]));
puts(Tmp);
LineCount = 0;
continue;
}
if(Tmp[3] == ' '){
strcpy(Lines[LineCount++], Tmp);
}
}
return 0;
}
#########################
This message has been scanned for viruses with F-Secure Anti-Virus for
Microsoft Exchange and it has been found clean.
For more information about computer viruses, connect to
http://www.F-Secure.com/vir-info/ .
#########################
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list