Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2016 15:39:47 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Cc:        Nathan Whitehorn <nwhitehorn@freebsd.org>, Justin Hibbits <chmeeedalf@gmail.com>, Dimitry Andric <dim@FreeBSD.org>, Ed Maste <emaste@freebsd.org>
Subject:   clang 3.9.0 vs. TARGET_ARCH=powerpc: fsck_ufs and "df -m" are example failures: __floatdidf gets SIGSEGV's in both of them.
Message-ID:  <82B4883E-250C-4D93-A139-7949665C1B77@dsl-only.net>

next in thread | raw e-mail | index | archive | help
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=3Dpowerpc . 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@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  =3D 2118565888 (2020 MB)
> avail memory =3D 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=3D11538459 (8 should be 0)
> CORRECT? no
>=20
> ** Phase 2 - Check Pathnames
> ** Phase 3 - Check Connectivity
> ** Phase 4 - Check Reference Counts
> LINK COUNT FILE I=3D10016041  OWNER=3Doperator MODE=3D100400
> SIZE=3D4096 MTIME=3DNov 26 14:44 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
>=20
> LINK COUNT FILE I=3D10016049  OWNER=3Doperator MODE=3D100400
> SIZE=3D4096 MTIME=3DNov 26 14:55 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
>=20
> LINK COUNT FILE I=3D10016089  OWNER=3Doperator MODE=3D100400
> SIZE=3D4096 MTIME=3DNov 26 15:00 2016  COUNT 2 SHOULD BE 1
> ADJUST? no
>=20
> UNREF FILE  I=3D11538459  OWNER=3Droot MODE=3D100600
> SIZE=3D0 MTIME=3DNov 26 15:11 2016=20
> RECONNECT? no
>=20
>=20
> CLEAR? no
>=20
> ** Phase 5 - Check Cyl groups
> FREE BLK COUNT(S) WRONG IN SUPERBLK
> SALVAGE? no
>=20
> SUMMARY INFORMATION BAD
> SALVAGE? no
>=20
> BLK(S) MISSING IN BIT MAPS
> SALVAGE? no
>=20
> fsck: /dev/ufs/FBSDG4Srootfs: Segmentation fault


> # gdb fsck_ufs /var/crash/fsck_ufs.1129.core=20
> 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=3D<value optimized out>, argv=3D<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=3D0x41e24000, mwp=3D0xffffd930) at =
/usr/src/bin/df/df.c:503
> #2  0x01801df0 in main (argc=3D<value optimized out>, argv=3D<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 =3D=3D 0 ? 100.0 : (double)used / =
(double)availblks * 100.0);



Context details:

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

. . .


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


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


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?82B4883E-250C-4D93-A139-7949665C1B77>