[Mesa-dev] [PATCH] egl/dri2: add a libname to dlopen for OpenBSD

Eric Engestrom eric.engestrom at imgtec.com
Mon Oct 17 15:39:34 UTC 2016


On Monday, 2016-10-17 22:53:20 +1100, Jonathan Gray wrote:
> On Mon, Oct 17, 2016 at 12:39:11PM +0100, Emil Velikov wrote:
> > On 17 October 2016 at 10:53, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> > > On Sunday, 2016-10-16 16:38:35 +1100, Jonathan Gray wrote:
> > >> On OpenBSD try to dlopen 'libglapi.so', ld.so will find
> > >> the highest major/minor version and open it in this case.
> > >>
> > >> Avoids '#error Unknown glapi provider for this platform' at build time.
> > >>
> > >> Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> > >
> > > LGTM, and I guess the other *BSD will want the same since 7a9c92d0 broke
> > > them too.
> > >
> > I'm not 100% sure about that. OpenBSD (unlike other BSD) did bump the
> > major when the ABI breaks due to 'internal' changes - think of
> > off_t/time_t on 32 vs 64bit systems and alike.
> > 
> > Unlike Linux kernel/distros, BSDs tend to be more relaxed when in
> > comes to ABI, I believe. Don't quote me on that one ;-)
> 
> OpenBSD tends to favour simplified interfaces over backwards compatiblity
> and is more like a research system in that respect.  As the kernel
> and userland are one source tree ioctl compat largely doesn't exist.
> System calls get deprecated and removed over the course of a few releases.
> So we didn't go through the pain of duplicated systems calls for off_t
> as mentioned, and don't go in for symbol versioning.  Just major.minor
> library versioning, which is roughly symbol removals, major crank,
> symbol additions minor crank.
> 
> I believe FreeBSD tends to go in for backwards compatibility more
> but am not familiar with the details.  They also have a different ld.so.
> 
> Perhaps an else case for 'libglapi.so.0' would be appropriate for all
> the other various unices instead of the #error ?

Yeah actually, I'm thinking reverting this hunk of 7a9c92d0 might be a better,
to avoid the potentially huge list of every *BSD and other Unix:

----8<----
@@ -2808,10 +2808,8 @@ dri2_load(_EGLDriver *drv)
    const char *libname = "libglapi.0.dylib";
 #elif defined(__CYGWIN__)
    const char *libname = "cygglapi-0.dll";
-#elif defined(__linux__)
+#else
    const char *libname = "libglapi.so.0";
-#else
-#error Unknown glapi provider for this platform
 #endif
    void *handle;
 
---->8----

> 
> > 
> > > Fixes: 7a9c92d071d010066349 ("egl/dri2: non-shared glapi cleanups")
> > > Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
> > >
> > > Side note, I don't understand why we hardcode the version everywhere
> > > (except Android). I can see it's been like that since that code was
> > > added nearly 6 years ago (218381d9), but I couldn't find an explanation
> > > in the logs, or any mention of it in the thread I found [1].
> > > Emil, do you know?
> > >
> > The ABI must be stable. Since a) we (and linux distros in general)
> > have the greater flexibility to "mix and match" components and b)
> > glapi is/was used by xserver as well, the initial goal was that the
> > ABI should not break, ever. See some the src/mapi changes by Brian
> > Paul, which rework the nop calls due to different calling convention
> > and stack corruption on Windows and the follow up fix to keep those
> > Windows only and stable for everyone else
> > be71bbfaa2ad201b570b56847a13328fc359d0ee.

Right, makes sense. Thanks for spending the time to educate me :P

> > 
> > Emil


More information about the mesa-dev mailing list