From: Peter Johnson Date: Tue, 1 Nov 2005 03:37:44 +0000 (-0000) Subject: Fix linker errors with GAS parser directives .data/.text/etc. X-Git-Tag: v0.5.0rc1~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc13c875a12df915bb3139674d9567de834a3201;p=yasm Fix linker errors with GAS parser directives .data/.text/etc. * 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 --- diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c index f082d477..0e3f8160 100644 --- a/modules/objfmts/elf/elf-objfmt.c +++ b/modules/objfmts/elf/elf-objfmt.c @@ -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; diff --git a/modules/parsers/gas/gas-bison.y b/modules/parsers/gas/gas-bison.y index 1a6f7b19..815d569b 100644 --- a/modules/parsers/gas/gas-bison.y +++ b/modules/parsers/gas/gas-bison.y @@ -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); }