fix instruction matching errors in i386 CFI generation
authorAlex Dowad <alexinbeijing@gmail.com>
Fri, 2 Oct 2015 11:32:33 +0000 (13:32 +0200)
committerRich Felker <dalias@aerifal.cx>
Thu, 8 Oct 2015 21:04:41 +0000 (21:04 +0000)
fdiv and fmul instructions were wrongly matched by the rules for
integer div and mul instructions, leading to incorrect conclusions
about register values being clobbered.

tools/add-cfi.i386.awk

index b8bdd7f423875aaa709cc1a62b5b7ad2c7e36efb..5dc8794145bc57c7c8c0bd5812c5cbe2e8b903ec 100644 (file)
@@ -188,9 +188,9 @@ function trashed(register) {
 /(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr) %e(ax|bx|cx|dx|si|di|bp),/ {
   trashed(get_reg1())
 }
-/i?mul [^,]*$/                    { trashed("eax"); trashed("edx") }
-/i?mul %e(ax|bx|cx|dx|si|di|bp),/ { trashed(get_reg1()) }
-/i?div/                           { trashed("eax"); trashed("edx") }
+/^i?mul [^,]*$/                    { trashed("eax"); trashed("edx") }
+/^i?mul %e(ax|bx|cx|dx|si|di|bp),/ { trashed(get_reg1()) }
+/^i?div/                           { trashed("eax"); trashed("edx") }
 /(dec|inc|not|neg|pop) %e(ax|bx|cx|dx|si|di|bp)/  { trashed(get_reg()) }
 /cpuid/ { trashed("eax"); trashed("ebx"); trashed("ecx"); trashed("edx") }