Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: linux/arm external linking broken #10557

Closed
minux opened this issue Apr 23, 2015 · 8 comments
Closed

cmd/link: linux/arm external linking broken #10557

minux opened this issue Apr 23, 2015 · 8 comments
Milestone

Comments

@minux
Copy link
Member

minux commented Apr 23, 2015

$ go build -ldflags="-linkmode=external -v" cmd/objdump/testdata/fmthello.go 
# command-line-arguments
HEADER = -H5 -T0x10c00 -D0x0 -R0x1000
searching for runtime.a in $WORK/runtime.a
searching for runtime.a in $GOROOT/pkg/linux_arm/runtime.a
searching for math.a in $WORK/math.a
searching for math.a in $GOROOT/pkg/linux_arm/math.a
searching for runtime/cgo.a in $WORK/runtime/cgo.a
searching for runtime/cgo.a in $GOROOT/pkg/linux_arm/runtime/cgo.a
 0.00 deadcode
 0.46 pclntab=242507 bytes, funcdata total 87728 bytes
 0.52 dodata
 0.61 reloc
 0.66 asmb
 0.81 datblk
 0.81 sym
 0.81 elfsym
 0.84 symsize = 44432
 0.86 symsize = 44624
 0.86 dwarf
 0.93 symsize = 44624
runtime.save_g: missing xsym in relocation
runtime.load_g: missing xsym in relocation
runtime._initcgo: missing xsym in relocation
 2.22 dwarf pass 2.
 2.98 header

This is reason for recent linux/arm builder failures.

@minux minux added this to the Go1.5 milestone Apr 23, 2015
@minux
Copy link
Member Author

minux commented Apr 23, 2015

@davecheney
Copy link
Contributor

Can we revert that change to fix the issue ?

On Thu, Apr 23, 2015 at 4:04 PM, Minux Ma notifications@github.com wrote:

The change the breaks this is

https://go-review.googlesource.com/#/c/9107/5/src/cmd/internal/obj/arm/asm5.go


Reply to this email directly or view it on GitHub
#10557 (comment).

@minux
Copy link
Member Author

minux commented Apr 23, 2015 via email

@mwhudson
Copy link
Contributor

Whoops, sorry. Can we fix this by making tls stuff less fragile please?

@minux
Copy link
Member Author

minux commented Apr 23, 2015 via email

@mwhudson
Copy link
Contributor

This fixes it:

diff --git a/src/cmd/internal/ld/data.go b/src/cmd/internal/ld/data.go
index 13a4019..7de0b70 100644
--- a/src/cmd/internal/ld/data.go
+++ b/src/cmd/internal/ld/data.go
@@ -372,6 +372,17 @@ func relocsym(s *LSym) {
                        }

                case obj.R_TLS:
+                       if Linkmode == LinkExternal && Iself && HEADTYPE != obj.Hopenbsd {
+                               r.Done = 0
+                               r.Sym = Ctxt.Tlsg
+                               r.Xsym = Ctxt.Tlsg
+                               r.Xadd = r.Add
+                               if Thearch.Thechar == '6' {
+                                       panic("oh no you don't")
+                               }
+                               o = r.Add
+                               break
+                       }
                        if Linkmode == LinkInternal && Iself && Thearch.Thechar == '5' {
                                // On ELF ARM, the thread pointer is 8 bytes before
                                // the start of the thread-local data block, so add 8

I just want to set everything on fire though. Bit late in my TZ for that :)

mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 24, 2015
…file

I think this should fix the arm build. A proper fix involves making the handling
of tlsg less fragile, I'll try that tomorrow.

Update golang#10557

Change-Id: I9b1b666737fb40aebb6f284748509afa8483cce5
Reviewed-on: https://go-review.googlesource.com/9272
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
mwhudson added a commit to mwhudson/go that referenced this issue May 22, 2015
…file

I think this should fix the arm build. A proper fix involves making the handling
of tlsg less fragile, I'll try that tomorrow.

Update golang#10557

Change-Id: I9b1b666737fb40aebb6f284748509afa8483cce5
@rsc rsc changed the title cmd/5l: linux/arm external linking broken cmd/link: linux/arm external linking broken Jun 8, 2015
@mwhudson
Copy link
Contributor

mwhudson commented Jun 8, 2015

This is fixed isn't it?

@rsc
Copy link
Contributor

rsc commented Jun 29, 2015

Trusting @mwhudson that this is fixed. If not, please reopen.

@rsc rsc closed this as completed Jun 29, 2015
@golang golang locked and limited conversation to collaborators Jun 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants