diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-06-16 19:24:59 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-06-16 21:56:09 +0200 |
commit | 13a4de6bf65d29a808ecd94b382ac0c1add9e0b3 (patch) | |
tree | 0d8ee56585893ada9a6c3387ed8901e2611628e0 /config.tests | |
parent | 335123f240c0b59cc62ad151dcf185160ef33696 (diff) | |
download | qtbase-13a4de6bf65d29a808ecd94b382ac0c1add9e0b3.tar.gz |
Remove target specific flags from the linker capabilities check
Remove target specific flags from static_link_order.
Move the check to the common config.tests folder.
Amends 5fb99e3860eb43f4bacacec7f4a4626cb0159b14
Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I1368075ec6bd1e743b2b89fd93143df38a278ec2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'config.tests')
-rw-r--r-- | config.tests/static_link_order/CMakeLists.txt | 22 | ||||
-rw-r--r-- | config.tests/static_link_order/main.cpp | 33 | ||||
-rw-r--r-- | config.tests/static_link_order/objlib.cpp | 33 | ||||
-rw-r--r-- | config.tests/static_link_order/staticlib1.cpp | 33 | ||||
-rw-r--r-- | config.tests/static_link_order/staticlib2.cpp | 30 |
5 files changed, 151 insertions, 0 deletions
diff --git a/config.tests/static_link_order/CMakeLists.txt b/config.tests/static_link_order/CMakeLists.txt new file mode 100644 index 0000000000..36ce10e87c --- /dev/null +++ b/config.tests/static_link_order/CMakeLists.txt @@ -0,0 +1,22 @@ +# The test represents the order-related issue that we have with the ld linker. +# +# CMake versions < 3.21.0 produce the following linker line: +# <binary_name> main.cpp -o static_link_order_test libstaticLib.a objlib.cpp.o +# Since 'static_link_order_test' doesn't have direct use of 'staticlib2.cpp.o' symbols +# the translation unit is not linked. When we link objlib.cpp.o it cannot resolve symbols from +# staticlib2.cpp.o. +# +# For now it's only applicable for ld-like linkers. 'lld' has no such issue. +cmake_minimum_required(VERSION 3.14) + +project(static_link_order_test LANGUAGES CXX) + +add_library(objLib OBJECT objlib.cpp) +add_library(staticLib STATIC staticlib1.cpp staticlib2.cpp) + +target_link_libraries(staticLib + INTERFACE objLib "$<TARGET_OBJECTS:objLib>" +) + +add_executable(static_link_order_test main.cpp) +target_link_libraries(static_link_order_test PRIVATE staticLib) diff --git a/config.tests/static_link_order/main.cpp b/config.tests/static_link_order/main.cpp new file mode 100644 index 0000000000..02f10d1620 --- /dev/null +++ b/config.tests/static_link_order/main.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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$ +** +****************************************************************************/ + +void staticLibFunc1(); + +int main() { + staticLibFunc1(); +} diff --git a/config.tests/static_link_order/objlib.cpp b/config.tests/static_link_order/objlib.cpp new file mode 100644 index 0000000000..c3889e04d7 --- /dev/null +++ b/config.tests/static_link_order/objlib.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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$ +** +****************************************************************************/ + +void staticLibFunc2(); + +void objLibFunc() { + staticLibFunc2(); +} diff --git a/config.tests/static_link_order/staticlib1.cpp b/config.tests/static_link_order/staticlib1.cpp new file mode 100644 index 0000000000..b2e933e510 --- /dev/null +++ b/config.tests/static_link_order/staticlib1.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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$ +** +****************************************************************************/ + +void objLibFunc(); + +void staticLibFunc1() { + objLibFunc(); +} diff --git a/config.tests/static_link_order/staticlib2.cpp b/config.tests/static_link_order/staticlib2.cpp new file mode 100644 index 0000000000..7e84289797 --- /dev/null +++ b/config.tests/static_link_order/staticlib2.cpp @@ -0,0 +1,30 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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$ +** +****************************************************************************/ + +void staticLibFunc2() { +} |