﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
4479	chap5: startfile location in  gcc	thomas	lfs-book	"In chapter 5 we are currently changing a hand full of c,h sources by adding #undef and #define statements to al of them. The #define is to specify the location of the start files in /tools/lib/.

The only file where STANDARD_STARTFILE_PREFIX_1/2 is defined is in gcc/gcc.c. As far as i can see, patching this file has the same effect of setting the location correct but makes it unneccessary to manipulate some other files to do that.

Following patch changes the location where it is initially defined. Not much reduction of the size of instructions but i think its more straight forward to patch one file instead of several others:

{{{
Index: chapter05/gcc-pass1.xml
===================================================================
--- chapter05/gcc-pass1.xml	(revision 11613)
+++ chapter05/gcc-pass1.xml	(working copy)
@@ -73,13 +73,11 @@
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
-  echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 ""/tools/lib/""
-#define STANDARD_STARTFILE_PREFIX_2 """"' &gt;&gt; $file
   touch $file.orig
-done</userinput></screen>
+done
+sed -e ""/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\"".*\"";\""/tools/lib/\"";"" \
+    -e ""/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\"".*\"";\""\"";"" \
+    -i gcc/gcc.c</userinput></screen>
 
     <para>In case the above seems hard to follow, let's break it down a bit.
     First we copy the files <filename>gcc/config/linux.h</filename>,
Index: chapter05/gcc-pass2.xml
===================================================================
--- chapter05/gcc-pass2.xml	(revision 11613)
+++ chapter05/gcc-pass2.xml	(working copy)
@@ -75,13 +75,11 @@
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
-  echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 ""/tools/lib/""
-#define STANDARD_STARTFILE_PREFIX_2 """"' &gt;&gt; $file
   touch $file.orig
-done</userinput></screen>
+done
+sed -e ""/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\"".*\"";\""/tools/lib/\"";"" \
+    -e ""/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\"".*\"";\""\"";"" \
+    -i gcc/gcc.c</userinput></screen>
 
     <para>If building on x86_64, change the default directory name for 64-bit
     libraries to <quote>lib</quote>:</para>
}}}

A complete LFS build went fine using the new instructions but of course, there might still something i've not been aware of, so comments welcome! 
"	task	closed	normal	9.0	Book	SVN	normal	wontfix	gcc	
