From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8639A740039 for ; Tue, 14 Jan 2025 22:23:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=2egGiPWAltDNVKJRX2p6H4L2kWPGRg/NK1kZGGcgtD4=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:Message-ID:Date:MIME-Version:User-Agent:To:From:Subject:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240830; t=1736893385; v=1; x=1737152583; b=JL6f8neMmKpWP6OaxZzaDIa+VS9b/6kOZ0sUOn07cpaMCCzvxVq+8p9KWvcyKDn4Z8tiACP+ MUBGsAhJFKlMQ/wiVfMwU4UdFlROrDCLuEp2F2WZfPrcwhvcUDCY58ijXnib5x9BfhLfDWlPPnu oNY75nYQdRpwQxJW9Bu9rzLGjDYF4BpBtvmV1FzWe5VyXtwpoUyqJjy0yY9Z9A7oQljAhOZmLgL octjVX4CRfSOovzBx120VpCgspg3rYwwm6Gia7jJNo1iDFTXjYdwwY16XZ+12LjxFwSBsDZDTE/ wB46rjw0qIiDbg93GZvKIOhAtktkAMS5gyCvuit0yQ2cw== X-Received: by 127.0.0.2 with SMTP id YX8jYY7687511xiTbbT5V4Yu; Tue, 14 Jan 2025 14:23:03 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.7407.1736893382994104107 for ; Tue, 14 Jan 2025 14:23:03 -0800 X-Received: from [10.137.194.171] (unknown [131.107.1.235]) by linux.microsoft.com (Postfix) with ESMTPSA id 7DE9F20BEBE1 for ; Tue, 14 Jan 2025 14:23:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7DE9F20BEBE1 Message-ID: <236138ad-b25d-4522-9d84-a3634980dbc5@linux.microsoft.com> Date: Tue, 14 Jan 2025 14:23:02 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: "devel@edk2.groups.io" From: "Oliver Smith-Denny via groups.io" Subject: [edk2-devel] GCC Linker Warnings and GCC 12 Requirement 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 Resent-Date: Tue, 14 Jan 2025 14:23:03 -0800 Resent-From: osde@linux.microsoft.com Reply-To: devel@edk2.groups.io,osde@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: zBKRlCkQvQ6OvFvQ2pRmzbP5x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=JL6f8neM; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi folks, I currently have PR https://github.com/tianocore/edk2/pull/10585 up to enable linker warnings as errors for MSVC and GCC builds. This helps catch critical errors produced at link time that edk2 builds were otherwise ignoring (e.g. things like not finding a module entry point and so defaulting to an address, which would cause executing at a random address in a binary). However, GCC12+ ld warns about RWX segments in the ELF binary that is being produced, which happens because of our custom linker script. I toyed around with the linker script, but did not get a configuration that produced different segments, it was always one RWX segment. However, in the end this doesn't actually matter, GenFw converts the ELF binary into a PE/COFF binary and then we apply the memory protections in FW based on our heuristics. So, I added --no-warn-rwx-segments, so that the warning, now produced to an error, would not break the build. This works for the edk2 containers, which are using GCC12+. However, I just noticed outside of the container that --no-warn-rwx-segments was also added in GCC12+. In older versions of GCC, ld will warn when an unrecognized linker option is passed. I have enabled fatal-warnings, so that warning gets promoted to an error and the build fails. There does not appear to be any way to not warn when unrecognized linker options are passed. So, for older than GCC12, adding --no-warn-rwx-segments and --fatal-warnings will break the build. It is easily fixable by removing them. I have left the PR up as it does not break edk2, as mentioned, and I believe that is the lesser of two evils, as we are protected against potentially bad linker warnings. I wanted to ensure folks were aware and had the opportunity to comment on the PR and/or propose different solutions. Thanks, Oliver -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120992): https://edk2.groups.io/g/devel/message/120992 Mute This Topic: https://groups.io/mt/110617354/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-