binutils executables capture paths from build machine

Steven Taschuk <[email protected]>
Newsgroups gmane.comp.gcc.cross-compiling
Message-ID <20180106192755.GA3536@femur>
Hi!  I'm using crosstool-ng 1.23.0 to make a cross-native toolchain,
and am a bit confused about the configuration and install of the
binutils executables.

I've understood correctly, the bash function do_binutils_for_host
configures binutils with --prefix=${CT_PREFIX_DIR} and installs the
executables with make install.  This procedure results in paths from
the build machine being embedded in the binaries, in at least two
places: the use of BINDIR at binutils-2.28/bfd/plugin.c:337; and
the various uses of DEBUGDIR in binutils-2.28/bfd/dwarf2.c (where
DEBUGDIR=${libdir}/debug; see binutils-2.28/bfd/configure.ac:108).

I would have expected that, for a cross-native (or, for that matter,
Canadian) build, binutils would be configured with --prefix=/usr or
something, then installed with make DESTDIR=${CT_SYSROOT_DIR} install,
for later transfer to the host.  That's what do_binutils_for_target
does, but it seems to build and install only libiberty and libbfd,
not the executables.

For builds with build!=host, how should binutils executables be built?

(Context: I'm developing a small reproducible and self-reproducing
Linux distribution, which requires making a reproducible cross-native
toolchain.  I also think there are some similar issues in the gcc
executables, but haven't tracked those down yet.)

-- 
Steven Taschuk                                     http://www.amotlpaa.org/
Receive them ignorant; dispatch them confused.  (Weschler's Teaching Motto)
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.