Bug 220122 - head -r320059 (e.g.) clang based buildkernel (without WERROR): /usr/src/sys/sys/sglist.h:81:19: error: passing 'int *' to parameter of type 'volatile u_int *' ... converts between pointers to integer types with different sign
Summary: head -r320059 (e.g.) clang based buildkernel (without WERROR): /usr/src/sys/s...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Conrad Meyer
URL:
Keywords:
: 214903 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-19 04:24 UTC by Mark Millard
Modified: 2017-10-11 02:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2017-06-19 04:24:22 UTC
Attempting to buildkernel (without WERROR)
stopped with:

--- drm_auth.o ---
In file included from /usr/src/sys/dev/drm2/drm_auth.c:39:
In file included from /usr/src/sys/dev/drm2/drmP.h:51:
/usr/src/sys/sys/sglist.h:67:16: error: passing 'int *' to parameter of type 'volatile u_int *' (aka 'volatile unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        refcount_init(&sg->sg_refs, 1);
                      ^~~~~~~~~~~~
/usr/src/sys/sys/refcount.h:42:31: note: passing argument to parameter 'count' here
refcount_init(volatile u_int *count, u_int value)
                              ^
In file included from /usr/src/sys/dev/drm2/drm_auth.c:39:
In file included from /usr/src/sys/dev/drm2/drmP.h:51:
/usr/src/sys/sys/sglist.h:81:19: error: passing 'int *' to parameter of type 'volatile u_int *' (aka 'volatile unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        refcount_acquire(&sg->sg_refs);
                         ^~~~~~~~~~~~
/usr/src/sys/sys/refcount.h:49:34: note: passing argument to parameter 'count' here
refcount_acquire(volatile u_int *count)
                                 ^
. . .
--- all_subdir_drm2/drm2 ---
2 errors generated.
*** [drm_auth.o] Error code 1

make[5]: stopped in /usr/src/sys/modules/drm2/drm2
.ERROR_TARGET='drm_auth.o'
.ERROR_META_FILE='/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/drm2/drm2/drm_auth.o.meta'
.MAKE.LEVEL='5'
MAKEFILE=''
.MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose'
_ERROR_CMD='/usr/local/bin/clang40 -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/  -O2 -pipe  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h -I. -I/usr/src/sys -fno-common -g -fno-omit-frame-pointer -I/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG  -mno-altivec -msoft-float -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wno-cast-qual    -std=iso9899:1999 -c /usr/src/sys/dev/drm2/drm_auth.c -o drm_auth.o; ctfconvert -L VERSION -g drm_auth.o;'
.CURDIR='/usr/src/sys/modules/drm2/drm2'
. . .

This does not look to be powerpc64 specific but powerpc64
was the context.

This did happen to be built via a llvm40 xtoolchain variant that
allowed me to specify to use devel/powerpc64-bintuils use
(including for ld since lld does not work for powerpc64 or
powerpc last I knew).


# more /usr/local/share/toolchains/llvm40_altbinutils.mk 
XCC=/usr/local/bin/clang40
XCXX=/usr/local/bin/clang++40
XCPP=/usr/local/bin/clang-cpp40
X_COMPILER_TYPE=clang


# more ~/src.configs/src.conf.powerpc64-xtoolchain-llvm.amd64-host 
TO_TYPE=powerpc64
TOOLS_TO_TYPE=${TO_TYPE}
#
KERNCONF=GENERIC64vtsc-NODBG
TARGET=powerpc
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITHOUT_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITHOUT_BINUTILS_BOOTSTRAP=
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITHOUT_LLD_BOOTSTRAP=
WITH_LLD=
WITHOUT_LLD_IS_LD=
WITH_LLDB=
#
WITH_BOOT=
WITH_LIB32=
#
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#
# Avoid build aborting for the likes of:
#  /usr/src/sys/sys/sglist.h:81:19: error:
#  passing 'int *' to parameter of type 'volatile u_int *'
#  (aka 'volatile unsigned int *') converts between
#  pointers to integer types with different sign
#  [-Werror,-Wpointer-sign]
#
WERROR=
MALLOC_PRODUCTION=
#
WITH_REPRODUCIBLE_BUILD=
WITH_DEBUG_FILES=
#
#
# For TO (so-called "cross") stages . . .
# TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . .
#
CROSS_TOOLCHAIN=llvm40_altbinutils
X_COMPILER_TYPE=clang
CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/
.if ${.MAKE.LEVEL} == 0
XCC=/usr/local/bin/clang40
XCXX=/usr/local/bin/clang++40
XCPP=/usr/local/bin/clang-cpp40
.export XCC
.export XCXX
.export XCPP
XAS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as
XAR=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar
XLD=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld
XNM=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm
XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy
XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump
XRANLIB=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib
XSIZE=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size
#NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings
XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings
.export XAS
.export XAR
.export XLD
.export XNM
.export XOBJCOPY
.export XOBJDUMP
.export XRANLIB
.export XSIZE
.export XSTRINGS
.endif
#
#
# From based on clang (via system). . .
#
.if ${.MAKE.LEVEL} == 0
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPP=/usr/bin/clang-cpp
.export CC
.export CXX
.export CPP
.endif
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2017-06-22 15:48:37 UTC
I've noticed this before at $WORK, too.  I think the type of sg_refs is just wrong -- should be u_int, if not volatile u_int.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-06-22 15:52:32 UTC
A commit references this bug:

Author: cem
Date: Thu Jun 22 15:52:18 UTC 2017
New revision: 320236
URL: https://svnweb.freebsd.org/changeset/base/320236

Log:
  sglist.h: Fix sg_refs signedness to match refcount(9)

  PR:		220122
  Reported by:	Mark Millard <markmi at dsl-only.net>
  Sponsored by:	Dell EMC Isilon

Changes:
  head/sys/sys/sglist.h
Comment 3 Justin Hibbits freebsd_committer freebsd_triage 2017-10-11 02:43:17 UTC
*** Bug 214903 has been marked as a duplicate of this bug. ***