GNU bug report logs - #13202
Make Microsoft Visual C recognize the .S file extension

Previous Next

Package: libtool;

Reported by: Rheinländer <jrheinlaender <at> gmx.de>

Date: Mon, 17 Dec 2012 00:43:01 UTC

Severity: normal

To reply to this bug, email your comments to 13202 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#13202; Package libtool. (Mon, 17 Dec 2012 00:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rheinländer <jrheinlaender <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Mon, 17 Dec 2012 00:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rheinländer <jrheinlaender <at> gmx.de>
To: bug-libtool <at> gnu.org
Subject: Make Microsoft Visual C recognize the .S file extension
Date: Mon, 17 Dec 2012 05:11:09 +0430
[Message part 1 (text/plain, inline)]
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.

Regards,
    Jan Rheinländer

[Message part 2 (text/html, inline)]

Information forwarded to bug-libtool <at> gnu.org:
bug#13202; Package libtool. (Mon, 17 Dec 2012 08:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 13202 <at> debbugs.gnu.org (full text, mbox):

From: Peter Rosin <peda <at> lysator.liu.se>
To: Rheinländer <jrheinlaender <at> gmx.de>
Cc: Automake List <automake <at> gnu.org>, 13202 <at> debbugs.gnu.org
Subject: Re: bug#13202: Make Microsoft Visual C recognize the .S file extension
Date: Mon, 17 Dec 2012 09:07:30 +0100
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>'




Information forwarded to bug-libtool <at> gnu.org:
bug#13202; Package libtool. (Mon, 17 Dec 2012 11:36:01 GMT) Full text and rfc822 format available.

Message #11 received at 13202 <at> debbugs.gnu.org (full text, mbox):

From: Peter Rosin <peda <at> lysator.liu.se>
To: Rheinländer <jrheinlaender <at> gmx.de>
Cc: 13202 <at> debbugs.gnu.org, Automake List <automake <at> gnu.org>
Subject: Re: bug#13202: Make Microsoft Visual C recognize the .S file extension
Date: Mon, 17 Dec 2012 12:34:02 +0100
Hi Jan,

Please keep replies on list.

On 2012-12-17 11:28, Rheinländer wrote:
> Hello Peter,
> 
>> However, I can't get assembly to actually work with -Tc or -TC (see
>> below), so what am I doing wrong?
>>
> 
> OK, I looked a bit more deeply in it and discovered that my .S file is
> actually a C file wrapper for an assembly include... The files are from
> the CLN library, I attached them.
> 
> My real problem is not to compile the assembly code (I have set
> -DNO_ASM anyway) but that the MSVC make breaks on the .S extension.
> Though looking at it again maybe I should suggest instead to the CLN
> folks to rename their file to .cc since it is a C file anyway.

Ok, except it isn't really a C file. It's assembly intended to be
preprocessed by the C preprocessor (as is indicated by the .S extension).
I think the preprocessor will reduce the source to very little in case
NO_ASM is defined (but you didn't attach enough files for me to tell
for sure).

I therefore think the 'compile' script I referred to earlier may
handle your case; it will preprocess the .S file and feed the remaining
few bits to ml which in turn will do nothing, hopefully. But maybe ml
will miss an END directive? Or something? Untested...

Cheers,
Peter





Information forwarded to bug-libtool <at> gnu.org:
bug#13202; Package libtool. (Mon, 17 Dec 2012 20:34:01 GMT) Full text and rfc822 format available.

Message #14 received at 13202 <at> debbugs.gnu.org (full text, mbox):

From: Jeffrey Walton <noloader <at> gmail.com>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 13202 <at> debbugs.gnu.org, Automake List <automake <at> gnu.org>
Subject: Re: bug#13202: Make Microsoft Visual C recognize the .S file extension
Date: Mon, 17 Dec 2012 15:31:54 -0500
On Mon, Dec 17, 2012 at 3:07 AM, Peter Rosin <peda <at> lysator.liu.se> wrote:
> 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 may not work under MASM64 since inline ASM is not supported on x64.

Jeff




This bug report was last modified 12 years and 189 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.