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

Add FreeBSD support using the same API as on Linux #5

Merged
merged 3 commits into from
May 14, 2024

Conversation

tunedal
Copy link
Contributor

@tunedal tunedal commented May 11, 2024

It turns out FreeBSD uses the same API as Linux for this, so it just works.

At least it does on 13.3 and later. FreeBSD 13.2 and earlier need a small tweak (as described on the bug tracker), but since 13.2 is only supported until the end of June, I'm not sure if it's worth complicating the code. It works on 13.2 with this change to linux.py:

RTLD_DEFAULT = -2
libc = ctypes.CDLL("", handle=RTLD_DEFAULT)

But supporting 13.3 and later doesn't need any changes. In that case, is it confusing to have linux.py support both Linux and FreeBSD? Should I add a new freebsd.py that just imports the Linux implementation?

@WardBrian
Copy link
Owner

It seems OpenBSD may support the same API? https://man.openbsd.org/dl_iterate_phdr
And even Solaris: https://docs.oracle.com/cd/E88353_01/html/E37843/dl-iterate-phdr-3c.html

The lack of free github CI on these platforms makes it hard to be confident. In terms of naming, perhaps unix is the least-incorrect catchall?

@WardBrian WardBrian enabled auto-merge (rebase) May 14, 2024 15:08
@WardBrian WardBrian merged commit 41e0520 into WardBrian:main May 14, 2024
6 checks passed
@WardBrian
Copy link
Owner

Thanks!

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