1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:54:43 -07:00

cmd/link: simplify writePESymTableRecords

Change-Id: I2da982fdef826aaecb86431f7d80ffc0fb2c4337
Reviewed-on: https://go-review.googlesource.com/59424
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Alex Brainman 2017-08-28 13:35:21 +10:00
parent 6561e4b61c
commit 84af5ea9b4

View File

@ -1103,7 +1103,14 @@ func writePESymTableRecords(ctxt *Link) {
s.Name = "_" + s.Name
}
typ := uint16(IMAGE_SYM_TYPE_NULL)
var typ uint16
if Linkmode == LinkExternal {
typ = IMAGE_SYM_TYPE_NULL
} else {
// TODO: fix IMAGE_SYM_DTYPE_ARRAY value and use following expression, instead of 0x0308
typ = IMAGE_SYM_DTYPE_ARRAY<<8 + IMAGE_SYM_TYPE_STRUCT
typ = 0x0308 // "array of structs"
}
sect, value, err := pefile.mapToPESection(s)
if err != nil {
if type_ == UndefinedSym {
@ -1112,12 +1119,6 @@ func writePESymTableRecords(ctxt *Link) {
Errorf(s, "addpesym: %v", err)
}
}
if typ != IMAGE_SYM_TYPE_NULL {
} else if Linkmode != LinkExternal {
// TODO: fix IMAGE_SYM_DTYPE_ARRAY value and use following expression, instead of 0x0308
typ = IMAGE_SYM_DTYPE_ARRAY<<8 + IMAGE_SYM_TYPE_STRUCT
typ = 0x0308 // "array of structs"
}
class := IMAGE_SYM_CLASS_EXTERNAL
if s.Version != 0 || (s.Type&SHIDDEN != 0) || s.Attr.Local() {
class = IMAGE_SYM_CLASS_STATIC