Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2018 22:47:53 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Jan Beich <jbeich@FreeBSD.org>
Cc:        Mark Millard via freebsd-ports <freebsd-ports@freebsd.org>
Subject:   Re: port building on small, single-board computers or cross building ports: for lld I'd like to use -Wl,--no-threads
Message-ID:  <174526EE-739E-42F5-AF04-5178AA711CE0@yahoo.com>
In-Reply-To: <FCE5E5A5-EC5A-4BFB-936F-903E0C5B8B6E@yahoo.com>
References:  <D89E117C-9FCA-4598-AB33-58D7CAB1527B@yahoo.com> <1s7u-6kpq-wny@FreeBSD.org> <B9961D0A-95B6-4E8D-9B99-7AE7B6E9213F@yahoo.com> <FCE5E5A5-EC5A-4BFB-936F-903E0C5B8B6E@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2018-Nov-9, at 21:38, Mark Millard <marklmi at yahoo.com> wrote:

> On 2018-Nov-9, at 14:34, Mark Millard <marklmi at yahoo.com> wrote:
>=20
>> On 2018-Nov-9, at 12:48, Jan Beich <jbeich at FreeBSD.org> wrote:
>>=20
>>> Mark Millard via freebsd-ports <freebsd-ports at freebsd.org> =
writes:
>>>=20
>>>> For lld I'd like to use -Wl,--no-threads during poudriere-devel =
use.
>>>>=20
>>>> ld.bfd and such reject --no-threads .
>>>>=20
>>>> It appears that for ports there is no analogous support
>>>> of something like what buildworld has as notation for
>>>> specifying such:
>>>>=20
>>>> LDFLAGS.lld+=3D -Wl,--no-threads
>>>>=20
>>>> Any recommendation on an appropriate way to have use of
>>>> lld in ports also use --no-threads in its link commands
>>>> --but other linkers not do so?
>>>=20
>>> Can you try the following?
>>>=20
>>> .if ${LDFLAGS:M-fuse-ld=3D*lld*} || ${/usr/bin/ld:L:tA} =3D=3D =
/usr/bin/ld.lld
>>> LDFLAGS+=3D	-Wl,--no-threads
>>> .endif
>>=20
>> I added that to /usr/local/etc/poudriere.d/make.conf . The
>> cross build via poudriere did not hang (so far). lang/gcc8
>> (full bootstrap) takes a long time so I'll not be able to
>> declare the test done for some time. (There are other
>> things to build as well.)
>>=20
>> However, if a port uses devel/binutils or devel/*-binutils
>> or such would not LDFLAGS still end up with the addition,
>> which the gcc(?) ld would then reject? The notation:
>>=20
>> ${/usr/bin/ld:L:tA} =3D=3D /usr/bin/ld.lld
>>=20
>> does not appear to depend on which linker is in actual use
>> for the specific port generally --or what config scripting
>> might do before picking how later stages will work.
>=20
> For what I've cross-built so far, I've had no such examples
> as below, so for now it is working for me for that context.
> Thanks!
>=20
> But the notation issue is confirmed (non-cross build
> example). . .
>=20
> I updated what ports vintage my amd64 context was based on
> ( -r48-0180 to -r484565 ) and tried a poudriere bulk with
> your 3 lines in poudriere.d/make.conf . The result for
> security/nss was:
>=20
> [00:12:03] [23] [00:04:06] Saved security/nss | nss-3.40 wrkdir to: =
/usr/local/poudriere/data/wrkdirs/FBSDFSSDjail-default/default/nss-3.40.tb=
z
> [00:12:04] [23] [00:04:07] Finished security/nss | nss-3.40: Failed: =
build
>=20
> because of:
>=20
> cc -B/usr/local/bin -o FreeBSD13.0_OPT.OBJ/nsinstall -O2 -pipe  =
-I/usr/local/include/nspr -g -fstack-protector -fno-strict-aliasing   =
-fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall =
-Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds =
-Wno-unevaluated-expression -Werror -DXP_UNIX -UDEBUG -DNDEBUG =
-D_THREAD_SAFE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY =
-DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES =
-I./../dist/FreeBSD13.0_OPT.OBJ/include -I./../dist/public/ =
-I./../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR =
-DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments =
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression =
-Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT =
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT =
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES =
-I../../dist/FreeBSD13.0_OPT.OBJ/include -I../../dist/public/coreconf =
-I../../dist/private/coreconf   -fPIC -Wall -Wno-switch -DFREEBSD =
-DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments =
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression =
-Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT =
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT =
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES =
-I../../../dist/FreeBSD13.0_OPT.OBJ/include =
-I../../../dist/public/coreconf -I../../../dist/private/coreconf  =
FreeBSD13.0_OPT.OBJ/nsinstall.o FreeBSD13.0_OPT.OBJ/pathsub.o  =
-Wl,--no-threads -fstack-protector    -pthread
> /usr/local/bin/ld: unrecognized option '--no-threads'
> /usr/local/bin/ld: use the --help option for usage information
> cc: error: linker command failed with exit code 1 (use -v to see =
invocation)
> gmake[3]: *** [../../coreconf/rules.mk:243: =
FreeBSD13.0_OPT.OBJ/nsinstall] Error 1
> gmake[3]: Leaving directory =
'/wrkdirs/usr/ports/security/nss/work/nss-3.40/nss/coreconf/nsinstall'
>=20
>=20
> So, a mix of cc (system clang) and /usr/local/bin/ld in use together.
> It ended up with -Wl,--no-threads used and passing /usr/local/bin/ld
> --no-threads .

Just an FYI: gcc8 (set as the default) was given the
-Wl,--no-threads by devel/kBuild :

cd /wrkdirs/usr/ports/devel/kBuild/work/kBuild-0.1.9998 && /usr/bin/env =
AUTORECONF=3D/usr/local/bin/autoreconf  AUTOPOINT=3Dtrue  CC=3D"gcc8" =
CFLAGS=3D"-O2 -pipe  -g -fstack-protector -Wl,-rpath=3D/usr/local/li
b/gcc8 -fno-strict-aliasing " CPPFLAGS=3D""  LDFLAGS=3D" =
-Wl,--no-threads -fstack-protector -Wl,-rpath=3D/usr/local/lib/gcc8 =
-L/usr/local/lib/gcc8 " MAKE=3D"gmake" ./kBuild/env.sh --full gmake -f =
bootstrap.gm

So the examples are not limited to clang/binutil mixes.

I'll not list any more examples that may show up.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?174526EE-739E-42F5-AF04-5178AA711CE0>