]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/ld: fix symbol visibility for external linking
authorShenghou Ma <minux@golang.org>
Wed, 4 Mar 2015 01:45:00 +0000 (20:45 -0500)
committerMinux Ma <minux@golang.org>
Wed, 4 Mar 2015 08:32:00 +0000 (08:32 +0000)
The original C code is: (x->type & SHIDDEN) ? 2 : 0, however when
cleaning up the code for c2go, the ternary operator is rewritten in
the exact opposite way.

We need a test for this, and that's being tracked as #10070.

Fixes #10067.

Change-Id: I24a5e021597d8bc44218c6e75bab6446513b76cf
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/6730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/ld/symtab.go

index 79c1bf6026c402f055976b5e6257dac82c42a8ad..d6577ad2310c469e7edd24b322c443cfbdaeee7a 100644 (file)
@@ -141,9 +141,9 @@ func putelfsym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *L
        if Linkmode == LinkExternal {
                addr -= int64((xo.Sect.(*Section)).Vaddr)
        }
-       other := 2
+       other := STV_DEFAULT
        if x.Type&SHIDDEN != 0 {
-               other = 0
+               other = STV_HIDDEN
        }
        putelfsyment(off, addr, size, bind<<4|type_&0xf, ((xo.Sect.(*Section)).Elfsect.(*ElfShdr)).shnum, other)
        x.Elfsym = int32(numelfsym)