diff options
author | Fabian Giesen <fabiang@radgametools.com> | 2016-07-13 17:22:01 -0700 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2016-07-27 01:06:09 +0300 |
commit | 1df89ea03902161b76773d0eef48f277b49d918e (patch) | |
tree | aea8d10103aa964e30361dfde1ab8f3ff3694f9c | |
parent | 199f3d73548f472e65a1948373da9a0b9e966f2f (diff) | |
download | nasm-1df89ea03902161b76773d0eef48f277b49d918e.tar.gz |
codeview: Fix ill-formed "S_COMPILE2" record.
write_symbolinfo_properties didn't match the S_COMPILE2 record it's
supposed to be writing (the "compiler version" string was emitted
starting in the final "version" field); fix that.
Write version 8.0.50727; the Windows App Certification Kit (WACK)
checks compiler versions as given in app debug info and complains
when the toolchain is too old. 8.0.50727 is the lowest permitted
"MASM" version for WACK to be happy, so that's what we write.
Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | output/codeview.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/output/codeview.c b/output/codeview.c index 3526bd4b..2fe919d2 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -624,22 +624,30 @@ static uint16_t write_symbolinfo_obj(struct coff_Section *sect) static uint16_t write_symbolinfo_properties(struct coff_Section *sect, const char *const creator_str) { + /* https://github.com/Microsoft/microsoft-pdb/blob/1d60e041/include/cvinfo.h#L3313 */ uint16_t creator_len; - creator_len = 2 + 4 + 4 + 4 + 4 + strlen(creator_str)+1 + 2; + creator_len = 2 + 4 + 2 + 3*2 + 3*2 + strlen(creator_str)+1 + 2; section_write16(sect, creator_len); section_write16(sect, 0x1116); - section_write32(sect, 3); /* language */ + section_write32(sect, 3); /* language/flags */ if (win64) - section_write32(sect, 0x000000D0); + section_write16(sect, 0x00D0); /* machine */ else if (win32) - section_write32(sect, 0x00000006); + section_write16(sect, 0x0006); /* machine */ else nasm_assert(!"neither win32 nor win64 are set!"); - section_write32(sect, 0); /* flags*/ - section_write32(sect, 8); /* version */ - section_wbytes(sect, creator_str, strlen(creator_str)+1); + section_write16(sect, 0); /* verFEMajor */ + section_write16(sect, 0); /* verFEMinor */ + section_write16(sect, 0); /* verFEBuild */ + + /* BinScope/WACK insist on version >= 8.0.50727 */ + section_write16(sect, 8); /* verMajor */ + section_write16(sect, 0); /* verMinor */ + section_write16(sect, 50727); /* verBuild */ + + section_wbytes(sect, creator_str, strlen(creator_str)+1); /* verSt */ /* * normally there would be key/value pairs here, but they aren't * necessary. They are terminated by 2B @@ -712,7 +720,7 @@ static void write_symbolinfo_table(struct coff_Section *const sect) /* signature, language, outfile NULL */ obj_length = 2 + 4 + cv8_state.outfile.namebytes; - creator_length = 2 + 4 + 4 + 4 + 4 + strlen(creator_str)+1 + 2; + creator_length = 2 + 4 + 2 + 3*2 + 3*2 + strlen(creator_str)+1 + 2; sym_length = ( cv8_state.num_syms[SYMTYPE_CODE] * 7) + ( cv8_state.num_syms[SYMTYPE_PROC] * 7) + |