Ticket #2461: toolchain-v2.patch
File toolchain-v2.patch, 3.7 KB (added by , 15 years ago) |
---|
-
chapter05/toolchaintechnotes.xml
old new 99 99 seen during its run of <command>configure</command> is:</para> 100 100 101 101 <screen><computeroutput>checking what assembler to use... 102 /tools/i686- pc-linux-gnu/bin/as103 checking what linker to use... /tools/i686- pc-linux-gnu/bin/ld</computeroutput></screen>102 /tools/i686-lfs-linux-gnu/bin/as 103 checking what linker to use... /tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen> 104 104 105 105 <para>This is important for the reasons mentioned above. It also demonstrates 106 106 that GCC's configure script does not search the PATH directories to find which … … 117 117 118 118 <para>The next package installed is Glibc. The most important considerations 119 119 for building Glibc are the compiler, binary tools, and kernel headers. The 120 compiler is generally not an issue since Glibc will always use the 121 <command>gcc</command> found in a <envar>PATH</envar> directory. The binary 120 compiler is generally not an issue since Glibc will always use the compiler 121 relating to the <parameter>--host</parameter> parameter passed to its 122 configure script, e.g. <command>i686-lfs-linux-gnu-gcc</command>. The binary 122 123 tools and kernel headers can be a bit more complicated. Therefore, take no 123 124 risks and use the available configure switches to enforce the correct 124 125 selections. After the run of <command>configure</command>, check the contents 125 126 of the <filename>config.make</filename> file in the <filename 126 127 class="directory">glibc-build</filename> directory for all important details. 127 Note the use of <parameter>CC=" gcc -B/tools/bin/"</parameter> to control which128 Note the use of <parameter>CC="i686-lfs-gnu-gcc"</parameter> to control which 128 129 binary tools are used and the use of the <parameter>-nostdinc</parameter> 129 130 and <parameter>-isystem</parameter> flags to control the compiler's include 130 131 search path. These items highlight an important aspect of the Glibc 131 132 package—it is very self-sufficient in terms of its build machinery and 132 133 generally does not rely on toolchain defaults.</para> 133 134 134 <para>After the Glibc installation, make some adjustments to ensure that 135 searching and linking take place only within the <filename 136 class="directory">/tools</filename> prefix. Install an adjusted 137 <command>ld</command>, which has a hard-wired search path limited to 138 <filename class="directory">/tools/lib</filename>. Then amend 139 <command>gcc</command>'s specs file to point to the new dynamic linker in 140 <filename class="directory">/tools/lib</filename>. This last step is vital 141 to the whole process. As mentioned above, a hard-wired path to a dynamic 142 linker is embedded into every Executable and Link Format (ELF)-shared 143 executable. This can be inspected by running: 135 <para>After the Glibc installation, amend <command>gcc</command>'s specs file 136 to point to the new dynamic linker in <filename 137 class="directory">/tools/lib</filename>. This last step is vital in ensuring 138 that searching and linking take place only within the <filename 139 class="directory">/tools</filename> prefix. As mentioned above, a hard-wired 140 path to a dynamic linker is embedded into every Executable and Link Format 141 (ELF)-shared executable. This can be inspected by running: 144 142 <userinput>readelf -l <name of binary> | grep interpreter</userinput>. 145 143 Amending gcc's specs file ensures that every program compiled from here 146 144 through the end of this chapter will use the new dynamic linker in