Changeset 574b0ea for chapter05/toolchaintechnotes.xml
- Timestamp:
- 05/30/2004 01:41:04 PM (20 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- 07f719a
- Parents:
- b711e1d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/toolchaintechnotes.xml
rb711e1d r574b0ea 28 28 many folks the target triplet will probably be 29 29 <emphasis>i686-pc-linux-gnu</emphasis>. A simple way to determine your target 30 triplet is to run the < filename>config.guess</filename> script that comes with30 triplet is to run the <command>config.guess</command> script that comes with 31 31 the source for many packages. Unpack the Binutils sources and run the script: 32 32 <userinput>./config.guess</userinput> and note the output.</para> … … 35 35 <emphasis>dynamic linker</emphasis>, often also referred to as the 36 36 <emphasis>dynamic loader</emphasis>, not to be confused with the standard linker 37 < emphasis>ld</emphasis> that is part of Binutils. The dynamic linker is provided37 <command>ld</command> that is part of Binutils. The dynamic linker is provided 38 38 by Glibc and has the job of finding and loading the shared libraries needed by a 39 39 program, preparing the program to run and then running it. For most folks the 40 name of the dynamic linker will be < emphasis>ld-linux.so.2</emphasis>. On40 name of the dynamic linker will be <filename>ld-linux.so.2</filename>. On 41 41 platforms that are less prevalent, the name might be 42 < emphasis>ld.so.1</emphasis> and newer 64 bit platforms might even have42 <filename>ld.so.1</filename> and newer 64 bit platforms might even have 43 43 something completely different. You should be able to determine the name 44 44 of your platform's dynamic linker by looking in the … … 64 64 65 65 <listitem><para>Careful manipulation of <command>gcc</command>'s 66 < emphasis>specs</emphasis> file to tell the compiler which target dynamic66 <filename>specs</filename> file to tell the compiler which target dynamic 67 67 linker will be used.</para></listitem> 68 68 </itemizedlist> … … 82 82 the tools in one location are hard linked to the other. An important facet of 83 83 the linker is its library search order. Detailed information can be obtained 84 from <command>ld</command> by passing it the < emphasis>--verbose</emphasis>84 from <command>ld</command> by passing it the <parameter>--verbose</parameter> 85 85 flag. For example: <command>ld --verbose | grep SEARCH</command> will 86 86 show you the current search paths and their order. You can see what files are 87 87 actually linked by <command>ld</command> by compiling a dummy program and 88 passing the < emphasis>--verbose</emphasis> switch to the linker. For example:89 < command>gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded</command>88 passing the <parameter>--verbose</parameter> switch to the linker. For example: 89 <userinput>gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded</userinput> 90 90 will show you all the files successfully opened during the linking.</para> 91 91 … … 93 93 <command>./configure</command> you'll see, for example:</para> 94 94 95 <blockquote><screen> checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as96 checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</ screen></blockquote>95 <blockquote><screen><computeroutput>checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as 96 checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</computeroutput></screen></blockquote> 97 97 98 98 <para>This is important for the reasons mentioned above. It also demonstrates … … 101 101 itself, the same search paths are not necessarily used. You can find out which 102 102 standard linker <command>gcc</command> will use by running: 103 < command>gcc -print-prog-name=ld</command>.103 <userinput>gcc -print-prog-name=ld</userinput>. 104 104 Detailed information can be obtained from <command>gcc</command> by passing 105 it the < emphasis>-v</emphasis> flag while compiling a dummy program. For106 example: < command>gcc -v dummy.c</command> will show you detailed105 it the <parameter>-v</parameter> flag while compiling a dummy program. For 106 example: <userinput>gcc -v dummy.c</userinput> will show you detailed 107 107 information about the preprocessor, compilation and assembly stages, including 108 108 <command>gcc</command>'s include search paths and their order.</para> … … 118 118 <filename class="directory">glibc-build</filename> directory for all the 119 119 important details. You'll note some interesting items like the use of 120 < emphasis>CC="gcc -B/tools/bin/"</emphasis> to control which binary tools are121 used, and also the use of the < emphasis>-nostdinc</emphasis> and122 < emphasis>-isystem</emphasis> flags to control the compiler's include search120 <parameter>CC="gcc -B/tools/bin/"</parameter> to control which binary tools are 121 used, and also the use of the <parameter>-nostdinc</parameter> and 122 <parameter>-isystem</parameter> flags to control the compiler's include search 123 123 path. These items help to highlight an important aspect of the Glibc package: 124 124 it is very self-sufficient in terms of its build machinery and generally does … … 126 126 127 127 <para>After the Glibc installation, we make some adjustments to ensure that 128 searching and linking take place only within our <filename >/tools</filename>128 searching and linking take place only within our <filename class="directory">/tools</filename> 129 129 prefix. We install an adjusted <command>ld</command>, which has a hard-wired 130 130 search path limited to <filename class="directory">/tools/lib</filename>. Then … … 134 134 hard-wired path to a dynamic linker is embedded into every ELF shared 135 135 executable. You can inspect this by running: 136 < command>readelf -l <name of binary> | grep interpreter</command>.136 <userinput>readelf -l <name of binary> | grep interpreter</userinput>. 137 137 By amending <command>gcc</command>'s specs file, we are ensuring that every 138 138 program compiled from here through the end of this chapter will use our new … … 146 146 147 147 <para>During the second pass of Binutils, we are able to utilize the 148 < emphasis>--with-lib-path</emphasis> configure switch to control148 <parameter>--with-lib-path</parameter> configure switch to control 149 149 <command>ld</command>'s library search path. From this point onwards, the 150 150 core toolchain is self-contained and self-hosted. The remainder of the
Note:
See TracChangeset
for help on using the changeset viewer.