]> granicus.if.org Git - yasm/commitdiff
macho: Support N_PEXT bit.
authorPeter Johnson <peter@tortall.net>
Sat, 27 Aug 2011 17:01:26 +0000 (10:01 -0700)
committerPeter Johnson <peter@tortall.net>
Sat, 27 Aug 2011 17:01:26 +0000 (10:01 -0700)
Can be enabled via use of "private_extern" in NASM syntax.

Patch by: Hironori Bono

[#215 state:resolved]

modules/objfmts/macho/macho-objfmt.c
modules/objfmts/macho/tests/nasm32/Makefile.inc

index 89b0be47dd79f4a55b834692f9aaec5beb0d87d4..76b802926e4e3b5fafb6fc1e0eedae9c0bbdca22 100644 (file)
@@ -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;
index 2bb2d9866f40c9b40e1b51f8745fba4a75145cc5..2bba5de78e127696c9b2f9f1ae066a47f8a57aa7 100644 (file)
@@ -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