aco: don't split store data if it was already split into more elements
[mesa.git] / meson.build
index 2b30ab014b698a9519f4ea75e8fa9e8b2cecb1e5..5d7b31123044c0e203297d2337b72892edcda582 100644 (file)
@@ -1757,6 +1757,19 @@ else
   dep_lmsensors = null_dep
 endif
 
+# If the compiler supports it, put function and data symbols in their
+# own sections and GC the sections after linking.  This lets drivers
+# drop shared code unused by that specific driver (particularly
+# relevant for Vulkan drivers).
+if cc.has_link_argument('-Wl,--gc-sections')
+  add_project_arguments('-Wl,--gc-sections', language : ['c', 'cpp'])
+  foreach a: ['-ffunction-sections', '-fdata-sections']
+    if cc.has_argument(a)
+      add_project_arguments(a, language : ['c', 'cpp'])
+    endif
+  endforeach
+endif
+
 foreach a : pre_args
   add_project_arguments(a, language : ['c', 'cpp'])
 endforeach