}
func decodetype_gcprog_shlib(s *LSym) uint64 {
+ if Thearch.Thechar == '7' {
+ for _, shlib := range Ctxt.Shlibs {
+ if shlib.Path == s.File {
+ return shlib.gcdata_addresses[s]
+ }
+ }
+ return 0
+ }
return decode_inuxi(s.P[2*int32(Thearch.Ptrsize)+8+1*int32(Thearch.Ptrsize):], Thearch.Ptrsize)
}
Diag("cannot read symbols from shared library: %s", libpath)
return
}
+ gcdata_locations := make(map[uint64]*LSym)
for _, elfsym := range syms {
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
continue
// the type data.
if strings.HasPrefix(lsym.Name, "type.") && !strings.HasPrefix(lsym.Name, "type..") {
lsym.P = readelfsymboldata(f, &elfsym)
+ gcdata_locations[elfsym.Value+2*uint64(Thearch.Ptrsize)+8+1*uint64(Thearch.Ptrsize)] = lsym
+ }
+ }
+ }
+ gcdata_addresses := make(map[*LSym]uint64)
+ if Thearch.Thechar == '7' {
+ for _, sect := range f.Sections {
+ if sect.Type == elf.SHT_RELA {
+ var rela elf.Rela64
+ rdr := sect.Open()
+ for {
+ err := binary.Read(rdr, f.ByteOrder, &rela)
+ if err == io.EOF {
+ break
+ } else if err != nil {
+ Diag("reading relocation failed %v", err)
+ return
+ }
+ t := elf.R_AARCH64(rela.Info & 0xffff)
+ if t != elf.R_AARCH64_RELATIVE {
+ continue
+ }
+ if lsym, ok := gcdata_locations[rela.Off]; ok {
+ gcdata_addresses[lsym] = uint64(rela.Addend)
+ }
+ }
}
}
}
Ctxt.Etextp = last
}
- Ctxt.Shlibs = append(Ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f})
+ Ctxt.Shlibs = append(Ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f, gcdata_addresses: gcdata_addresses})
}
func mywhatsys() {