Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompCert puts constants in the text segment, which breaks under operating systems (e.g. OpenBSD) that make it execute-only #508

Open
monniaux opened this issue Jan 18, 2024 · 0 comments

Comments

@monniaux
Copy link
Contributor

monniaux commented Jan 18, 2024

Certain operating systems set the text segment execute-only as a security measure. This is most notably the case by default with OpenBSD on x86-64, AArch64, MIPS64, PowerPC32, PowerPC64, RISC-V, and SPARC64.

CompCert stores certain constants in the text segment. This is for instance the case of jump tables and two floating-point constants in __compcert_i64_dtou on x86-64. This breaks under those operating systems.

A workaround on OpenBSD is to assemble and link using cc -Wl,--no-execute-only.

I'm unsure of the implications of storing these constants in .rodata as opposed to .text.

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

No branches or pull requests

1 participant