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 -=-=-=-=-=-=-=-=-=-=-=- 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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-