When Branch Target Identifier (BTI) is enabled on aarch64,
any software which run libglvnd will fail with SIGILL, Illegal instruction.
This is because some assembler code misses the BTI landing pads.
See: https://developer.arm.com/documentation/102433/0100/Jump-oriented-programming
"hint #34" is the same thing as "BTI C" landing pad, but keep
compatibility with systems without BTI enabled.
Remove the "If only executable code is distributed..." paragraph from
the license text. Everything now uses a normal MIT license.
The only code from Khronos that's included in libglvnd is the EGL/GL
header and XML files, which do not contain that paragraph.
Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/221
LLVM currently ignores inline assembly references to symbols during
dead code and data elimination while linking with link-time optimizations
enabled.
This manifests in a very large amount of unresolved references to
entrypointFunctions when building libglvnd using clang with LTO enabled.
This issue fixes#220 by marking the entrypointFunctions array as used,
using a compiler attribute.
Signed-off-by: Charlotte Delenk <darkkirb@darkkirb.de>
Add .arm and .thumb directives before and after the ARMv7 GLX dispatch stubs.
The function addresses that get passed around don't take Thumb into account, so
if they're compiled as Thumb, then they'd still get executed as ARM, which
would cause them to crash a SIGILL.
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.
Rewrote the generated dispatch stubs for GLX so that they're all defined at
compile time, instead of generating them at runtime.
Insted of patching the address of the vendor-provided functions into the
assembly stubs, it will now keep a separate array of function pointers. The
assembly stubs will look up the approprite entry in that array and jump to it.
As a result, the assembly code is entirely static, so we don't need to deal
with generating or modifying executable code at runtime.