libphobos: Fix static build.

Message ID 20231116100155.2460745-1-yangyujie@loongson.cn
State Accepted
Headers
Series libphobos: Fix static build. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Yang Yujie Nov. 16, 2023, 10:01 a.m. UTC
  This is a temporary solution to
https://forum.dlang.org/thread/bug-12268-3@https.d.puremagic.com%2Fissues%2F

libphobos/ChangeLog:

	* libdruntime/gcc/sections/elf.d: Removes reference to __tls_get_addr for
	static libdruntime.
---
 libphobos/libdruntime/gcc/sections/elf.d | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/libphobos/libdruntime/gcc/sections/elf.d b/libphobos/libdruntime/gcc/sections/elf.d
index 5376957befd..46234ae7229 100644
--- a/libphobos/libdruntime/gcc/sections/elf.d
+++ b/libphobos/libdruntime/gcc/sections/elf.d
@@ -1091,7 +1091,9 @@  void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
             addr = addr + cast(c_ulong)__builtin_thread_pointer();
             return addr[0 .. sz];
         }
-        else
+        else version (Shared)
             return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
+        else
+            return null;
     }
 }