Skip to content

Conversation

the-horo
Copy link
Contributor

Like it is done for the other assembly files, add the GNU-stack note.

Like it is done for the other assembly files, add the GNU-stack note.

Signed-off-by: Andrei Horodniceanu <[email protected]>
@the-horo
Copy link
Contributor Author

I hope that this doesn't break anything, but I have no way of testing riscv

@thewilsonator
Copy link
Contributor

cc @denizzzka

@denizzzka
Copy link
Contributor

denizzzka commented Aug 16, 2025

I checked this PR on QEMU rv64, Ubuntu 24.10 - compiler and druntime was built and druntime tests passed

@the-horo the-horo force-pushed the switch_context_riscv branch from 87e5683 to 0c5275f Compare August 17, 2025 07:03
@@ -6,6 +6,18 @@
* Authors: Denis Feklushkin
*/

#if (__linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__) && __ELF__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the #if needed? Seems better to include this section for all targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the #if here and in the other two files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the other files. This functionality is perhaps only available for ELF and GCC ld (I read that lld ignores this section and defaults to noexecstack for all object files), so the #if ELF may make sense in the other files that are used for broader range of targets including non-ELF ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if #if __ELF__ is enough. I've added it to all three files since they are all part of the build, regardless of target. The riscv-specificity comes from the code being in an #if defined(__riscv)

@JohanEngelen
Copy link
Member

JohanEngelen commented Aug 18, 2025

would it be possible to add a test for the noexecstack attribute of linked binaries produced by the compiler?

(also thikning about betterC programs that do not link any library. Those should default to noexecstack too, with an arcane option to bail out)

@the-horo the-horo force-pushed the switch_context_riscv branch from 381b50a to 45ca78d Compare August 18, 2025 10:00
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.

5 participants