sub main'pushf { &out0("pushf"); $stack+=4; }
sub main'popf { &out0("popf"); $stack-=4; }
sub main'not { &out1("notl",@_); }
-sub main'call { &out1("call",($_[0]=~/^\Q${dot}\EL/?'':$under).$_[0]); }
+sub main'call { my $pre=$under;
+ foreach $i (%label)
+ { if ($label{$i} eq $_[0]) { $pre=''; last; } }
+ &out1("call",$pre.$_[0]);
+ }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
sub main'test { &out2("testl",@_); }
local($tmp)=<<"EOF";
.text
-.align $align
-.globl $func
+.globl $func
EOF
push(@out,$tmp);
if ($main'cpp)
elsif ($main'aout)
{ }
else { $tmp=push(@out,".type\t$func,\@function\n"); }
+ push(@out,".align\t$align\n");
push(@out,"$func:\n");
$tmp=<<"EOF";
pushl %ebp
local($tmp)=<<"EOF";
.text
-.align $align
-.globl $func
+.globl $func
EOF
push(@out,$tmp);
if ($main'cpp)
elsif ($main'aout)
{ }
else { push(@out,".type $func,\@function\n"); }
+ push(@out,".align\t$align\n");
push(@out,"$func:\n");
$stack=4;
}
if ($main'cpp)
{ push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); }
elsif ($main'coff or $main'aout)
- { $tmp=push(@out,".align $align\n"); }
+ { }
else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); }
push(@out,".ident \"$func\"\n");
$stack=0;
if ($main'cpp)
{ push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); }
elsif ($main'coff or $main'aout)
- { push(@out,".align $align\n"); }
+ { }
else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); }
push(@out,".ident \"$func\"\n");
$stack=0;
$label{$_[0]}="${dot}${label}${_[0]}";
$label++;
}
- push(@out,".align $align\n") if ($_[1] != 0);
+ if ($_[1]!=0)
+ {
+ if ($_[1]>1) { main'align($_[1]); }
+ else { push(@out,".align $align\n"); }
+ }
push(@out,"$label{$_[0]}:\n");
}
$val=$p2-1;
$val.=",0x90";
}
- push(@out,".align $val\n");
+ push(@out,".align\t$val\n");
}
# debug output functions: puts, putx, printf
&main'call(&main'label("PIC_me_up"));
&main'set_label("PIC_me_up");
&main'blindpop($dst);
- &main'add($dst,"\$$under"."_GLOBAL_OFFSET_TABLE_+[.-".
+ &main'add($dst,"\$${under}_GLOBAL_OFFSET_TABLE_+[.-".
&main'label("PIC_me_up") . "]");
- &main'mov($dst,&main'DWP("$under".$sym."\@GOT",$dst));
+ &main'mov($dst,&main'DWP($under.$sym."\@GOT",$dst));
}
else
{