Fix libgo build (was Re: [PATCH v3] PR85678: Change default to -fno-common)
diff mbox series

Message ID 20191121001845.GC4650@tucnak
State New
Headers show
Series
  • Fix libgo build (was Re: [PATCH v3] PR85678: Change default to -fno-common)
Related show

Commit Message

Jakub Jelinek Nov. 21, 2019, 12:18 a.m. UTC
On Tue, Nov 05, 2019 at 05:17:10PM +0000, Wilco Dijkstra wrote:
> Passes bootstrap and regress on AArch64 and x64. OK for commit?

This broke bootstrap on x86_64-linux as well as i686-linux (guess all
targets that go supports).
The following patch fixes it for me, though not sure which *.c file is best
and what location in there for the definition.
With this bootstrap succeeded on both x86_64-linux and i686-linux, regtest
is still pending, but without it it just failed to link libgo.


	Jakub

Comments

Rainer Orth Nov. 21, 2019, 12:41 a.m. UTC | #1
Hi Jakub,

> On Tue, Nov 05, 2019 at 05:17:10PM +0000, Wilco Dijkstra wrote:
>> Passes bootstrap and regress on AArch64 and x64. OK for commit?
>
> This broke bootstrap on x86_64-linux as well as i686-linux (guess all
> targets that go supports).

indeed: just saw it on Solaris with the native ld.

> The following patch fixes it for me, though not sure which *.c file is best
> and what location in there for the definition.

I've placed it in runtime/go-unwind.c: probestackmaps is defined there
which is declared close to runtime_usestackmaps.

> With this bootstrap succeeded on both x86_64-linux and i686-linux, regtest
> is still pending, but without it it just failed to link libgo.

Same on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

There where quite a number of non-Go regressions all over the place.
Many are like this:

FAIL: gcc.c-torture/execute/complex-6.c   -O0  (test for excess errors)

ld: warning: symbol 'err' has differing types:
        (file /var/tmp//ccWQCyMc.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//ccWQCyMc.o definition taken

	Rainer
Jakub Jelinek Nov. 21, 2019, 12:54 a.m. UTC | #2
On Thu, Nov 21, 2019 at 01:41:47AM +0100, Rainer Orth wrote:
> Same on sparc-sun-solaris2.11 and i386-pc-solaris2.11.
> 
> There where quite a number of non-Go regressions all over the place.
> Many are like this:
> 
> FAIL: gcc.c-torture/execute/complex-6.c   -O0  (test for excess errors)
> 
> ld: warning: symbol 'err' has differing types:
>         (file /var/tmp//ccWQCyMc.o type=OBJT; file /lib/libc.so type=FUNC);
>         /var/tmp//ccWQCyMc.o definition taken

On i686-linux, I see just:
+FAIL: gcc.target/i386/memcpy-strategy-1.c scan-assembler-times movdqa 4
+FAIL: gcc.target/i386/memcpy-strategy-2.c scan-assembler-times movdqa 4
+FAIL: gcc.target/i386/memcpy-vector_loop-1.c scan-assembler-times movdqa 4
+FAIL: gcc.target/i386/pr69052.c scan-assembler-not leal[ \\t]ind@GOTOFF\\\\(%[^,]*\\\\), %
+FAIL: gfortran.dg/global_vars_f90_init.f90   -O0  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -O0  compilation failed to produce executable
+FAIL: gfortran.dg/global_vars_f90_init.f90   -O1  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -O1  compilation failed to produce executable
+FAIL: gfortran.dg/global_vars_f90_init.f90   -O2  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -O2  compilation failed to produce executable
+FAIL: gfortran.dg/global_vars_f90_init.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to produce executable
+FAIL: gfortran.dg/global_vars_f90_init.f90   -O3 -g  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -O3 -g  compilation failed to produce executable
+FAIL: gfortran.dg/global_vars_f90_init.f90   -Os  (test for excess errors)
+UNRESOLVED: gfortran.dg/global_vars_f90_init.f90   -Os  compilation failed to produce executable

	Jakub
Ian Lance Taylor Nov. 21, 2019, 1:08 a.m. UTC | #3
On Wed, Nov 20, 2019 at 4:18 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Tue, Nov 05, 2019 at 05:17:10PM +0000, Wilco Dijkstra wrote:
> > Passes bootstrap and regress on AArch64 and x64. OK for commit?
>
> This broke bootstrap on x86_64-linux as well as i686-linux (guess all
> targets that go supports).
> The following patch fixes it for me, though not sure which *.c file is best
> and what location in there for the definition.
> With this bootstrap succeeded on both x86_64-linux and i686-linux, regtest
> is still pending, but without it it just failed to link libgo.

I just committed a fix for this.  I put the variable in
libgo/runtime/stack.c.  Sorry about the difficulties.

Ian
Rainer Orth Nov. 21, 2019, 11:03 a.m. UTC | #4
Hi Jakub,

> On Thu, Nov 21, 2019 at 01:41:47AM +0100, Rainer Orth wrote:
>> Same on sparc-sun-solaris2.11 and i386-pc-solaris2.11.
>> 
>> There where quite a number of non-Go regressions all over the place.
>> Many are like this:
>> 
>> FAIL: gcc.c-torture/execute/complex-6.c   -O0  (test for excess errors)
>> 
>> ld: warning: symbol 'err' has differing types:
>>         (file /var/tmp//ccWQCyMc.o type=OBJT; file /lib/libc.so type=FUNC);
>>         /var/tmp//ccWQCyMc.o definition taken
>
> On i686-linux, I see just:
> +FAIL: gcc.target/i386/memcpy-strategy-1.c scan-assembler-times movdqa 4
> +FAIL: gcc.target/i386/memcpy-strategy-2.c scan-assembler-times movdqa 4
> +FAIL: gcc.target/i386/memcpy-vector_loop-1.c scan-assembler-times movdqa 4
> +FAIL: gcc.target/i386/pr69052.c scan-assembler-not leal[
> \\t]ind@GOTOFF\\\\(%[^,]*\\\\), %
> +FAIL: gfortran.dg/global_vars_f90_init.f90   -O0  (test for excess errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -O0 compilation failed to
> produce executable
> +FAIL: gfortran.dg/global_vars_f90_init.f90   -O1  (test for excess errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -O1 compilation failed to
> produce executable
> +FAIL: gfortran.dg/global_vars_f90_init.f90   -O2  (test for excess errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -O2 compilation failed to
> produce executable
> +FAIL: gfortran.dg/global_vars_f90_init.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess
> errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions compilation failed
> to produce executable
> +FAIL: gfortran.dg/global_vars_f90_init.f90   -O3 -g  (test for excess errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -O3 -g compilation failed
> to produce executable
> +FAIL: gfortran.dg/global_vars_f90_init.f90   -Os  (test for excess errors)
> +UNRESOLVED: gfortran.dg/global_vars_f90_init.f90 -Os compilation failed to
> produce executable

I'm seeing those, too, plus the following that are apparently only
diagnosed by Solaris ld:

+FAIL: gcc.c-torture/execute/20030913-1.c   -O0  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -O1  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -O2  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -O2 -flto  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -O2 -flto -flto-partition=none  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -O3 -g  (test for excess errors)
+FAIL: gcc.c-torture/execute/20030913-1.c   -Os  (test for excess errors)

Excess errors:
ld: warning: symbol 'glob' has differing types:
        (file /var/tmp//ccdl_86b.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//ccdl_86b.o definition taken

+FAIL: gcc.c-torture/execute/960218-1.c   -O0  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O1  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O2  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O2 -flto  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O2 -flto -flto-partition=none  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -O3 -g  (test for excess errors)
+FAIL: gcc.c-torture/execute/960218-1.c   -Os  (test for excess errors)

Excess errors:
ld: warning: symbol 'glob' has differing types:
        (file /var/tmp//cc0ib2Zb.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//cc0ib2Zb.o definition taken

+FAIL: gcc.c-torture/execute/complex-6.c   -O0  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -O1  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -O2  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -O2 -flto  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -O2 -flto -flto-partition=none  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -O3 -g  (test for excess errors)
+FAIL: gcc.c-torture/execute/complex-6.c   -Os  (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//ccz5Kj5d.o type=OBJT; file /lib/sparcv9/libc.so type=FUNC);
        /var/tmp//ccz5Kj5d.o definition taken

+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -O1  (test for excess errors)
+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -O2  (test for excess errors)
+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -O2 -flto  (test for excess errors)
+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -O2 -flto -flto-partition=none  (test for excess errors)
+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -O3 -g  (test for excess errors)
+FAIL: gcc.dg/torture/ssa-pta-fn-1.c   -Os  (test for excess errors)

Excess errors:
ld: warning: symbol 'glob' has differing types:
        (file /var/tmp//ccn1WXac.o type=OBJT; file /lib/sparcv9/libc.so type=FUNC);
        /var/tmp//ccn1WXac.o definition taken

+FAIL: libgomp.c/pr39591-1.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//cc_ExIUc.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//cc_ExIUc.o definition taken

+FAIL: libgomp.c/pr39591-2.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//cc4vqObc.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//cc4vqObc.o definition taken

+FAIL: libgomp.c/pr39591-3.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//ccivrjXd.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//ccivrjXd.o definition taken

+FAIL: libgomp.c/private-1.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//cch58Hvd.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//cch58Hvd.o definition taken

+FAIL: libgomp.c/task-1.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//ccBb4fsb.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//ccBb4fsb.o definition taken

+FAIL: libgomp.c/task-5.c (test for excess errors)

Excess errors:
ld: warning: symbol 'err' has differing types:
        (file /var/tmp//ccvQhrHd.o type=OBJT; file /lib/libc.so type=FUNC);
        /var/tmp//ccvQhrHd.o definition taken

Fixed as follows, tested on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.  Ok for mainline?

	Rainer
Jakub Jelinek Nov. 21, 2019, 11:40 a.m. UTC | #5
On Thu, Nov 21, 2019 at 12:03:19PM +0100, Rainer Orth wrote:
> I'm seeing those, too, plus the following that are apparently only
> diagnosed by Solaris ld:
> 
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O0  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O1  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O2  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O2 -flto  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O2 -flto -flto-partition=none  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -O3 -g  (test for excess errors)
> +FAIL: gcc.c-torture/execute/20030913-1.c   -Os  (test for excess errors)
> 
> Excess errors:
> ld: warning: symbol 'glob' has differing types:
>         (file /var/tmp//ccdl_86b.o type=OBJT; file /lib/libc.so type=FUNC);
>         /var/tmp//ccdl_86b.o definition taken

That is arguably a weird ld feature, the libraries can contain various
extensions and even if one doesn't use them, there will be a warning if
chosen identifiers for variables match some function in the library.

> 2019-11-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	gcc/testsuite:
> 	* gcc.c-torture/execute/20030913-1.c: Rename glob to g.
> 	* gcc.c-torture/execute/960218-1.c: Rename glob to gl.
> 	* gcc.c-torture/execute/complex-6.c: Rename err to e.
> 	* gcc.dg/torture/ssa-pta-fn-1.c: Rename glob to g.
> 
> 	libgomp:
> 	* testsuite/libgomp.c/pr39591-1.c: Rename err to e.
> 	* testsuite/libgomp.c/pr39591-2.c: Likewise.
> 	* testsuite/libgomp.c/pr39591-3.c: Likewise.
> 	* testsuite/libgomp.c/private-1.c: Likewise.
> 	* testsuite/libgomp.c/task-1.c: Likewise.
> 	* testsuite/libgomp.c/task-5.c: Renamed err to serr.

That said, I can live with this, so ok for trunk.

	Jakub
Wilco Dijkstra Nov. 21, 2019, 11:40 a.m. UTC | #6
Hi Rainer,

>> ld: warning: symbol 'err' has differing types:
>>          (file /var/tmp//ccWQCyMc.o type=OBJT; file /lib/libc.so type=FUNC);
>>          /var/tmp//ccWQCyMc.o definition taken

So are glob and err somehow exported as globals by your GLIBC? I don't think those
are standard functions... It's odd the linker didn't give the warning when the mismatch
was on a common data symbol - in both cases you have a function/data mismatch.

Wilco
Jakub Jelinek Nov. 21, 2019, 11:53 a.m. UTC | #7
On Thu, Nov 21, 2019 at 11:40:33AM +0000, Wilco Dijkstra wrote:
> Hi Rainer,
> 
> >> ld: warning: symbol 'err' has differing types:
> >>          (file /var/tmp//ccWQCyMc.o type=OBJT; file /lib/libc.so type=FUNC);
> >>          /var/tmp//ccWQCyMc.o definition taken
> 
> So are glob and err somehow exported as globals by your GLIBC? I don't think those
> are standard functions... It's odd the linker didn't give the warning when the mismatch
> was on a common data symbol - in both cases you have a function/data mismatch.

Both are functions on Linux too, see man glob and man err.

	Jakub

Patch
diff mbox series

--- libgo/runtime/runtime.h.jj	2019-09-06 23:00:17.755294355 +0200
+++ libgo/runtime/runtime.h	2019-11-21 00:32:51.146992951 +0100
@@ -475,7 +475,7 @@  bool scanstackwithmap(void*)
 bool doscanstack(G*, void*)
   __asm__("runtime.doscanstack");
 
-bool runtime_usestackmaps;
+extern bool runtime_usestackmaps;
 
 bool probestackmaps(void)
   __asm__("runtime.probestackmaps");
--- libgo/runtime/proc.c.jj	2019-08-31 13:26:29.646735239 +0200
+++ libgo/runtime/proc.c	2019-11-21 00:34:23.509610234 +0100
@@ -676,6 +676,8 @@  makeGContext(G* gp, byte* sp, uintptr sp
 	__go_makecontext(uc, kickoff, sp, (size_t)spsize);
 }
 
+bool runtime_usestackmaps;
+
 // The goroutine g is about to enter a system call.
 // Record that it's not using the cpu anymore.
 // This is called only from the go syscall library and cgocall,