Skip to content

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented May 30, 2025

From what I have been able to find, compilers that try to emit object files compatible with a GNU linker appear to add a .note.GNU-stack section if the stack should not be executable (this section is empty). We never want an executable stack, so extend the object file check to verify that object files with any executable sections also have this .note.GNU-stack section.

This appears to match what is done by scanelf to emit !WX 1, which is the tool used to create the output in the issue.

Closes: #183

@tgross35 tgross35 force-pushed the check-wx-sections branch from ada5714 to 9f44c32 Compare May 30, 2025 02:44
@tgross35
Copy link
Contributor Author

Thumb makes sense to skip as a bare metal target. Note sure about ppc64

@tgross35

This comment was marked as outdated.

@tgross35

This comment was marked as outdated.

@tgross35
Copy link
Contributor Author

tgross35 commented Jun 2, 2025

It seems like the PowerPC behavior is intentional; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21098

@tgross35 tgross35 force-pushed the check-wx-sections branch 3 times, most recently from b6e06fd to fea76d5 Compare June 14, 2025 23:48
@tgross35 tgross35 force-pushed the check-wx-sections branch 2 times, most recently from adfbd2f to 1531b9d Compare September 7, 2025 08:16
From what I have been able to find, compilers that try to emit object
files compatible with a GNU linker appear to add a `.note.GNU-stack`
section if the stack should not be writeable (this section is empty). We
never want a writeable stack, so extend the object file check to verify
that object files with any executable sections also have this
`.note.GNU-stack` section.

This appears to match what is done by `scanelf` to emit `!WX` [2], which
is the tool used to create the output in the issue.

Closes: rust-lang#183

[1]: https://github.com/gentoo/pax-utils/blob/9ef54b472e42ba2c5479fbd86b8be2275724b064/scanelf.c#L428-L512

update

update

debug

update

fix asm file
@tgross35 tgross35 force-pushed the check-wx-sections branch 8 times, most recently from f6d4714 to 52e4faf Compare September 12, 2025 08:03
@tgross35 tgross35 force-pushed the check-wx-sections branch 2 times, most recently from ca874ea to fdb8c4e Compare September 12, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parts of libcompiler_builtins are compiled as WX
1 participant