Skip to content

cmd/6l: -shared generated invalid relocations #9652

@mwhudson

Description

@mwhudson

I guess this falls into the category of things not really guaranteed to work, but:

mwhudson@narsil:shared-lib-stuff$ cat trivialmain.go 
package main

func main () {}
mwhudson@narsil:shared-lib-stuff$ go build -ldflags -shared trivialmain.go
# command-line-arguments
/usr/bin/ld: /var/tmp/go-link-teMwJN/go.o: relocation R_X86_64_TPOFF32 against `runtime.tlsg' can not be used when making a shared object; recompile with -fPIC
/var/tmp/go-link-teMwJN/go.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
/opt/opensource/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100

I think this was broken by 90093f0. For ARM the roughly analogous change (b377c9c) was fixed by 9ed5995.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions