diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-05-23 09:14:54 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-05-25 16:29:31 -0700 |
commit | fdd7227c67fd54456b8c0f2348630ef04b4d2a5e (patch) | |
tree | b23ac00c253ff9a2d915a587d80d570d8c6d2577 /config.tests | |
parent | 845491ed3b38eb756cd73cf4161f440559c9a6a6 (diff) | |
download | qtbase-fdd7227c67fd54456b8c0f2348630ef04b4d2a5e.tar.gz |
CMake: Test the linker too for -mno-direct-extern-access
The GNU binutils ld linker needed a patch after the tagging of 2.38 to
make the new feature work. Before this patch, the linker will fail to
link when protected visibility symbols are used in the library, so don't
enable the feature unless the linker is recent enough.
GNU binutils gold from that version passes this test.
LLVM lld is unknown (I didn't test), but LLVM was consulted in
developing the feature.
Fixes: QTBUG-103493
Change-Id: Ibcde9b9795ad42ac9978fffd16f1c80ca20953ff
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'config.tests')
-rw-r--r-- | config.tests/direct_extern_access/CMakeLists.txt | 9 | ||||
-rw-r--r-- | config.tests/direct_extern_access/lib.cpp | 10 | ||||
-rw-r--r-- | config.tests/direct_extern_access/lib.h | 16 | ||||
-rw-r--r-- | config.tests/direct_extern_access/main.cpp | 12 |
4 files changed, 47 insertions, 0 deletions
diff --git a/config.tests/direct_extern_access/CMakeLists.txt b/config.tests/direct_extern_access/CMakeLists.txt new file mode 100644 index 0000000000..50a35f1d02 --- /dev/null +++ b/config.tests/direct_extern_access/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.16) +project(direct_extern_access LANGUAGES CXX) + +# this is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087 + +add_library(no_extern_access_lib SHARED lib.cpp) +add_executable(no_extern_access_main main.cpp) +target_compile_options(no_extern_access_lib PUBLIC "-mno-direct-extern-access") +target_link_libraries(no_extern_access_main no_extern_access_lib) diff --git a/config.tests/direct_extern_access/lib.cpp b/config.tests/direct_extern_access/lib.cpp new file mode 100644 index 0000000000..6cbc85571f --- /dev/null +++ b/config.tests/direct_extern_access/lib.cpp @@ -0,0 +1,10 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: MIT + +// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087 + +#define BUILD +#include "lib.h" + +S::~S() { } +void S::f() { } diff --git a/config.tests/direct_extern_access/lib.h b/config.tests/direct_extern_access/lib.h new file mode 100644 index 0000000000..d35b52f135 --- /dev/null +++ b/config.tests/direct_extern_access/lib.h @@ -0,0 +1,16 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: MIT + +// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087 + +#ifdef BUILD +# define LIB_API __attribute__((visibility("protected"))) +#else +# define LIB_API __attribute__((visibility("default"))) +#endif + +struct LIB_API S +{ + virtual ~S(); + virtual void f(); +}; diff --git a/config.tests/direct_extern_access/main.cpp b/config.tests/direct_extern_access/main.cpp new file mode 100644 index 0000000000..9cf0323766 --- /dev/null +++ b/config.tests/direct_extern_access/main.cpp @@ -0,0 +1,12 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: MIT + +// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087 + +#include "lib.h" + +struct Local : S { }; +int main() +{ + Local l; +} |