diff --git a/en_US.ISO8859-1/articles/Makefile b/en_US.ISO8859-1/articles/Makefile index 17e7f90499..950005bb67 100644 --- a/en_US.ISO8859-1/articles/Makefile +++ b/en_US.ISO8859-1/articles/Makefile @@ -13,6 +13,7 @@ SUBDIR+= contributing SUBDIR+= contributing-ports SUBDIR+= contributors SUBDIR+= cups +SUBDIR+= custom-gcc SUBDIR+= cvs-freebsd SUBDIR+= cvsup-advanced SUBDIR+= dialup-firewall diff --git a/en_US.ISO8859-1/articles/custom-gcc/Makefile b/en_US.ISO8859-1/articles/custom-gcc/Makefile new file mode 100644 index 0000000000..b7bd286403 --- /dev/null +++ b/en_US.ISO8859-1/articles/custom-gcc/Makefile @@ -0,0 +1,18 @@ +# +# $FreeBSD$ +# + +DOC?= article + +FORMATS?= html +WITH_ARTICLE_TOC?= YES + +INSTALL_COMPRESSED?= gz +INSTALL_ONLY_COMPRESSED?= + +SRCS= article.sgml + +URL_RELPREFIX?= ../../../.. +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/en_US.ISO8859-1/articles/custom-gcc/article.sgml b/en_US.ISO8859-1/articles/custom-gcc/article.sgml new file mode 100644 index 0000000000..31b9dfc643 --- /dev/null +++ b/en_US.ISO8859-1/articles/custom-gcc/article.sgml @@ -0,0 +1,226 @@ + +%articles.ent; +]> + +
+ + Using newer version of <application>GCC</application> and + <application>binutils</application> with the &os; Ports + Collection + + + Martin + Matuska + +
mm@FreeBSD.org
+
+
+ + $FreeBSD$ + + + &tm-attrib.freebsd; + &tm-attrib.general; + + + + 2009 + The &os; Documentation Project + + + + This article describes how to use newer versions of the + GCC compilers and + binutils from the &os; ports tree. + Custom GCC configurations are also + discussed. + +
+ + + Introduction + + The default system compiler as of &os; 8.0 is + GCC version 4.2.1. In addition, the + base system of &os; includes binutils + version 2.15. These versions are several years old and lack, + among other things, support for recent CPU + instructions like SSSE3, + SSE4.1, SSE4.2, etc. + Due to licensing issues, new versions of these applications will + not be integrated into the base system. Luckily, it is possible + to use a newer version of the GCC + compiler (e.g. version 4.4) with the help of the &os; ports + tree. + + + + Prerequisites + + + Installing binutils from ports + + To make use of all of the new features in the latest + GCC versions, the latest version of + binutils needs to be installed. + Installation of the newer version of + binutils is optional; but without it, + there will be no support for new CPU + instructions. + + To install the latest available version of + binutils using the &os; ports tree, + issue the following command: + + &prompt.root; cd /usr/ports/devel/binutils && make install + + + + Installing GCC from ports + + The &os; ports tree offers several new versions of + GCC. The following example is for + the stable version 4.4. However, it is possible to install + previous or later development versions (e.g. + lang/gcc43 or + lang/gcc45). + + To install one of the mentioned + GCC ports, run the following + command: + + &prompt.root; cd /usr/ports/lang/gcc44 && make install + + + + + Configuring ports for custom version of + <application>GCC</application> + + Additional system configuration is required in order to use + custom version of GCC installed from + the &os; ports tree. + + + Adjusting <filename>make.conf</filename> + + Add the following lines to the + /etc/make.conf file (or modify + appropriately): + + .if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc44) +USE_GCC=4.4 +CPP=cpp44 +.endif + + Alternatively, it is possible to specify the + ${CC} and ${CPP} variables + manually. + + + The examples above are for GCC + version 4.4. To use gcc43, replace + "gcc44" with "gcc43" and + "4.4" with "4.3" and so + on. + + + + + Adjusting <filename>libmap.conf</filename> + + Many of the ports' binaries and libraries link to libgcc_s + or libstdc++. The base system already includes these libraries, + but from an earlier version of GCC + (version 4.2.1). To supply rtld (and ldd) with correct versions, + add the following lines to the + /etc/libmap.conf file (or modify + appropriately): + + libgcc_s.so.1 gcc44/libgcc_s.so.1 +libgomp.so.1 gcc44/libgomp.so.1 +libobjc.so.3 gcc44/libobjc.so.2 +libssp.so.0 gcc44/libssp.so.0 +libstdc++.so.6 gcc44/libstdc++.so.6 + + + The examples above are for GCC + version 4.4. To use gcc43, replace + "gcc44" with "gcc43" + and so on. Note also that all of these libraries are fully + backwards compatible with base system libraries. + + + + Some C++ programs may refuse to work if these libraries + are not mapped correctly. If it is not feasible to map them + all, it is recommended to map at least libstdc++.so. + + + + + Custom <literal>CFLAGS</literal> for the ports tree + + To add custom CFLAGS for the ports tree + which are unsupported by the base system, adjust the + /etc/make.conf according to the following + example: + + .if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc44) +USE_GCC=4.4 +CPP=cpp44 +CFLAGS+=-mssse3 +.endif + + It is possible to completely replace + CFLAGS and/or define custom + CPUTYPE as well. We recommend setting + CPUTYPE because many ports decide their + optimizations flags based on this variable. + + + + Excluding ports that do not build with new version of + <application>GCC</application> + + To exclude ports that have problems with custom version of + GCC, adjust the + /etc/make.conf according to the following + example: + + .if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc44) +.if empty(.CURDIR:M/usr/ports/net/openldap*) +USE_GCC=4.X +.endif +.endif + + The example above excludes the forced use of + gcc 4.4 for the + net/openldap* ports. It is + also possible to specify more ports on a single line: + + .if empty(.CURDIR:M/usr/ports/net/openldap*) && empty(.CURDIR:M/usr/ports/xxx/yyy) && ... + + + + + Impact on the binary performance + + Using GCC version 4.4 with + SSSE3 instruction set enabled (if supported by + the CPU) may yield up to 10% average increase + in binary performance. In certain tests, the results show + more than a 20% performance boost (e.g. in multimedia + processing). + + The table located at + shows a comparison of GCC versions + currently available in base &os; system, + GCC version 4.3 and + GCC version 4.4 with various + combinations of CFLAGS using the perlbench + benchmark suite. + +