From: Peter Johnson Date: Sat, 27 Aug 2011 17:01:26 +0000 (-0700) Subject: macho: Support N_PEXT bit. X-Git-Tag: v1.2.0~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d58243134087b1617bbc16c7dddb58a79fd707b;p=yasm macho: Support N_PEXT bit. Can be enabled via use of "private_extern" in NASM syntax. Patch by: Hironori Bono [#215 state:resolved] --- diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c index 89b0be47..76b80292 100644 --- a/modules/objfmts/macho/macho-objfmt.c +++ b/modules/objfmts/macho/macho-objfmt.c @@ -921,7 +921,26 @@ macho_objfmt_output_symtable(yasm_symrec *sym, /*@null@*/ void *d) } /*printf("common symbol %s val %lu\n", name, yasm_intnum_get_uint(val));*/ } else if (vis & YASM_SYM_GLOBAL) { - n_type |= N_EXT; + yasm_valparamhead *valparams = + yasm_symrec_get_objext_valparams(sym); + + struct macho_global_data { + unsigned long flag; /* N_PEXT */ + } data; + + data.flag = 0; + + if (valparams) { + static const yasm_dir_help help[] = { + { "private_extern", 0, yasm_dir_helper_flag_set, + offsetof(struct macho_global_data, flag), N_PEXT }, + }; + yasm_dir_helper(sym, yasm_vps_first(valparams), + yasm_symrec_get_decl_line(sym), help, NELEMS(help), + &data, yasm_dir_helper_valparam_warn); + } + + n_type |= N_EXT | data.flag; } localbuf = info->buf; diff --git a/modules/objfmts/macho/tests/nasm32/Makefile.inc b/modules/objfmts/macho/tests/nasm32/Makefile.inc index 2bb2d986..2bba5de7 100644 --- a/modules/objfmts/macho/tests/nasm32/Makefile.inc +++ b/modules/objfmts/macho/tests/nasm32/Makefile.inc @@ -6,6 +6,8 @@ EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.hex +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.asm +EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.asm EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.hex EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-sect.asm