📄 gcc.texi
字号:
SR#4701-078451. Anyway, the attached assembler uses the archivelibrary version of ``cvtnum(3c)'' and thus does not exhibit the bug.@end quotationThis patch is also known as PHCO_0800.@itemAnother assembler problem on the HP PA results in an error message likethis while compiling part of @file{libgcc2.a}:@exampleas: /usr/tmp/cca08196.s @@line#30 [err#1060] Argument 1 or 3 in FARG upper - lookahead = RTNVAL=GR@end exampleThis happens because HP changed the assembler syntax after systemrelease 8.02. GNU CC assumes the newer syntax; if your assembler wantsthe older syntax, comment out this line in the file @file{pa1-hpux.h}:@example#define HP_FP_ARG_DESCRIPTOR_REVERSED@end example@itemSome versions of the Pyramid C compiler are reported to be unable tocompile GNU CC. You must use an older version of GNU CC forbootstrapping. One indication of this problem is if you get a crashwhen GNU CC compiles the function @code{muldi3} in file @file{libgcc2.c}.You may be able to succeed by getting GNU CC version 1, installing it,and using it to compile GNU CC version 2. The bug in the Pyramid Ccompiler does not seem to affect GNU CC version 1.@itemOn the Tower models 4@var{n}0 and 6@var{n}0, by default a process is notallowed to have more than one megabyte of memory. GNU CC cannot compileitself (or many other programs) with @samp{-O} in that much memory.To solve this problem, reconfigure the kernel adding the following lineto the configuration file:@exampleMAXUMEM = 4096@end example@itemOn the Altos 3068, programs compiled with GNU CC won't work unless youfix a kernel bug. This happens using system versions V.2.2 1.0gT1 andV.2.2 1.0e and perhaps later versions as well. See the file@file{README.ALTOS}.@itemYou will get several sorts of compilation and linking errors on thewe32k if you don't follow the special instructions. @xref{WE32KInstall}.@end itemize@node Cross-Compiler Problems@section Cross-Compiler Problems@itemize @bullet@itemCross compilation can run into trouble for certain machines becausesome target machines' assemblers require floating point numbers to bewritten as @emph{integer} constants in certain contexts.The compiler writes these integer constants by examining the floatingpoint value as an integer and printing that integer, because this issimple to write and independent of the details of the floating pointrepresentation. But this does not work if the compiler is running ona different machine with an incompatible floating point format, oreven a different byte-ordering.In addition, correct constant folding of floating point valuesrequires representing them in the target machine's format.(The C standard does not quite require this, but in practiceit is the only way to win.)@ifset INTERNALSIt is now possible to overcome these problems by defining macros suchas @code{REAL_VALUE_TYPE}. But doing so is a substantial amount ofwork for each target machine. @xref{Cross-compilation}.@end ifset@ifclear INTERNALSIt is now possible to overcome these problems by defining macros suchas @code{REAL_VALUE_TYPE}. But doing so is a substantial amount ofwork for each target machine. @xref{Cross-compilation,,CrossCompilation and Floating Point Format, gcc.info, Using and Porting GCC}.@end ifclear@itemAt present, the program @file{mips-tfile} which adds debugsupport to object files on MIPS systems does not work in a crosscompile environment.@end itemize@node Interoperation@section InteroperationThis section lists various difficulties encountered in using GNU C orGNU C++ together with other compilers or with the assemblers, linkers,libraries and debuggers on certain systems.@itemize @bullet@itemGNU C normally compiles functions to return small structures and unionsin registers. Most other compilers arrange to return them just likelarger structures and unions. This can lead to trouble when you linktogether code compiled by different compilers. To avoid the problem, youcan use the option @samp{-fpcc-struct-return} when compiling with GNU CC.@itemGNU C++ does not do name mangling in the same way as other C++compilers. This means that object files compiled with one compilercannot be used with another.GNU C++ also uses different techniques for arranging virtual functiontables and the layout of class instances. In general, therefore,linking code compiled with different C++ compilers does not work.@itemOlder GDB versions sometimes fail to read the output of GNU CC version2. If you have trouble, get GDB version 4.4 or later.@item@cindex DBXDBX rejects some files produced by GNU CC, though it accepts similarconstructs in output from PCC. Until someone can supply a coherentdescription of what is valid DBX input and what is not, there isnothing I can do about these problems. You are on your own.@itemThe GNU assembler (GAS) does not support PIC. To generate PIC code, youmust use some other assembler, such as @file{/bin/as}.@itemOn some BSD systems including some versions of Ultrix, use of profilingcauses static variable destructors (currently used only in C++) not tobe run.@itemUse of @samp{-I/usr/include} may cause trouble.Many systems come with header files that won't work with GNU CC unlesscorrected by @code{fixincludes}. The corrected header files go in a newdirectory; GNU CC searches this directory before @file{/usr/include}.If you use @samp{-I/usr/include}, this tells GNU CC to search@file{/usr/include} earlier on, before the corrected headers. Theresult is that you get the uncorrected header files.Instead, you should use these options:@example-I/usr/local/lib/gcc-lib/@var{target}/@var{version}/include -I/usr/include@end example@ignore@cindex @code{vfork}, for the Sun-4@itemThere is a bug in @code{vfork} on the Sun-4 which causes the registersof the child process to clobber those of the parent. Because of this,programs that call @code{vfork} are likely to lose when compiledoptimized with GNU CC when the child code alters registers which containC variables in the parent. This affects variables which are live in theparent across the call to @code{vfork}.If you encounter this, you can work around the problem by declaringvariables @code{volatile} in the function that calls @code{vfork}, untilthe problem goes away, or by not declaring them @code{register} and notusing @samp{-O} for those source files.@end ignore@itemOn a Sparc, GNU CC aligns all values of type @code{double} on an 8-byteboundary, and it expects every @code{double} to be so aligned. The Suncompiler usually gives @code{double} values 8-byte alignment, with oneexception: function arguments of type @code{double} may not be aligned.As a result, if a function compiled with Sun CC takes the address of anargument of type @code{double} and passes this pointer of type@code{double *} to a function compiled with GNU CC, dereferencing thepointer may cause a fatal signal.One way to solve this problem is to compile your entire program with GNUCC. Another solution is to modify the function that is compiled withSun CC to copy the argument into a local variable; local variablesare always properly aligned. A third solution is to modify the functionthat uses the pointer to dereference it via the following function@code{access_double} instead of directly with @samp{*}:@exampleinline doubleaccess_double (double *unaligned_ptr)@{ union d2i @{ double d; int i[2]; @}; union d2i *p = (union d2i *) unaligned_ptr; union d2i u; u.i[0] = p->i[0]; u.i[1] = p->i[1]; return u.d;@}@end example@noindentStoring into the pointer can be done likewise with the same union.@itemOn a Sun, linking using GNU CC fails to find a shared library andreports that the library doesn't exist at all.This happens if you are using the GNU linker, because it does onlystatic linking and looks only for unshared libraries. If you have ashared library with no unshared counterpart, the GNU linker won't findanything.We hope to make a linker which supports Sun shared libraries, but pleasedon't ask when it will be finished---we don't know.@itemSun forgot to include a static version of @file{libdl.a} with someversions of SunOS (mainly 4.1). This results in undefined symbols whenlinking static binaries (that is, if you use @samp{-static}). If yousee undefined symbols @code{_dlclose}, @code{_dlsym} or @code{_dlopen}when linking, compile and link against the file@file{mit/util/misc/dlsym.c} from the MIT version of X windows.@itemOn the HP PA machine, ADB sometimes fails to work on functions compiledwith GNU CC. Specifically, it fails to work on functions that use@code{alloca} or variable-size arrays. This is because GNU CC doesn'tgenerate HP-UX unwind descriptors for such functions. It may even beimpossible to generate them.@item Debugging (@samp{-g}) is not supported on the HP PA machine, unless you use the preliminary GNU tools (@pxref{Installation}).@itemThe HP-UX linker has a bug which can cause programs which make use of@code{const} variables to fail in unusual ways. If your program makesuse of global @code{const} variables, we suggest you compile with thefollowing additional options:@example-Dconst="" -D__const="" -D__const__="" -fwritable-strings@end exampleThis will force the @code{const} variables into the DATA subspace which will avoid the linker bug.Another option one might use to work around this problem is@samp{-mkernel}. @samp{-mkernel} changes how the address of variablesis computed to a sequence less likely to tickle the HP-UX linker bug.We hope to work around this problem in GNU CC 2.4, if HP does not fixit.@itemTaking the address of a label may generate errors from the HP-UXPA assembler. GAS for the PA does not have this problem.@itemGNU CC produced code will not yet link against HP-UX 8.0 shared libraries.We expect to fix this problem in GNU CC 2.4. @itemThe current version of the assembler (@file{/bin/as}) for the RS/6000has certain problems that prevent the @samp{-g} option in GCC fromworking.IBM has produced a fixed version of the assembler. The replacementassembler is not a standard component of either AIX 3.1.5 or AIX 3.2,but is expected to become standard in a future distribution. Thisassembler is available from IBM as APAR IX22829. Yet more bugs havebeen fixed in a newer assembler, which will shortly be available as APARIX26107. See the file @file{README.RS6000} for more details on theseassemblers.@itemOn the IBM RS/6000, compiling code of the form@exampleextern int foo;@dots{} foo @dots{}static int foo;@end example@noindentwill cause the linker to report an undefined symbol @code{foo}.Although this behavior differs from most other systems, it is not abug because redefining an @code{extern} variable as @code{static}is undefined in ANSI C.@itemOn VMS, GAS versions 1.38.1 and earlier may cause spurious warningmessages from the linker. These warning messages complain of mismatchedpsect attributes. You can ignore them. @xref{VMS Install}.@itemOn NewsOS version 3, if you include both @file{stddef.h} and@file{sys/types.h}, you get an error because there are two typedefs of@code{size_t}. You should change @file{sys/types.h} by adding theselines around the definition of @code{size_t}:@example#ifndef _SIZE_T#define _SIZE_T@var{actual typedef here}#endif@end example@cindex Alliant@itemOn the Alliant, the system's own convention for returning structuresand unions is unusual, and is not compatible with GNU CC no matterwhat options are used.@cindex RT PC@cindex IBM RT PC@itemOn the IBM RT PC, the MetaWare HighC compiler (hc) uses yet anotherconvention for structure and union returning. Use@samp{-mhc-struct-return} to tell GNU CC to use a convention compatiblewith it.@cindex Vax calling convention@cindex Ultrix calling convention@itemOn Ultrix, the Fortran compiler expects registers 2 through 5 to be savedby function calls. However, the C compiler uses conventions compatiblewith BSD Unix: registers 2 through 5 may be clobbered by function calls.GNU CC uses the same convention as the Ultrix C compiler. You can usethese options to produce code compatible with the Fortran compiler:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -