]> granicus.if.org Git - yasm/commitdiff
yasm_object_optimize(): Fix error/warning handling by using the new method.
authorPeter Johnson <peter@tortall.net>
Sat, 10 Jun 2006 16:54:45 +0000 (16:54 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 10 Jun 2006 16:54:45 +0000 (16:54 -0000)
effaddr.asm: Disable now-unsupported construct of [reg*(label2-label)].
x86_bc_insn_calc_len(): Don't destroy NULL intnum.

svn path=/branches/new-optimizer/; revision=1562

frontends/yasm/yasm.c
libyasm/section.c
libyasm/section.h
modules/arch/x86/tests/effaddr.asm
modules/arch/x86/tests/effaddr.hex
modules/arch/x86/x86bc.c

index e32f136d416c1afe4a6b865168e3dc6470d9919a..59ebe342b6e62239661aa1a19d91453bc9f2f0d8 100644 (file)
@@ -624,7 +624,7 @@ main(int argc, char *argv[])
     check_errors(errwarns, object);
 
     /* Optimize */
-    yasm_object_optimize(object, cur_arch);
+    yasm_object_optimize(object, cur_arch, errwarns);
     check_errors(errwarns, object);
 
     /* generate any debugging information */
index 23d2a715cc8cc65c3c8e1f98fdb92cae1bdd9b29..b7552857d49bb31092f3e281d734badf07ff878f 100644 (file)
@@ -777,7 +777,8 @@ update_all_bc_offsets(yasm_object *object)
 }
 
 void
-yasm_object_optimize(yasm_object *object, yasm_arch *arch)
+yasm_object_optimize(yasm_object *object, yasm_arch *arch,
+                    yasm_errwarns *errwarns)
 {
     yasm_section *sect;
     unsigned long bc_index = 0;
@@ -807,6 +808,7 @@ yasm_object_optimize(yasm_object *object, yasm_arch *arch)
 
            if (yasm_bc_calc_len(cur, optimize_add_span, &optd))
                saw_error = 1;
+           yasm_errwarn_propagate(errwarns, cur->line);
 
            /* TODO: times */
            if (cur->multiple)
index 63d720e40e28d406d357994e8cffed67f4da612c..61b7acdfe8e5cd13d6d0bec81220a0eefa786deb 100644 (file)
@@ -161,10 +161,12 @@ const char *yasm_object_get_object_fn(const yasm_object *object);
 /** Optimize an object.  Takes the unoptimized object and optimizes it.
  * If successful, the object is ready for output to an object file.
  * \param object       object
- * \note Optimization failures are indicated by this function calling
- *       yasm__error_at(); see errwarn.h for details.
+ * \param arch         architecture
+ * \param errwarns     error/warning set
+ * \note Optimization failures are stored into errwarns.
  */
-void yasm_object_optimize(yasm_object *object, yasm_arch *arch);
+void yasm_object_optimize(yasm_object *object, yasm_arch *arch,
+                         yasm_errwarns *errwarns);
 
 /** Determine if a section is absolute or general.
  * \param sect     section
index 7fa2f678772402633736fd6fb73f890723fc0e04..5a165c9a9109d6961a289b1bdd6cdb5055ae2d83 100644 (file)
@@ -14,4 +14,4 @@ mov eax,[dword eax]
 label
 dd 5
 label2
-mov ax,[eax+ebx*(label2-label)]
+;mov ax,[eax+ebx*(label2-label)]       ; not supported
index 75ad22b63ee64800f9cd9b3b094a7435958e1ae6..b3628f0d6b2189ef5b2be79491f3213c52dd4afd 100644 (file)
@@ -57,7 +57,3 @@ f8
 00 
 00 
 00 
-66 
-8b 
-04 
-98 
index 2aeca231546817142f5bc32fbc32241f8b2b2b2a..51bcbb4ec7396cf9c84860e02680810ddb3615a9 100644 (file)
@@ -578,8 +578,8 @@ x86_bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span,
                    insn->opcode.len = 1;
                }
                insn->postop = X86_POSTOP_NONE;
+               yasm_intnum_destroy(num);
            }
-           yasm_intnum_destroy(num);
        }
 
        bc->len += immlen/8;