On 2018-Nov-9, at 12:48, Jan Beich <jbeich at FreeBSD.org> wrote:

> Mark Millard via freebsd-ports <freebsd-ports at freebsd.org> writes:
> 
>> For lld I'd like to use -Wl,--no-threads during poudriere-devel use.
>> 
>> ld.bfd and such reject --no-threads .
>> 
>> It appears that for ports there is no analogous support
>> of something like what buildworld has as notation for
>> specifying such:
>> 
>> LDFLAGS.lld+= -Wl,--no-threads
>> 
>> 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?
> 
> Can you try the following?
> 
> .if ${LDFLAGS:M-fuse-ld=*lld*} || ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
> LDFLAGS+=     -Wl,--no-threads
> .endif

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.)

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:

${/usr/bin/ld:L:tA} == /usr/bin/ld.lld

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.


>> Without --no-threads, lld creates approximately one
>> thread per "cpu" (as FreeBSD counts such). For
>> cross building, this can run into bugs under
>> qemu-arm-static and hang up. It may also use more
>> memory in low memory contexts that might do better
>> without such extra memory use.
> 
> Are those only ports using non-default Clang? If not maybe haven't used
> -x flag from poudriere-jail(8).

I use -x in a jail -c command to have the native cross tools
around.

Past experiments have shown that some conftest.c
compiles/links via emulation do sometimes have the hanging
problem. Some config scripts explore some issues while
ignoring CC and the like and so end up running some
experiments with emulated cc and ld code.

Turns out attaching to the hung process with gdb and then
detaching is enough to let the process start running after
such a hang, at least in my examples.


Extra notes:

( from the test under 12 head -r339076 )
# gdb `which qemu-arm-static`
. . .
(gdb) attach 18703
Attaching to program: /usr/local/bin/qemu-arm-static, process 18703
Couldn't get registers: Device busy.
. . .
(gdb) bt
#0  _umtx_op () at _umtx_op.S:3
#1  0x0000000060050cd4 in _umtx_wait_uint_private (where=0x0, addr=<optimized 
out>, target_val=<optimized out>, tsz=<optimized out>, t=<optimized out>)
   at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/freebsd/os-thread.c:258
#2  freebsd_lock_umutex (target_addr=4102556064, id=100867, ts=0x0, 
mode=<optimized out>) at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/freebsd/os-thread.c:890
#3  0x000000006004a808 in do_freebsd__umtx_op (obj=4102556064, op=<optimized 
out>, val=0, uaddr=0, target_time=0)
   at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/freebsd/os-thread.h:359
#4  0x00000000600414d5 in do_freebsd_syscall (cpu_env=0x8607a4c58, num=454, 
arg1=<optimized out>, arg2=<optimized out>, arg3=<optimized out>, arg4=0, 
arg5=0, arg6=-185272152, arg7=0, arg8=0)
   at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/syscall.c:1364
#5  0x0000000060038d03 in target_cpu_loop (env=0x8607a4c58) at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/arm/target_arch_cpu.h:207
#6  0x00000000600386a9 in cpu_loop (env=0xf48809bc) at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/main.c:121
#7  0x0000000060039922 in main (argc=-10608, argv=0x7fffffffd1d8) at 
/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-495fb3a/bsd-user/main.c:513
(gdb) detach
Detaching from program: /usr/local/bin/qemu-arm-static, process 18703

Things started back up from there. (The above only listed one thread's
backtrace.)



I separately confirmed that the _packed use removed in:

https://github.com/MikaelUrankar/qemu-bsd-user/commit/d6f65a7f07d280b6906d499d8e465d4d2026c52b

does make the target_freebsd_kevent field offsets for
the armv7 context match the host environment and that
the qemu-user-static code does depend on such matching.
(I did this back on 12 head -r339076 as well.)

I've not checked aarch64 or any others, just armv7.


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

_______________________________________________
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to