From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 577BD780091 for ; Thu, 30 Nov 2023 22:42:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=G8AUaU7ME7kaDU6UekQKU7Dvvm3ojtLLpq++ubbSaKI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701384146; v=1; b=ogTxhQXuiAkt8Hwen6j7Hlr38kCrsgut6Cky1q9Qr0F8sOJvxS+mbVOHJycd58VTBiVW4zey reDeWFlDmw/iiF7Q2HPwXco8n2JBb0XLk1JeYmdv2tGUlWGYMOSo7MuO9wdBOwOYgzrQUCgVvc5 ONStAZW4Lc4YR34rsan4Mz98= X-Received: by 127.0.0.2 with SMTP id N0LDYY7687511x2Q1fincUtM; Thu, 30 Nov 2023 14:42:26 -0800 X-Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.groups.io with SMTP id smtpd.web10.9341.1701384140917344849 for ; Thu, 30 Nov 2023 14:42:21 -0800 X-Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-333308c3683so87577f8f.3 for ; Thu, 30 Nov 2023 14:42:20 -0800 (PST) X-Gm-Message-State: p2NYENHhLkiyyww1LHMjzUpPx7686176AA= X-Google-Smtp-Source: AGHT+IETF4i2CODSdaAHGiUU0W1ugUDj0ErFIt8E0pYJXnn5jG/knZgBH41kWavO8ZGJeMr6dspUwg== X-Received: by 2002:a5d:6342:0:b0:332:fe77:2c60 with SMTP id b2-20020a5d6342000000b00332fe772c60mr87652wrw.24.1701384138769; Thu, 30 Nov 2023 14:42:18 -0800 (PST) X-Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id k26-20020adfb35a000000b003332faefd86sm547243wrd.0.2023.11.30.14.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:42:18 -0800 (PST) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Pedro Falcato , Michael D Kinney , Michael Kubacki , Sean Brogan Subject: [edk2-devel] [PATCH 0/2] UnitTestFrameworkPkg: Fix Google Test components with multiple files Date: Thu, 30 Nov 2023 22:42:12 +0000 Message-ID: <20231130224214.86027-1-pedro.falcato@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ogTxhQXu; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Google Test hides test registration in global constructors on global objects. Global constructors are traditionally implemented by placing references to the global constructor's symbol in special sections (traditionally named .ctors or .init_array). These sections are not explicitly referenced by the linker, and libc only looks at special start and end symbols (and calls them). This works fine if you're linking a program manually using gcc a.o b.o c.o -o test_suite but fails miserably when using static libraries (such as what EDK2 does), because traditional static archive symbol resolution rules don't allow for object files to be pulled in to the link if there isn't an undefined symbol reference to that .o elsewhere. Fix it by passing --whole-archive (GCC) and /WHOLEARCHIVE (MSVC). These options force the linker to pull in the entire static library, thus including previously-unreferenced constructors and making sure multi-file gtest EDK2 components work. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4610 Cc: Michael D Kinney Cc: Michael Kubacki Cc: Sean Brogan Pedro Falcato (2): UnitTestFrameworkPkg: Fix Google Test components with multiple files UnitTestFrameworkPkg/Readme.md: Remove the mention of the gtest main() limitation UnitTestFrameworkPkg/ReadMe.md | 16 ---------------- .../UnitTestFrameworkPkgHost.dsc.inc | 9 +++++++-- 2 files changed, 7 insertions(+), 18 deletions(-) -- 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111915): https://edk2.groups.io/g/devel/message/111915 Mute This Topic: https://groups.io/mt/102904622/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-