vnd-glapi: allow asm to be used on ELFv2 ppc64 big endian
These entry points are actually not little endian specific, but they are specific to ELFv2 ABI. ELFv2 ABI can be used on either little or big endian, and there are distributions doing so (e.g. Void Linux, Adélie Linux) as well as other OSes transitioning (FreeBSD).
These have been confirmed to work on a Power Mac G5 running Void Linux.
Testsuite passes:
[1/10] Compiling C object 'tests/dummy/bdc5d17@@patchentrypoints@sta/patchentrypoints.c.o'.
[2/10] Linking static target tests/dummy/libpatchentrypoints.a.
[3/10] Linking target tests/dummy/libGLX_dummy.so.
[4/10] Generating GLX_dummy.so.0 with a custom command.
[5/10] Linking target tests/dummy/libEGL_dummy0.so.
[6/10] Linking target tests/dummy/libEGL_dummy1.so.
[7/10] Generating EGL_dummy0.so.0 with a custom command.
[8/10] Generating EGL_dummy1.so.0 with a custom command.
[9/10] Linking target tests/testgldispatch.
[9/10] Running all tests.
1/33 glvnd:symbols / OpenGL symbols check OK 0.36 s
2/33 glvnd:egl+symbols / EGL symbols check OK 0.28 s
3/33 glvnd:glx+symbols / GLX symbols check OK 0.28 s
4/33 glvnd:symbols / GL symbols check OK 1.14 s
5/33 glvnd:symbols / GLESv1 symbols check OK 0.28 s
6/33 glvnd:symbols / GLESv2 symbols check OK 0.28 s
7/33 glvnd:gldispatch / gldispatch static OK 0.02 s
8/33 glvnd:gldispatch / gldispatch static thr OK 0.02 s
9/33 glvnd:gldispatch / gldispatch generated OK 0.02 s
10/33 glvnd:gldispatch / gldispatch generated end OK 0.28 s
11/33 glvnd:gldispatch / gldispatch generated thr OK 0.02 s
12/33 glvnd:gldispatch / gldispatch generated thr end OK 0.29 s
13/33 glvnd:gldispatch / gldispatch patched OK 0.24 s
14/33 glvnd:gldispatch / gldispatch patched end OK 0.43 s
15/33 glvnd:gldispatch / gldispatch patched thr OK 0.24 s
16/33 glvnd:gldispatch / gldispatch patched thr end OK 0.48 s
17/33 glvnd:gldispatch / testgldispatchthread OK 0.02 s
18/33 glvnd:glx / glxcreatecontext OK 0.02 s
19/33 glvnd:glx / glxmakecurrent (basic) OK 0.03 s
20/33 glvnd:glx / glxmakecurrent (loop) OK 0.03 s
21/33 glvnd:glx / glxmakecurrent (threads) OK 1.84 s
22/33 glvnd:glx / glxmakecurrent (oldlink) OK 0.04 s
23/33 glvnd:glx / glxgetprocess OK 0.02 s
24/33 glvnd:glx / glxgetprocess_genentry OK 0.02 s
25/33 glvnd:glx / glxgetprocaddress_genentry OK 0.88 s
26/33 glvnd:glx / glxgetclientstr OK 0.02 s
27/33 glvnd:glx / glxgetqueryversion OK 0.02 s
28/33 glvnd:egl / egldisplay OK 0.04 s
29/33 glvnd:egl / egldevice OK 0.02 s
30/33 glvnd:egl / eglgetprocaddress OK 0.02 s
31/33 glvnd:egl / eglmakecurrent OK 0.02 s
32/33 glvnd:egl / eglerror OK 0.02 s
33/33 glvnd:egl / egldebug OK 0.02 s
Ok: 33
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/q66/libglvnd/build/meson-logs/testlog.txt
Linux maya 5.4.1_1 #1 SMP Fri Nov 29 16:10:17 UTC 2019 ppc64 GNU/Linux
There was an issue in patchentrypoints.c
which is technically incorrect on either BE or LE, but only manifests on BE. I fixed it as a part of this MR.
--- a/tests/dummy/patchentrypoints.c
+++ b/tests/dummy/patchentrypoints.c
@@ -176,9 +176,9 @@ static void patch_ppc64(char *writeEntry, const char *execEntry,
// 1000:
0x7D2903A6, // mtctr 9
0xE96C0020, // ld 11, 9000f-1000b(12)
- 0xE92B0000, // ld 9, 0(11)
+ 0x812B0000, // lwz 9, 0(11)
0x39290001, // addi 9, 9, 1
- 0xF92B0000, // std 9, 0(11)
+ 0x912B0000, // stw 9, 0(11)
0x7D2902A6, // mfctr 9
0x4E800020, // blr
0x60000000, // nop
Turns out it was using ld
and std
(doubleword instructions) on an int *
(which works on LE but not on BE). Changing to lwz
and stw
respectively fixed the problem. Thanks Samuel Holland for helping me figure this out.
Moved from Github PR: https://github.com/NVIDIA/libglvnd/pull/194