Skip to contentSkip to conversation

mesa: Disable asm on musl

PATCH Superseded Khem Raj 1 participant 1 message Oct 3, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 mesa: Disable asm on musl

Musl started blocking dlopen of libs with initial-exec references into dynamic TLS area, via

https://github.com/kraj/musl/commit/5c2f46a214fceeee3c3e41700c51415e0a4f1acd

prior to that commit, musl was loading it and silently letting subsequent TLS accesses via the miscompiled code clobber memory that didn't belong to them

This was wrong behavior and it relied on additional space reserved by libc in TLS space to adjust fo such broken libs, but it also fails with glibc if the reserved space was already used up

Right fix is that mesa should be patched to remove all the initial-exec hacks and use real TLS, and -mtls-dialect=gnu2 (TLSDESC) should be used on archs it's supported on (i386, x86_64, and aarch64) to make up for the lost performance, but mesa hardcodes the initial-exec, so there must be a reason that probably is better known to mesa devs.

but we 'fixed' it for musl by adding --disable-glx-tls for mesa in OE, which uses pthread_getspecific instead and makes is lot slower.

this caused additional problems with security flags on, it get textrels in .text segment. Therefore this is 'second fix' to get us through this warning.

Cause is some unknown part of mesa's x86 assembly code is broken by readonly text segments

[ YOCTO #12918 ]

---
 meta/recipes-graphics/mesa/mesa.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/mesa/mesa.inc +1 -1
index 8d0e2cb67c..e6f3712706 100644
@@ -107,7 +107,7 @@ PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}"
 PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind"
 
 EXTRA_OECONF_remove_libc-musl = "--enable-glx-tls"
-EXTRA_OECONF_append_libc-musl = " --disable-glx-tls"
+EXTRA_OECONF_append_libc-musl = " --disable-asm --disable-glx-tls"
 # llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
 FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
 
Signature · 1 line
2.19.0