Too long symbols
[openssl.git] / crypto / perlasm / x86masm.pl
index 98845fab6583a7dac06a550fc12a70051b1a6ab5..3d50e4a786564c3eed9e318558ef8e656a61edc0 100644 (file)
@@ -8,17 +8,19 @@ $::lbdecor="\$L";     # local label decoration
 $nmdecor="_";          # external name decoration
 
 $initseg="";
+$segment="";
 
 sub ::generic
 { my ($opcode,@arg)=@_;
 
     # fix hexadecimal constants
-    $arg[0] =~ s/0x([0-9a-f]+)/0$1h/oi if (defined($arg[0]));
-    $arg[1] =~ s/0x([0-9a-f]+)/0$1h/oi if (defined($arg[1]));
+    for (@arg) { s/0x([0-9a-f]+)/0$1h/oi; }
 
-    # fix xmm references
-    $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
-    $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
+    if ($opcode !~ /movq/)
+    {  # fix xmm references
+       $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
+       $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
+    }
 
     &::emit($opcode,@arg);
   1;
@@ -84,6 +86,7 @@ ELSE
 ENDIF
 ___
     push(@out,$tmp);
+    $segment = ".text\$";
 }
 
 sub ::function_begin_B
@@ -121,11 +124,11 @@ ___
        grep {s/\.[3-7]86/$xmmheader/} @out;
     }
 
-    push(@out,".text\$ ENDS\n");
+    push(@out,"$segment        ENDS\n");
 
     if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
     {  my $comm=<<___;
-.bss   SEGMENT
+.bss   SEGMENT 'BSS'
 COMM   ${nmdecor}OPENSSL_ia32cap_P:DWORD
 .bss   ENDS
 ___
@@ -175,4 +178,7 @@ DD  $f
 ___
 }
 
+sub ::dataseg
+{   push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA";   }
+
 1;