WT-4198 conditional compilation modes were added for the following preprocessed assembly files:
The scope of this conditional compilation is too broad: the .note.GNU-stack section must always be emitted, since we still produce and link an object file for this TU whether.
As written, the section may not be emitted depending on the value of the HAVE_NO_CRC32_HARDWARE. In the event that the section is not emitted, the resulting object file will not be tagged as not requiring an executable stack. As a result, any binary into which the object file is linked will not be marked as not requiring an executable stack.
The solution is to move up the #endif that was added at the end of the file above the block responsible for injecting the section. I recommend adding a warning comment around the blocks to avoid this error in the future.
This change should be backported to 4.0, or to any other branch where WT commit 96f004261d6336f81fbd0bc245e8aa07e7cc24ac is backported.