mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go, cmd/link: build c-archive as position independent on ELF
This permits people to use -buildmode=c-archive to produce an archive file that can be included in a PIE or shared library. Change-Id: Ie340ee2f08bcff4f6fd1415f7d96d51ee3a7c9a1 Reviewed-on: https://go-review.googlesource.com/24180 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
dc9755c2a2
commit
d92a3606f5
6 changed files with 101 additions and 9 deletions
|
|
@ -163,7 +163,7 @@ func DynlinkingGo() bool {
|
|||
// relro.
|
||||
func UseRelro() bool {
|
||||
switch Buildmode {
|
||||
case BuildmodeCShared, BuildmodeShared, BuildmodePIE:
|
||||
case BuildmodeCArchive, BuildmodeCShared, BuildmodeShared, BuildmodePIE:
|
||||
return Iself
|
||||
default:
|
||||
return *FlagLinkshared
|
||||
|
|
@ -1642,7 +1642,7 @@ func stkcheck(ctxt *Link, up *Chain, depth int) int {
|
|||
// onlyctxt.Diagnose the direct caller.
|
||||
// TODO(mwhudson): actually think about this.
|
||||
if depth == 1 && s.Type != obj.SXREF && !DynlinkingGo() &&
|
||||
Buildmode != BuildmodePIE && Buildmode != BuildmodeCShared {
|
||||
Buildmode != BuildmodeCArchive && Buildmode != BuildmodePIE && Buildmode != BuildmodeCShared {
|
||||
ctxt.Diag("call to external function %s", s.Name)
|
||||
}
|
||||
return -1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue