gcc.texi

来自「GCC编译器源代码」· TEXI 代码 · 共 1,739 行 · 第 1/5 页

TEXI
1,739
字号
@file{iclib.a}.  You must also modify @file{stdio.h} as follows: beforethe lines@example#if     defined(__i860__) && !defined(_VA_LIST)#include <va_list.h>@end example@noindentinsert the line@example#if __PGC__@end example@noindentand after the lines@exampleextern int  vprintf(const char *, va_list );extern int  vsprintf(char *, const char *, va_list );#endif@end example@noindentinsert the line@example#endif /* __PGC__ */@end exampleThese problems don't exist in operating system version 1.1.@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{Configurations}.@itemA bug in the HP-UX 8.05 (and earlier) shell will cause the fixprotoprogram to report an error of the form:@example./fixproto: sh internal 1K buffer overflow@end exampleTo fix this, change the first line of the fixproto script to look like:@example#!/bin/ksh@end example@end itemize@node Cross-Compiler Problems@section Cross-Compiler ProblemsYou may run into problems with cross compilation on certain machines,for several reasons.@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.)It 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.@ifset INTERNALS@xref{Cross-compilation}.@end ifset@ifclear INTERNALS@xref{Cross-compilation,,Cross Compilation 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@itemObjective C does not work on the RS/6000.@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.This effect is intentional, to protect you from more subtle problems.Compilers differ as to many internal details of C++ implementation,including: how class instances are laid out, how multiple inheritance isimplemented, and how virtual function calls are handled.  If the nameencoding were made the same, your programs would link against librariesprovided from other compilers---but the programs would then crash whenrun.  Incompatible libraries are then detected at link time, rather thanat run time.@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 (when compiling C programs):@smallexample-I/usr/local/lib/gcc-lib/@var{target}/@var{version}/include -I/usr/include@end smallexampleFor C++ programs, GNU CC also uses a special directory that defines C++interfaces to standard C subroutines.  This directory is meant to besearched @emph{before} other standard include directories, so that ittakes precedence.  If you are compiling C++ programs and specifyinginclude directories explicitly, use this option first, then the twooptions above:@example-I/usr/local/lib/g++-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 some SGI systems, when you use @samp{-lgl_s} as an option,it gets translated magically to @samp{-lgl_s -lX11_s -lc_s}.Naturally, this does not happen when you use GNU CC.You must specify all three options explicitly.@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{*}:@smallexampleinline 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 smallexample@noindentStoring into the pointer can be done likewise with the same union.@itemOn Solaris, the @code{malloc} function in the @file{libmalloc.a} librarymay allocate memory that is only 4 byte aligned.  Since GNU CC on theSparc assumes that doubles are 8 byte aligned, this may result in afatal signal if doubles are stored in memory allocated by the@file{libmalloc.a} library.The solution is to not use the @file{libmalloc.a} library.  Use instead@code{malloc} and related functions from @file{libc.a}; they do not havethis problem.@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.@itemThe 128-bit long double format that the Sparc port supports currentlyworks by using the architecturally defined quad-word floating pointinstructions.  Since there is no hardware that supports theseinstructions they must be emulated by the operating system.  Longdoubles do not work in Sun OS versions 4.0.3 and earlier, because thekernel emulator uses an obsolete and incompatible format.  Long doublesdo not work in Sun OS version 4.1.1 due to a problem in a Sun library.Long doubles do work on Sun OS versions 4.1.2 and higher, but GNU CCdoes not enable them by default.  Long doubles appear to work in Sun OS5.x (Solaris 2.x).@itemOn HP-UX version 9.01 on the HP PA, the HP compiler @code{cc} does notcompile GNU CC correctly.  We do not yet know why.  However, GNU CCcompiled on earlier HP-UX versions works properly on HP-UX 9.01 and cancompile itself properly on 9.01.@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.@itemDebugging (@samp{-g}) is not supported on the HP PA machine, unless you usethe preliminary GNU tools (@pxref{Installation}).@itemTaking the address of a label may generate errors from the HP-UXPA assembler.  GAS for the PA does not have this problem.@itemUsing floating point parameters for indirect calls to static functionswill not work when using the HP assembler.  There simply is no way for GCCto specify what registers hold arguments for static functions when usingthe HP assembler.  GAS for the PA does not have this problem.@itemIn extremely rare cases involving some very large functions you mayreceive errors from the HP linker complaining about an out of boundsunconditional branch offset.  This used to occur more often in previousversions of GNU CC, but is now exceptionally rare.  If you should runinto it, you can work around by making your function smaller.@itemGNU CC compiled code sometimes emits warnings from the HP-UX assembler ofthe form:@smallexample(warning) Use of GR3 when  frame >= 8192 may cause conflict.@end smallexampleThese warnings are harmless and can be safely ignored.@itemThe current version of the assembler (@file{/bin/as}) for the RS/6000has certain problems that prevent the @samp{-g} option in GCC fromworking.  Note that @file{Makefile.in} uses @samp{-g} by default whencompiling @file{libgcc2.c}.IBM has produced a fixed version of the assembler.  The upgradedassembler unfortunately was not included in any of the AIX 3.2 updatePTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1 should requestPTF U403044 from IBM and users of AIX 3.2 should request PTF U416277.See the file @file{README.RS6000} for more details on these updates.You can test for the presense of a fixed assembler by using thecommand@smallexampleas -u < /dev/null@end smallexample@noindentIf the command exits normally, the assembler fix already is installed.If the assembler complains that "-u" is an unknown flag, you need toorder the fix.@itemOn the IBM RS/6000, compiling code of the form@smallexampleextern int foo;@dots{} foo @dots{}static int foo;@end smallexample@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.@item

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?