Re: POLA.. missing --sysroot option in ld?

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 1 May 2014 23:40:00 +0200
On 01 May 2014, at 15:18, Brooks Davis <brooks_at_freebsd.org> wrote:
> On Wed, Apr 30, 2014 at 11:02:31PM -0600, Warner Losh wrote:
>> 
>> On Apr 29, 2014, at 10:23 PM, Julian Elischer <julian_at_FreeBSD.org> wrote:
>>> On 4/30/14, 10:36 AM, Julian Elischer wrote:
>>>> In our 8.0 based systems at $JOB our build environment made heavy use of the --sysroot option in gcc and ld.
>>>> 
>>>> We are trying to move up to a newer release but suddenly the --sysroot option has disappeared.
>>>> 
>>>> we get the message "/usr/bin/ld: this linker was not configured to use sysroots"
>>> more spefically the following command (from 'configure') fails on "near 9"
>>> and succeeds on 8.0.
>>> 
>>> configure:3352: /usr/bin/gcc -Wall -Wno-unused-parameter  -nostdinc -isystem /usr/build/buildroot/tools/x86_gcc4.2.4/usr/include --sysroot /usr/build/buildroot/tools/x86_gcc4.2.4 -Wall -Wno-unused-parame
>>> ter  -nostdinc -isystem /usr/build/buildroot/tools/x86_gcc4.2.4/usr/include --sysroot /usr/build/buildroot/tools/x86_gcc4.2.4 --sysroot /usr/build/buildroot/tools/x86_gcc4.2.4 -L/usr/build/buildroot/too
>>> ls/x86_gcc4.2.4/lib -L/usr/build/buildroot/tools/x86_gcc4.2.4/usr/lib conftest.c >&5
>>>> 
>>>> Does anyone know what happened?  and when, and by who?
>>>> I have looked in the Makefiles and configuration files in SVN and I can't see a change that would have done this..
>>>> of course the building of these tools is rather complex so I may have missed some place..
>> 
>> Yea, I looked too and don?t see anything. I thought it was broken in more like 2005 not 2011. You?re only hope is to bisect the tree down to the change that caused it?
> 
> It's been broken since at least the last binutils import and probably
> longer since the inane ld behavior of activating --sysroot only when
> built with a specified sysroot is from upstream.  The fix is trivial, just
> merge r257268 and r257530 to the branch you are using.

Yes, I already had a discussion with Julian on IRC about it, but for the
sake of the mailing list, a summary:
* The change got introduced with the binutils 2.17.50 merge, in r218822
  (-CURRENT, at the time).
* Upstream apparently introduced this, "because it was hard to make it
  work": see the thread starting at
  https://sourceware.org/ml/binutils/2007-02/msg00274.html
* Upstream binutils git master still contains the same logic.
* Brooks's r257268 and r257530 ensures TARGET_SYSTEM_ROOT is always
  defined (e.g. to "/" in the regular case), making --sysroot work
  correctly.

-Dimitry


Received on Thu May 01 2014 - 19:40:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:48 UTC