This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [BUILDROBOT] Go runtime: calling â__builtin_frame_addressâ with a nonzero argument is unsafe
- From: Martin Sebor <msebor at gmail dot com>
- To: Jan-Benedict Glaw <jbglaw at lug-owl dot de>
- Cc: Jeff Law <law at redhat dot com>, Segher Boessenkool <segher at kernel dot crashing dot org>, Martin Sebor <msebor at redhat dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 03 Aug 2015 08:48:13 -0600
- Subject: Re: [BUILDROBOT] Go runtime: calling â__builtin_frame_addressâ with a nonzero argument is unsafe
- Authentication-results: sourceware.org; auth=none
- References: <555E2FC6 dot 60804 at redhat dot com> <555E50A5 dot 60309 at redhat dot com> <557A0617 dot 6040605 at redhat dot com> <55B1C845 dot 1030000 at redhat dot com> <20150725142035 dot GB7309 at gate dot crashing dot org> <55B6F232 dot 2080402 at gmail dot com> <20150728142406 dot GA14409 at gate dot crashing dot org> <55B7A368 dot 3060200 at gmail dot com> <55BBA5A2 dot 8040709 at redhat dot com> <55BEA48F dot 9020808 at gmail dot com> <20150803115544 dot GB24297 at lug-owl dot de>
On 08/03/2015 05:55 AM, Jan-Benedict Glaw wrote:
On Sun, 2015-08-02 17:15:27 -0600, Martin Sebor <msebor@gmail.com> wrote:
OK for the trunk. Sorry for the delay.
Thank you. Committed in revision 226480.
...und breaks native builds. When doing builds using config-list.mk, I
first build a GCC for the build machine, then re-build a
cross-configured GCC with that.
I don't know if pragma GCC diagnostic is valid in Go (still waiting
for my build to finish to confirm) but disabling the warning in
cases where the calls are known to be safe should fix the compilation
error.
Index: runtime/mprof.goc
===================================================================
--- runtime/mprof.goc (revision 226505)
+++ runtime/mprof.goc (working copy)
@@ -404,10 +404,15 @@
func Stack(b Slice, all bool) (n int) {
byte *pc, *sp;
bool enablegc;
-
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wframe-address"
+
sp = runtime_getcallersp(&b);
pc = (byte*)(uintptr)runtime_getcallerpc(&b);
+#pragma GCC diagnostic pop
+
if(all) {
runtime_semacquire(&runtime_worldsema, false);
runtime_m()->gcing = 1;
Martin
While building GCC targeting the build=host machine, I get ie:
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=459572
/bin/bash ./libtool --tag=CC --mode=compile /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/build-gcc/native-compiler-build/./gcc/xgcc -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/build-gcc/native-compiler-build/./gcc/ -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/bin/ -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/lib/ -isystem /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/include -isystem /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos-configlist_mk/gcc/libgo -I /home/jbglaw/repos-configlist_mk/gcc/libgo/runtime -I/home/jbglaw/repos-configlist_mk/gcc/libgo/../libffi/include -I../libffi/include -pthread -fexceptions -fnon-call-exceptions -fplan9-extensions -fsplit-stack -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -minline-all-stringops -D_GNU_SOURCE -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I /home/jbglaw/repos-configlist_mk/gcc/libgo/../libgcc -I /home/jbglaw/repos-configlist_mk/gcc/libgo/../libbacktrace -I ../../gcc/include -g -O2 -MT mprof.lo -MD -MP -MF .deps/mprof.Tpo -c -o mprof.lo mprof.c
libtool: compile: /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/build-gcc/native-compiler-build/./gcc/xgcc -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/build-gcc/native-compiler-build/./gcc/ -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/bin/ -B/home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/lib/ -isystem /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/include -isystem /home/jbglaw/build-configlist_mk/rs6000-ibm-aix5.1.0/_install_/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos-configlist_mk/gcc/libgo -I /home/jbglaw/repos-configlist_mk/gcc/libgo/runtime -I/home/jbglaw/repos-configlist_mk/gcc/libgo/../libffi/include -I../libffi/include -pthread -fexceptions -fnon-call-exceptions -fplan9-extensions -fsplit-stack -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -minline-all-stringops -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BIT
S=64 -I /home/jbglaw/repos-configlist_mk/gcc/libgo/../libgcc -I /home/jbglaw/repos-configlist_mk/gcc/libgo/../libbacktrace -I ../../gcc/include -g -O2 -MT mprof.lo -MD -MP -MF .deps/mprof.Tpo -c mprof.c -fPIC -DPIC -o .libs/mprof.o
/home/jbglaw/repos-configlist_mk/gcc/libgo/runtime/mprof.goc: In function âruntime_Stackâ:
/home/jbglaw/repos-configlist_mk/gcc/libgo/runtime/mprof.goc:408:5: error: calling â__builtin_frame_addressâ with a nonzero argument is unsafe [-Werror=frame-address]
sp = runtime_getcallersp(&b);
^
cc1: all warnings being treated as errors
Makefile:2613: recipe for target 'mprof.lo' failed
make[4]: *** [mprof.lo] Error 1
Seems Go's runtime uses that feature.
MfG, JBG