func addgotsyminternal(ctxt *ld.Link, s *ld.Symbol) { if s.Got >= 0 { return } got := ld.Linklookup(ctxt, ".got", 0) s.Got = int32(got.Size) ld.Addaddrplus(ctxt, got, s, 0) if ld.Iself { } else { ctxt.Diag("addgotsyminternal: unsupported binary format") } }
func addgotsym(ctxt *ld.Link, s *ld.Symbol) { if s.Got >= 0 { return } ld.Adddynsym(ctxt, s) got := ld.Linklookup(ctxt, ".got", 0) s.Got = int32(got.Size) ld.Adduint32(ctxt, got, 0) if ld.Iself { rel := ld.Linklookup(ctxt, ".rel", 0) ld.Addaddrplus(ctxt, rel, got, int64(s.Got)) ld.Adduint32(ctxt, rel, ld.ELF32_R_INFO(uint32(s.Dynid), ld.R_ARM_GLOB_DAT)) } else { ctxt.Diag("addgotsym: unsupported binary format") } }
func addgotsym(s *ld.Symbol) { if s.Got >= 0 { return } ld.Adddynsym(ld.Ctxt, s) got := ld.Linklookup(ld.Ctxt, ".got", 0) s.Got = int32(got.Size) ld.Adduint64(ld.Ctxt, got, 0) if ld.Iself { rela := ld.Linklookup(ld.Ctxt, ".rela", 0) ld.Addaddrplus(ld.Ctxt, rela, got, int64(s.Got)) ld.Adduint64(ld.Ctxt, rela, ld.ELF64_R_INFO(uint32(s.Dynid), ld.R_390_GLOB_DAT)) ld.Adduint64(ld.Ctxt, rela, 0) } else { ld.Diag("addgotsym: unsupported binary format") } }
func addgotsym(ctxt *ld.Link, s *ld.Symbol) { if s.Got >= 0 { return } ld.Adddynsym(ctxt, s) got := ctxt.Syms.Lookup(".got", 0) s.Got = int32(got.Size) ld.Adduint32(ctxt, got, 0) if ld.Iself { rel := ctxt.Syms.Lookup(".rel", 0) ld.Addaddrplus(ctxt, rel, got, int64(s.Got)) ld.Adduint32(ctxt, rel, ld.ELF32_R_INFO(uint32(s.Dynid), ld.R_386_GLOB_DAT)) } else if ld.Headtype == obj.Hdarwin { ld.Adduint32(ctxt, ctxt.Syms.Lookup(".linkedit.got", 0), uint32(s.Dynid)) } else { ld.Errorf(s, "addgotsym: unsupported binary format") } }
func addgotsym(ctxt *ld.Link, s *ld.Symbol) { if s.Got >= 0 { return } ld.Adddynsym(ctxt, s) got := ld.Linklookup(ctxt, ".got", 0) s.Got = int32(got.Size) ld.Adduint64(ctxt, got, 0) if ld.Iself { rela := ld.Linklookup(ctxt, ".rela", 0) ld.Addaddrplus(ctxt, rela, got, int64(s.Got)) ld.Adduint64(ctxt, rela, ld.ELF64_R_INFO(uint32(s.Dynid), ld.R_X86_64_GLOB_DAT)) ld.Adduint64(ctxt, rela, 0) } else if ld.HEADTYPE == obj.Hdarwin { ld.Adduint32(ctxt, ld.Linklookup(ctxt, ".linkedit.got", 0), uint32(s.Dynid)) } else { ctxt.Diag("addgotsym: unsupported binary format") } }
func addpltsym(ctxt *ld.Link, s *ld.Symbol) { if s.Plt >= 0 { return } ld.Adddynsym(ctxt, s) if ld.Iself { plt := ld.Linklookup(ctxt, ".plt", 0) got := ld.Linklookup(ctxt, ".got.plt", 0) rel := ld.Linklookup(ctxt, ".rel.plt", 0) if plt.Size == 0 { elfsetupplt(ctxt) } // .got entry s.Got = int32(got.Size) // In theory, all GOT should point to the first PLT entry, // Linux/ARM's dynamic linker will do that for us, but FreeBSD/ARM's // dynamic linker won't, so we'd better do it ourselves. ld.Addaddrplus(ctxt, got, plt, 0) // .plt entry, this depends on the .got entry s.Plt = int32(plt.Size) addpltreloc(ctxt, plt, got, s, obj.R_PLT0) // add lr, pc, #0xXX00000 addpltreloc(ctxt, plt, got, s, obj.R_PLT1) // add lr, lr, #0xYY000 addpltreloc(ctxt, plt, got, s, obj.R_PLT2) // ldr pc, [lr, #0xZZZ]! // rel ld.Addaddrplus(ctxt, rel, got, int64(s.Got)) ld.Adduint32(ctxt, rel, ld.ELF32_R_INFO(uint32(s.Dynid), ld.R_ARM_JUMP_SLOT)) } else { ctxt.Diag("addpltsym: unsupported binary format") } }