meson: combine checks for linker --gc-sections support
authorDylan Baker <dylan.c.baker@intel.com>
Thu, 2 Feb 2023 21:05:33 +0000 (13:05 -0800)
committerEric Engestrom <eric@engestrom.ch>
Wed, 8 Feb 2023 20:34:44 +0000 (20:34 +0000)
commit28e5823a68b4474b064b5cc092febd82a558f499
treeab14929dbd03e42e6dbafe5e112745bd0e2a1acf
parentb742313eaf70dfd740d035426d33b61279c85720
meson: combine checks for linker --gc-sections support

We first do an incomplete check for whether the linker supports
--gc-sections, then potentially add C and C++ arguments assuming that it
works, then later do a complete check to see if it actually works and
use --gc-sections. This means we can end up putting functions and data
in separate sections when we can't gc them.

Combine the checks, do less work, and be more accurate.

fixes: f51ce21e4e0bf7efabe58afb4a2cd6b9f98d9505
       ("meson: Drop adding -Wl,--gc-sections to project c/cpp arguments.")

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21083>
(cherry picked from commit fd9b50aa1c07512c46ec981f19ea68fa4b8d7b4f)
.pick_status.json
meson.build