-x assembler-with-cpp problem on alpha-osf hosts
Kevin Nomura
nomura@netapp.com
Fri Mar 17 17:05:00 GMT 2000
The GCC version: 2.95.1
The system type: OSF1 V4.0 1229 alpha or similar
All options you passed to the compiler: gcc -x assembler-with-cpp
-s a.s -c
Preprocessed output of the source file that caused the compiler
error, even if the source code can be downloaded from
elsewhere
File a.s:
============================================
#define ENTRY(x) .globl x; .ent x; x:
ENTRY(rpcc64)
rpcc $0
ret
.end rpcc64
============================================
Compile as follows:
[pollux]$ gcc -x assembler-with-cpp -s a.s -c -v
Reading specs from
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/specs
gcc version 2.95.1 19990816 (release)
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/cpp -lang-asm -v -$
-Dunix -D__osf__ -D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__
-D__osf__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix
-D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -D__ASSEMBLER__
-D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu(alpha)
-Amachine(alpha) -D__alpha -D__alpha__ -D__alpha_ev5__ -Acpu(ev5)
-D__alpha_bwx__ -Acpu(bwx) a.s /tmp/ccRHOnRA.s
GNU CPP version 2.95.1 19990816 (release)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/../../../../alphaev56-dec-osf4.0d/include
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/../../../../include/g++-3
End of omitted list.
as -g -nocpp -O0 -o a.o /tmp/ccRHOnRA.s
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/mips-tfile -v -o
a.o a.s
mips-tfile version 2.95.1 19990816 (release)
mips-tfile, a.s:5 .end directive without a preceding .ent directive
line: .end rpcc64
=========================================
Note the syntax errors at the bottom of the preceding output; these
would not occur if the file were named ".S" (which implies preprocessing
just as "-x assembler-with-cpp" does).
Here is my analysis of the problem. The file requires preprocessing,
but the name (which I am not at liberty to change) is ".s" rather than
".S". So I specify "-x assembler-with-cpp" to have preprocessing
applied to the file. As the -v output shows, the preprocessor is run,
followed by the assembler, so far so good.
Then the "mips-tfile" utility is run. This is apparently some
post-assembly tool run on systems that use ECOFF. mips-tfile takes the
object file (just produced from as) as one argument and the .s file as
the other argument. The problem is that the original .s file is given
to mips-tfile instead of the preprocessed .s file in /tmp/ccRHOnRA.s.
This exposes preprocessing directives to mips-tfile that it is not
equipped to handle and results in syntax errors.
If gcc is invoked on a ".S" file, then "as" followed by mips-tfile are
invoked just as they are with "-x assembler-with-cpp", except mips-tfile
is supplied with the preprocessed assembly file. This works correctly.
My understanding is the two scenarios should be equivalent, so we need
to make "-x assembler-with-cpp" pass in the preprocessed name the same
way that a source file named ".S" arranges to happen. The ".S" path is
illustrated below:
==========================================
[pollux]$ gcc -s b.S -c -v
Reading specs from
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/specs
gcc version 2.95.1 19990816 (release)
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/cpp -lang-asm -v -$
-Dunix -D__osf__ -D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__
-D__osf__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix
-D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -D__ASSEMBLER__
-D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY -DLANGUAGE_ASSEMBLY
-Acpu(alpha) -Amachine(alpha) -D__alpha -D__alpha__ -D__alpha_ev5__
-Acpu(ev5) -D__alpha_bwx__ -Acpu(bwx) b.S /tmp/ccQ0E1FL.s
GNU CPP version 2.95.1 19990816 (release)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/../../../../alphaev56-dec-osf4.0d/include
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/../../../../include/g++-3
End of omitted list.
as -g -nocpp -O0 -o b.o /tmp/ccQ0E1FL.s
/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0d/2.95.1/mips-tfile -v -o
b.o /tmp/ccQ0E1FL.s
mips-tfile version 2.95.1 19990816 (release)
[pollux]$
More information about the Gcc-bugs
mailing list