Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#4479 closed task (wontfix)

chap5: startfile location in gcc

Reported by: thomas Owned by: lfs-book
Priority: normal Milestone: 9.0
Component: Book Version: SVN
Severity: normal Keywords: gcc
Cc:

Description

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&@g' \
       -e 's@/usr@/tools@g' $file.orig > $file
-  echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' >> $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!

Change History (3)

comment:1 by thomas, 2 years ago

Keywords: eudev removed

comment:2 by Bruce Dubbs, 2 years ago

Resolution: wontfix
Status: newclosed

Marking as won't fix. What we have works fine and is relatively clear about what we are doing.

comment:3 by Bruce Dubbs, 2 years ago

Milestone: 8.59.0

Milestone renamed

Note: See TracTickets for help on using tickets.