Пример #1
0
func Addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) int64 {
	s.Reachable = true
	i := s.Size
	s.Size += 4
	ld.Symgrow(ctxt, s, s.Size)
	r := ld.Addrel(s)
	r.Sym = t
	r.Off = int32(i)
	r.Type = ld.R_CALL
	r.Siz = 4
	return i + int64(r.Siz)
}
Пример #2
0
func addpltreloc(ctxt *ld.Link, plt *ld.LSym, got *ld.LSym, sym *ld.LSym, typ int) *ld.Reloc {
	r := ld.Addrel(plt)
	r.Sym = got
	r.Off = int32(plt.Size)
	r.Siz = 4
	r.Type = int32(typ)
	r.Add = int64(sym.Got) - 8

	plt.Reachable = true
	plt.Size += 4
	ld.Symgrow(ctxt, plt, plt.Size)

	return r
}