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/ld: hostobj fails on openbsd -current/5.3 #5067

Closed
4a6f656c opened this issue Mar 17, 2013 · 8 comments
Closed

cmd/ld: hostobj fails on openbsd -current/5.3 #5067

4a6f656c opened this issue Mar 17, 2013 · 8 comments

Comments

@4a6f656c
Copy link
Contributor

hostobj based linking fails on OpenBSD -current and 5.3 for amd64:

# ../misc/cgo/test
scatter = 0x4a8870
hello from C
PASS
ok      _/home/joel/src/go5/misc/cgo/test       1.318s
# testmain
/usr/bin/ld: /var/tmp/go-link-fMoXBH/go.o: relocation R_X86_64_32 can not be
used when making a shared object; recompile with -fPIC
/var/tmp/go-link-fMoXBH/go.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
.string: /home/joel/src/go5/pkg/tool/openbsd_amd64/6l: running gcc failed:
unsuccessful exit status 0x100
FAIL    _/home/joel/src/go5/misc/cgo/test [build failed]

This is presumably due to PIE being enabled by default on newer OpenBSD releases. One
workaround is:

  https://golang.org/cl/7572049

However this then breaks hostobj on OpenBSD 5.2.
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 1:

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

@ianlancetaylor
Copy link
Contributor

Comment 2:

The Go on OpenBSD developers are going to have to decide what to do here.  As I
understand it, the problem is that the OpenBSD 5.3 GCC passes -pie by default, and using
-nopie turns that off.  Unfortunately the OpenBSD 5.2 GCC does not understand -nopie. 
The object generated by 6l is neither PIC nor PIE and therefore can not be used when
linking with -pie.  So, trouble all around.
One remote possibility would be to modify the linker to support a variant of flag_shared
that would produce a PIC object without passing -shared to the external linker. 
Probably not for 1.2, though.

@rsc
Copy link
Contributor

rsc commented Sep 6, 2013

Comment 3:

Since we don't support any OpenBSD officially, we could only support 5.3 or
later, right?

@rsc
Copy link
Contributor

rsc commented Sep 9, 2013

Comment 4:

Since we don't support any OpenBSD officially, removing Go1.2Maybe tag.

Labels changed: removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 5:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added repo-main.

@4a6f656c
Copy link
Contributor Author

Comment 8:

This issue was closed by revision 0eaabf6.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

4 participants