summaryrefslogtreecommitdiffstats
path: root/config.tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-03-21 16:33:56 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-03-24 21:50:50 +0100
commit39f657032b5e65bfcb93472201f6607c0388ba37 (patch)
tree037884810d4e54439ffd7cc3e965a5975178dd4a /config.tests
parent70c3dd4a54d3b72076bfc2edbd66fd5ccf0e3b28 (diff)
CMake: Generate and use a wrapper script for stripping binaries
MinGW 11.2.0 comes with a strip.exe that strips the ".gnu_debuglink" section in binaries, a section that is needed for the separate debug information feature. binutils version 2.34 mentions the feature for the first time: https://sourceware.org/binutils/docs-2.34/binutils/strip.html#strip To ensure the debuglink section is preserved, generate a shell wrapper that calls the original strip binary with an extra option to keep the required section. To determine if the option is supported, we build a real shared library on which strip will be called with the --keep-section option. If the option is not supported, a wrapper is not generated and the stock strip binary is used. This logic only applies when targeting Linux and MinGW + a shared library Qt. For other targets, the stock strip binary is used. Developers can opt out of this logic by passing -DQT_NO_STRIP_WRAPPER=TRUE when configuring each Qt repo. Pick-to: 6.2 6.3 Fixes: QTBUG-101653 Change-Id: Idd213d48d087d3c9600c853362aebaba348cde33 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'config.tests')
-rw-r--r--config.tests/binary_for_strip/CMakeLists.txt8
-rw-r--r--config.tests/binary_for_strip/lib1.cpp29
2 files changed, 37 insertions, 0 deletions
diff --git a/config.tests/binary_for_strip/CMakeLists.txt b/config.tests/binary_for_strip/CMakeLists.txt
new file mode 100644
index 0000000000..810e303629
--- /dev/null
+++ b/config.tests/binary_for_strip/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.16)
+project(proj LANGUAGES CXX)
+add_library(lib1 SHARED lib1.cpp)
+
+add_custom_target(print_lib_path ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "###$<TARGET_FILE:lib1>###"
+)
+add_dependencies(print_lib_path lib1)
diff --git a/config.tests/binary_for_strip/lib1.cpp b/config.tests/binary_for_strip/lib1.cpp
new file mode 100644
index 0000000000..b387dc4c4e
--- /dev/null
+++ b/config.tests/binary_for_strip/lib1.cpp
@@ -0,0 +1,29 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the utils of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+int libfunc() { return 0; }