A C error that clang 3.9.1 did not catch while generating mlx5_en_ethtool.o (amd64-xtoolchain-gcc's amd64-gcc did catch it)

2017-01-29 Thread Mark Millard
Context: head -r312942

Generating:

/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o

involves. . .

/usr/src/sys/dev/mlx5/diagnostics.h shows:

struct mlx5_core_diagnostics_entry {
const char *const desc;
u16 counter_id;
};

Note the const between * and desc: the pointer
field is declared to be constant.

/usr/src/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
shows:

static void
mlx5e_create_diagnostics(struct mlx5e_priv *priv)
{
struct mlx5_core_diagnostics_entry entry;
. . .
for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) {
entry = mlx5_core_pci_diagnostics_table[x];
. . .
}
  
/* create general diagnostics */
for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) {
entry = mlx5_core_general_diagnostics_table[x];
 . .
}
}

which involves assignments to constant pointers: the
desc value is supposed to be constant as things are
declared.

A clang 3.9.1 based build did not complain about this:

# Meta data file 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o.meta
CMD cc -target x86_64-unknown-freebsd12.0 
--sysroot=/usr/obj/amd64_clang/amd64.amd64/usr/src/tmp 
-B/usr/obj/amd64_clang/amd64.amd64/usr/src/tmp/usr/bin  -O2 -pipe  
-fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc  
-I/usr/src/sys/modules/mlx5en/../../ofed/include 
-I/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include 
-DHAVE_KERNEL_OPTION_HEADERS -include 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h -I. 
-I/usr/src/sys -fno-common -g -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer 
-I/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  -mcmodel=kernel 
-mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables 
-ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ 
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wn
 o-error-tautological-compare -Wno-error-empty-body 
-Wno-error-parentheses-equality -Wno-error-unused-function 
-Wno-error-pointer-sign -Wno-error-shift-negative-value  -mno-aes -mno-avx  
-std=iso9899:1999 -Wno-cast-qual -Wno-pointer-arith  -c 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c -o 
mlx5_en_ethtool.o
CMD ctfconvert -L VERSION -g mlx5_en_ethtool.o
CWD 
/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en
TARGET mlx5_en_ethtool.o
-- command output --


but amd64-xtoolchain-gcc's amd64-gcc got:
(I had CFLAGS.gcc += -v for this.)

# Meta data file 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/mlx5en/mlx5_en_ethtool.o.meta
CMD /usr/local/bin/x86_64-unknown-freebsd12.0-gcc -isystem 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include 
-L/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib 
-B/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib 
--sysroot=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp 
-B/usr/local/x86_64-freebsd/bin/  -O2 -pipe  -fno-strict-aliasing -D_KERNEL 
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/mlx5en/../../ofed/include 
-I/usr/src/sys/modules/mlx5en/../../compat/linuxkpi/common/include 
-DHAVE_KERNEL_OPTION_HEADERS -include 
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h 
-I. -I/usr/src/sys -fno-common -g -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer 
-I/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG  
-mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  
-fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector 
-gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmiss
 ing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign 
-fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option 
-Wno-unknown-pragmas -Wno-error=address 
-Wno-error=aggressive-loop-optimizations -Wno-error=array-bounds 
-Wno-error=attributes -Wno-error=cast-qual -Wno-error=enum-compare 
-Wno-error=inline -Wno-error=maybe-uninitialized -Wno-error=overflow 
-Wno-error=sequence-point -Wno-error=strict-overflow 
-Wno-error=unused-but-set-variable -Wno-error=misleading-indentation 
-Wno-error=nonnull-compare -Wno-error=shift-overflow 
-Wno-error=tautological-compare  -v -finline-limit=8000 -fms-extensions --param 
inline-unit-growth=100 --param large-function-growth=1000  -std=iso9899:1999 
-Wno-cast-qual -Wno-pointer-arith  -c 
/usr/src/sys/modules/mlx5en/../../dev/mlx5/mlx5_en/mlx5_en_ethtool.c -o 
mlx5_en_ethtool.o
CMD ctfconvert -L VERSION -g mlx5_en_ethtool.o
CWD 

Re: head -r312942: install: link /usr/obj/DESTDIRs/.../boot/dtb/am3335x-bone.dtb -> /usr/obj/DESTDIRs/.../boot/dtb/beaglebone.dtb: No such file or directory

2017-01-29 Thread Guy Yur
Hi,

On Sun, Jan 29, 2017 at 11:09 PM, Mark Millard  wrote:
> For a prior amd64 -> armv6 cross build and I tried a local
> file system install of the kernel via DESTDIR= use:
>
>> Script started on Sun Jan 29 12:51:42 2017
>> Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null 
>> SRC_ENV_CONF=/root/src.configs/src.conf.bpim3-clang-bootstrap.amd64-host 
>> WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/bpim3_clang make -j 4 
>> installkernel DESTDIR=/usr/obj/DESTDIRs/clang-bpim3-installkernel
> . . .
>
> But the install stopped early with:
>
>> --- realinstall_subdir_dtb/am335x ---
>> install: link 
>> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/am3335x-bone.dtb -> 
>> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/beaglebone.dtb: No such 
>> file or directory
>> *** [_installlinks] Error code 71
>>
>> ...
>
>
>
> ===
> Mark Millard
> markmi at dsl-only.net
>
> ___
> freebsd-...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscr...@freebsd.org"

In r312915 changes there is an extra '3' in the LINKS= section
of sys/modules/dtb/am335x/Makefile

${DTBDIR}/am3335x-bone.dtb should be ${DTBDIR}/am335x-bone.dtb
${DTBDIR}/am3335x-boneblack.dtb should be ${DTBDIR}/am335x-boneblack.dtb

Regards,
Guy
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


head -r312942: install: link /usr/obj/DESTDIRs/.../boot/dtb/am3335x-bone.dtb -> /usr/obj/DESTDIRs/.../boot/dtb/beaglebone.dtb: No such file or directory

2017-01-29 Thread Mark Millard
For a prior amd64 -> armv6 cross build and I tried a local
file system install of the kernel via DESTDIR= use:

> Script started on Sun Jan 29 12:51:42 2017
> Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null 
> SRC_ENV_CONF=/root/src.configs/src.conf.bpim3-clang-bootstrap.amd64-host 
> WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/bpim3_clang make -j 4 
> installkernel DESTDIR=/usr/obj/DESTDIRs/clang-bpim3-installkernel
. . .

But the install stopped early with:

> --- realinstall_subdir_dtb/am335x ---
> install: link 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/am3335x-bone.dtb -> 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/beaglebone.dtb: No such 
> file or directory
> *** [_installlinks] Error code 71
> 
> make[4]: stopped in /usr/src/sys/modules/dtb/am335x
> 1 error
> 
> make[4]: stopped in /usr/src/sys/modules/dtb/am335x
> *** [realinstall_subdir_dtb/am335x] Error code 2
> 
> make[3]: stopped in /usr/src/sys/modules


Retrying without -j 4 failed the same way:

> ===> dtb/am335x (install)
> test -d /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb || install -d -o 
> root -g wheel /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb
> install -o root -g wheel -m 444   am335x-bone.dtb 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/
> install -o root -g wheel -m 444   am335x-boneblack.dtb 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/
> install -o root -g wheel -m 444   am335x-bonegreen.dtb 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/
> install -o root -g wheel -m 444   ufw.dtb 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/
> /boot/dtb/beaglebone.dtb -> /boot/dtb/am3335x-bone.dtb
> install: link 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/am3335x-bone.dtb -> 
> /usr/obj/DESTDIRs/clang-bpim3-installkernel/boot/dtb/beaglebone.dtb: No such 
> file or directory
> *** Error code 71
> 
> Stop.
> make[4]: stopped in /usr/src/sys/modules/dtb/am335x
> *** Error code 1
> 
> Stop.
> make[3]: stopped in /usr/src/sys/modules
> *** Error code 1
> 
> Stop.
> make[2]: stopped in /usr/obj/bpim3_clang/arm.armv6/usr/src/sys/BPIM3-NODBG
> *** Error code 1
> 
> Stop.
> make[1]: stopped in /usr/src
> *** Error code 1
> 
> Stop.
> make: stopped in /usr/src



Details:

> # more /usr/src/sys/arm/conf/BPIM3-NODBG
> #
> # BPIM3 -- Custom configuration for the Banana Pi M3
> #
> 
> include "GENERIC"
> 
> ident   BPIM3-NODBG
> 
> makeoptions DEBUG=-g# Build kernel with gdb(1) debug 
> symbols
> 
> options ALT_BREAK_TO_DEBUGGER
> 
> options KDB # Enable kernel debugger support
> 
> # For minimum debugger support (stable branch) use:
> options KDB_TRACE   # Print a stack trace for a panic
> options DDB # Enable the kernel debugger
> 
> # Extra stuff:
> #optionsVERBOSE_SYSINIT # Enable verbose sysinit messages
> #optionsBOOTVERBOSE=1
> #optionsBOOTHOWTO=RB_VERBOSE
> #optionsKTR
> #optionsKTR_MASK=KTR_TRAP
> ##options   KTR_CPUMASK=0xF
> #optionsKTR_VERBOSE
> 
> # Disable any extra checking for. . .
> nooptions   DEADLKRES   # Enable the deadlock resolver
> nooptions   INVARIANTS  # Enable calls of extra sanity 
> checking
> nooptions   INVARIANT_SUPPORT   # Extra sanity checks of internal 
> structures, required by INVARIANTS
> nooptions   WITNESS # Enable checks to detect deadlocks 
> and cycles
> nooptions   WITNESS_SKIPSPIN# Don't run witness on spinlocks for 
> speed
> nooptions   DIAGNOSTIC


> # more /root/src.configs/src.conf.bpim3-clang-bootstrap.amd64-host
> TO_TYPE=armv6
> #
> KERNCONF=BPIM3-NODBG
> TARGET=arm
> .if ${.MAKE.LEVEL} == 0
> TARGET_ARCH=${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_CROSS_COMPILER=
> WITHOUT_SYSTEM_COMPILER=
> #
> #CPUTYPE=soft
> WITH_LIBCPLUSPLUS=
> WITH_BINUTILS_BOOTSTRAP=
> WITH_ELFTOOLCHAIN_BOOTSTRAP=
> WITH_CLANG_BOOTSTRAP=
> WITH_CLANG=
> WITH_CLANG_IS_CC=
> WITH_CLANG_FULL=
> WITH_CLANG_EXTRAS=
> WITH_LLD=
> #
> # Linking lldb fails for armv6(/v7) (historical binutils)
> WITHOUT_LLDB=
> #
> WITH_BOOT=
> WITHOUT_LIB32=
> WITHOUT_LIBSOFT=
> #
> WITHOUT_GCC_BOOTSTRAP=
> WITHOUT_GCC=
> WITHOUT_GCC_IS_CC=
> WITHOUT_GNUCXX=
> #
> NO_WERROR=
> #WERROR=
> MALLOC_PRODUCTION=
> #
> WITH_REPRODUCIBLE_BUILD=
> WITH_DEBUG_FILES=
> #
> XCFLAGS+= -mcpu=cortex-a7
> XCXXFLAGS+= -mcpu=cortex-a7
> # There is no XCPPFLAGS but XCPP gets XCFLAGS content.


> # more /root/src.configs/make.conf
> #MALLOC_PRODUCTION=
> #NO_WERROR=
> #WERROR=
> CFLAGS.gcc+= -v



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

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


Re: GCC i386 stack misalignment: [package - head-i386-default][graphics/rawtherapee-devel] Failed for rawtherapee-devel-5.0 in stage

2017-01-29 Thread Dimitry Andric
On 29 Jan 2017, at 19:35, Matthias Andree  wrote:
> whenever I've traced one of the attached SIGBUS issues on gcc-compiled
> i386 code with SSE2, I found that it was using unaligned 128-bit =
> 16-byte wide SSE2 access which also needs 16-byte aligned data
> (including stacks).

See these very old bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496

PR 40838 is 8 years old and still has status NEW, PR38496 has WONTFIX.

E.g. don't count on this getting fixed upstream.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


GCC i386 stack misalignment: [package - head-i386-default][graphics/rawtherapee-devel] Failed for rawtherapee-devel-5.0 in stage

2017-01-29 Thread Matthias Andree
Greetings,

whenever I've traced one of the attached SIGBUS issues on gcc-compiled
i386 code with SSE2, I found that it was using unaligned 128-bit =
16-byte wide SSE2 access which also needs 16-byte aligned data
(including stacks).

For rawtherapee in particular, the crash happens in one of the C++
constructors that don't do anything beyond initializing an auto
double[8] = { ... } vector and then create STL containers from the vector.

Please see BZ#216563 here for more details:


While I don't think there's anything special about the attached case, it
does involve callbacks through Gtkmm and all its requisites, but never
shows up when the code is compiled with Clang.

Please investigate why GCC-compiled -msse2 code on i386 is prone to
insufficiently aligned stacks. I can't do it, am not knowledgable about
compiler innards and only see the high-level difference "gcc fucks up,
clang compiles usable code".

WRT rawtherapee, I'm fed up with the compiler generating nonworking code
and force -mstackrealign on i386, and I've pulled the plug on any
non-amd64 stuff on FreeBSD12+ because I don't have time to sort this
mess out.

(The interesting question is why 12-CURRENT i386 uses GCC, rather than
clang. Some of the Uses/compiler.mk logic must be hosed there, assuming
that the 12-CURRENT base compiler can't fully do c++11. If it really
can't do that, we should make it.)
--- Begin Message ---
You are receiving this mail as a port that you maintain
is failing to build on the FreeBSD package build server.
Please investigate the failure and submit a PR to fix
build.

Maintainer: mand...@freebsd.org
Last committer: mand...@freebsd.org
Ident:  $FreeBSD: head/graphics/rawtherapee-devel/Makefile 432608 
2017-01-28 00:49:11Z mandree $
Log URL:
http://beefy11.nyi.freebsd.org/data/head-i386-default/p432608_s312909/logs/rawtherapee-devel-5.0.log
Build URL:  
http://beefy11.nyi.freebsd.org/build.html?mastername=head-i386-default=p432608_s312909
Log:

>> Building graphics/rawtherapee-devel
build started at Sun Jan 29 16:27:28 UTC 2017
port directory: /usr/ports/graphics/rawtherapee-devel
building for: FreeBSD head-i386-default-job-05 12.0-CURRENT FreeBSD 
12.0-CURRENT r312909 i386
maintained by: mand...@freebsd.org
Makefile ident:  $FreeBSD: head/graphics/rawtherapee-devel/Makefile 432608 
2017-01-28 00:49:11Z mandree $
Poudriere version: 3.1.14
Host OSVERSION: 1200018
Jail OSVERSION: 1200020
Job Id: 05




!!! Jail is newer than host. (Jail: 1200020, Host: 1200018) !!!
!!! This is not supported. !!!
!!! Host kernel must be same or newer than jail. !!!
!!! Expect build failures. !!!



---Begin Environment---
SHELL=/bin/csh
UNAME_p=i386
UNAME_m=i386
UNAME_v=FreeBSD 12.0-CURRENT r312909
UNAME_r=12.0-CURRENT
BLOCKSIZE=K
MAIL=/var/mail/root
STATUS=1
OPSYS=FreeBSD
ARCH=i386
SAVED_TERM=
MASTERMNT=/usr/local/poudriere/data/.m/head-i386-default/ref
UID=0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
_JAVA_VERSION_LIST_REGEXP=1.6\|1.7\|1.8\|1.6+\|1.7+\|1.8+
POUDRIERE_BUILD_TYPE=bulk
PKGNAME=rawtherapee-devel-5.0
OSREL=12.0
_OSRELEASE=12.0-CURRENT
PYTHONBASE=/usr/local
OLDPWD=/
_SMP_CPUS=24
PWD=/usr/local/poudriere/data/.m/head-i386-default/ref/.p/pool
MASTERNAME=head-i386-default
SCRIPTPREFIX=/usr/local/share/poudriere
_JAVA_VENDOR_LIST_REGEXP=openjdk\|oracle\|sun
USER=root
HOME=/root
POUDRIERE_VERSION=3.1.14
SCRIPTPATH=/usr/local/share/poudriere/bulk.sh
CONFIGURE_MAX_CMD_LEN=262144
LIBEXECPREFIX=/usr/local/libexec/poudriere
LOCALBASE=/usr/local
PACKAGE_BUILDING=yes
_JAVA_OS_LIST_REGEXP=native\|linux
OSVERSION=1200020
---End Environment---

---Begin OPTIONS List---
===> The following configuration options are available for 
rawtherapee-devel-5.0:
 NATIVE=off: Use -march=native for compilation (do not use for generic 
packages!)
 OPENMP=on: Enable multicore processing using OpenMP (amd64)
 OPTIMIZED_CFLAGS=on: Use extra compiler optimizations (requires SSE2 
support)
===> Use 'make config' to modify these settings
---End OPTIONS List---

--CONFIGURE_ARGS--

--End CONFIGURE_ARGS--

--CONFIGURE_ENV--
CFLAGS="-O2 -pipe  -I/usr/local/include -fPIC -D_GLIBCXX_USE_C99 
-Wno-deprecated-declarations -Wno-unused-result -O3 -funroll-loops -msse2 
-fexpensive-optimizations -fstack-protector -Wl,-rpath=/usr/local/lib/gcc5 
-isystem /usr/local/include -fno-strict-aliasing" PKG_CONFIG=pkgconf 
XDG_DATA_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
XDG_CONFIG_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work TMPDIR="/tmp" 
SHELL=/bin/sh CONFIG_SHELL=/bin/sh CMAKE_PREFIX_PATH="/usr/local"
--End CONFIGURE_ENV--

--MAKE_ENV--
XDG_DATA_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
XDG_CONFIG_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work TMPDIR="/tmp" 
NO_PIE=yes