MantisBT - CMake
View Issue Details
0008392CMakeCMakepublic2009-01-16 19:052011-03-10 15:01
flar 
Alex Neundorf 
normalmajoralways
closedfixed 
CMake-2-6 
 
0008392: ASM-ATT doesn't preprocess *.S sources through cpp
When file end with ".S" it means that "gcc" should preprocess it and generate ".s" file, which should be compiled.
cmake calls "as" on ".S" files and don't do any preprocessing.
No tags attached.
patch asmgcc.patch (3,444) 2009-09-05 15:29
https://public.kitware.com/Bug/file/2440/asmgcc.patch
Issue History
2009-01-16 19:05flarNew Issue
2009-01-16 23:25Bill HoffmanStatusnew => assigned
2009-01-16 23:25Bill HoffmanAssigned To => Alex Neundorf
2009-09-05 15:29Alex NeundorfFile Added: asmgcc.patch
2009-09-05 15:30Alex NeundorfNote Added: 0017318
2009-09-06 03:37Alex NeundorfNote Added: 0017320
2009-09-12 02:17Alex NeundorfNote Added: 0017404
2009-10-14 18:39Alex NeundorfNote Added: 0018074
2010-11-10 13:04David ColeTarget Version => CMake 2.8.4
2010-12-08 16:55Alex NeundorfNote Added: 0023826
2011-01-07 09:53David ColeNote Added: 0024506
2011-01-07 09:53David ColeTarget VersionCMake 2.8.4 =>
2011-02-08 16:46Alex NeundorfNote Added: 0025343
2011-03-10 15:01Alex NeundorfNote Added: 0025739
2011-03-10 15:01Alex NeundorfStatusassigned => closed
2011-03-10 15:01Alex NeundorfResolutionopen => fixed

Notes
(0017318)
Alex Neundorf   
2009-09-05 15:30   
Attached is a patch which adds a language ASM-GCC which uses gcc to process the assembler files.

Do other compilers also support processing assembler files or is this only gcc ?
If other compilers do this too, then it needs a different name.

Alex
(0017320)
Alex Neundorf   
2009-09-06 03:37   
John Smith wrote:

IMHO, I believe that the C compiler (or C compiler driver) should be
invoked on the assembly sources, with the exact definitions and C
compiler flags that are set at that point in the processing of the
source tree. The reason for that is definitions may be involved in
pre-processing the source file as conditionals guarding include
directives, etc. and flags may alter the code generation, e.g., -m32 may
be used to generate x86 code.

If CMake has the concept of a settable "default" language/compiler per
project then perhaps that default compiler -- be it C or C++ -- might be
the perfect choice for building the project's assembly files. The C
compiler would use the compile definitions and C flags, whereas the C++
compiler would use the same definitions but CXX flags. I.e., not
hard-coding the C compiler in might be a better choice. Of course, I
might be wrong, and I invite others to state their opinions on this.

gcc -- per the man page -- does not preprocess .s files but it does so
for .S files, when invoked for compilation. With this behavior, I
believe gcc is unique.

Other compilers which I believe know automagically what to do with .s
assembly sources are:

1. HP aCC at http://docs.hp.com/en/14672/Help/commandsyntax.htm#Assembly-source [^] :

Assembly language source files (.s files)
Files with names ending in .s are assumed to be assembly source files.
The compiler invokes the assembler through cc to produce .o files from
these.

2. IBM VisualAge for C++ at http://www-01.ibm.com/support/docview.wss?uid=swg27012874&aid=1 [^] :

Assembler files
Assembler files must have a .s suffix, for example, file_name.s, unless
you compile with the -qsourcetype=assembler option. Assembler files are
assembled to create an object file.

3. Sun's Sun Studio at http://docs.sun.com/app/docs/doc/820-7598/bjapp?l=en&a=view&q=.s+assembler [^] :

The syntax of the cc command is:
% cc [options] filenames [libraries]...
[...]
Use the C compiler to compile and link any combination of the following:
[...] o Assembler source files, with .s suffixes

4. Intel C++ at http://www.intel.com/software/products/compilers/docs/clin/main_cls/whnjs.htm [^] :

The IntelĀ® C++ Compiler recognizes input files with the extensions
listed in the following table:

[...]
file.s | Assembly file | Passed to assembler
(0017404)
Alex Neundorf   
2009-09-12 02:17   
Now *.S files are not longer passed to the assembler, this was relatively obviously wrong, since they have to be preprocessed.

Alex
(0018074)
Alex Neundorf   
2009-10-14 18:39   
I'll change the plain "ASM" language so that it always hands the assembler files to the C/C++ compiler. If the ASM language is enabled but neither C nor C++ are enabled this will be an error.
This will need GNU-ASM.cmake etc. support files in cmake.

Alex
(0023826)
Alex Neundorf   
2010-12-08 16:55   
This should be the way to go:
http://www.cmake.org/pipermail/cmake-developers/2010-August/000503.html [^] (and following posts)

Alex
(0024506)
David Cole   
2011-01-07 09:53   
Alex,

I have unset the "target version" field, assuming that you will not be getting to this by our upcoming Monday evening deadline. I'm doing this just to make sure the roadmap page has an up-to-date-as- possible view of the still open bugs we're planning to fix by Monday.

If I'm incorrect, feel free to put this back on the 2.8.4 roadmap page by switching the target version back again.

Thanks.
(0025343)
Alex Neundorf   
2011-02-08 16:46   
Brad wrote:
The IBM VisualAge compiler was rebranded to "XL":

$ xlc -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0001
$ xlC -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0001

IBM Summary: Use -qversion, look for "XL C".

-----------------------------------------------------------
Sun:

$ cc -V
cc: Sun C 5.6 2004/07/15
usage: cc [ options] files. Use 'cc -flags' for details
$ CC -V
CC: Sun C++ 5.6 2004/07/15

$ cc -V
cc: Sun C 5.9 Linux_i386 Build40_1 2007/02/09
usage: cc [ options] files. Use 'cc -flags' for details
$ CC -V
sunCC: Sun C++ 5.9 Linux_i386 Build40_1 2007/02/09

Sun Summary: Use -V, look for "Sun C".

I don't know whether this has changed since Oracle's purchase.

-----------------------------------------------------------
HP:

$ cc -V
cc: HP C/aC++ B3910B A.06.20 [May 13 2008]
$ aCC -V
aCC: HP C/aC++ B3910B A.06.20 [May 13 2008]

HP Summary: Use -V, look for "HP C".
(0025739)
Alex Neundorf   
2011-03-10 15:01   
This is now in next.
"ASM" is now all assembler which can be processed by the normal C compiler. So with gcc this is now also preprocessed.
Intel, IBM, Sun and HP are also supported.

If you want plain as/gas, you still can enable ASM-ATT.