]> granicus.if.org Git - yasm/commitdiff
Fix linker errors with GAS parser directives .data/.text/etc.
authorPeter Johnson <peter@tortall.net>
Tue, 1 Nov 2005 03:37:44 +0000 (03:37 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 1 Nov 2005 03:37:44 +0000 (03:37 -0000)
* gas-bison.y (gas_get_section): Don't create empty gas flags unless type
is also specified.  This fixes .data/.text/etc section flags.
* elf-objfmt.c (elf_objfmt_section_switch): Add default flags for .comment
section; this is needed so the above change doesn't break .ident.

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

modules/objfmts/elf/elf-objfmt.c
modules/parsers/gas/gas-bison.y

index f082d4773d0480e7884ecc5fa17076ed62ef30ce..0e3f816080255d9ed43e7d82ce1fb4275d813850 100644 (file)
@@ -759,6 +759,9 @@ elf_objfmt_section_switch(yasm_objfmt *objfmt, yasm_valparamhead *valparams,
        align = 16;
        type = SHT_PROGBITS;
        flags = SHF_ALLOC + SHF_EXECINSTR;
+    } else if (strcmp(sectname, ".comment") == 0) {
+       type = SHT_PROGBITS;
+       flags = 0;
     } else {
        /* Default to code */
        align = 1;
index 1a6f7b19a69a4847a1c2d20a44bdc3d5d806e9f8..815d569b793ad389de4a2272c3e0f203a66a4501 100644 (file)
@@ -729,12 +729,12 @@ gas_get_section(yasm_parser_gas *parser_gas, char *name,
        gasflags = yasm_xmalloc(5+strlen(flags));
        strcpy(gasflags, "gas_");
        strcat(gasflags, flags);
-    } else
+       vp = yasm_vp_create(gasflags, NULL);
+       yasm_vps_append(&vps, vp);
+    } else if (type) {
        gasflags = yasm__xstrdup("gas_");
-    vp = yasm_vp_create(gasflags, NULL);
-    yasm_vps_append(&vps, vp);
-
-    if (type) {
+       vp = yasm_vp_create(gasflags, NULL);
+       yasm_vps_append(&vps, vp);
        vp = yasm_vp_create(type, NULL);
        yasm_vps_append(&vps, vp);
     }