loongson-community / discussions

Cross-community issue tracker & discussions / 跨社区工单追踪 & 讨论场所
9 stars 0 forks source link

Investigate BFD linker crashes possibly related to TLSDESC #64

Open xen0n opened 4 weeks ago

xen0n commented 4 weeks ago

Example: Debian mesa 24.2.0-2 build crash

This may be linked to the usage of TLSDESC, but I'm not sure at present.

On Gentoo I also noticed bus errors linking something while building sys-libs/glibc, with -mtls-dialect=desc globally set. On another box without TLSDESC enabled, glibc built without problems, so this is again highly suspect.

xry111 commented 4 weeks ago

When I built Glibc with -mtls-dialect=desc there was no strange crashes. Note that the Glibc library code is built with -ftls-model=initial-exec so only some tests use TLS descriptor.

xen0n commented 4 weeks ago

Important finding: I have specifically enabled additional CFLAGS for source debugging for glibc -- namely -ggdb3.

These CFLAGS work:

These don't:

So it's the combination of -mtls-dialect=desc -ggdb3 that produces the object code eventually crashing the BFD linker. Not related to code generation.

xry111 commented 3 weeks ago

Is there a reduced test case (one or several .s file(s))?

ywgrit commented 3 days ago

This issue has been fixed, refefence:https://patchwork.sourceware.org/project/binutils/patch/20240906010012.910300-1-wangxin03@loongson.cn/