[PATCH] Fine control sysroot runtime behavior.

heroxbd@gentoo.org heroxbd@gentoo.org
Thu Dec 4 04:54:00 GMT 2014


Dear Hans,

Thank you for your comments.

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On Mon, 1 Dec 2014, Benda Xu wrote:
>> This is a rebase of patch submitted in
>>
>>   http://article.gmane.org/gmane.comp.gnu.binutils/63137
>>
>> to the HEAD of git repository.
>>
>> Patch updated for the Changelog entries and for regeneration with
>> autoconf and autoheader.
>
> I think you're going to need a little bit more than a straight
> rebase-with-conflict-resolution for this to do something
> well-defined.  For example, as your patch stands, I would guess
> it will fail a "make check-ld" when --disable-runtime-sysroot
> (either or both with/without --with-sysroot=Y) specifically
> running the sysroot tests.  

Good question.  From a quick run, I see a lot of other tests fail.  It
might need more time than I expected to look into this.

> It seems you're not disabling --sysroot=X as a run-time option as
> would be truthful the name of the option.  Your patch just touches the
> static ELF-specific paths (IIUC) and the predicate that tells whether
> a file is found in the sysroot.  Thus, --sysroot=X will be accepted
> and all X prepended through "=" will be found but wrongly be thought
> to be outside the sysroot, still --print-sysroot will emit the
> specified directory.  I'm not sure that makes sense other than it
> happening to work for you.

Yes, that is my intention, though I admit the name
disable-runtime-sysroot is misleading.  The run-time option is not
disabled.  Only the extra feature of prepending SYSROOT implicitly to
rpath/ld script is disabled.

> Are you using --disable-runtime-sysroot --with-sysroot=Y as just
> specifying some kind of alternative installation point, sort of
> (but not exactly) like --prefix=Y?  

Yes, exactly.  I only want the SEARCH_DIR to be prefixed by that
specified by --sysroot and nothing more.  It is the same effect as
--with-lib-path, but specifying a set of default directories is not
convenient.

Prepending NATIVE_LIB_DIRS in ld/configure.tgt can do exactly the same
thing.  One block is that gcc passes down --sysroot to ld.  If ld is not
configured --with-sysroot, it fails.  Spec file of gcc could be hacked
to strip out the --sysroot=X argument to ld.  That passes the ball to
gcc.

> Maybe instead introduce an appropriately named option to do exactly
> that.

Yeah, I am serious considering that instead of messing up with sysroot.

> If not, I suggest you tell us the "user story" as it's unclear
> why the full --sysroot functionality is wrong for the
> intended use.

The use case is called "Gentoo Prefix".  It runs a GNU userland in a
directory prefix without root privilege, managed by Gentoo's package
manager, called portage.

The use cases are:

  1. Compiling new software on shared computing clusters as normal user.
  2. A LTS environment not sensitive to underlying infrastructure for
     dedicated software deployment.
  3. Running GNU userland on Android-based mobile devices.

https://www.gentoo.org/proj/en/gentoo-alt/prefix/usecases.xml
https://wiki.gentoo.org/wiki/Project:Android

Cheers,
Benda



More information about the Binutils mailing list