SVN-20070706: Step 5.7 Adjusting the Toolchain

Ivan Kabaivanov chepati at yahoo.com
Fri Jul 13 09:18:02 PDT 2007


Jon Fullmer wrote:
> Gentlemen,
> 
> Forgive a novice to this list. I couldn't find any mention of this,  
> so if it's already been talked about, I'm sorry.
> 
> Step 5.7 of the recent development book shows this step currently to  
> generate the specs file:
> 
> gcc -dumpspecs | sed 's@^/lib/ld-linux.so.2@/tools&@g' \
>    > `dirname $(gcc -print-libgcc-file-name)`/specs
> 
> When putting this system for a non-x86 (PowerPC, to be specific), I  
> noticed that this setup is actually wrong.  I discovered this when  
> the compile test of the dummy.c code showed the interpreter as still  
> being /lib/ld... (as opposed to /tools/lib/ld...). In looking at the  
> generated stream, I noticed that the "/lib/ld..." mentionings do not  
> occur at the beginning of the line, as the sed statement requires. I  
> would think that you would need to remove the ^, like this:
> 
> gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \
>    > `dirname $(gcc -print-libgcc-file-name)`/specs
> 
> That's what I did, anyway, and it worked great.
> 
> This is my first shot at participating in the Development version, so  
> if I'm full of it, or I've totally missed something obvious, feel  
> free to point it out to me.  I love LFS, and would love to see it  
> continue in its greatness.  Thanks.
> 
>   - Jon



Jon,

actually there's a notice just before the command you've quoted.  This 
is what I'm referring to:

<quote>
If working on a platform where the name of the dynamic linker is 
something other than ld-linux.so.2, replace “ld-linux.so.2” with the 
name of the platform's dynamic linker in the following commands. Refer 
to Section 5.2, “Toolchain Technical Notes,” if necessary.
</quote>

I've been compiling and running LFS on ppc and sparc for six years 
already and this notice has been there for at least three or four years.

However, further to this discussion, there is actually a problem with 
the sed command on platforms other than x86.

Here's how it is right now:

sed 's@^/lib/ld-linux.so.2@/tools&@g'

and here's how I would change it so it works everywhere:

sed 's@/lib/ld-linux.so.2@/tools&@g'

The linker on non-x86 platforms is not defined at the start of a new 
line, all by itself.

Now, can I make another suggestion, can we define a variable LD_LINKER 
or something like that that we can write into .bashrc and which will 
default to ld-linux.so.2, but with a note saying that it's something 
else on different platforms?  You can put a disclaimer that building and 
running LFS on non-x86 platforms is not supported, if you want.  So the 
sed command will look like:

sed 's@/lib/$LD_LINKER@/tools&@g'

IvanK.



More information about the lfs-dev mailing list