In ELF, @ is used to indicate special relocations.
Fixes #164.
Reported by: Gregory McGarry on yasm-devel@
Testcase by: Gregory McGarry
We don't allow identifiers to start with @; doing so conflicts with use of
e.g. "@function" in some directives. Need to look into what GAS does.
svn path=/trunk/yasm/; revision=2166
*/
const unsigned char default_x86_mode_bits;
+ /** If @ signs should be legal in identifiers. */
+ const unsigned char id_at_ok;
+
/** NULL-terminated list of debug format (yasm_dbgfmt) keywords that are
* valid to use with this object format. The null debug format
* (null_dbgfmt, "null") should always be in this list so it's possible to
"bin",
NULL,
16,
+ 0,
bin_objfmt_dbgfmt_keywords,
"null",
bin_objfmt_directives,
"dosexe",
"exe",
16,
+ 0,
bin_objfmt_dbgfmt_keywords,
"null",
bin_objfmt_directives,
"coff",
"o",
32,
+ 0,
coff_objfmt_dbgfmt_keywords,
"null",
coff_objfmt_directives,
"win32",
"obj",
32,
+ 1,
winXX_objfmt_dbgfmt_keywords,
"null",
win32_objfmt_directives,
"win64",
"obj",
64,
+ 1,
winXX_objfmt_dbgfmt_keywords,
"null",
win64_objfmt_directives,
"x64",
"obj",
64,
+ 1,
winXX_objfmt_dbgfmt_keywords,
"null",
win64_objfmt_directives,
"dbg",
"dbg",
32,
+ 0,
dbg_objfmt_dbgfmt_keywords,
"null",
NULL, /* no directives */
"elf",
"o",
32,
+ 0,
elf_objfmt_dbgfmt_keywords,
"null",
elf_objfmt_directives,
"elf32",
"o",
32,
+ 0,
elf_objfmt_dbgfmt_keywords,
"null",
elf_objfmt_directives,
"elf64",
"o",
64,
+ 0,
elf_objfmt_dbgfmt_keywords,
"null",
elf_objfmt_directives,
"macho",
"o",
32,
+ 0,
macho_objfmt_dbgfmt_keywords,
"null",
NULL, /* no directives */
"macho32",
"o",
32,
+ 0,
macho_objfmt_dbgfmt_keywords,
"null",
NULL, /* no directives */
"macho64",
"o",
64,
+ 0,
macho_objfmt_dbgfmt_keywords,
"null",
NULL, /* no directives */
"rdf",
"rdf",
32,
+ 0,
rdf_objfmt_dbgfmt_keywords,
"null",
rdf_objfmt_directives,
EXTRA_DIST += modules/objfmts/win32/tests/win32test.c
EXTRA_DIST += modules/objfmts/win32/tests/win32test.asm
EXTRA_DIST += modules/objfmts/win32/tests/win32test.hex
+
+EXTRA_DIST += modules/objfmts/win32/tests/gas/Makefile.inc
+
+include modules/objfmts/win32/tests/gas/Makefile.inc
--- /dev/null
+# $Id$
+
+TESTS += modules/objfmts/win32/tests/gas/win32_gas_test.sh
+
+EXTRA_DIST += modules/objfmts/win32/tests/gas/win32_gas_test.sh
+EXTRA_DIST += modules/objfmts/win32/tests/gas/win32at.asm
+EXTRA_DIST += modules/objfmts/win32/tests/gas/win32at.hex
--- /dev/null
+#! /bin/sh
+# $Id$
+${srcdir}/out_test.sh win32_gas_test modules/objfmts/win32/tests/gas "win32 objfmt" "-f win32 -p gas" ".obj"
+exit $?
--- /dev/null
+.section .rodata
+L2586:
+.ascii "myWindowClass\0"
+.globl _g_szClassName
+_g_szClassName:
+.byte 109
+.byte 121
+.byte 87
+.byte 105
+.byte 110
+.byte 100
+.byte 111
+.byte 119
+.byte 67
+.byte 108
+.byte 97
+.byte 115
+.byte 115
+.byte 0
+.text
+.align 4
+.globl _WndProc@16
+_WndProc@16:
+pushl %ebp
+movl %esp,%ebp
+subl $8,%esp
+L2588:
+L2590:
+movl 12(%ebp),%eax
+movl %eax,-4(%ebp)
+jmp L2592
+L2593:
+pushl 8(%ebp)
+call _DestroyWindow@4
+jmp L2591
+L2594:
+pushl $0
+call _PostQuitMessage@4
+jmp L2591
+L2595:
+pushl 20(%ebp)
+pushl 16(%ebp)
+pushl 12(%ebp)
+pushl 8(%ebp)
+call _DefWindowProcA@16
+movl %eax,-8(%ebp)
+jmp L2589
+L2592:
+cmpl $2,-4(%ebp)
+je L2594
+cmpl $16,-4(%ebp)
+je L2593
+jmp L2595
+L2591:
+movl $0,-8(%ebp)
+jmp L2589
+L2589:
+movl -8(%ebp),%eax
+leave
+ret $16
+.section .rodata
+L2600:
+.ascii "Window Registration Failed!\0"
+L2601:
+.ascii "Error!\0"
+L2602:
+.ascii "The title of my window\0"
+L2604:
+.ascii "Window Creation Failed!\0"
+.text
+.align 4
+.globl _WinMain@16
+_WinMain@16:
+pushl %ebp
+movl %esp,%ebp
+subl $84,%esp
+L2596:
+L2598:
+movl $48,-48(%ebp)
+movl $0,-44(%ebp)
+movl $_WndProc@16,-40(%ebp)
+movl $0,-36(%ebp)
+movl $0,-32(%ebp)
+movl 8(%ebp),%eax
+movl %eax,-28(%ebp)
+pushl $32512
+pushl $0
+call _LoadIconA@8
+movl %eax,-24(%ebp)
+pushl $32512
+pushl $0
+call _LoadCursorA@8
+movl %eax,-20(%ebp)
+movl $6,-16(%ebp)
+movl $0,-12(%ebp)
+movl $_g_szClassName,-8(%ebp)
+pushl $32512
+pushl $0
+call _LoadIconA@8
+movl %eax,-4(%ebp)
+leal -48(%ebp),%edx
+pushl %edx
+call _RegisterClassExA@4
+cmpw $0,%ax
+jne L2599
+pushl $48
+pushl $L2601
+pushl $L2600
+pushl $0
+call _MessageBoxA@16
+movl $0,-84(%ebp)
+jmp L2597
+L2599:
+pushl $0
+pushl 8(%ebp)
+pushl $0
+pushl $0
+pushl $120
+pushl $240
+pushl $-2147483648
+pushl $-2147483648
+pushl $13565952
+pushl $L2602
+pushl $_g_szClassName
+pushl $512
+call _CreateWindowExA@48
+movl %eax,-52(%ebp)
+cmpl $0,-52(%ebp)
+jne L2603
+pushl $48
+pushl $L2601
+pushl $L2604
+pushl $0
+call _MessageBoxA@16
+movl $0,-84(%ebp)
+jmp L2597
+L2603:
+pushl 20(%ebp)
+pushl -52(%ebp)
+call _ShowWindow@8
+pushl -52(%ebp)
+call _UpdateWindow@4
+L2605:
+pushl $0
+pushl $0
+pushl $0
+leal -80(%ebp),%edx
+pushl %edx
+call _GetMessageA@16
+cmpl $0,%eax
+jle L2606
+leal -80(%ebp),%eax
+pushl %eax
+call _TranslateMessage@4
+leal -80(%ebp),%eax
+pushl %eax
+call _DispatchMessageA@4
+jmp L2605
+L2606:
+movl -72(%ebp),%eax
+movl %eax,-84(%ebp)
+jmp L2597
+L2597:
+movl -84(%ebp),%eax
+leave
+ret $16
+.ident "PCC: pcc 0.9.9 (win32)"
--- /dev/null
+4c
+01
+03
+00
+00
+00
+00
+00
+91
+03
+00
+00
+18
+00
+00
+00
+00
+00
+0c
+01
+2e
+74
+65
+78
+74
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+99
+01
+00
+00
+8c
+00
+00
+00
+25
+02
+00
+00
+00
+00
+00
+00
+17
+00
+00
+00
+20
+00
+50
+60
+2e
+72
+6f
+64
+61
+74
+61
+00
+99
+01
+00
+00
+00
+00
+00
+00
+6e
+00
+00
+00
+0b
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+40
+00
+40
+40
+2f
+34
+00
+00
+00
+00
+00
+00
+07
+02
+00
+00
+00
+00
+00
+00
+18
+00
+00
+00
+79
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+40
+00
+40
+40
+55
+89
+e5
+83
+ec
+08
+8b
+45
+0c
+89
+45
+fc
+eb
+29
+ff
+75
+08
+e8
+00
+00
+00
+00
+eb
+2d
+6a
+00
+e8
+00
+00
+00
+00
+eb
+24
+ff
+75
+14
+ff
+75
+10
+ff
+75
+0c
+ff
+75
+08
+e8
+00
+00
+00
+00
+89
+45
+f8
+eb
+17
+83
+7d
+fc
+02
+74
+db
+83
+7d
+fc
+10
+74
+cb
+eb
+dc
+c7
+45
+f8
+00
+00
+00
+00
+eb
+00
+8b
+45
+f8
+c9
+c2
+10
+00
+8d
+76
+00
+55
+89
+e5
+83
+ec
+54
+c7
+45
+d0
+30
+00
+00
+00
+c7
+45
+d4
+00
+00
+00
+00
+c7
+45
+d8
+00
+00
+00
+00
+c7
+45
+dc
+00
+00
+00
+00
+c7
+45
+e0
+00
+00
+00
+00
+8b
+45
+08
+89
+45
+e4
+68
+00
+7f
+00
+00
+6a
+00
+e8
+00
+00
+00
+00
+89
+45
+e8
+68
+00
+7f
+00
+00
+6a
+00
+e8
+00
+00
+00
+00
+89
+45
+ec
+c7
+45
+f0
+06
+00
+00
+00
+c7
+45
+f4
+00
+00
+00
+00
+c7
+45
+f8
+0e
+00
+00
+00
+68
+00
+7f
+00
+00
+6a
+00
+e8
+00
+00
+00
+00
+89
+45
+fc
+8d
+55
+d0
+52
+e8
+00
+00
+00
+00
+66
+83
+f8
+00
+75
+1f
+6a
+30
+68
+38
+00
+00
+00
+68
+1c
+00
+00
+00
+6a
+00
+e8
+00
+00
+00
+00
+c7
+45
+ac
+00
+00
+00
+00
+e9
+9b
+00
+00
+00
+6a
+00
+ff
+75
+08
+6a
+00
+6a
+00
+6a
+78
+68
+f0
+00
+00
+00
+68
+00
+00
+00
+80
+68
+00
+00
+00
+80
+68
+00
+00
+cf
+00
+68
+3f
+00
+00
+00
+68
+0e
+00
+00
+00
+68
+00
+02
+00
+00
+e8
+00
+00
+00
+00
+89
+45
+cc
+83
+7d
+cc
+00
+75
+1c
+6a
+30
+68
+38
+00
+00
+00
+68
+56
+00
+00
+00
+6a
+00
+e8
+00
+00
+00
+00
+c7
+45
+ac
+00
+00
+00
+00
+eb
+43
+ff
+75
+14
+ff
+75
+cc
+e8
+00
+00
+00
+00
+ff
+75
+cc
+e8
+00
+00
+00
+00
+6a
+00
+6a
+00
+6a
+00
+8d
+55
+b0
+52
+e8
+00
+00
+00
+00
+83
+f8
+00
+7e
+14
+8d
+45
+b0
+50
+e8
+00
+00
+00
+00
+8d
+45
+b0
+50
+e8
+00
+00
+00
+00
+eb
+d8
+8b
+45
+b8
+89
+45
+ac
+eb
+00
+8b
+45
+ac
+c9
+c2
+10
+00
+12
+00
+00
+00
+08
+00
+00
+00
+14
+00
+1b
+00
+00
+00
+09
+00
+00
+00
+14
+00
+2e
+00
+00
+00
+0a
+00
+00
+00
+14
+00
+6f
+00
+00
+00
+02
+00
+00
+00
+06
+00
+8f
+00
+00
+00
+0c
+00
+00
+00
+14
+00
+9e
+00
+00
+00
+0d
+00
+00
+00
+14
+00
+b6
+00
+00
+00
+04
+00
+00
+00
+06
+00
+c2
+00
+00
+00
+0c
+00
+00
+00
+14
+00
+ce
+00
+00
+00
+0e
+00
+00
+00
+14
+00
+db
+00
+00
+00
+04
+00
+00
+00
+06
+00
+e0
+00
+00
+00
+04
+00
+00
+00
+06
+00
+e7
+00
+00
+00
+0f
+00
+00
+00
+14
+00
+17
+01
+00
+00
+04
+00
+00
+00
+06
+00
+1c
+01
+00
+00
+04
+00
+00
+00
+06
+00
+26
+01
+00
+00
+10
+00
+00
+00
+14
+00
+36
+01
+00
+00
+04
+00
+00
+00
+06
+00
+3b
+01
+00
+00
+04
+00
+00
+00
+06
+00
+42
+01
+00
+00
+0f
+00
+00
+00
+14
+00
+56
+01
+00
+00
+11
+00
+00
+00
+14
+00
+5e
+01
+00
+00
+12
+00
+00
+00
+14
+00
+6d
+01
+00
+00
+13
+00
+00
+00
+14
+00
+7b
+01
+00
+00
+14
+00
+00
+00
+14
+00
+84
+01
+00
+00
+15
+00
+00
+00
+14
+00
+6d
+79
+57
+69
+6e
+64
+6f
+77
+43
+6c
+61
+73
+73
+00
+6d
+79
+57
+69
+6e
+64
+6f
+77
+43
+6c
+61
+73
+73
+00
+57
+69
+6e
+64
+6f
+77
+20
+52
+65
+67
+69
+73
+74
+72
+61
+74
+69
+6f
+6e
+20
+46
+61
+69
+6c
+65
+64
+21
+00
+45
+72
+72
+6f
+72
+21
+00
+54
+68
+65
+20
+74
+69
+74
+6c
+65
+20
+6f
+66
+20
+6d
+79
+20
+77
+69
+6e
+64
+6f
+77
+00
+57
+69
+6e
+64
+6f
+77
+20
+43
+72
+65
+61
+74
+69
+6f
+6e
+20
+46
+61
+69
+6c
+65
+64
+21
+00
+00
+50
+43
+43
+3a
+20
+70
+63
+63
+20
+30
+2e
+39
+2e
+39
+20
+28
+77
+69
+6e
+33
+32
+29
+00
+2e
+66
+69
+6c
+65
+00
+00
+00
+00
+00
+00
+00
+fe
+ff
+00
+00
+67
+01
+2d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+2e
+74
+65
+78
+74
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+03
+01
+99
+01
+00
+00
+17
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+2e
+72
+6f
+64
+61
+74
+61
+00
+00
+00
+00
+00
+02
+00
+00
+00
+03
+01
+6e
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+0f
+00
+00
+00
+0e
+00
+00
+00
+02
+00
+00
+00
+02
+00
+00
+00
+00
+00
+1e
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+02
+00
+00
+00
+00
+00
+2a
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+3b
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+4e
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+61
+00
+00
+00
+58
+00
+00
+00
+01
+00
+00
+00
+02
+00
+00
+00
+00
+00
+6d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+7a
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+89
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+9d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+ad
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+c1
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+cf
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+df
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+ef
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+03
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+02
+00
+00
+00
+00
+00
+17
+01
+00
+00
+00
+00
+00
+00
+03
+00
+00
+00
+03
+01
+18
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+22
+01
+00
+00
+2e
+72
+64
+61
+74
+61
+24
+7a
+7a
+7a
+00
+5f
+67
+5f
+73
+7a
+43
+6c
+61
+73
+73
+4e
+61
+6d
+65
+00
+5f
+57
+6e
+64
+50
+72
+6f
+63
+40
+31
+36
+00
+5f
+44
+65
+73
+74
+72
+6f
+79
+57
+69
+6e
+64
+6f
+77
+40
+34
+00
+5f
+50
+6f
+73
+74
+51
+75
+69
+74
+4d
+65
+73
+73
+61
+67
+65
+40
+34
+00
+5f
+44
+65
+66
+57
+69
+6e
+64
+6f
+77
+50
+72
+6f
+63
+41
+40
+31
+36
+00
+5f
+57
+69
+6e
+4d
+61
+69
+6e
+40
+31
+36
+00
+5f
+4c
+6f
+61
+64
+49
+63
+6f
+6e
+41
+40
+38
+00
+5f
+4c
+6f
+61
+64
+43
+75
+72
+73
+6f
+72
+41
+40
+38
+00
+5f
+52
+65
+67
+69
+73
+74
+65
+72
+43
+6c
+61
+73
+73
+45
+78
+41
+40
+34
+00
+5f
+4d
+65
+73
+73
+61
+67
+65
+42
+6f
+78
+41
+40
+31
+36
+00
+5f
+43
+72
+65
+61
+74
+65
+57
+69
+6e
+64
+6f
+77
+45
+78
+41
+40
+34
+38
+00
+5f
+53
+68
+6f
+77
+57
+69
+6e
+64
+6f
+77
+40
+38
+00
+5f
+55
+70
+64
+61
+74
+65
+57
+69
+6e
+64
+6f
+77
+40
+34
+00
+5f
+47
+65
+74
+4d
+65
+73
+73
+61
+67
+65
+41
+40
+31
+36
+00
+5f
+54
+72
+61
+6e
+73
+6c
+61
+74
+65
+4d
+65
+73
+73
+61
+67
+65
+40
+34
+00
+5f
+44
+69
+73
+70
+61
+74
+63
+68
+4d
+65
+73
+73
+61
+67
+65
+41
+40
+34
+00
+2e
+72
+64
+61
+74
+61
+24
+7a
+7a
+7a
+00
"xdf",
"xdf",
32,
+ 0,
xdf_objfmt_dbgfmt_keywords,
"null",
NULL, /* no directives */
RETURN(ID);
}
+ /* identifier with @ */
+ [a-zA-Z_.]([a-zA-Z0-9_$.]*[@][a-zA-Z0-9_$.]*)+ {
+ /* if @ not part of ID, move the scanner cursor to the first @ */
+ if (!((yasm_objfmt_base *)p_object->objfmt)->module->id_at_ok)
+ cursor = (unsigned char *)strchr(TOK, '@');
+ lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN);
+ lvalp->str.len = TOKLEN;
+ RETURN(ID);
+ }
+
/* register or segment register */
[%][a-zA-Z0-9]+ {
savech = s->tok[TOKLEN];