if p := ctxt.findLibPath("libmingw32.a"); p != "none" {
hostArchive(ctxt, p)
}
+ // Link libmsvcrt.a to resolve '__acrt_iob_func' symbol
+ // (see https://golang.org/issue/23649 for details).
+ if p := ctxt.findLibPath("libmsvcrt.a"); p != "none" {
+ hostArchive(ctxt, p)
+ }
// TODO: maybe do something similar to peimporteddlls to collect all lib names
// and try link them all to final exe just like libmingwex.a and libmingw32.a:
/*
name = sectsyms[f.Sections[pesym.SectionNumber-1]].Name
} else {
name = symname
- name = strings.TrimPrefix(name, "__imp_") // __imp_Name => Name
- if arch.Family == sys.I386 && name[0] == '_' {
- name = name[1:] // _Name => Name
+ switch arch.Family {
+ case sys.AMD64:
+ if name == "__imp___acrt_iob_func" {
+ // Do not rename __imp___acrt_iob_func into __acrt_iob_func,
+ // becasue __imp___acrt_iob_func symbol is real
+ // (see commit b295099 from git://git.code.sf.net/p/mingw-w64/mingw-w64 for detials).
+ } else {
+ name = strings.TrimPrefix(name, "__imp_") // __imp_Name => Name
+ }
+ case sys.I386:
+ if name == "__imp____acrt_iob_func" {
+ // Do not rename __imp____acrt_iob_func into ___acrt_iob_func,
+ // becasue __imp____acrt_iob_func symbol is real
+ // (see commit b295099 from git://git.code.sf.net/p/mingw-w64/mingw-w64 for detials).
+ } else {
+ name = strings.TrimPrefix(name, "__imp_") // __imp_Name => Name
+ }
+ if name[0] == '_' {
+ name = name[1:] // _Name => Name
+ }
}
}