From patchwork Mon Dec 26 20:47:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 36702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1085568wrt; Mon, 26 Dec 2022 12:49:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXsp22M7T899P+suZ4y26sUbmG0YyCHCDVJwQbgoPsieWA6lMeLzbuEWdIZQvHsmu2x63s1q X-Received: by 2002:a17:906:5dd2:b0:7c1:7010:f413 with SMTP id p18-20020a1709065dd200b007c17010f413mr19947107ejv.19.1672087779308; Mon, 26 Dec 2022 12:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672087779; cv=none; d=google.com; s=arc-20160816; b=sihkNUUi0GdcGvl+Ayb7TUOuvCf3pOhsSd5zFmDwNMbdgl8hHlqrSpUqLv1UdS53CZ ByQ4pu9khwXbbK7ltSHdAYgJqpLXymzkMvQm7eYVFYVKeJj7MqBQeaIEUnicZfxSBvff OHGyTEri3OdiBFhfoll7VpV6J35+VOE7V9DdH6F3Q23JDE6JDFEGwQ2ibhoVsYPIkUXg DdipC3Hd1a6WIxJBu2LGrmdrI0GZ6+BAU3pAFwILZNPEq8SPPzGSc6Ikkt8/O4pOkXTV 9o6vjoVNI8aMDfvVlaFSgN04x7J0Vvjdt4Pe+8eLSl63m24mVi05UuSB52CsG13h2k1G wOjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=WtQFthZskNEDCGcq/NNtKzFGi4EjL24cCQnxad40WXI=; b=kXLSrV9obTzIoM4yEdO+Z/xQDN2jumwoQyagYkdWCjDF3A1H9fkBp+EvQcX/7COJw/ bxvHvyBH03p7zH7DFk7KlK8UeNfWlYztstckgnqnF6fptwYoHK3ffrMVrabWJsUJ3I4G YJ6PY0mNFNiFOVroLbePe0hYFUVXmVpBidlUoFKdWyEWcEzt2K7ob8aaU0Jg6OTKqzcK 7MMxVjd5GMq6T1cA7OeKx0YCS8vBD9KJFJWQqm3a0udN2TJ48W/7iBTt7nCfDr5ZIEiN 68LISechBnEvt8vLuEvv7TWQ55xcOitAT1PJQImsaHvpLravHHUby/DtDatmOnyNpvFE saQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=lFPdcahq; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hg6-20020a1709072cc600b0077156c9124esi9505255ejc.1001.2022.12.26.12.49.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=lFPdcahq; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32031383F972 for ; Mon, 26 Dec 2022 20:48:36 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 0C2CF3858D32 for ; Mon, 26 Dec 2022 20:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C2CF3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32c.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so8201695wms.2 for ; Mon, 26 Dec 2022 12:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=WtQFthZskNEDCGcq/NNtKzFGi4EjL24cCQnxad40WXI=; b=lFPdcahqAj/vfOc3vGTuQfYuHHzKuajD65Y8HmNJQ5X/sv2r5W01cDueSFvzy43FoQ YAeWml7OQ/hi+34GS+Q8rbHNJIeWRdeJgxjvTnerK9/INhW/zzcnROyviFgzm9cOmpOZ wEaTnybjI9vCtXDPhEJROCizvNVBmQGfGWbzk74eHQULsrU6dr9COx6upNlDXA2G51Fz BK4WG2SdLq1mk6tqtUD7G0itD1EcGVJyJ0dsL6KWTPtTdUPKKI6Vp1GypzHSY/Dg5YB8 NbO+WuaBBrxfZ9L4G6s2P2ujuRjJuKQRjrHi//eI+ChwySeeBZLYNnEGo99jZnpLSmG4 NBlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WtQFthZskNEDCGcq/NNtKzFGi4EjL24cCQnxad40WXI=; b=Ej2BiKqKRw4qUUxkBU3/fuLH6DV9kWRcfq0z1YnKg09WfOAvd/AkzShNTWeCCz1O6u PVetCdk6ljo4o/7zworJgKmaDybSVjCTTgK49g81o4euw+2+bqaJogdN2ICWN283yZn3 9iLhRovqBrsCiK6VbKPUx2zLB4v8IN1kjTqG2o0gLH7S6nWpRh5ijzJ07kBSBWtMXR/A 61Syhj9Zv0MEvAHQnI+36r30qGVNsGu+qWkhkok0OoTBbmOfNOrnG7HnN1psYUk/SU3k eVeH2Fp4GFfzdeppEaDmBKqqtyf4DnAcZfzBlD5pCRVfLlsTEU2RAZwd9UFrDJ+nr8UN bQOQ== X-Gm-Message-State: AFqh2krbwVEK9cDtLpxYyH6OqMdr1NUiNUcjKgwWPfB6UzkyAiVmuOnG f+ovzkXyHcQ9i+Y8oqyGvOSJNa6RXMA= X-Received: by 2002:a1c:4b06:0:b0:3cf:5e42:de64 with SMTP id y6-20020a1c4b06000000b003cf5e42de64mr16588629wma.39.1672087675250; Mon, 26 Dec 2022 12:47:55 -0800 (PST) Received: from beren.harmstone.com ([2a02:8010:64ea:0:8eb8:7eff:fe53:9d5f]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b00272c0767b4asm10384990wrc.109.2022.12.26.12.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:47:54 -0800 (PST) From: Mark Harmstone To: binutils@sourceware.org Cc: Mark Harmstone Subject: [PATCH 1/3] ld: Handle extended-length data structures in PDB types Date: Mon, 26 Dec 2022 20:47:49 +0000 Message-Id: <20221226204751.23761-1-mark@harmstone.com> X-Mailer: git-send-email 2.37.4 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753311114847595941?= X-GMAIL-MSGID: =?utf-8?q?1753311114847595941?= A few fixes to minor issues I've discovered in my PDB patches. * If sizes or offsets are greater than 0x8000, they get encoded as extended values in the same way as for enum values - e.g. a LF_ULONG .short followed by a .long. * I've managed to coax MSVC to produce another type, LF_VFTABLE, which is seen when dealing with COM. I don't think LLVM emits this. Note that we can't just implement everything in Microsoft's header files, as most of it is obsolete. * Fixes a stupid bug in the test program, where I was adding an index to a size. The index was hard-coded to 0, so this didn't cause any actual issues. --- ld/pdb.c | 228 ++++++++++++++++++++--- ld/pdb.h | 1 - ld/testsuite/ld-pe/pdb-types1-hashlist.d | 4 +- ld/testsuite/ld-pe/pdb-types1-typelist.d | 16 +- ld/testsuite/ld-pe/pdb-types1b.s | 121 +++++++++++- ld/testsuite/ld-pe/pdb.exp | 2 +- 6 files changed, 344 insertions(+), 28 deletions(-) diff --git a/ld/pdb.c b/ld/pdb.c index 0346ccb388c..5467a9efc12 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -2485,6 +2485,7 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, case LF_MEMBER: { struct lf_member *mem = (struct lf_member *) ptr; + uint16_t offset; size_t name_len, subtype_len; if (left < offsetof (struct lf_member, name)) @@ -2497,9 +2498,34 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, if (!remap_type (&mem->type, map, type_num, num_types)) return false; + subtype_len = offsetof (struct lf_member, name); + + offset = bfd_getl16 (&mem->offset); + + /* If offset >= 0x8000, actual value follows. */ + if (offset >= 0x8000) + { + unsigned int param_len = extended_value_len (offset); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_MEMBER\n"), offset); + return false; + } + + subtype_len += param_len; + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_MEMBER\n")); + return false; + } + } + name_len = - strnlen (mem->name, - left - offsetof (struct lf_member, name)); + strnlen ((char *) mem + subtype_len, left - subtype_len); if (name_len == left - offsetof (struct lf_member, name)) { @@ -2510,7 +2536,7 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, name_len++; - subtype_len = offsetof (struct lf_member, name) + name_len; + subtype_len += name_len; if (subtype_len % 4 != 0) subtype_len += 4 - (subtype_len % 4); @@ -2715,6 +2741,8 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, case LF_BCLASS: { struct lf_bclass *bc = (struct lf_bclass *) ptr; + size_t subtype_len; + uint16_t offset; if (left < sizeof (struct lf_bclass)) { @@ -2727,8 +2755,44 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, num_types)) return false; - ptr += sizeof (struct lf_bclass); - left -= sizeof (struct lf_bclass); + subtype_len = sizeof (struct lf_bclass); + + offset = bfd_getl16 (&bc->offset); + + /* If offset >= 0x8000, actual value follows. */ + if (offset >= 0x8000) + { + unsigned int param_len = extended_value_len (offset); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_BCLASS\n"), offset); + return false; + } + + subtype_len += param_len; + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_BCLASS\n")); + return false; + } + } + + if (subtype_len % 4 != 0) + subtype_len += 4 - (subtype_len % 4); + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_BCLASS\n")); + return false; + } + + ptr += subtype_len; + left -= subtype_len; break; } @@ -2757,6 +2821,8 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, case LF_IVBCLASS: { struct lf_vbclass *vbc = (struct lf_vbclass *) ptr; + size_t subtype_len; + uint16_t offset; if (left < sizeof (struct lf_vbclass)) { @@ -2773,8 +2839,70 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, type_num, num_types)) return false; - ptr += sizeof (struct lf_vbclass); - left -= sizeof (struct lf_vbclass); + subtype_len = offsetof (struct lf_vbclass, + virtual_base_vbtable_offset); + + offset = bfd_getl16 (&vbc->virtual_base_pointer_offset); + + /* If offset >= 0x8000, actual value follows. */ + if (offset >= 0x8000) + { + unsigned int param_len = extended_value_len (offset); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_VBCLASS/LF_IVBCLASS\n"), offset); + return false; + } + + subtype_len += param_len; + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_VBCLASS/LF_IVBCLASS\n")); + return false; + } + } + + offset = bfd_getl16 ((char *)vbc + subtype_len); + subtype_len += sizeof (uint16_t); + + /* If offset >= 0x8000, actual value follows. */ + if (offset >= 0x8000) + { + unsigned int param_len = extended_value_len (offset); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_VBCLASS/LF_IVBCLASS\n"), offset); + return false; + } + + subtype_len += param_len; + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_VBCLASS/LF_IVBCLASS\n")); + return false; + } + } + + if (subtype_len % 4 != 0) + subtype_len += 4 - (subtype_len % 4); + + if (left < subtype_len) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_VBCLASS/LF_IVBCLASS\n")); + return false; + } + + ptr += subtype_len; + left -= subtype_len; break; } @@ -2959,8 +3087,8 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, case LF_STRUCTURE: { struct lf_class *cl = (struct lf_class *) data; - uint16_t prop; - size_t name_len; + uint16_t prop, num_bytes; + size_t name_len, name_off; if (size < offsetof (struct lf_class, name)) { @@ -2978,9 +3106,35 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, if (!remap_type (&cl->vshape, map, type_num, num_types)) return false; - name_len = strnlen (cl->name, size - offsetof (struct lf_class, name)); + name_off = offsetof (struct lf_class, name); + + num_bytes = bfd_getl16 (&cl->length); - if (name_len == size - offsetof (struct lf_class, name)) + /* If num_bytes >= 0x8000, actual value follows. */ + if (num_bytes >= 0x8000) + { + unsigned int param_len = extended_value_len (num_bytes); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_CLASS/LF_STRUCTURE\n"), num_bytes); + return false; + } + + name_off += param_len; + + if (size < name_off) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_CLASS/LF_STRUCTURE\n")); + return false; + } + } + + name_len = strnlen ((char *) cl + name_off, size - name_off); + + if (name_len == size - name_off) { einfo (_("%P: warning: name for LF_CLASS/LF_STRUCTURE has no" " terminating zero\n")); @@ -2993,10 +3147,11 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, { /* Structure has another name following first one. */ - size_t len = offsetof (struct lf_class, name) + name_len + 1; + size_t len = name_off + name_len + 1; size_t unique_name_len; - unique_name_len = strnlen (cl->name + name_len + 1, size - len); + unique_name_len = strnlen ((char *) cl + name_off + name_len + 1, + size - len); if (unique_name_len == size - len) { @@ -3007,10 +3162,10 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, } if (!(prop & (CV_PROP_FORWARD_REF | CV_PROP_SCOPED)) - && !is_name_anonymous (cl->name, name_len)) + && !is_name_anonymous ((char *) cl + name_off, name_len)) { other_hash = true; - cv_hash = crc32 ((uint8_t *) cl->name, name_len); + cv_hash = crc32 ((uint8_t *) cl + name_off, name_len); } break; @@ -3019,8 +3174,8 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, case LF_UNION: { struct lf_union *un = (struct lf_union *) data; - uint16_t prop; - size_t name_len; + uint16_t prop, num_bytes; + size_t name_len, name_off; if (size < offsetof (struct lf_union, name)) { @@ -3032,9 +3187,35 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, if (!remap_type (&un->field_list, map, type_num, num_types)) return false; - name_len = strnlen (un->name, size - offsetof (struct lf_union, name)); + name_off = offsetof (struct lf_union, name); + + num_bytes = bfd_getl16 (&un->length); + + /* If num_bytes >= 0x8000, actual value follows. */ + if (num_bytes >= 0x8000) + { + unsigned int param_len = extended_value_len (num_bytes); + + if (param_len == 0) + { + einfo (_("%P: warning: unhandled type %v within" + " LF_UNION\n"), num_bytes); + return false; + } + + name_off += param_len; + + if (size < name_off) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_UNION\n")); + return false; + } + } + + name_len = strnlen ((char *) un + name_off, size - name_off); - if (name_len == size - offsetof (struct lf_union, name)) + if (name_len == size - name_off) { einfo (_("%P: warning: name for LF_UNION has no" " terminating zero\n")); @@ -3047,10 +3228,11 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, { /* Structure has another name following first one. */ - size_t len = offsetof (struct lf_union, name) + name_len + 1; + size_t len = name_off + name_len + 1; size_t unique_name_len; - unique_name_len = strnlen (un->name + name_len + 1, size - len); + unique_name_len = strnlen ((char *) un + name_off + name_len + 1, + size - len); if (unique_name_len == size - len) { @@ -3061,10 +3243,10 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, } if (!(prop & (CV_PROP_FORWARD_REF | CV_PROP_SCOPED)) - && !is_name_anonymous (un->name, name_len)) + && !is_name_anonymous ((char *) un + name_off, name_len)) { other_hash = true; - cv_hash = crc32 ((uint8_t *) un->name, name_len); + cv_hash = crc32 ((uint8_t *) un + name_off, name_len); } break; diff --git a/ld/pdb.h b/ld/pdb.h index 749a60249df..ddf731b99c9 100644 --- a/ld/pdb.h +++ b/ld/pdb.h @@ -480,7 +480,6 @@ struct lf_bclass uint16_t attributes; uint32_t base_class_type; uint16_t offset; - uint16_t padding; } ATTRIBUTE_PACKED; /* lfVFuncTab in cvinfo.h */ diff --git a/ld/testsuite/ld-pe/pdb-types1-hashlist.d b/ld/testsuite/ld-pe/pdb-types1-hashlist.d index b75f08c1de7..aa00aaf7593 100644 --- a/ld/testsuite/ld-pe/pdb-types1-hashlist.d +++ b/ld/testsuite/ld-pe/pdb-types1-hashlist.d @@ -10,4 +10,6 @@ Contents of section .data: 0050 ffd80200 b0260100 7c060200 e3240200 * 0060 63ff0100 fb6b0300 0ad90100 523c0200 * 0070 4d5e0200 8a940200 4b710300 6aa90300 * - 0080 0a2c0300 67e10300 4a3d0300 * \ No newline at end of file + 0080 0a2c0300 67e10300 4a3d0300 fa460300 * + 0090 db020200 ec4e0100 131e0300 fb120300 * + 00a0 aece0200 1db70100 * \ No newline at end of file diff --git a/ld/testsuite/ld-pe/pdb-types1-typelist.d b/ld/testsuite/ld-pe/pdb-types1-typelist.d index ff2d91c311e..df862c3f837 100644 --- a/ld/testsuite/ld-pe/pdb-types1-typelist.d +++ b/ld/testsuite/ld-pe/pdb-types1-typelist.d @@ -57,4 +57,18 @@ Contents of section .data: 0340 7200f2f1 10150000 20100000 6e657374 r....... ...nest 0350 65645f65 6e756d00 1a000515 01000000 ed_enum......... 0360 21100000 00000000 00000000 04007175 !.............qu - 0370 757800f1 ux.. \ No newline at end of file + 0370 757800f1 12000315 10000000 74000000 ux..........t... + 0380 028060ea 00f3f2f1 2e000312 0d150300 ..`............. + 0390 23100000 00006100 0d150300 23100000 #.....a.....#... + 03a0 028060ea 6200f2f1 0d150300 23100000 ..`.b.......#... + 03b0 0480c0d4 01006300 26000515 03000000 ......c.&....... + 03c0 24100000 00000000 00000000 048020bf $............. . + 03d0 02006c6f 6e677374 72756374 00f3f2f1 ..longstruct.... + 03e0 1a000312 0d150300 23100000 00006100 ........#.....a. + 03f0 0d150300 23100000 00006200 1a000615 ....#.....b..... + 0400 02000000 26100000 028060ea 6c6f6e67 ....&.....`.long + 0410 756e696f 6e00f2f1 1e000312 00140000 union........... + 0420 25100000 0480c0d4 0100f2f1 0d150300 %............... + 0430 23100000 00006400 26000312 01140000 #.....d.&....... + 0440 25100000 00000000 028060ea 0480c0d4 %.........`..... + 0450 0100f2f1 0d150300 23100000 00006400 ........#.....d. \ No newline at end of file diff --git a/ld/testsuite/ld-pe/pdb-types1b.s b/ld/testsuite/ld-pe/pdb-types1b.s index 89ee6e3840f..544b338c251 100644 --- a/ld/testsuite/ld-pe/pdb-types1b.s +++ b/ld/testsuite/ld-pe/pdb-types1b.s @@ -33,6 +33,7 @@ .equ LF_USHORT, 0x8002 .equ LF_LONG, 0x8003 +.equ LF_ULONG, 0x8004 .equ LF_UQUADWORD, 0x800a .equ CV_PTR_NEAR32, 0xa @@ -447,7 +448,7 @@ # Type 1021, struct quux, field list 1020 .struct4: -.short .types_end - .struct4 - 2 +.short .arr2 - .struct4 - 2 .short LF_STRUCTURE .short 1 # no. members .short 0 # property @@ -458,4 +459,122 @@ .asciz "quux" # name .byte 0xf1 # padding +# Type 1022, array[60000] of char +.arr2: +.short .fieldlist8 - .arr2 - 2 +.short LF_ARRAY +.long T_CHAR # element type +.long T_INT4 # index type +.short LF_USHORT +.short 60000 # size in bytes +.byte 0 # name +.byte 0xf3 # padding +.byte 0xf2 # padding +.byte 0xf1 # padding + +# Type 1023, field list for struct longstruct +.fieldlist8: +.short .struct5 - .fieldlist8 - 2 +.short LF_FIELDLIST +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short 0 # offset +.asciz "a" +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short LF_USHORT +.short 60000 # offset +.asciz "b" +.byte 0xf2 # padding +.byte 0xf1 # padding +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short LF_ULONG +.long 120000 # offset +.asciz "c" + +# Type 1024, struct longstruct +.struct5: +.short .fieldlist9 - .struct5 - 2 +.short LF_STRUCTURE +.short 3 # no. members +.short 0 # property +.long 0x1023 # field list +.long 0 # type derived from +.long 0 # type of vshape table +.short LF_ULONG +.long 180000 # size +.asciz "longstruct" # name +.byte 0xf3 # padding +.byte 0xf2 # padding +.byte 0xf1 # padding + +# Type 1025, field list for union longunion +.fieldlist9: +.short .union4 - .fieldlist9 - 2 +.short LF_FIELDLIST +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short 0 # offset +.asciz "a" +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short 0 # offset +.asciz "b" + +# Type 1026, union longunion (field list 1025) +.union4: +.short .fieldlist10 - .union4 - 2 +.short LF_UNION +.short 2 # no. members +.short 0 # property +.long 0x1025 # field list +.short LF_USHORT +.short 60000 # size +.asciz "longunion" +.byte 0xf2 # padding +.byte 0xf1 # padding + +# Type 1027, field list with base class longstruct +.fieldlist10: +.short .fieldlist11 - .fieldlist10 - 2 +.short LF_FIELDLIST +.short LF_BCLASS +.short 0 # attributes +.long 0x1024 # base class +.short LF_ULONG +.long 120000 # offset within class +.byte 0xf2 # padding +.byte 0xf1 # padding +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short 0 # offset +.asciz "d" + +# Type 1028, field list with virtual base class longstruct +.fieldlist11: +.short .types_end - .fieldlist11 - 2 +.short LF_FIELDLIST +.short LF_VBCLASS +.short 0 # attributes +.long 0x1024 # type index of direct virtual base class +.long 0 # type index of virtual base pointer +.short LF_USHORT +.short 60000 # virtual base pointer offset +.short LF_ULONG +.long 120000 # virtual base offset from vbtable +.byte 0xf2 # padding +.byte 0xf1 # padding +.short LF_MEMBER +.short 3 # public +.long 0x1022 +.short 0 # offset +.asciz "d" + .types_end: diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp index bd50b2fb076..fbc0cf949f1 100644 --- a/ld/testsuite/ld-pe/pdb.exp +++ b/ld/testsuite/ld-pe/pdb.exp @@ -1029,7 +1029,7 @@ proc test5 { } { binary scan $data i end_type # end_type is one greater than the last type in the stream - if { $end_type != 0x1023 } { + if { $end_type != 0x102a } { fail "Incorrect end type value in TPI stream." } else { pass "Correct end type value in TPI stream." From patchwork Mon Dec 26 20:47:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 36701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1085209wrt; Mon, 26 Dec 2022 12:48:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoxJr25Ea8+1gc41HCF7Ldh7BKosCznI5qrzXLm44gjKJ8uMUKKRXK5NZkyuBr1DWRzzya X-Received: by 2002:a17:907:c71b:b0:7c1:67ca:56f5 with SMTP id ty27-20020a170907c71b00b007c167ca56f5mr21655265ejc.15.1672087691547; Mon, 26 Dec 2022 12:48:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672087691; cv=none; d=google.com; s=arc-20160816; b=QxSFhMm3tpqUz9mf3VWUHHlOqIDhl1rSsefzQX795BSoIHPWF1T4TqWAMCoKHe3Eno jcbS17TuCfj7pC0C4CKXyPZEiZUfFyEB7TW6S7Fwpy+L7xH8/7gs7O6Xf82lAcQZ4/vM b813W5hn4bSrJsGh9W24LDUBv3DGBlv+fYbobQmFVfT8kfpj5zHqIy5QYGPCpyCI/CkS xsg6WCixvlglpwu8oRrMGJoKeI3MxoUDdZzvoVvgRtFkLnXMG+UXm1YCGwYx0y2TTqZS yEf1BADgamvERhWIeyTGLgkMq2mHrzeJPvGvp7ncFcVwK7N9TTdBPh2p1k0yQ4Ama5YF s/Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=x14oDZx3bPGPkP3IdMksXmlczuJQvFFovOG/jaAn+ok=; b=si47+ipJadUtkXLJ80EwfDbNF4VJHjm/dm/zSDQa4qdHKgEePqvNr1Taozk6PxtZBh txFoRNP46lJY02PJ5QmqUl4gD2qgQpNWiQ9h61ouB7OcdaeWxaySsgYa7xD0KCyFxFrA bLVTvPCVjy6A+UQwfoqk9GxdejOnGr+89I2zOvWF3k39YF6WsdgSvU6qw++8mCAX0Sst DmQl0AoMYz4ovKKSjswAXEF04WjMBsQ68G1+5+hpA5M7GdodzRPsN6Tjj1KmKBsVjCTk cpx5xJe/hz6GBgPhc6Bxh+2TljlFRnKp4cydnS77d+mOQChdFGIzY3nWz5Cu6NF2uLlE fz6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=JtzZHFqQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hv15-20020a17090760cf00b007ae1e635ea3si9783458ejc.754.2022.12.26.12.48.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:48:11 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=JtzZHFqQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8270F3858C2D for ; Mon, 26 Dec 2022 20:48:06 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 9E3B63858D37 for ; Mon, 26 Dec 2022 20:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E3B63858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x334.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so5706196wms.0 for ; Mon, 26 Dec 2022 12:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=x14oDZx3bPGPkP3IdMksXmlczuJQvFFovOG/jaAn+ok=; b=JtzZHFqQfvfceJxMKgx4/iHm0ebPEoRA3uFdMHIC2+H49IkRFtu+4t1w4/zLJkkBQq lN73FAPDerZwpBlR41q09aP1N63JOK5MpwfoQePlsqtl6GWHgmp0ZBpXIGxoy750346m NuK/exmXXHmLGzfluT7ULmfamB+nlXKvNkRGpR2k03v3lb1XwYtaCICq/hFuNbbLTmOU QuhI1UFHGqQEKmEClYAJrr/dWB7O9M67HKNBIkCT5gg9gx2W/Cea0mZIdxBJJ4EP9Dh+ VpeR9HWIRDY5qERGazUIRCyzGPBCobIZezyp/b9cvJQza9TW2TO196I0KtpPbRWWjcA7 VIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=x14oDZx3bPGPkP3IdMksXmlczuJQvFFovOG/jaAn+ok=; b=QfZteyJtSgoBT8TAtPTo2f13lMLS/8ScnoJJQ7wkdAxAz7iYuDCXIlCCrSkGqCddS2 jDbTC++T1fYmK9LDTahupVCqk6m7Ds3hDoN2cGZdZVmlasNdzOnqGfmzDOeJu0dxjaE8 t+vIq8cHdt+RK9dKQ85+C4BCrWqwfNsFNyH2ouCrE1hy5ky6o6e5DTKpGMvUzJOJ58Ot 8rhbZ6HK8d+VOuy9MsKGJAUaHqa4XAUnWNRMmAd6Yp7gTMpQ8UIvKgUVgJ+vdFPAOYNK lpiQRodfl0r8c6KY+jSAR7AguDUg2AQS1KzHte0qSHGFP6sP2NbmIXO+oK9vnZWZ2rQ8 qe8Q== X-Gm-Message-State: AFqh2kqETeZaDKy3iiPdj5GGOXM6CcOem5I5tkO2jIpamYvDAEsedbFG NM7BTKCAiFLA0d7x0NdnPlagSspFpDs= X-Received: by 2002:a05:600c:35ca:b0:3d1:f2de:195a with SMTP id r10-20020a05600c35ca00b003d1f2de195amr16579207wmq.32.1672087676192; Mon, 26 Dec 2022 12:47:56 -0800 (PST) Received: from beren.harmstone.com ([2a02:8010:64ea:0:8eb8:7eff:fe53:9d5f]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b00272c0767b4asm10384990wrc.109.2022.12.26.12.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:47:55 -0800 (PST) From: Mark Harmstone To: binutils@sourceware.org Cc: Mark Harmstone Subject: [PATCH 2/3] ld: Handle LF_VFTABLE types in PDBs Date: Mon, 26 Dec 2022 20:47:50 +0000 Message-Id: <20221226204751.23761-2-mark@harmstone.com> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221226204751.23761-1-mark@harmstone.com> References: <20221226204751.23761-1-mark@harmstone.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753311023248600210?= X-GMAIL-MSGID: =?utf-8?q?1753311023248600210?= --- ld/pdb.c | 20 +++++++++++++++ ld/pdb.h | 13 ++++++++++ ld/testsuite/ld-pe/pdb-types1-hashlist.d | 2 +- ld/testsuite/ld-pe/pdb-types1-typelist.d | 8 +++++- ld/testsuite/ld-pe/pdb-types1b.s | 32 +++++++++++++++++++++++- ld/testsuite/ld-pe/pdb.exp | 2 +- 6 files changed, 73 insertions(+), 4 deletions(-) diff --git a/ld/pdb.c b/ld/pdb.c index 5467a9efc12..4f0efa828f0 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -3306,6 +3306,26 @@ handle_type (uint8_t *data, struct type_entry **map, uint32_t type_num, /* Does not reference any types, nothing to be done. */ break; + case LF_VFTABLE: + { + struct lf_vftable *vft = (struct lf_vftable *) data; + + if (size < offsetof (struct lf_vftable, names)) + { + einfo (_("%P: warning: truncated CodeView type record" + " LF_VFTABLE\n")); + return false; + } + + if (!remap_type (&vft->type, map, type_num, num_types)) + return false; + + if (!remap_type (&vft->base_vftable, map, type_num, num_types)) + return false; + + break; + } + case LF_STRING_ID: { struct lf_string_id *str = (struct lf_string_id *) data; diff --git a/ld/pdb.h b/ld/pdb.h index ddf731b99c9..2efaa466efb 100644 --- a/ld/pdb.h +++ b/ld/pdb.h @@ -54,6 +54,7 @@ #define LF_METHOD 0x150f #define LF_NESTTYPE 0x1510 #define LF_ONEMETHOD 0x1511 +#define LF_VFTABLE 0x151d #define LF_FUNC_ID 0x1601 #define LF_MFUNC_ID 0x1602 #define LF_BUILDINFO 0x1603 @@ -578,6 +579,18 @@ struct lf_udt_mod_src_line uint16_t module_no; } ATTRIBUTE_PACKED; +/* lfVftable in cvinfo.h */ +struct lf_vftable +{ + uint16_t size; + uint16_t kind; + uint32_t type; + uint32_t base_vftable; + uint32_t offset; + uint32_t names_len; + char names[]; +} ATTRIBUTE_PACKED; + /* DATASYM32 in cvinfo.h */ struct datasym { diff --git a/ld/testsuite/ld-pe/pdb-types1-hashlist.d b/ld/testsuite/ld-pe/pdb-types1-hashlist.d index aa00aaf7593..7d314edb670 100644 --- a/ld/testsuite/ld-pe/pdb-types1-hashlist.d +++ b/ld/testsuite/ld-pe/pdb-types1-hashlist.d @@ -12,4 +12,4 @@ Contents of section .data: 0070 4d5e0200 8a940200 4b710300 6aa90300 * 0080 0a2c0300 67e10300 4a3d0300 fa460300 * 0090 db020200 ec4e0100 131e0300 fb120300 * - 00a0 aece0200 1db70100 * \ No newline at end of file + 00a0 aece0200 1db70100 99a30000 a8010100 * \ No newline at end of file diff --git a/ld/testsuite/ld-pe/pdb-types1-typelist.d b/ld/testsuite/ld-pe/pdb-types1-typelist.d index df862c3f837..248dda50d2d 100644 --- a/ld/testsuite/ld-pe/pdb-types1-typelist.d +++ b/ld/testsuite/ld-pe/pdb-types1-typelist.d @@ -71,4 +71,10 @@ Contents of section .data: 0420 25100000 0480c0d4 0100f2f1 0d150300 %............... 0430 23100000 00006400 26000312 01140000 #.....d.&....... 0440 25100000 00000000 028060ea 0480c0d4 %.........`..... - 0450 0100f2f1 0d150300 23100000 00006400 ........#.....d. \ No newline at end of file + 0450 0100f2f1 0d150300 23100000 00006400 ........#.....d. + 0460 1e000515 00008000 00000000 00000000 ................ + 0470 00000000 00004955 6e6b6e6f 776e00f1 ......IUnknown.. + 0480 3a001d15 2a100000 00000000 00000000 :...*........... + 0490 27000000 49556e6b 6e6f776e 00517565 '...IUnknown.Que + 04a0 7279496e 74657266 61636500 41646452 ryInterface.AddR + 04b0 65660052 656c6561 736500f1 ef.Release.. \ No newline at end of file diff --git a/ld/testsuite/ld-pe/pdb-types1b.s b/ld/testsuite/ld-pe/pdb-types1b.s index 544b338c251..bd227b12ebc 100644 --- a/ld/testsuite/ld-pe/pdb-types1b.s +++ b/ld/testsuite/ld-pe/pdb-types1b.s @@ -30,6 +30,7 @@ .equ LF_METHOD, 0x150f .equ LF_NESTTYPE, 0x1510 .equ LF_ONEMETHOD, 0x1511 +.equ LF_VFTABLE, 0x151d .equ LF_USHORT, 0x8002 .equ LF_LONG, 0x8003 @@ -559,7 +560,7 @@ # Type 1028, field list with virtual base class longstruct .fieldlist11: -.short .types_end - .fieldlist11 - 2 +.short .struct6 - .fieldlist11 - 2 .short LF_FIELDLIST .short LF_VBCLASS .short 0 # attributes @@ -577,4 +578,33 @@ .short 0 # offset .asciz "d" +# Type 1029, forward declaration of struct IUnknown +.struct6: +.short .vftable1 - .struct6 - 2 +.short LF_STRUCTURE +.short 0 # no. members +.short 0x80 # property (forward declaration) +.long 0 # field list +.long 0 # type derived from +.long 0 # type of vshape table +.short 0 # size +.asciz "IUnknown" # name +.byte 0xf1 # padding + +# Type 102a, virtual function table +.vftable1: +.short .types_end - .vftable1 - 2 +.short LF_VFTABLE +.long 0x1029 # type +.long 0 # base vftable +.long 0 # offset +.long .vftable1_names_end - .vftable1_names # length of names array +.vftable1_names: +.asciz "IUnknown" +.asciz "QueryInterface" +.asciz "AddRef" +.asciz "Release" +.vftable1_names_end: +.byte 0xf1 # padding + .types_end: diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp index fbc0cf949f1..b2016313e96 100644 --- a/ld/testsuite/ld-pe/pdb.exp +++ b/ld/testsuite/ld-pe/pdb.exp @@ -1029,7 +1029,7 @@ proc test5 { } { binary scan $data i end_type # end_type is one greater than the last type in the stream - if { $end_type != 0x102a } { + if { $end_type != 0x102c } { fail "Incorrect end type value in TPI stream." } else { pass "Correct end type value in TPI stream." From patchwork Mon Dec 26 20:47:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 36700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1085172wrt; Mon, 26 Dec 2022 12:48:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuEEtnRepwmsK9yT7Q72DVK6yb8A3EEuEhnTChwXUP75HnKtSErCyq7n2i2ZG3Bvko9vs0E X-Received: by 2002:a17:906:b041:b0:7c1:22a6:818e with SMTP id bj1-20020a170906b04100b007c122a6818emr15328261ejb.24.1672087686058; Mon, 26 Dec 2022 12:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672087686; cv=none; d=google.com; s=arc-20160816; b=Koq0HD8bxD0Ki8NlbpH3YVDwh2OeTfII1a7tTHC+0BK8C2xXMt+eFq0O8o003i0W2/ pk6OoK+YLHs8TJ1s6O3Z3RhbsyeVqadlgz1kk/QpnnRc3rMZv0VW/ZWQaaxpLiS+tOrk JP7aWah8sBvCksvh8O0kXLUL2Nj05AmyAV0+v3w3eIAXUHlfHQTnpbiM0hD0c7VqB76O Yap1BEsXBMOPXrGJBLUee5qg3j7ZzD21yiLPjB1Cn0dqHtA1jKOq1PAqmcTutta0r9ml aBf5wSJKahtKideU6Rny2/eH3z3rnCdmUGufCUQ/fpVJ4hsHPxWRlcz8WPRFkv9425MD DL/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=ej1Xls1MstXT2FwYDYySu8ATB72kTADoagNybZwQKi8=; b=UJXb9ymze5LxAZXxDsaZ01JivFAoUbSbPpH4TAix+UsxjB7i64lHmPe4uX+lHETCsp TDuEgHfmJpOjc031i9HQEaJmmDlPfwzQZBzHijcDXRAlUPdBf7CTOS1prftqXPalW4el 940o+YojiV/7jSvlaS9B6hEZuxSXlX98JsCcf40NGGN75l2/xt8YRXGeKQI1mEvZLwt1 eGKS2Z6VWnIInLh9QUAbkXP/eQSeZNmmYeD0MpkLqRlzYqlC1/aXaj9LpJAp/JqeIU61 fkFuN/Gs54yJEZDZrYvhH6XaHMIm4dNYihT2K3KI+TrFh2g8EAUxL3EaMhq8cXfZ9tbs CAyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b="UOFy/433"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hs6-20020a1709073e8600b007c170f6b32bsi10113397ejc.266.2022.12.26.12.48.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b="UOFy/433"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A31993858401 for ; Mon, 26 Dec 2022 20:48:03 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id AFAB93858D38 for ; Mon, 26 Dec 2022 20:47:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AFAB93858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x42b.google.com with SMTP id i7so10831880wrv.8 for ; Mon, 26 Dec 2022 12:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ej1Xls1MstXT2FwYDYySu8ATB72kTADoagNybZwQKi8=; b=UOFy/433rsWbuqvVpQrFkwjg61BG+YyTB8RUI0pagBl53A7+EPXm8wLGicOf8uX4IF 8ZBbirYXeRjZPvjoglkyGl7ZIyoPaGCJ50Ls8rlKQBI/dCwugbSlnLdJgFbP8RNMJ8Km iYM0RZrvepdJerqTKsO3SAA/v+/7Ujy7ahrNqz1tamct/td/FA0se4RHiw/2xvmuzyHp Hn/QNyHxZ6hvbq8ivzcJagz7pTEQqH3sjMQJlrQrKS4V9Oe5ejKrXpUErugbAsmmilhL MEfNbThhpxFExgTeij3VRl2pcFaW6EbIx63rI6c+W0CoRUFS1AgCRmZQsRC3yrffxklx Brlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ej1Xls1MstXT2FwYDYySu8ATB72kTADoagNybZwQKi8=; b=L6Gm5xXZnl4DS8K5RKRcy10jYunDjfA3Uw9fNuMp1OEn1kZ+ZFsJUetG8WMsFHMv43 HMVbveKmWrKLK/5o1oo4bC5L6/wfb2SZNGuS7mm9EcBohdgB3AcmUjt98cOGaQiQ37J7 qoEpGJ49QvQuuBS1dLNX8k6O4X3MdQUoY89T9kvq0Lx25S/rCFE5eLVQTniaM7g8ziHq cenw+s3Xi7yOaTwRBY3X1LrQ68ULthEQriG02IRk2DNsB0SZlqfUR7TkVFMjkcYlD0bl zgtiqdS0R5UbACOvHg8qcinkDf6Oqk9fOJQCOFdBEqTs3FZsRhYrbZawEejpF3fwl65S W2uw== X-Gm-Message-State: AFqh2koMgKCz7DpjVtaNKu4k2Zl1nHjMdFf1X9zZgk/H5LayW2JzFB3S u2WNl+HW+Gl0rnG2b4q1LE0miyFfudo= X-Received: by 2002:adf:fa4e:0:b0:260:ebb2:ebf6 with SMTP id y14-20020adffa4e000000b00260ebb2ebf6mr12149370wrr.13.1672087677236; Mon, 26 Dec 2022 12:47:57 -0800 (PST) Received: from beren.harmstone.com ([2a02:8010:64ea:0:8eb8:7eff:fe53:9d5f]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b00272c0767b4asm10384990wrc.109.2022.12.26.12.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 12:47:56 -0800 (PST) From: Mark Harmstone To: binutils@sourceware.org Cc: Mark Harmstone Subject: [PATCH 3/3] ld/testsuite: Don't add index to sizes in pdb.exp Date: Mon, 26 Dec 2022 20:47:51 +0000 Message-Id: <20221226204751.23761-3-mark@harmstone.com> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221226204751.23761-1-mark@harmstone.com> References: <20221226204751.23761-1-mark@harmstone.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753311017212236997?= X-GMAIL-MSGID: =?utf-8?q?1753311017212236997?= --- ld/testsuite/ld-pe/pdb.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp index b2016313e96..60aa39ae130 100644 --- a/ld/testsuite/ld-pe/pdb.exp +++ b/ld/testsuite/ld-pe/pdb.exp @@ -256,8 +256,8 @@ proc check_dbi_stream { pdb } { set data [read $fi 4] binary scan $data i type_server_map_size - set data [read $fi 4] - binary scan $data i mfc_type_server_index + # skip MFC type server index + seek $fi 4 current set data [read $fi 4] binary scan $data i optional_dbg_header_size @@ -271,7 +271,7 @@ proc check_dbi_stream { pdb } { set stream_length [file size tmpdir/0003] - if { $stream_length != [expr 0x40 + $mod_info_size + $section_contribution_size + $section_map_size + $source_info_size + $type_server_map_size + $mfc_type_server_index + $optional_dbg_header_size + $ec_substream_size] } { + if { $stream_length != [expr 0x40 + $mod_info_size + $section_contribution_size + $section_map_size + $source_info_size + $type_server_map_size + $optional_dbg_header_size + $ec_substream_size] } { return 0 }