]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: add loader.ExtReloc to Archreloc2
authorJeremy Faller <jeremy@golang.org>
Wed, 29 Apr 2020 16:20:38 +0000 (12:20 -0400)
committerJeremy Faller <jeremy@golang.org>
Wed, 29 Apr 2020 17:41:33 +0000 (17:41 +0000)
Non functional, but required by the majority of the architectures.

Change-Id: I57601016c28ce665a9d434e283a1db8bded9b133
Reviewed-on: https://go-review.googlesource.com/c/go/+/230858
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/x86/asm.go

index a4e9a4c1e88db610adcbb9a88ef6cafa9cbba713..1cf3e9a7fc84ce6a8e149ec88b6e6cd190b24d29 100644 (file)
@@ -253,7 +253,10 @@ func relocsym(target *Target, ldr *loader.Loader, err *ErrorReporter, syms *Arch
                        case 8:
                                o = int64(target.Arch.ByteOrder.Uint64(P[off:]))
                        }
-                       if out, ok := thearch.Archreloc2(target, ldr, syms, &r, s, o); ok {
+                       var out int64
+                       var ok bool
+                       out, needExtReloc, ok = thearch.Archreloc2(target, ldr, syms, &r, &rr, s, o)
+                       if ok {
                                o = out
                        } else {
                                err.Errorf(s, "unknown reloc to %v: %d (%s)", ldr.SymName(rs), rt, sym.RelocName(target.Arch, rt))
index baccb8baaeaab3ed4eb36e9ba9ccae248a5af578..3b76f3a236e132c6b074dda291bb5154a4e546b4 100644 (file)
@@ -235,18 +235,18 @@ type Arch struct {
        Adddynrel      func(*Target, *loader.Loader, *ArchSyms, *sym.Symbol, *sym.Reloc) bool
        Adddynrel2     func(*Target, *loader.Loader, *ArchSyms, loader.Sym, *loader.Reloc2, int) bool
        Archinit       func(*Link)
-       // Archreloc is an arch-specific hook that assists in
-       // relocation processing (invoked by 'relocsym'); it handles
-       // target-specific relocation tasks. Here "rel" is the current
-       // relocation being examined, "sym" is the symbol containing the
-       // chunk of data to which the relocation applies, and "off" is the
-       // contents of the to-be-relocated data item (from sym.P). Return
-       // value is the appropriately relocated value (to be written back
-       // to the same spot in sym.P) and a boolean indicating
-       // success/failure (a failing value indicates a fatal error).
+       // Archreloc is an arch-specific hook that assists in relocation processing
+       // (invoked by 'relocsym'); it handles target-specific relocation tasks.
+       // Here "rel" is the current relocation being examined, "sym" is the symbol
+       // containing the chunk of data to which the relocation applies, and "off"
+       // is the contents of the to-be-relocated data item (from sym.P). Return
+       // value is the appropriately relocated value (to be written back to the
+       // same spot in sym.P), a boolean indicating if the external relocations'
+       // been used, and a boolean indicating success/failure (a failing value
+       // indicates a fatal error).
        Archreloc func(target *Target, syms *ArchSyms, rel *sym.Reloc, sym *sym.Symbol,
                offset int64) (relocatedOffset int64, success bool)
-       Archreloc2 func(*Target, *loader.Loader, *ArchSyms, *loader.Reloc2, loader.Sym, int64) (int64, bool)
+       Archreloc2 func(*Target, *loader.Loader, *ArchSyms, *loader.Reloc2, *loader.ExtReloc, loader.Sym, int64) (int64, bool, bool)
        // Archrelocvariant is a second arch-specific hook used for
        // relocation processing; it handles relocations where r.Type is
        // insufficient to describe the relocation (r.Variant !=
index 0cf4009c4e9cf65804b2e9f706659344eda73955..0a0052a4f5810875f59c3c2967e76a913df088ed 100644 (file)
@@ -435,8 +435,8 @@ func pereloc1(arch *sys.Arch, out *ld.OutBuf, s *sym.Symbol, r *sym.Reloc, secto
        return true
 }
 
-func archreloc2(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r *loader.Reloc2, sym loader.Sym, val int64) (int64, bool) {
-       return val, false
+func archreloc2(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r *loader.Reloc2, rr *loader.ExtReloc, sym loader.Sym, val int64) (int64, bool, bool) {
+       return val, false, false
 }
 
 func archrelocvariant(target *ld.Target, syms *ld.ArchSyms, r *sym.Reloc, s *sym.Symbol, t int64) int64 {