libglvnd is compiled for ARM mode, but asm stubs expect thumb mode
This was noted when investigating a build failure of a port dependent on the graphics/libglvnd
port of the FreeBSD ports collection. An upstream bug report can be found in PR #263845.
When building for AArch32, the build scripts of libglvnd do not supply any options to select thumb mode code generation. So by default, ARM mode code is generated. Yet the assembly snippets assume Thumb mode and tag their entry symbols as being for Thumb mode (see src/GLdispatch/vnd-glapi/entry_armv7_tsd.c).
As a result, the entry stubs are compiled as ARM code but executed as Thumb code, leading to unpredictable results (usually a crash).
Possible fixes are to either only supply .thumb_func
if the code is actually compiled for thumb mode or alternatively to supply compiler options such that the code is indeed compiled for thumb mode. Note that the latter solution means that the code will no longer compile for any targets preceeding Thumb2 support, which might not be desired.