-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Record dynamic dependencies in .note.dlopen elf section #13078
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
base: main
Are you sure you want to change the base?
Conversation
The data can be used with `dlopen-notes`. The raw date can be viewed with `objdump -j .note.dlopen -s libSDL3.so.0`
b327c8c
to
8f8fc35
Compare
Co-authored-by: Ben Boeckel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Feel free to merge if you get the thumbs up from @smcv
(Just a brief review for now, I'm not at work today) This doesn't seem right:
The list of SONAMEs is an "or" not an "and", so this is asking for: libX11.so.6 OR libXext.so.6 OR ... But I think SDL needs libX11.so.6 AND libXext.so.6 AND ... for X11 video? I believe the way you encode that is to have several JSON blobs that all say |
Looking at the spec: yes, this. The udev feature is doing this correctly: SDL will dlopen
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comments
Thanks for calling me out on my misunderstanding of the spec. |
I think the idea is that if they're all conceptually part of the same feature, then you list them as Example: https://sources.debian.org/src/systemd/257.5-2/src/shared/tpm2-util.c/ dlopens |
src/video/wayland/SDL_waylanddyn.c
Outdated
SDL_ELF_NOTE_DLOPEN( | ||
"wayland", | ||
"Support for Wayland video", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC | ||
); | ||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL | ||
SDL_ELF_NOTE_DLOPEN( | ||
"wayland-egl", | ||
"Support for Wayland video", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL | ||
); | ||
#endif | ||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR | ||
SDL_ELF_NOTE_DLOPEN( | ||
"wayland-cursor", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these (and the rest of the Wayland libraries) all be grouped as a "wayland"
topic? (the AND
pattern, similar to "x11"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to do this now.
With my initial prototype, dlopen-notes.py
was complaining about something and I somehow assumed identical ids were an error.
Running dlopen-notes.py libSDL3.so -f x11
now gives a nice list.
Though, should it be x11
, video
or video-x11
?
src/video/wayland/SDL_waylanddyn.c
Outdated
SDL_ELF_NOTE_DLOPEN( | ||
"wayland", | ||
"Support for Wayland video", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC | ||
); | ||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL | ||
SDL_ELF_NOTE_DLOPEN( | ||
"wayland-egl", | ||
"Support for Wayland video", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL | ||
); | ||
#endif | ||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR | ||
SDL_ELF_NOTE_DLOPEN( | ||
"wayland-cursor", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to do this now.
With my initial prototype, dlopen-notes.py
was complaining about something and I somehow assumed identical ids were an error.
Running dlopen-notes.py libSDL3.so -f x11
now gives a nice list.
Though, should it be x11
, video
or video-x11
?
src/video/SDL_egl.c
Outdated
SDL_ELF_NOTE_DLOPEN( | ||
"egl-opengl", | ||
"Support for OpenGL", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
DEFAULT_OGL, ALT_OGL | ||
); | ||
SDL_ELF_NOTE_DLOPEN( | ||
"egl-egl", | ||
"Support for EGL", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
DEFAULT_EGL | ||
); | ||
SDL_ELF_NOTE_DLOPEN( | ||
"egl-es2", | ||
"Support for EGL ES2", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
DEFAULT_OGL_ES2 | ||
); | ||
SDL_ELF_NOTE_DLOPEN( | ||
"egl-es-prv", | ||
"Support for EGL ES PVR", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
DEFAULT_OGL_ES_PVR | ||
); | ||
SDL_ELF_NOTE_DLOPEN( | ||
"egl-ogl-es", | ||
"Support for OpenGL ES", | ||
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, | ||
DEFAULT_OGL_ES | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about any of these.
The data can be used with
dlopen-notes
.The raw data can be viewed with
objdump -j .note.dlopen -s libSDL3.so.0
Please review the features/descriptions/priorities I've given
The feature string must be unique, and priority must be one of "required", "recommended" or "suggested".
The spec can be found here.
/cc @smcv
Extra embedded data
This is the output of running
python dlopen-notes.py
on my machine:The raw embedded data can be viewed with
objdump
:Output of
objdump -j .note.dlopen -s libSDL3.so.0
:So the extra data adds at least 3,368 bytes to the library.
Fixes #12971