- Timestamp:
- 12/03/2008 10:46:04 PM (15 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.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:
- 4e82d47
- Parents:
- b0e1dc8
- Location:
- chapter05
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/adjusting.xml
rb0e1dc8 r6e88633 33 33 dumping GCC's <quote>specs</quote> file to a location where GCC will look for it 34 34 by default. A simple <command>sed</command> substitution then alters the 35 dynamic linker that GCC will use.</para> 35 dynamic linker that GCC will use. The principle here is to find all references 36 to the dynamic linker file in <filename class="directory">/lib</filename> 37 or possibly <filename class="directory">/lib64</filename> if the host system 38 is 64-bit capable, and adjust them to point to the new location in 39 <filename class="directory">/tools</filename>.</para> 36 40 37 41 <para>For the sake of accuracy, it is recommended to use a copy-and-paste 38 42 method when issuing the following command. Be sure to visually inspect the 39 specs file and verify that all occurrences of <quote>/lib/ld-linux.so.2</quote> 40 have been replaced with <quote>/tools/lib/ld-linux.so.2</quote>:</para> 41 42 <important> 43 <para>If working on a platform where the name of the dynamic linker is 44 something other than <filename class="libraryfile">ld-linux.so.2</filename>, 45 replace <quote>ld-linux.so.2</quote> with the name of the platform's 46 dynamic linker in the following commands. Refer to <xref 47 linkend="ch-tools-toolchaintechnotes" role=","/> if necessary.</para> 48 </important> 43 specs file to verify that it has properly adjusted all references to the 44 dynamic linker location. Refer to <xref 45 linkend="ch-tools-toolchaintechnotes" role=","/> for the default name 46 of the dynamic linker, if necessary.</para> 49 47 50 48 <!-- Ampersands are needed to allow copy and paste --> 51 <screen><userinput>gcc -dumpspecs | sed 's@/lib /ld-linux.so.2@/tools&@g' > \49 <screen><userinput>gcc -dumpspecs | sed 's@/lib\(64\)\?/ld@/tools&@g' > \ 52 50 `dirname $(gcc -print-libgcc-file-name)`/specs</userinput></screen> 53 51 … … 87 85 /tools/lib/ld-linux.so.2]</computeroutput></screen> 88 86 89 <para>Note that <filename class="directory">/tools/lib</filename> 87 <para>Note that <filename class="directory">/tools/lib</filename>, or 88 <filename class="directory">/tools/lib64</filename> for 64-bit machines 90 89 appears as the prefix of the dynamic linker.</para> 91 90 -
chapter05/binutils-pass1.xml
rb0e1dc8 r6e88633 125 125 first pass will soon be replaced by those from the second.</para> 126 126 127 <para>Create a symlink to ensure the sanity of our toolchain:</para> 128 129 <screen><userinput remap="install">mkdir -v /tools/lib 130 ln -sv lib /tools/lib64</userinput></screen> 131 127 132 <para>Install the package:</para> 128 133 129 134 <screen><userinput remap="install">make install</userinput></screen> 130 135 131 <para> Next, prepare the linker for the <quote>Adjusting</quote> phase136 <para>Finally, prepare the linker for the <quote>Adjusting</quote> phase 132 137 later on:</para> 133 138 -
chapter05/gcc-pass1.xml
rb0e1dc8 r6e88633 63 63 <screen><userinput remap="configure">CC="gcc -B/usr/bin/" ../gcc-&gcc-version;/configure --prefix=/tools \ 64 64 --with-local-prefix=/tools --disable-nls --disable-shared --disable-libssp \ 65 -- enable-languages=c</userinput></screen>65 --disable-multilib --enable-languages=c</userinput></screen> 66 66 67 67 <variablelist> … … 112 112 <para>This option ensures that only the C compiler is built. 113 113 This is the only language needed now.</para> 114 </listitem> 115 </varlistentry> 116 117 <varlistentry> 118 <term><parameter>--disable-multilib</parameter></term> 119 <listitem> 120 <para>We currently only want to build support for 64-bit libraries.</para> 114 121 </listitem> 115 122 </varlistentry> -
chapter05/gcc-pass2.xml
rb0e1dc8 r6e88633 100 100 against the new Glibc. Issue:</para> 101 101 102 <screen><userinput remap="pre">for file in $(find gcc/config -name linux64.h -o -name linux.h) 102 <screen><userinput remap="pre">for file in \ 103 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h) 103 104 do 104 105 cp -uv $file{,.orig} … … 113 114 <para>In case the above seems hard to follow, let's break it down a bit. 114 115 First we find all the files under the gcc/config directory that are named 115 either <filename>linux.h</filename> or <filename>linux64.h</filename>. 116 either <filename>linux.h</filename>, <filename>linux64.h</filename> or 117 <filename>sysv4.h</filename>. 116 118 For each file found, we copy it to a file of the same name but with an added 117 119 suffix of <quote>.orig</quote>. Then the first sed expression prepends … … 125 127 </para> 126 128 129 <para>Unsetting the multlib spec for GCC ensures that it 130 won't attempt to link against libraries on the host:</para> 131 132 <screen><userinput remap="pre">for file in $(find gcc/config -name t-linux64) ; do \ 133 cp -v $file{,.orig} 134 sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file 135 done</userinput></screen> 136 127 137 <para>As in the first build of GCC it requires the GMP and MPFR packages. 128 138 Unpack the tarballs and move them into the required directory names:</para> … … 147 157 --enable-shared --enable-threads=posix \ 148 158 --enable-__cxa_atexit --enable-languages=c,c++ \ 149 --disable-libstdcxx-pch --disable-bootstrap</userinput></screen> 159 --disable-libstdcxx-pch --disable-multilib \ 160 --disable-bootstrap</userinput></screen> 150 161 151 162 <variablelist> -
chapter05/glibc.xml
rb0e1dc8 r6e88633 65 65 that is changed when setting -march.</para> 66 66 67 <screen><userinput remap="configure">echo "CFLAGS += -march=i486 -mtune=native" > configparms</userinput></screen> 67 <screen><userinput remap="configure">case `uname -m` in 68 i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;; 69 esac</userinput></screen> 68 70 69 71 <para>Next, prepare Glibc for compilation:</para> -
chapter05/toolchaintechnotes.xml
rb0e1dc8 r6e88633 28 28 <important> 29 29 <para>Before continuing, be aware of the name of the working platform, 30 often referred to as the target triplet. Many times, the target31 triplet will probably be <emphasis>i686-pc-linux-gnu</emphasis>. A32 s imple way to determine the name of the target triplet is to run the33 <command>config.guess</command> script that comes with the source for34 many packages. Unpack the Binutils sources and run the script:35 <userinput>./config.guess</userinput> and note the output.</para>30 often referred to as the target triplet. A simple way to determine the 31 name of the target triplet is to run the <command>config.guess</command> 32 script that comes with the source for many packages. Unpack the Binutils 33 sources and run the script: <userinput>./config.guess</userinput> and note 34 the output. For example, for a modern 32-bit Intel processor the 35 output will likely be <emphasis>i686-pc-linux-gnu</emphasis>.</para> 36 36 37 37 <para>Also be aware of the name of the platform's dynamic linker, often … … 40 40 provided by Glibc finds and loads the shared libraries needed by a program, 41 41 prepares the program to run, and then runs it. The name of the dynamic 42 linker will usually be <filename class="libraryfile">ld-linux.so.2</filename>. 43 On platforms that are less prevalent, the name might be <filename 44 class="libraryfile">ld.so.1</filename>, and newer 64 bit platforms might 45 be named something else entirely. The name of the platform's dynamic linker 46 can be determined by looking in the <filename class="directory">/lib</filename> 47 directory on the host system. A sure-fire way to determine the name is to 42 linker for a 32-bit Intel machine will be 43 <filename class="libraryfile">ld-linux.so.2</filename>. 44 A sure-fire way to determine the name of the dynamic linker is to 48 45 inspect a random binary from the host system by running: 49 46 <userinput>readelf -l <name of binary> | grep interpreter</userinput>
Note:
See TracChangeset
for help on using the changeset viewer.