]> granicus.if.org Git - yasm/commitdiff
Rather than pulling the objfmt keyword back from the objfmt when setting
authorPeter Johnson <peter@tortall.net>
Fri, 16 Dec 2005 06:06:25 +0000 (06:06 -0000)
committerPeter Johnson <peter@tortall.net>
Fri, 16 Dec 2005 06:06:25 +0000 (06:06 -0000)
__YASM_OBJFMT__, use whatever name was specified on the command line.  This
also matches the behavior of yasm preprocess-only mode (-e).  Both the
mismatch between preproc/non-preproc and the internal name change (e.g. from
elf to elf32) were quite confusing.

Reported by: Mike Frysinger <vapier@gentoo.org>

svn path=/trunk/yasm/; revision=1325

frontends/yasm/yasm.c
modules/objfmts/elf/tests/Makefile.inc
modules/objfmts/elf/tests/elfcond.asm [new file with mode: 0644]
modules/objfmts/elf/tests/elfcond.errwarn [new file with mode: 0644]
modules/objfmts/elf/tests/elfcond.hex [new file with mode: 0644]

index 22b6c2bc2b810f26d19ddf91697a0d55db70cfbd..ceced82ae50d50ee4b6a70941fb68e4bac13b905 100644 (file)
@@ -55,6 +55,7 @@ static int special_options = 0;
 /*@null@*/ /*@dependent@*/ static yasm_preproc *cur_preproc = NULL;
 /*@null@*/ /*@dependent@*/ static const yasm_preproc_module *
     cur_preproc_module = NULL;
+/*@null@*/ static char *objfmt_keyword = NULL;
 /*@null@*/ /*@dependent@*/ static yasm_objfmt *cur_objfmt = NULL;
 /*@null@*/ /*@dependent@*/ static const yasm_objfmt_module *
     cur_objfmt_module = NULL;
@@ -759,6 +760,8 @@ cleanup(yasm_object *object)
            yasm_xfree(list_filename);
        if (machine_name)
            yasm_xfree(machine_name);
+       if (objfmt_keyword)
+           yasm_xfree(objfmt_keyword);
     }
 }
 
@@ -860,6 +863,9 @@ opt_objfmt_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra)
                    _("object format"), param);
        exit(EXIT_FAILURE);
     }
+    if (objfmt_keyword)
+       yasm_xfree(objfmt_keyword);
+    objfmt_keyword = yasm__xstrdup(param);
     return 0;
 }
 
@@ -1033,10 +1039,9 @@ static void
 apply_preproc_builtins()
 {
     char *predef;
-    const char *objfmt_keyword = DEFAULT_OBJFMT_MODULE;
 
-    if (cur_objfmt_module)
-       objfmt_keyword = cur_objfmt_module->keyword;
+    if (!objfmt_keyword)
+       objfmt_keyword = yasm__xstrdup(DEFAULT_OBJFMT_MODULE);
 
     /* Define standard YASM assembly-time macro constants */
     predef = yasm_xmalloc(strlen("__YASM_OBJFMT__=")
index e9642e7abd6426f3e26c1b78bf7dbe399eba0815..e823e62207a99e2470d824892ccfff026471106e 100644 (file)
@@ -3,6 +3,9 @@
 TESTS += modules/objfmts/elf/tests/elf_test.sh
 
 EXTRA_DIST += modules/objfmts/elf/tests/elf_test.sh
+EXTRA_DIST += modules/objfmts/elf/tests/elfcond.asm
+EXTRA_DIST += modules/objfmts/elf/tests/elfcond.hex
+EXTRA_DIST += modules/objfmts/elf/tests/elfcond.errwarn
 EXTRA_DIST += modules/objfmts/elf/tests/elfsectalign.asm
 EXTRA_DIST += modules/objfmts/elf/tests/elfsectalign.hex
 EXTRA_DIST += modules/objfmts/elf/tests/elfsectalign.errwarn
diff --git a/modules/objfmts/elf/tests/elfcond.asm b/modules/objfmts/elf/tests/elfcond.asm
new file mode 100644 (file)
index 0000000..482b068
--- /dev/null
@@ -0,0 +1,4 @@
+%ifidn __YASM_OBJFMT__,elf
+SECTION .booga progbits
+%endif
+
diff --git a/modules/objfmts/elf/tests/elfcond.errwarn b/modules/objfmts/elf/tests/elfcond.errwarn
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/objfmts/elf/tests/elfcond.hex b/modules/objfmts/elf/tests/elfcond.hex
new file mode 100644 (file)
index 0000000..85e0c03
--- /dev/null
@@ -0,0 +1,416 @@
+7f 
+45 
+4c 
+46 
+01 
+01 
+01 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+01 
+00 
+03 
+00 
+01 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+b0 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+34 
+00 
+00 
+00 
+00 
+00 
+28 
+00 
+06 
+00 
+01 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+2e 
+74 
+65 
+78 
+74 
+00 
+2e 
+62 
+6f 
+6f 
+67 
+61 
+00 
+2e 
+73 
+74 
+72 
+74 
+61 
+62 
+00 
+2e 
+73 
+79 
+6d 
+74 
+61 
+62 
+00 
+2e 
+73 
+68 
+73 
+74 
+72 
+74 
+61 
+62 
+00 
+00 
+2d 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+01 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+04 
+00 
+f1 
+ff 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+03 
+00 
+05 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+03 
+00 
+04 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+1e 
+00 
+00 
+00 
+03 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+40 
+00 
+00 
+00 
+28 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+0e 
+00 
+00 
+00 
+03 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+68 
+00 
+00 
+00 
+03 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+16 
+00 
+00 
+00 
+02 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+6c 
+00 
+00 
+00 
+40 
+00 
+00 
+00 
+02 
+00 
+00 
+00 
+04 
+00 
+00 
+00 
+04 
+00 
+00 
+00 
+10 
+00 
+00 
+00 
+01 
+00 
+00 
+00 
+01 
+00 
+00 
+00 
+06 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+40 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+10 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+07 
+00 
+00 
+00 
+01 
+00 
+00 
+00 
+02 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+40 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+01 
+00 
+00 
+00 
+00 
+00 
+00 
+00