diff --git a/asm/pragma.c b/asm/pragma.c index 0a58e3f0..cbe0cc7b 100644 --- a/asm/pragma.c +++ b/asm/pragma.c @@ -83,13 +83,15 @@ */ static struct pragma_facility global_pragmas[] = { - { "preproc", NULL }, /* This shouldn't happen... */ { "asm", NULL }, { "list", NULL }, { "file", NULL }, { "input", NULL }, + + /* None of these should actually happen... */ + { "preproc", NULL }, /* This shouldn't happen... */ { "output", NULL }, - { "debug", NULL }, + { "debug", NULL }, { "ignore", NULL }, { NULL, NULL } }; @@ -185,6 +187,15 @@ void process_pragma(char *str) if (!nasm_stricmp(pragma.facility_name, "ignore")) return; + /* + * The "output" and "debug" facilities are aliases for the + * current output and debug formats, respectively. + */ + if (!nasm_stricmp(pragma.facility_name, "output")) + pragma.facility_name = ofmt->shortname; + if (!nasm_stricmp(pragma.facility_name, "debug")) + pragma.facility_name = dfmt->shortname; + pragma.opname = nasm_get_word(p, &p); if (!pragma.opname) pragma.opcode = D_none; diff --git a/test/subsection.asm b/test/subsection.asm new file mode 100644 index 00000000..eb0f05d7 --- /dev/null +++ b/test/subsection.asm @@ -0,0 +1,39 @@ +; +; subsection.asm +; +; Test of Mach-O subsection_by_symbol +; + +%pragma output subsections_via_symbols + + bits 32 + + global foo, bar, quux + +%define baz Lbaz + +foo: + jmp foo + jmp bar + jmp baz + jmp quux + +bar: + jmp foo + jmp bar + jmp baz + jmp quux + +baz: + jmp foo + jmp bar + jmp baz + jmp quux + +quux: + jmp foo + jmp bar + jmp baz + jmp quux + +