Subject: Re: asm2gas in m68k/fpsp
To: Scott Reynolds <scottr@og.org>
From: I-Jong Lin <ijonglin@EE.Princeton.EDU>
List: port-mac68k
Date: 12/02/1998 11:37:10
>
> [I realize this is an old message, but since I haven't seen any useful
> response, perhaps it's not entirely too late?]
>
> On 19 Oct 1998, Paul Forgey wrote:
>
> >I'm attempting to cross a netbsd kernel from sparc-sun-solaris2.6 ->
> >m68k-apple-netbsd. I'm using egcs-1.1b and bintuils 2.9.1. I've hit the
> >following snags:
> >[...]
> >res_func.s: Assembler messages:
> >res_func.s:1524: Error: parse error -- statement `fcmpd
> >#:0x41dfffffffc00000,fp0' ignored
>
> If I recall correctly, what you're seeing there is a local (NetBSD)
> modification to allow our version of gas to handle double precision real
> constants. I'm not sure if anybody has resolved this satisfactorily for
> a cross-compile environment, but I'm cross-posting to port-m68k to see if
> someone can help.
>
> --scott
>
> PS - This is one of the things the m68k ports need to do something about
> before we move them to gas.new, by the way...
>
To whom it may concern,
Actually, I've written a pre-processing PERL script that takes cares
of most of these problems. I've inserted this script into the
assembler call and it allows me to do a clean build of the 1.3.2
kernel w/o any changes to the source in HP/UX w/ gcc. I've enclosed
the PERL script below. Try it and see if it works. It also handles
a weird local labelling protocol and the "%:" symbol. It's a bit
of a hack, but it works for me. Let me know if you have an problems.
I-Jong
-----------Cut here ---------------
#!/opt/bin/perl
$the_args="";
$the_files="";
$num_files=0;
$count=1;
for $my_arg (@ARGV) {
print "\t $my_arg\n";
if($my_arg =~ /\.[sS]$/) {
$the_files.=" $my_arg";
$num_files++;
} else {
$the_args.=" $my_arg";
}
}
print "System call: as $the_files $the_args\n";
if($the_files eq "") {
&do_file("",$the_args);
} else {
for $my_file (@files=split(/ /,$the_files)) {
if($my_file ne "") {
print "Opening $my_file...";
open(FIN,"< $my_file");
&do_file($my_file,$the_args);
close(FIN);
print "closed.\n";
}
}
}
sub do_file {
local($filename,$the_args)=@_;
if($filename ne "") {
system("ls -l $filename");
}
print "Running /opt/mac68k/m68k-apple-netbsd1.1/bin/as.orig $the_args.\n";
open(FOUT,"| /opt/mac68k/m68k-apple-netbsd1.1/bin/as.orig $the_args");
open(FOUT2,"> /tmp/lookie.raw ");
open(FOUT3,"> /tmp/lookie");
$flag=1;
if($filename eq "") {
$buf_line=<STDIN>;
} else {
$buf_line=<FIN>;
}
print FOUT2 $buf_line;
do {
if($buf_line eq "" && $line eq "") {
$flag=0;
}
if($buf_line =~ /^([^;]*;)(.*)/) {
$chomp=$1;
$chomp_left=$2;
$line=$chomp;
$buf_line=$chomp_left;
} else {
$line=$buf_line;
if($filename eq "") {
$buf_line=<STDIN>;
} else {
$buf_line=<FIN>;
}
print FOUT2 $buf_line;
$buf_line =~ s/(\"[^\";]*);([^\";]*\")/$1:$2/g;
$buf_line =~ s/#:0/#0/g;
if($buf_line !~ /\.asci/) {
if($buf_line =~ /^([^\|]*)\|.*/) {
$buf_line="$1 ";
}
}
}
if($line =~ /\b([0-9])[fF]\b/) {
$pat=$1;
$flag{$pat}=$count;
$line =~ s/\b($pat)[fF]\b/ my_kludge$count /;
$count++;
}
if($line =~ /^(\W*)([0-9]):/) {
$pat=$2;
if($get=$flag{$pat}) {
$line =~ s/^(\W*)$pat:/my_kludge$get:/;
$flag{$pat}=0;
} else {
$line =~ s/^(\W*)$pat:/my_kludge$count:/;
$flag{$pat}=$count;
$count++;
}
}
if($line =~ /\b([0-9])[bB]\b/) {
$pat=$1;
$get=$flag{$pat};
$line =~ s/\b$pat[bB]\b/ my_kludge$get /;
$flag{$pat}=0;
}
if($line !~/^\W*$/) {
print FOUT "$line";
print FOUT3 "$line";
if($line !~/\n$/) {
print FOUT "\n";
print FOUT3 "\n";
}
}
} while($flag);
if($filename eq "") {
close(STDIN);
} else {
close(FIN);
}
close(FOUT);
close(FOUT2);
close(FOUT3);
}