Skip to content

Commit 7d58243

Browse files
committed
macho: Support N_PEXT bit.
Can be enabled via use of "private_extern" in NASM syntax. Patch by: Hironori Bono [yasm#215 state:resolved]
1 parent 0ed2cc4 commit 7d58243

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

modules/objfmts/macho/macho-objfmt.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,26 @@ macho_objfmt_output_symtable(yasm_symrec *sym, /*@null@*/ void *d)
921921
}
922922
/*printf("common symbol %s val %lu\n", name, yasm_intnum_get_uint(val));*/
923923
} else if (vis & YASM_SYM_GLOBAL) {
924-
n_type |= N_EXT;
924+
yasm_valparamhead *valparams =
925+
yasm_symrec_get_objext_valparams(sym);
926+
927+
struct macho_global_data {
928+
unsigned long flag; /* N_PEXT */
929+
} data;
930+
931+
data.flag = 0;
932+
933+
if (valparams) {
934+
static const yasm_dir_help help[] = {
935+
{ "private_extern", 0, yasm_dir_helper_flag_set,
936+
offsetof(struct macho_global_data, flag), N_PEXT },
937+
};
938+
yasm_dir_helper(sym, yasm_vps_first(valparams),
939+
yasm_symrec_get_decl_line(sym), help, NELEMS(help),
940+
&data, yasm_dir_helper_valparam_warn);
941+
}
942+
943+
n_type |= N_EXT | data.flag;
925944
}
926945

927946
localbuf = info->buf;

modules/objfmts/macho/tests/nasm32/Makefile.inc

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.asm
66
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/machotest.hex
77
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.asm
88
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho-reloc.hex
9+
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.asm
10+
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pext.hex
911
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.asm
1012
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-pic.hex
1113
EXTRA_DIST += modules/objfmts/macho/tests/nasm32/macho32-sect.asm

0 commit comments

Comments
 (0)