X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage2%2Fcis-toolchain-adjust;h=af99d6b49a71fb97ea5d28234f193b40ddde58e2;hb=d9a5344c1aa683d051d1a1d5e87f0bba317e299a;hp=dece896d72706b52ca5f173008c9f0e5901b91a6;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage2/cis-toolchain-adjust b/stage2/cis-toolchain-adjust index dece896..af99d6b 100755 --- a/stage2/cis-toolchain-adjust +++ b/stage2/cis-toolchain-adjust @@ -1,48 +1,17 @@ -#!/bin/sh +#!/bin/bash +set -o errexit # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list -# First, backup the /tools linker, and replace it with the adjusted linker -# we made in chapter 5. We'll also create a link to its counterpart in -# /tools/$(gcc -dumpmachine)/bin. -mv -v /tools/bin/{ld,ld-old} && -mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} && -mv -v /tools/bin/{ld-new,ld} && -ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld && - # Amend the GCC specs file so that it points to the new dynamic linker, and so # that GCC knows where to find its start files. -gcc -dumpspecs | sed \ - -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \ - -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ - -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \ - `dirname $(gcc --print-libgcc-file-name)`/specs && - -# Testing toolchain -cd /tmp && -echo 'main(){}' > dummy.c && -cc dummy.c -Wl,--verbose &> dummy.log && -if [ ! readelf -l a.out | grep 'Requesting program interpreter: /lib/' \ - 1> /dev/null 2>&1 ]; then - exit 1 -fi && - -if [ ! grep "attempt to open /usr/lib/crt.* succeeded" dummy.log 1> /dev/null 2>&1 ]; then - exit 1 -fi && - -if [ ! grep "attempt to open /lib/libc.so.6 succeeded" dummy.log 1> /dev/null 2>&1 ]; then - exit 1 -fi && - -if [ ! grep "found ld-linux.so.2 at /lib/ld-linux.so.2" dummy.log 1> /dev/null 2>&1 ]; then - exit 1 -fi && - -rm dummy.c a.out +gcc -dumpspecs | \ + sed \ + -e 's@/tools/lib/ld@/lib/ld@g' \ + -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' > \ + `dirname $(gcc --print-libgcc-file-name)`/specs -# Return last error exit $?