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

I#1973: fix build on musl libc #7168

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

ziyao233
Copy link
Contributor

This pull request allows DynamoRIO and all the tests to be built on musl libc,

  • Introduce MUSL macro and detect for musl libc in CMakeLists.txt
  • Add necessary macro and typedefs in core/unix/include/siginfo.h
  • Fix compilation of vendored elfutils
  • Temporarily use STDOUT/STDERR_FILENO when we need the underlying fds of
    stdout/stderr and suppress warnings for musl's opaque FILE type
  • Adjust linux.signal* tests to stay compatible with musl's SIGRTMAX, which is
    actually a function call, instead of a constant value

Tested on Alpine Linux, half of the tests are passed and it's possible to run
some applications (busybox, mutt and telegram-desktop) and some simple clients
(bbsize).

Issue: #1973

This introduces the MUSL macro.
bits/wordsize.h is a glibc-specific header, on musl __WORD_SIZE is
defined as LONG_BIT. This is okay since Linux kernel assumes the size
of long is equal to a machine word.
The pre-defined config.h is adjusted to match musl's features. We also
to build and link lib/error.c to provide functions for error message
handling.
As DynamoRIO enables -Werror by default, such warnings will prevent a
warning-aware build. Since we also issue a warnings during start up,
Let's remove it.
GCC on Alpine Linux enables "-Wtrampolines" by default, breaking the
test. Since Alpine is the most widely-used musl-based distribution, it's
worth to work around this: let's defaults to -Wno-trampoline on musl
systems.
Some glibc-specific APIs are used in the test, we need to port them to
musl.
DynamoRIO defines REG_* macros for compatibility with old clients, which
conflict with signal.h on musl. Use of pragma push_macro/pop_macro to
avoid messing musl's header up.
@ziyao233
Copy link
Contributor Author

@derekbruening thanks for your review

@abhinav92003
Copy link
Contributor

@derekbruening thanks for your review

If this PR is ready for review, please add a reviewer from the "Reviewers" list on the top-right1.

@ziyao233
Copy link
Contributor Author

@derekbruening thanks for your review

If this PR is ready for review, please add a reviewer from the "Reviewers" list on the top-right1.

I have no write access to the repository, thus cannot require a reviewer :/
It's ready for review and I'll be thankful if you could give me a helpful hand.

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