Slight issue at LFS Chapter 6.10 Adjusting the Toolchain

С A <[email protected]>
Newsgroups gmane.linux.lfs.general
Message-ID <[email protected]>
Hello, I am new to LFS, so I don't really know where to put that
message. It's not even a problem as far as I have encountered, it may be
a tiny improvement to the book, it is probably related both to stable
and development books. I'm building a development version though.

So, when adjusting a toolchain after compiling dummy.c as part of
testing, when running:

grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'

the result is:

SEARCH_DIR("=/tools/x86_64-unknown-linux-gnu/lib64")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("=/tools/x86_64-unknown-linux-gnu/lib");

but the book says it should be:

SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib");

and the further statement in the book is:
> If the output does not appear as shown above or is not received at
> all, then something is seriously wrong. Investigate and retrace the
> steps to find out where the problem is and correct it.

So, I've made my research and see that the SEARCH_DIR() lines are part
of linker script, more particularly, the internal linker script of
ld-new, which was built at the chapter 5.9 Binutils 2.25 - Pass 2. I've
built that ld-new linker according to the book and renamed it at the
chapter 6.10 as the book says, too.
I even have read the binutils configure scripts and I probably have
found a reason of the issue. There is a file ld/genscipts.sh in a
binutils-2.25 source directory, which is apparently responsible for
setting values for linker scripts. Here is the interesting part:

# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native
# except when LIBPATH=":".
if [ "${LIB_PATH}" != ":" ] ; then
  libs=
  if [ "x${TOOL_LIB}" = "x" ] ; then
    if [ "x${NATIVE}" = "xyes" ] ; then
      libs="${exec_prefix}/${target_alias}/lib"
    fi
  else

However, I am not sure if I've grasped whole logic of the building set
of scripts, files and so on, and that looks like a lot of work and I am
not exactly fluent with shell scripts and autotools, too. But
nonetheless, that piece of shell code looks pretty much exactly like
the internal ld-new's SEARCH_DIR() lines.

So, the question is:
1) Was that supposed to happen? Did you have those SEARCH_DIR()s when
you were at that point of building?
2) How can it break my toolchain? Can it break my toolchain?
3) If it is not an issue, probably the book should state it, too?

Regarding 2), I could check it myself, but this is my first experience
of building a toolchain and core packages whatsoever, so I really could
use some advice. I have read about searchdir option of ld a bit, but it
seems I need to dive into gcc and ld internals (and the packages I
gonna build before binutils from Chapter 5 will be replaced) to fully
understand what's going on.

Thank you for reading.
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.