Commit 84af5ea9 authored by Alex Brainman's avatar Alex Brainman

cmd/link: simplify writePESymTableRecords

Change-Id: I2da982fdef826aaecb86431f7d80ffc0fb2c4337
Reviewed-on: https://go-review.googlesource.com/59424Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 6561e4b6
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment