[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13202: Make Microsoft Visual C recognize the .S file extension
From: |
Peter Rosin |
Subject: |
bug#13202: Make Microsoft Visual C recognize the .S file extension |
Date: |
Mon, 17 Dec 2012 09:07:30 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 |
Hi Rheinländer!
On 2012-12-17 01:41, Rheinländer wrote:
> Hi,
>
> here is a suggestion how to make MSVC (cl.exe) recognize the standard
> extension for assembly code in C projects: Just add the compiler
> switch /Tc before the file inquestion, or use /TC toforce all files
> mentioned on the command line to be treated as C code.
Interesting!
This is best added to the 'compile' script which is "owned" by Automake,
so I have added a CC.
At one point I posted a hacked version of 'compile' to the libffi list,
but it relied on a separate preprocessing step, followed by directly
invoking the assembler (ml.exe).
See the attachment in
http://sourceware.org/ml/libffi-discuss/2012/msg00144.html
It seems very nice to get rid of the extra preprocessing step.
However, I can't get assembly to actually work with -Tc or -TC (see
below), so what am I doing wrong?
Cheers,
Peter
$ cat asm.S # stupid asm file generated from a trivial C file
; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.40219.01
TITLE c:\home\peda\src\junk\asm.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
PUBLIC _main
; Function compile flags: /Odtp
_TEXT SEGMENT
_main PROC
; File c:\cygwin\home\peda\src\junk\asm.c
; Line 2
push ebp
mov ebp, esp
; Line 3
xor eax, eax
; Line 4
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END
$ ml -c asm.S # assembly input is sane!
Microsoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: asm.S
$ cl -c -Tcasm.S # but cl -Tc fails miserably...
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
asm.S
asm.S(1) : error C2061: syntax error : identifier 'generated'
asm.S(1) : error C2059: syntax error : ';'
asm.S(1) : error C2061: syntax error : identifier 'Microsoft'
asm.S(1) : error C2059: syntax error : ';'
asm.S(1) : error C2061: syntax error : identifier 'Optimizing'
asm.S(1) : error C2059: syntax error : ';'
asm.S(1) : error C2061: syntax error : identifier 'Version'
asm.S(1) : error C2059: syntax error : ';'
asm.S(1) : error C2059: syntax error : 'constant'
asm.S(3) : error C2017: illegal escape sequence
asm.S(3) : error C2017: illegal escape sequence
asm.S(3) : error C2017: illegal escape sequence
asm.S(3) : error C2017: illegal escape sequence
asm.S(3) : error C2017: illegal escape sequence
asm.S(3) : error C2017: illegal escape sequence
asm.S(4) : error C2059: syntax error : 'bad suffix on number'
asm.S(13) : error C2061: syntax error : identifier 'compile'
asm.S(13) : error C2059: syntax error : ';'
asm.S(13) : error C2143: syntax error : missing '{' before ':'
asm.S(13) : error C2059: syntax error : ':'
asm.S(16) : error C2061: syntax error : identifier 'c'
asm.S(16) : error C2059: syntax error : ';'
asm.S(16) : error C2059: syntax error : ':'
asm.S(16) : error C2017: illegal escape sequence
asm.S(16) : error C2017: illegal escape sequence
asm.S(16) : error C2017: illegal escape sequence
asm.S(16) : error C2017: illegal escape sequence
asm.S(16) : error C2017: illegal escape sequence
asm.S(16) : error C2017: illegal escape sequence
asm.S(17) : error C2143: syntax error : missing '{' before 'constant'
asm.S(17) : error C2059: syntax error : '<Unknown>'
asm.S(20) : error C2143: syntax error : missing '{' before 'constant'
asm.S(20) : error C2059: syntax error : '<Unknown>'
asm.S(22) : error C2143: syntax error : missing '{' before 'constant'
asm.S(22) : error C2059: syntax error : '<Unknown>'