mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: support PIE internal linking on darwin/amd64
This CL adds support of PIE internal linking on darwin/amd64. This is also preparation for supporting internal linking on darwin/arm64 (macOS), which requires PIE for everything. Updates #38485. Change-Id: I2ed58583dcc102f5e0521982491fc7ba6f2754ed Reviewed-on: https://go-review.googlesource.com/c/go/+/261642 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
c8eea1633e
commit
f46a5b1e45
10 changed files with 289 additions and 54 deletions
|
|
@ -420,3 +420,21 @@ func (sb *SymbolBuilder) MakeWritable() {
|
|||
sb.l.SetAttrReadOnly(sb.symIdx, false)
|
||||
}
|
||||
}
|
||||
|
||||
func (sb *SymbolBuilder) AddUleb(v uint64) {
|
||||
if v < 128 { // common case: 1 byte
|
||||
sb.AddUint8(uint8(v))
|
||||
return
|
||||
}
|
||||
for {
|
||||
c := uint8(v & 0x7f)
|
||||
v >>= 7
|
||||
if v != 0 {
|
||||
c |= 0x80
|
||||
}
|
||||
sb.AddUint8(c)
|
||||
if c&0x80 == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue