Pārlūkot izejas kodu

X11: Link libgcc statically with use_static_cpp option

We were already linking libstdc++ statically for official binaries,
protecting us against most portability issues. But apparently since
we started using GCC 7 for official builds, we also need to link
libgcc statically for at least 32-bit builds to be portable.

Fixes #16409.

(cherry picked from commit b526088ae217de959cd395f5a74baf87552e0bbf)
Rémi Verschelde 7 gadi atpakaļ
vecāks
revīzija
bad7a8a657
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      platform/x11/detect.py

+ 3 - 2
platform/x11/detect.py

@@ -52,7 +52,7 @@ def get_opts():
 
 
     return [
     return [
         ('use_llvm', 'Use llvm compiler', 'no'),
         ('use_llvm', 'Use llvm compiler', 'no'),
-        ('use_static_cpp', 'link stdc++ statically', 'no'),
+        ('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', 'no'),
         ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
         ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
         ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
         ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
         ('use_lto', 'Use link time optimization', 'no'),
         ('use_lto', 'Use link time optimization', 'no'),
@@ -254,8 +254,9 @@ def configure(env):
     env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
     env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
     #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.gen.h',src_suffix = '.hlsl') } )
     #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.gen.h',src_suffix = '.hlsl') } )
 
 
+    # Link those statically for portability
     if (env["use_static_cpp"] == "yes"):
     if (env["use_static_cpp"] == "yes"):
-        env.Append(LINKFLAGS=['-static-libstdc++'])
+        env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
 
 
     list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
     list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
     if any(platform.machine() in s for s in list_of_x86):
     if any(platform.machine() in s for s in list_of_x86):