本文整理匯總了Golang中cmd/link/internal/ld.Exitf函數的典型用法代碼示例。如果您正苦於以下問題:Golang Exitf函數的具體用法?Golang Exitf怎麽用?Golang Exitf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Exitf函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: archinit
func archinit() {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hlinux: /* s390x elf */
ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x10000 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
}
if ld.INITDAT != 0 && ld.INITRND != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
}
}
示例2: archinit
func archinit(ctxt *ld.Link) {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
if ld.Buildmode == ld.BuildmodeCArchive || ld.Buildmode == ld.BuildmodeCShared || ld.DynlinkingGo() {
ld.Linkmode = ld.LinkExternal
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hlinux: // s390x ELF
ld.Elfinit(ctxt)
ld.HEADR = ld.ELFRESERVE
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
}
if *ld.FlagDataAddr != 0 && *ld.FlagRound != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(*ld.FlagDataAddr), uint32(*ld.FlagRound))
}
}
示例3: archinit
func archinit(ctxt *ld.Link) {
switch ld.Headtype {
default:
ld.Exitf("unknown -H option: %v", ld.Headtype)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 4128
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}
case obj.Hlinux: /* ppc64 elf */
if ld.SysArch == sys.ArchPPC64 {
*ld.FlagD = true // TODO(austin): ELF ABI v1 not supported yet
}
ld.Elfinit(ctxt)
ld.HEADR = ld.ELFRESERVE
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
case obj.Hnacl:
ld.Elfinit(ctxt)
ld.HEADR = 0x10000
ld.Funcalign = 16
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x20000
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
}
if *ld.FlagDataAddr != 0 && *ld.FlagRound != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(*ld.FlagDataAddr), uint32(*ld.FlagRound))
}
}
示例4: archinit
func archinit(ctxt *ld.Link) {
switch ld.Headtype {
default:
ld.Exitf("unknown -H option: %v", ld.Headtype)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 16*1024 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 16 * 1024
}
case obj.Hlinux: /* mips64 elf */
ld.Elfinit(ctxt)
ld.HEADR = ld.ELFRESERVE
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
case obj.Hnacl:
ld.Elfinit(ctxt)
ld.HEADR = 0x10000
ld.Funcalign = 16
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x20000
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
}
if *ld.FlagDataAddr != 0 && *ld.FlagRound != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(*ld.FlagDataAddr), uint32(*ld.FlagRound))
}
}
示例5: adddynrel
func adddynrel(ctxt *ld.Link, s *ld.Symbol, r *ld.Reloc) {
targ := r.Sym
ctxt.Cursym = s
switch r.Type {
default:
if r.Type >= 256 {
ctxt.Diag("unexpected relocation type %d", r.Type)
return
}
// Handle relocations found in ELF object files.
case 256 + ld.R_ARM_PLT32:
r.Type = obj.R_CALLARM
if targ.Type == obj.SDYNIMPORT {
addpltsym(ctxt, targ)
r.Sym = ld.Linklookup(ctxt, ".plt", 0)
r.Add = int64(braddoff(int32(r.Add), targ.Plt/4))
}
return
case 256 + ld.R_ARM_THM_PC22: // R_ARM_THM_CALL
ld.Exitf("R_ARM_THM_CALL, are you using -marm?")
return
case 256 + ld.R_ARM_GOT32: // R_ARM_GOT_BREL
if targ.Type != obj.SDYNIMPORT {
addgotsyminternal(ctxt, targ)
} else {
addgotsym(ctxt, targ)
}
r.Type = obj.R_CONST // write r->add during relocsym
r.Sym = nil
r.Add += int64(targ.Got)
return
case 256 + ld.R_ARM_GOT_PREL: // GOT(nil) + A - nil
if targ.Type != obj.SDYNIMPORT {
addgotsyminternal(ctxt, targ)
} else {
addgotsym(ctxt, targ)
}
r.Type = obj.R_PCREL
r.Sym = ld.Linklookup(ctxt, ".got", 0)
r.Add += int64(targ.Got) + 4
return
case 256 + ld.R_ARM_GOTOFF: // R_ARM_GOTOFF32
r.Type = obj.R_GOTOFF
return
case 256 + ld.R_ARM_GOTPC: // R_ARM_BASE_PREL
r.Type = obj.R_PCREL
r.Sym = ld.Linklookup(ctxt, ".got", 0)
r.Add += 4
return
case 256 + ld.R_ARM_CALL:
r.Type = obj.R_CALLARM
if targ.Type == obj.SDYNIMPORT {
addpltsym(ctxt, targ)
r.Sym = ld.Linklookup(ctxt, ".plt", 0)
r.Add = int64(braddoff(int32(r.Add), targ.Plt/4))
}
return
case 256 + ld.R_ARM_REL32: // R_ARM_REL32
r.Type = obj.R_PCREL
r.Add += 4
return
case 256 + ld.R_ARM_ABS32:
if targ.Type == obj.SDYNIMPORT {
ctxt.Diag("unexpected R_ARM_ABS32 relocation for dynamic symbol %s", targ.Name)
}
r.Type = obj.R_ADDR
return
// we can just ignore this, because we are targeting ARM V5+ anyway
case 256 + ld.R_ARM_V4BX:
if r.Sym != nil {
// R_ARM_V4BX is ABS relocation, so this symbol is a dummy symbol, ignore it
r.Sym.Type = 0
}
r.Sym = nil
return
case 256 + ld.R_ARM_PC24,
256 + ld.R_ARM_JUMP24:
r.Type = obj.R_CALLARM
if targ.Type == obj.SDYNIMPORT {
//.........這裏部分代碼省略.........
示例6: archinit
func archinit() {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
switch ld.Buildmode {
case ld.BuildmodePIE, ld.BuildmodeShared:
ld.Linkmode = ld.LinkExternal
}
if ld.Linkshared {
ld.Linkmode = ld.LinkExternal
}
if ld.Linkmode == ld.LinkExternal {
toc := ld.Linklookup(ld.Ctxt, ".TOC.", 0)
toc.Type = obj.SDYNIMPORT
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {
ld.Linkmode = ld.LinkInternal
}
if ld.Linkmode == ld.LinkExternal && obj.Getgoextlinkenabled() != "1" {
log.Fatalf("cannot use -linkmode=external with -H %s", ld.Headstr(int(ld.HEADTYPE)))
}
case obj.Hlinux:
break
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if ld.INITTEXT == -1 {
ld.INITTEXT = 4128
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hlinux: /* ppc64 elf */
if ld.Thestring == "ppc64" {
ld.Debug['d'] = 1 // TODO(austin): ELF ABI v1 not supported yet
}
ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x10000 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
case obj.Hnacl:
ld.Elfinit()
ld.HEADR = 0x10000
ld.Funcalign = 16
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x20000
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
}
if ld.INITDAT != 0 && ld.INITRND != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
}
}
示例7: archinit
func archinit(ctxt *ld.Link) {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
if ld.Buildmode == ld.BuildmodeCShared || ld.Buildmode == ld.BuildmodePIE || ld.DynlinkingGo() {
ld.Linkmode = ld.LinkExternal
got := ld.Linklookup(ctxt, "_GLOBAL_OFFSET_TABLE_", 0)
got.Type = obj.SDYNIMPORT
got.Attr |= ld.AttrReachable
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {
ld.Linkmode = ld.LinkInternal
}
if ld.Linkmode == ld.LinkExternal && obj.Getgoextlinkenabled() != "1" {
log.Fatalf("cannot use -linkmode=external with -H %s", ld.Headstr(int(ld.HEADTYPE)))
}
case obj.Hdarwin,
obj.Hfreebsd,
obj.Hlinux,
obj.Hnetbsd,
obj.Hopenbsd,
obj.Hwindows:
break
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 4096 + 32
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}
case obj.Hdarwin: /* apple MACH */
ld.Machoinit()
ld.HEADR = ld.INITIAL_MACHO_HEADR
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 4096 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}
case obj.Hlinux, /* elf32 executable */
obj.Hfreebsd,
obj.Hnetbsd,
obj.Hopenbsd:
ld.Elfinit(ctxt)
ld.HEADR = ld.ELFRESERVE
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x08048000 + int64(ld.HEADR)
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}
case obj.Hnacl:
ld.Elfinit(ctxt)
ld.HEADR = 0x10000
ld.Funcalign = 32
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 0x20000
}
if *ld.FlagDataAddr == -1 {
*ld.FlagDataAddr = 0
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 0x10000
}
case obj.Hwindows: /* PE executable */
ld.Peinit(ctxt)
ld.HEADR = ld.PEFILEHEADR
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = ld.PEBASE + int64(ld.PESECTHEADR)
//.........這裏部分代碼省略.........
示例8: archinit
func archinit() {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {
ld.Linkmode = ld.LinkInternal
}
if ld.Linkmode == ld.LinkExternal && obj.Getgoextlinkenabled() != "1" {
log.Fatalf("cannot use -linkmode=external with -H %s", ld.Headstr(int(ld.HEADTYPE)))
}
case obj.Hdarwin,
obj.Hfreebsd,
obj.Hhaiku,
obj.Hlinux,
obj.Hnetbsd,
obj.Hopenbsd,
obj.Hwindows:
break
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if ld.INITTEXT == -1 {
ld.INITTEXT = 4096 + 32
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hdarwin: /* apple MACH */
ld.Machoinit()
ld.HEADR = ld.INITIAL_MACHO_HEADR
if ld.INITTEXT == -1 {
ld.INITTEXT = 4096 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hlinux, /* elf32 executable */
obj.Hfreebsd,
obj.Hhaiku,
obj.Hnetbsd,
obj.Hopenbsd:
ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x08048000 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hnacl:
ld.Elfinit()
ld.HEADR = 0x10000
ld.Funcalign = 32
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x20000
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
case obj.Hwindows: /* PE executable */
ld.Peinit()
ld.HEADR = ld.PEFILEHEADR
if ld.INITTEXT == -1 {
ld.INITTEXT = ld.PEBASE + int64(ld.PESECTHEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
//.........這裏部分代碼省略.........
示例9: archinit
func archinit() {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {
ld.Linkmode = ld.LinkInternal
}
if ld.Linkmode == ld.LinkExternal && obj.Getgoextlinkenabled() != "1" {
log.Fatalf("cannot use -linkmode=external with -H %s", ld.Headstr(int(ld.HEADTYPE)))
}
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if ld.INITTEXT == -1 {
ld.INITTEXT = 16*1024 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 16 * 1024
}
case obj.Hlinux: /* mips64 elf */
ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x10000 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
case obj.Hnacl:
ld.Elfinit()
ld.HEADR = 0x10000
ld.Funcalign = 16
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x20000
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
}
if ld.INITDAT != 0 && ld.INITRND != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
}
}
示例10: archinit
func archinit() {
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
// Go was built; see ../../make.bash.
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
ld.Linkmode = ld.LinkInternal
}
if ld.Buildmode == ld.BuildmodeCArchive || ld.Buildmode == ld.BuildmodeCShared || ld.DynlinkingGo() {
ld.Linkmode = ld.LinkExternal
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {
ld.Linkmode = ld.LinkInternal
}
if ld.Linkmode == ld.LinkExternal && obj.Getgoextlinkenabled() != "1" {
log.Fatalf("cannot use -linkmode=external with -H %s", ld.Headstr(int(ld.HEADTYPE)))
}
case obj.Hlinux,
obj.Hfreebsd,
obj.Hnacl,
obj.Hdarwin:
break
}
switch ld.HEADTYPE {
default:
ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case obj.Hplan9: /* plan 9 */
ld.HEADR = 32
if ld.INITTEXT == -1 {
ld.INITTEXT = 4128
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hlinux, /* arm elf */
obj.Hfreebsd,
obj.Hnetbsd,
obj.Hopenbsd:
ld.Debug['d'] = 0
// with dynamic linking
ld.Elfinit()
ld.HEADR = ld.ELFRESERVE
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x10000 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
case obj.Hnacl:
ld.Elfinit()
ld.HEADR = 0x10000
ld.Funcalign = 16
if ld.INITTEXT == -1 {
ld.INITTEXT = 0x20000
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 0x10000
}
case obj.Hdarwin: /* apple MACH */
ld.Debug['w'] = 1 // disable DWARF generation
ld.Machoinit()
ld.HEADR = ld.INITIAL_MACHO_HEADR
if ld.INITTEXT == -1 {
ld.INITTEXT = 4096 + int64(ld.HEADR)
}
if ld.INITDAT == -1 {
ld.INITDAT = 0
}
if ld.INITRND == -1 {
ld.INITRND = 4096
}
}
if ld.INITDAT != 0 && ld.INITRND != 0 {
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
}
}