clang 3.9.0 vs. TARGET_ARCH=powerpc: fsck_ufs and "df -m" are example failures: __floatdidf gets SIGSEGV's in both of them.

Mark Millard markmi at dsl-only.net
Sat Nov 26 23:39:56 UTC 2016


I updated to head -r309197 (with a work around for -r309144 breaking the build).

This was on amd64, then used it to try to cross buildworld using clang 3.9.0 for
TARGET_ARCH=powerpc . The build completed. (I've been using clang 3.8.0 this way
for a long time.)

[The kernel here was cross built via gcc 4.2.1, as has been my normal procedure.
The kernel still has my "red zone for signal delivery" hack that was a workaround
for clang 3.8.0 stack-handling ABI violations.]

Booting, however, had problems because of fsck_ufs getting signal 11 and ended up
initially in single user mode.

Exiting single user did finish the boot. But "df -m" core dumps. (I've not
explored much else.)

Turns out that both fsck_ufs and "df -m" fail in the same routine for a SIGSEGV:
__floatdidf


The details. . .

First the boot and fsck_ufs:

> Copyright (c) 1992-2016 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
>         The Regents of the University of California. All rights reserved.
> FreeBSD is a registered trademark of The FreeBSD Foundation.
> FreeBSD 12.0-CURRENT #9 r309179M: Sat Nov 26 12:53:11 PST 2016
>     markmi at FreeBSDx64:/usr/obj/powerpcvtsc_clang_gcc421_kernel/powerpc.powerpc/usr/src/sys/GENERICvtsc-NODBG powerpc
> gcc version 4.2.1 20070831 patched [FreeBSD]
> cpu0: IBM PowerPC 970MP revision 1.1, 18446744071914.91 MHz
> cpu0: Features dc000000<PPC32,PPC64,ALTIVEC,FPU,MMU>
> cpu0: HID0 1511081<DEEPNAP,NAP,DPM,NHR,TBEN,ENATTN>
> real memory  = 2118565888 (2020 MB)
> avail memory = 2014863360 (1921 MB)
> FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> . . .
> Trying to mount root  from ufs:/dev/ufs/FBSDG4Srootfs [rw,noatime]...
> . . .
> pid 53 (fsck_ufs), uid 0: exited on signal 11


Manually running fsck later gets a segmentation fault core file in /var/crash/
and I used this too see a point of failure (__floatdidf):

> # fsck /
> ** /dev/ufs/FBSDG4Srootfs (NO WRITE)
> ** Last Mounted on /
> ** Root file system
> ** Phase 1 - Check Blocks and Sizes
> INCORRECT BLOCK COUNT I=11538459 (8 should be 0)
> CORRECT? no
> 
> ** Phase 2 - Check Pathnames
> ** Phase 3 - Check Connectivity
> ** Phase 4 - Check Reference Counts
> LINK COUNT FILE I=10016041  OWNER=operator MODE=100400
> SIZE=4096 MTIME=Nov 26 14:44 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
> 
> LINK COUNT FILE I=10016049  OWNER=operator MODE=100400
> SIZE=4096 MTIME=Nov 26 14:55 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
> 
> LINK COUNT FILE I=10016089  OWNER=operator MODE=100400
> SIZE=4096 MTIME=Nov 26 15:00 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
> 
> UNREF FILE  I=11538459  OWNER=root MODE=100600
> SIZE=0 MTIME=Nov 26 15:11 2016 
> RECONNECT? no
> 
> 
> CLEAR? no
> 
> ** Phase 5 - Check Cyl groups
> FREE BLK COUNT(S) WRONG IN SUPERBLK
> SALVAGE? no
> 
> SUMMARY INFORMATION BAD
> SALVAGE? no
> 
> BLK(S) MISSING IN BIT MAPS
> SALVAGE? no
> 
> fsck: /dev/ufs/FBSDG4Srootfs: Segmentation fault


> # gdb fsck_ufs /var/crash/fsck_ufs.1129.core 
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "powerpc-marcel-freebsd"...
> Core was generated by `fsck_ufs /dev/ufs/FBSDG4Srootfs'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libufs.so.6...Reading symbols from /usr/lib/debug//lib/libufs.so.6.debug...done.
> done.
> Loaded symbols for /lib/libufs.so.6
> Reading symbols from /lib/libc.so.7...Reading symbols from /usr/lib/debug//lib/libc.so.7.debug...done.
> done.
> Loaded symbols for /lib/libc.so.7
> Reading symbols from /libexec/ld-elf.so.1...Reading symbols from /usr/lib/debug//libexec/ld-elf.so.1.debug...done.
> done.
> Loaded symbols for /libexec/ld-elf.so.1
> #0  0x0181b024 in __floatdidf ()
> (gdb) bt
> #0  0x0181b024 in __floatdidf ()
> #1  0x0180a8e0 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/sbin/fsck_ffs/main.c:519
> #2  0x01801664 in _start ()
> #3  0x418303a0 in .text () at /usr/src/libexec/rtld-elf/powerpc/rtld_start.S:112

main.c's line 519 is part of:

>         printf("(%ju frags, %ju blocks, %.1f%% fragmentation)\n",
>             (uintmax_t)n_ffree, (uintmax_t)n_bfree,
>             n_ffree * 100.0 / sblock.fs_dsize);



As for "df -m" --it failed in __floatdidf as well:

> # gdb df /var/crash/df.1056.core                                                                                                                                                                        GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "powerpc-marcel-freebsd"...
> Core was generated by `df -m'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libxo.so.0...Reading symbols from /usr/lib/debug//lib/libxo.so.0.debug...done.
> done.
> Loaded symbols for /lib/libxo.so.0
> Reading symbols from /lib/libutil.so.9...Reading symbols from /usr/lib/debug//lib/libutil.so.9.debug...done.
> done.
> Loaded symbols for /lib/libutil.so.9
> Reading symbols from /lib/libc.so.7...Reading symbols from /usr/lib/debug//lib/libc.so.7.debug...done.
> done.
> Loaded symbols for /lib/libc.so.7
> Reading symbols from /libexec/ld-elf.so.1...Reading symbols from /usr/lib/debug//libexec/ld-elf.so.1.debug...done.
> done.
> Loaded symbols for /libexec/ld-elf.so.1
> #0  0x01802a18 in __floatdidf ()
> (gdb) bt
> #0  0x01802a18 in __floatdidf ()
> #1  0x01802538 in prtstat (sfsp=0x41e24000, mwp=0xffffd930) at /usr/src/bin/df/df.c:503
> #2  0x01801df0 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/bin/df/df.c:308
> #3  0x01800cdc in _start ()
> #4  0x418153a0 in .text () at /usr/src/libexec/rtld-elf/powerpc/rtld_start.S:112

df.c's line 503 was part of:

>         xo_emit(" {:used-percent/%5.0f}{U:%%}",
>             availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);



Context details:

> # head ~/sys_typescripts/typescript_make_powerpcvtsc_nodebug_clang_bootstrap_world-amd64-host-2016-11-26:11:38:36 
> Script started on Sat Nov 26 11:38:36 2016
> Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null SRC_ENV_CONF=/root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/powerpcvtsc_clang_world make -j 5 buildworld
> --- buildworld ---

. . .


> # more ~/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host
> TO_TYPE=powerpc
> #
> KERNCONF=GENERICvtsc-NODBG
> TARGET=${TO_TYPE}
> .if ${.MAKE.LEVEL} == 0
> TARGET_ARCH=${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_CROSS_COMPILER=
> WITHOUT_SYSTEM_COMPILER=
> #
> WITH_LIBCPLUSPLUS=
> WITH_BINUTILS_BOOTSTRAP=
> WITH_CLANG_BOOTSTRAP=
> WITH_CLANG=
> WITH_CLANG_IS_CC=
> WITH_CLANG_FULL=
> WITH_CLANG_EXTRAS=
> # lldb requires missing atomic 8-byte operations for powerpc (non-64)
> WITHOUT_LLDB=
> #
> WITH_BOOT=
> WITHOUT_LIB32=
> #
> WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
> WITHOUT_GCC_BOOTSTRAP=
> WITHOUT_GCC=
> WITHOUT_GCC_IS_CC=
> WITHOUT_GNUCXX=
> #
> NO_WERROR=
> #WERROR=
> MALLOC_PRODUCTION=
> #
> WITH_DEBUG_FILES=


> # more ~/src.configs/make.conf 
> CFLAGS.gcc+= -v


===
Mark Millard
markmi at @dsl-only.net



More information about the freebsd-toolchain mailing list