$T_X86_PRE_LLBL = 'L';
$T_X86_BADJMP = '^\tjmp [^L\*]';
- $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,0x90)?|\.globl\s+\S+|\.text|\.data|\.stab[^n].*|\.type\s+.*|\.size\s+.*|\.lcomm.*)\n)';
+ $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s.*|\.globl\s+\S+|\.text|\.data|\.stab[^n].*|\.type\s+.*|\.size\s+.*|\.lcomm.*)\n)';
$T_COPY_DIRVS = '\.(globl|stab|lcomm)';
$T_DOT_WORD = '\.(long|word|value|byte|space)';
$T_DOT_GLOBAL = '\.globl';
$T_X86_PRE_LLBL = '.L';
$T_X86_BADJMP = '^\tjmp\s+[^\.\*]';
- $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,\s*0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*|\.local.*)\n)';
+ $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s.*|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*|\.local.*)\n)';
$T_COPY_DIRVS = '^\s*\.(globl|type|size|local)';
$T_DOT_WORD = '\.(long|value|word|byte|zero)';
$T_DOT_WORD = '\.(long|short|byte|fill|space)';
$T_DOT_GLOBAL = '\.globl';
$T_HDR_toc = "\.toc\n";
- $T_HDR_literal = "\t\.const_data\n\t\.align 2\n";
+ $T_HDR_literal = "\t\.const\n\t\.align 2\n";
$T_HDR_misc = "\t\.text\n\t\.align 2\n";
$T_HDR_data = "\t\.data\n\t\.align 2\n";
- $T_HDR_rodata = "\t\.const_data\n\t\.align 2\n";
- $T_HDR_closure = "\t\.const_data\n\t\.align 2\n";
+ $T_HDR_rodata = "\t\.const\n\t\.align 2\n";
+ $T_HDR_relrodata= "\t\.const_data\n\t\.align 2\n";
+ $T_HDR_closure = "\t\.data\n\t\.align 2\n";
$T_HDR_info = "\t\.text\n\t\.align 2\n";
$T_HDR_entry = "\t\.text\n\t\.align 2\n";
$T_HDR_vector = "\t\.text\n\t\.align 2\n";
exit 1;
}
+ if($T_HDR_relrodata eq "") {
+ # default values:
+ # relrodata defaults to rodata.
+ $T_HDR_relrodata = $T_HDR_rodata;
+ }
+
if ( 0 ) {
print STDERR "T_STABBY: $T_STABBY\n";
print STDERR "T_US: $T_US\n";
|| /^${T_US}.*_closure_tbl${T_POST_LBL}$/o # closure tables
)
{
- $chkcat[$i] = 'rodata';
+ $chkcat[$i] = 'relrodata';
} else
{
print STDERR "Warning: retaining unknown function \`$thing' in output from C compiler\n";
# SRT
if ( defined($srtchk{$symb}) ) {
- print OUTASM $T_HDR_rodata;
+ print OUTASM $T_HDR_relrodata;
print OUTASM $chk[$srtchk{$symb}];
$chkcat[$srtchk{$symb}] = 'DONE ALREADY';
}
print OUTASM $T_HDR_rodata;
print OUTASM $chk[$i];
$chkcat[$i] = 'DONE ALREADY';
-
+ } elsif ( $chkcat[$i] eq 'relrodata' ) {
+ print OUTASM $T_HDR_relrodata;
+ print OUTASM $chk[$i];
+ $chkcat[$i] = 'DONE ALREADY';
} elsif ( $chkcat[$i] eq 'toc' ) {
# silly optimisation to print tocs, since they come in groups...
print OUTASM $T_HDR_toc;
# movl $_blah,<bad-reg>
# jmp *<bad-reg>
#
+ s/^\tmovl\s+\$${T_US}(.*),\s*(\%e[acd]x)\n\tjmp\s+\*\2/\tjmp $T_US$1/g;
- s/^\tmovl\s+\$${T_US}(.*),\s*(\%e[abcd]x)\n\tjmp\s+\*\2/\tjmp $T_US$1/g;
+ # Catch things like
+ #
+ # movl -4(%ebx), %eax
+ # jmp *%eax
+ #
+ # and optimise:
+ #
+ s/^\tmovl\s+(-?\d*\(\%e(bx|si)\)),\s*(\%e[acd]x)\n\tjmp\s+\*\3/\tjmp\t\*$1/g;
if ($StolenX86Regs <= 2 ) { # YURGH! spurious uses of esi?
s/^\tmovl\s+(.*),\s*\%esi\n\tjmp\s+\*%esi\n/\tmovl $1,\%eax\n\tjmp \*\%eax\n/g;