diff mbox

[BUILDROBOT] Go runtime: calling ‘__builtin_frame_address’ with a nonzero argument is unsafe

Message ID 55BF7F2D.2040605@gmail.com
State New
Headers show

Commit Message

Martin Sebor Aug. 3, 2015, 2:48 p.m. UTC
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.


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
>

Comments

Jeff Law Aug. 3, 2015, 3:29 p.m. UTC | #1
On 08/03/2015 08:48 AM, Martin Sebor wrote:
> 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.
My understanding is the runtime is shared across gcc-go and golang.  So 
the push/pop diagnostics may not be appropriate.

Ian Taylor should have the final say about the best way forward.

Jeff
diff mbox

Patch

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;