mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-31 18:20:22 +08:00
pragma.c: make the generic "output" and "debug" pragma namespaces work
"output" and "debug" are supposed to redirect to the current output and debug formats. Fix it so it actually does. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
7310d0bd5b
commit
b7136487bd
15
asm/pragma.c
15
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;
|
||||
|
39
test/subsection.asm
Normal file
39
test/subsection.asm
Normal file
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user