Bug 220118 - devel/powerpc64-gcc based buildkernel: sys/powerpc/powerpc/stack_machdep.c rejected for: '__builtin_frame_address' with a nonzero argument is unsafe
Summary: devel/powerpc64-gcc based buildkernel: sys/powerpc/powerpc/stack_machdep.c re...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Only Me
Assignee: Justin Hibbits
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-19 02:08 UTC by Mark Millard
Modified: 2019-01-21 21:45 UTC (History)
2 users (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 02:08:54 UTC
This is another example place with the same sort
of compiler report as bugzilla 215600 was for.
I've switched back to using WERROR to allow
the kernel to build via xtoolchain-powerpc64-gcc .
The example context is a debug kernel build.
At least this place in the kernel also needs
an update if WERROR use is to be avoided
for xtoolchain-powerpc64-gcc.

The detailed build failure material follows.

--- stack_machdep.o ---
/usr/src/sys/powerpc/powerpc/stack_machdep.c: In function 'stack_save':
/usr/src/sys/powerpc/powerpc/stack_machdep.c:113:22: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
  frame = (register_t)__builtin_frame_address(1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
Building /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-DBG/mmu_phyp.o
. . .
--- stack_machdep.o ---
cc1: all warnings being treated as errors
. . .
--- stack_machdep.o ---
*** [stack_machdep.o] Error code 1

make[2]: stopped in /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-DBG
.ERROR_TARGET='stack_machdep.o'
.ERROR_META_FILE='/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-DBG/stack_machdep.o.meta'
.MAKE.LEVEL='2'
. . .

# Meta data file /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-DBG/stack_machdep.o.meta
CMD /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc -isystem /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/include -L/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib -B/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib --sysroot=/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -c -O -pipe  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -msoft-float -fPIC -fno-omit-frame-pointer -mno-altivec -msoft-float -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-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 -fno-common -fms-extensions -finline-limit=15000 --param inline-unit-growth=100 --param large-function-growth=1000 -Wa,-many -mcall-aixdesc  -std=iso9899:1999 -Werror  /usr/src/sys/powerpc/powerpc/stack_machdep.c
CMD ctfconvert -L VERSION -g stack_machdep.o
CWD /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-DBG
TARGET stack_machdep.o
-- command output --
Using built-in specs.
COLLECT_GCC=/usr/local/bin/powerpc64-unknown-freebsd12.0-gcc
Target: powerpc64-unknown-freebsd12.0
Configured with: /usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/gcc-6.3.0/configure --target=powerpc64-unknown-freebsd12.0 --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports Collection for powerpc64' --with-system-zlib --with-gcc-include-dir=/usr/include/c++/v1/ --with-as=/usr/local/bin/powerpc64-freebsd-as --with-ld=/usr/local/bin/powerpc64-freebsd-ld --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/ --build=amd64-unknown-freebsd12.0
Thread model: posix
gcc version 6.3.0 (FreeBSD Ports Collection for powerpc64) 
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-c' '-O' '-pipe' '-g' '-nostdinc' '-I' '.' '-I' '/usr/src/sys' '-I' '/usr/src/sys/contrib/libfdt' '-D' '_KERNEL' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' 'opt_global.h' '-msoft-float' '-fPIC' '-fno-omit-frame-pointer' '-mno-altivec' '-msoft-float' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-Wall' '-Wredundant-decls' '-Wnested-externs' '-Wstrict-prototypes' '-Wmissing-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' '-fno-common' '-fms-extensions' '-finline-limit=15000' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-mcall-aixdesc' '-std=c99' '-Werror'
 /usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.3.0/cc1 -quiet -nostdinc -v -I . -I /usr/src/sys -I /usr/src/sys/contrib/libfdt -isysroot /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp -D _KERNEL -D HAVE_KERNEL_OPTION_HEADERS -isystem /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/include -include opt_global.h /usr/src/sys/powerpc/powerpc/stack_machdep.c -quiet -dumpbase stack_machdep.c -msoft-float -mno-altivec -msoft-float -mcall-aixdesc -auxbase stack_machdep -g -gdwarf-2 -O -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -Wmissing-include-dirs -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 -Werror -std=c99 -version -fPIC -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -fdiagnostics-show-option -fno-common -fms-extensions -finline-limit=15000 --param inline-unit-growth=100 --param large-function-growth=1000 -o - |
 /usr/local/bin/powerpc64-freebsd-as -v -I . -I /usr/src/sys -I /usr/src/sys/contrib/libfdt --traditional-format -a64 -mppc64 -many -many -o stack_machdep.o
GNU assembler version 2.28 (powerpc64-freebsd) using BFD version (GNU Binutils) 2.28
GNU C99 (FreeBSD Ports Collection for powerpc64) version 6.3.0 (powerpc64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final 297347), GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/src/sys
 /usr/src/sys/contrib/libfdt
 /usr/obj/powerpc64vtscdbg_xtoolchain-gcc_kernel/powerpc.powerpc64/usr/src/tmp/usr/include
End of search list.
GNU C99 (FreeBSD Ports Collection for powerpc64) version 6.3.0 (powerpc64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final 297347), GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8ac087b8ad16a23ac09c5d0c7497aeae
/usr/src/sys/powerpc/powerpc/stack_machdep.c: In function 'stack_save':
/usr/src/sys/powerpc/powerpc/stack_machdep.c:113:22: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
  frame = (register_t)__builtin_frame_address(1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
*** Error code 1
. . .
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-09-17 20:07:48 UTC
A commit references this bug:

Author: jhibbits
Date: Sun Sep 17 20:07:21 UTC 2017
New revision: 323687
URL: https://svnweb.freebsd.org/changeset/base/323687

Log:
  Don't use a non-zero argument for __builtin_frame_address

  __builtin_frame_address with a non-zero argument is unsafe and rejected by
  newer gcc.  Since it doesn't seem to impact the stacktrace, don't bother
  with gymnastics to unwind to a different frame for starting.

  PR:		kern/220118
  MFC after:	2 weeks

Changes:
  head/sys/powerpc/powerpc/stack_machdep.c
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:42:50 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 3 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-21 21:39:06 UTC
Justin, is this still require MFC or can PR be closed?
Comment 4 Justin Hibbits freebsd_committer freebsd_triage 2019-01-21 21:45:03 UTC
I never bothered MFC'ing it, and I now have no plans to do so.  Closing it.