本文整理匯總了Golang中cmd/internal/ld.LSym.Dynid方法的典型用法代碼示例。如果您正苦於以下問題:Golang LSym.Dynid方法的具體用法?Golang LSym.Dynid怎麽用?Golang LSym.Dynid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cmd/internal/ld.LSym
的用法示例。
在下文中一共展示了LSym.Dynid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: adddynsym
func adddynsym(ctxt *ld.Link, s *ld.LSym) {
if s.Dynid >= 0 {
return
}
if ld.Iself {
s.Dynid = int32(ld.Nelfsym)
ld.Nelfsym++
d := ld.Linklookup(ctxt, ".dynsym", 0)
name := s.Extname
ld.Adduint32(ctxt, d, uint32(ld.Addstring(ld.Linklookup(ctxt, ".dynstr", 0), name)))
/* type */
t := ld.STB_GLOBAL << 4
if s.Cgoexport != 0 && s.Type&ld.SMASK == ld.STEXT {
t |= ld.STT_FUNC
} else {
t |= ld.STT_OBJECT
}
ld.Adduint8(ctxt, d, uint8(t))
/* reserved */
ld.Adduint8(ctxt, d, 0)
/* section where symbol is defined */
if s.Type == ld.SDYNIMPORT {
ld.Adduint16(ctxt, d, ld.SHN_UNDEF)
} else {
ld.Adduint16(ctxt, d, 1)
}
/* value */
if s.Type == ld.SDYNIMPORT {
ld.Adduint64(ctxt, d, 0)
} else {
ld.Addaddr(ctxt, d, s)
}
/* size of object */
ld.Adduint64(ctxt, d, uint64(s.Size))
if s.Cgoexport&ld.CgoExportDynamic == 0 && s.Dynimplib != "" && needlib(s.Dynimplib) != 0 {
ld.Elfwritedynent(ld.Linklookup(ctxt, ".dynamic", 0), ld.DT_NEEDED, uint64(ld.Addstring(ld.Linklookup(ctxt, ".dynstr", 0), s.Dynimplib)))
}
} else if ld.HEADTYPE == ld.Hdarwin {
ld.Diag("adddynsym: missed symbol %s (%s)", s.Name, s.Extname)
} else if ld.HEADTYPE == ld.Hwindows {
} else // already taken care of
{
ld.Diag("adddynsym: unsupported binary format")
}
}
示例2: adddynsym
func adddynsym(ctxt *ld.Link, s *ld.LSym) {
if s.Dynid >= 0 {
return
}
if ld.Iself {
s.Dynid = int32(ld.Nelfsym)
ld.Nelfsym++
d := ld.Linklookup(ctxt, ".dynsym", 0)
/* name */
name := s.Extname
ld.Adduint32(ctxt, d, uint32(ld.Addstring(ld.Linklookup(ctxt, ".dynstr", 0), name)))
/* value */
if s.Type == ld.SDYNIMPORT {
ld.Adduint32(ctxt, d, 0)
} else {
ld.Addaddr(ctxt, d, s)
}
/* size */
ld.Adduint32(ctxt, d, 0)
/* type */
t := ld.STB_GLOBAL << 4
if s.Cgoexport != 0 && s.Type&ld.SMASK == ld.STEXT {
t |= ld.STT_FUNC
} else {
t |= ld.STT_OBJECT
}
ld.Adduint8(ctxt, d, uint8(t))
ld.Adduint8(ctxt, d, 0)
/* shndx */
if s.Type == ld.SDYNIMPORT {
ld.Adduint16(ctxt, d, ld.SHN_UNDEF)
} else {
ld.Adduint16(ctxt, d, 1)
}
} else if ld.HEADTYPE == ld.Hdarwin {
ld.Diag("adddynsym: missed symbol %s (%s)", s.Name, s.Extname)
} else if ld.HEADTYPE == ld.Hwindows {
} else // already taken care of
{
ld.Diag("adddynsym: unsupported binary format")
}
}
示例3: adddynsym
func adddynsym(ctxt *ld.Link, s *ld.LSym) {
if s.Dynid >= 0 {
return
}
if ld.Iself {
s.Dynid = int32(ld.Nelfsym)
ld.Nelfsym++
d := ld.Linklookup(ctxt, ".dynsym", 0)
name := s.Extname
ld.Adduint32(ctxt, d, uint32(ld.Addstring(ld.Linklookup(ctxt, ".dynstr", 0), name)))
/* type */
t := ld.STB_GLOBAL << 4
if s.Cgoexport != 0 && s.Type&ld.SMASK == ld.STEXT {
t |= ld.STT_FUNC
} else {
t |= ld.STT_OBJECT
}
ld.Adduint8(ctxt, d, uint8(t))
/* reserved */
ld.Adduint8(ctxt, d, 0)
/* section where symbol is defined */
if s.Type == ld.SDYNIMPORT {
ld.Adduint16(ctxt, d, ld.SHN_UNDEF)
} else {
ld.Adduint16(ctxt, d, 1)
}
/* value */
if s.Type == ld.SDYNIMPORT {
ld.Adduint64(ctxt, d, 0)
} else {
ld.Addaddr(ctxt, d, s)
}
/* size of object */
ld.Adduint64(ctxt, d, uint64(s.Size))
} else {
ld.Diag("adddynsym: unsupported binary format")
}
}