Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Guide de l'utilisateur Page 58

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 100
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 57
Chapter 4. Compiling and Building
48
3. Recompile and optimize source.c with profiling information gathered in step one:
gcc source.c -fprofile-use -O2 -o executable
Multiple data collection runs, as seen in step two, will accumulate data into the profiling file instead
of replacing it. This allows the executable in step two to be run multiple times with additional
representative data in order to collect even more information.
The executable must run with representative levels of both the machine being used and a respective
data set large enough for the input needed. This ensures optimal results are achieved.
By default, GCC will generate the profile data into the directory where step one was performed. To
generate this information elsewhere, compile with -fprofile-dir=DIR where DIR is the preferred
output directory.
Warning
The format of the compiler feedback data file changes between compiler versions. It is imperative
that the program compilation is repeated with every new version of the compiler.
4.1.6.6. Using 32-bit compilers on a 64-bit host
On a 64-bit host, GCC will build executables that can only run on 64-bit hosts. However, GCC can be
used to build executables that will run both on 64-bit hosts and on 32-bit hosts.
To build 32-bit binaries on a 64-bit host, first install 32-bit versions of any supporting libraries the
executable may need. This must at least include supporting libraries for glibc and li/jointfilesconvert/280529/bgcc, and
possibly for libstdc++ if the program is a C++ program. On Intel 64 and AMD64, this can be done
with:
yum install glibc-devel.i686 li/jointfilesconvert/280529/bgcc.i686 libstdc++-devel.i686
There may be cases where it is useful to to install additional 32-bit libraries that a program may need.
For example, if a program uses the db4-devel libraries to build, the 32-bit version of these libraries
can be installed with:
yum install db4-devel.i686
Note
The .i686 suffix on the x86 platform (as opposed to x86-64) specifies a 32-bit version of the
given package. For PowerPC architectures, the suffix is ppc (as opposed to ppc64).
After the 32-bit libraries have been installed, the -m32 option can be passed to the compiler and
linker to produce 32-bit executables. Provided the supporting 32-bit libraries are installed on teh 64-bit
system, this executable will be able to run on both 32-bit systems and 64-bit systems.
Procedure 4.6. Compiling a 32-bit Program on a 64-bit Host
1. On a 64-bit system, compile hello.c into a 64-bit executable with:
gcc hello.c -o hello64
2. Ensure that the resulting executable is a 64-bit binary:
Vue de la page 57
1 2 ... 53 54 55 56 57 58 59 60 61 62 63 ... 99 100

Commentaires sur ces manuels

Pas de commentaire