View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008392CMakeCMakepublic2009-01-16 19:052011-03-10 15:01
Reporterflar 
Assigned ToAlex Neundorf 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0008392: ASM-ATT doesn't preprocess *.S sources through cpp
DescriptionWhen 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.
TagsNo tags attached.
Attached Filespatch file icon asmgcc.patch [^] (3,444 bytes) 2009-09-05 15:29 [Show Content]

 Relationships

  Notes
(0017318)
Alex Neundorf (developer)
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 (developer)
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 (developer)
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 (developer)
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 (developer)
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 (manager)
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 (developer)
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 (developer)
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.

 Issue History
Date Modified Username Field Change
2009-01-16 19:05 flar New Issue
2009-01-16 23:25 Bill Hoffman Status new => assigned
2009-01-16 23:25 Bill Hoffman Assigned To => Alex Neundorf
2009-09-05 15:29 Alex Neundorf File Added: asmgcc.patch
2009-09-05 15:30 Alex Neundorf Note Added: 0017318
2009-09-06 03:37 Alex Neundorf Note Added: 0017320
2009-09-12 02:17 Alex Neundorf Note Added: 0017404
2009-10-14 18:39 Alex Neundorf Note Added: 0018074
2010-11-10 13:04 David Cole Target Version => CMake 2.8.4
2010-12-08 16:55 Alex Neundorf Note Added: 0023826
2011-01-07 09:53 David Cole Note Added: 0024506
2011-01-07 09:53 David Cole Target Version CMake 2.8.4 =>
2011-02-08 16:46 Alex Neundorf Note Added: 0025343
2011-03-10 15:01 Alex Neundorf Note Added: 0025739
2011-03-10 15:01 Alex Neundorf Status assigned => closed
2011-03-10 15:01 Alex Neundorf Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team