mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: apply R_DWARFFILEREF later
Apply R_DWARFFILEREF relocations later, along with other relocations, so that we don't modify symbols' contents before they are written to the output buffer. This is in preparation for mmap'ing input files read-only. Change-Id: I8e9ffb2f05acf8f198589b8770f277beb3847541 Reviewed-on: https://go-review.googlesource.com/c/go/+/170740 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
b2f94d3e88
commit
15a31bd9c8
2 changed files with 10 additions and 10 deletions
|
|
@ -168,12 +168,6 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
|
|||
if r.Siz == 0 { // informational relocation - no work to do
|
||||
continue
|
||||
}
|
||||
if r.Type == objabi.R_DWARFFILEREF {
|
||||
// These should have been processed previously during
|
||||
// line table writing.
|
||||
Errorf(s, "orphan R_DWARFFILEREF reloc to %v", r.Sym.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
// We need to be able to reference dynimport symbols when linking against
|
||||
// shared libraries, and Solaris, Darwin and AIX need it always
|
||||
|
|
@ -490,6 +484,10 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
|
|||
// This isn't a real relocation so it must not update
|
||||
// its offset value.
|
||||
continue
|
||||
|
||||
case objabi.R_DWARFFILEREF:
|
||||
// The final file index is saved in r.Add in dwarf.go:writelines.
|
||||
o = r.Add
|
||||
}
|
||||
|
||||
if r.Variant != sym.RV_NONE {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue