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

Support for musl libc under Linux #528

Merged
merged 2 commits into from
Mar 18, 2025
Merged

Support for musl libc under Linux #528

merged 2 commits into from
Mar 18, 2025

Conversation

se-mz
Copy link
Contributor

@se-mz se-mz commented Mar 13, 2025

I hope the commit messages explain the exact changes well enough.

I'm not super happy with the solution for mcheck.h, but as I understand it, start-mtrace and stop-mtrace are intended to be called manually for debugging purposes anyway, so it's not a big deal if the functions exist but fail.

se-mz added 2 commits March 13, 2025 14:14
Notably, this allows loading shared libraries on Linux systems using musl libc,
which uses displacements for DT_STRTAB.

The old logic based on negative displacements was nonsense because the dynamic
string table can't possibly come before the base address, so effectively, we
always assumed an absolute address under non-Android Linux. The new logic should
be mostly free of false positives, but since it's still guesswork, we only use
it when absolutely necessary.

Technically, the code for FreeBSD/Solaris/Android also changes here because the
displacement is no longer signed, but as explained above, displacements should
never be negative.
- Don't use the glibc-specific struct _libc_xmmreg

- Dummy out gnu_get_libc_version() if unavailable

- Remove unused fpu_control.h include

- Correct a typo in _LARGEFILE64_SOURCE (did nothing ever rely on lseek64?)

- Guard the glibc-specific mcheck.h behind __GLIBC__
@xrme xrme merged commit 1cca5bb into Clozure:master Mar 18, 2025
1 check passed
@xrme
Copy link
Member

xrme commented Mar 18, 2025

Thank you for your patch.

I am not worried about the mcheck stuff; as you note, it's for unusual debugging situations only anyway.

@se-mz se-mz deleted the musl-support branch March 18, 2025 20:11
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.

2 participants