diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-15 09:41:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-15 09:41:34 +0000 |
commit | 25e43e389c26d56f90f2f20e3cee19c808b2a18c (patch) | |
tree | fdadca249ffd70901103b3f06a98aeab695c6193 /cmake | |
parent | Adding debian version 5.6.1+really5.4.5-1. (diff) | |
download | xz-utils-25e43e389c26d56f90f2f20e3cee19c808b2a18c.tar.xz xz-utils-25e43e389c26d56f90f2f20e3cee19c808b2a18c.zip |
Merging upstream version 5.6.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | cmake/remove-ordinals.cmake | 5 | ||||
-rw-r--r-- | cmake/tuklib_common.cmake | 7 | ||||
-rw-r--r-- | cmake/tuklib_cpucores.cmake | 7 | ||||
-rw-r--r-- | cmake/tuklib_integer.cmake | 76 | ||||
-rw-r--r-- | cmake/tuklib_large_file_support.cmake | 7 | ||||
-rw-r--r-- | cmake/tuklib_mbstr.cmake | 7 | ||||
-rw-r--r-- | cmake/tuklib_physmem.cmake | 7 | ||||
-rw-r--r-- | cmake/tuklib_progname.cmake | 7 |
8 files changed, 84 insertions, 39 deletions
diff --git a/cmake/remove-ordinals.cmake b/cmake/remove-ordinals.cmake index 96419d5..de85ddf 100644 --- a/cmake/remove-ordinals.cmake +++ b/cmake/remove-ordinals.cmake @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: 0BSD + ############################################################################# # # remove-ordinals.cmake @@ -16,9 +18,6 @@ # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# ############################################################################# file(READ "${INPUT_FILE}" STR) diff --git a/cmake/tuklib_common.cmake b/cmake/tuklib_common.cmake index 088a3cb..a7f101f 100644 --- a/cmake/tuklib_common.cmake +++ b/cmake/tuklib_common.cmake @@ -1,11 +1,12 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_common.cmake - common functions and macros for tuklib_*.cmake files # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# function(tuklib_add_definitions TARGET_OR_ALL DEFINITIONS) # DEFINITIONS may be an empty string/list but it's fine here. There is diff --git a/cmake/tuklib_cpucores.cmake b/cmake/tuklib_cpucores.cmake index ea16e42..e5e9c34 100644 --- a/cmake/tuklib_cpucores.cmake +++ b/cmake/tuklib_cpucores.cmake @@ -1,11 +1,12 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_cpucores.cmake - see tuklib_cpucores.m4 for description and comments # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(CheckCSourceCompiles) diff --git a/cmake/tuklib_integer.cmake b/cmake/tuklib_integer.cmake index 949d2d9..7e1ed3c 100644 --- a/cmake/tuklib_integer.cmake +++ b/cmake/tuklib_integer.cmake @@ -1,11 +1,12 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_integer.cmake - see tuklib_integer.m4 for description and comments # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(TestBigEndian) @@ -59,25 +60,64 @@ function(tuklib_integer TARGET_OR_ALL) endif() endif() - # Unaligned access is fast on x86(-64), big endian PowerPC, and usually on - # 32/64-bit ARM too. There are others too and ARM could be a false match. - # - # Guess the default value for the option. - # CMake's ability to give info about the target arch seems bad. - # The the same arch can have different name depending on the OS. + # Guess that unaligned access is fast on these archs: + # - 32/64-bit x86 / x86-64 + # - 32/64-bit big endian PowerPC + # - 64-bit little endian PowerPC + # - Some 32-bit ARM + # - Some 64-bit ARM64 (AArch64) + # - Some 32/64-bit RISC-V # - # FIXME: The regex is based on guessing, not on factual information! - # - # NOTE: Compared to the Autoconf test, this lacks the GCC/Clang test - # on ARM and always assumes that unaligned is fast on ARM. + # CMake doesn't provide a standardized/normalized list of processor arch + # names. For example, x86-64 may be "x86_64" (Linux), "AMD64" (Windows), + # or even "EM64T" (64-bit WinXP). set(FAST_UNALIGNED_GUESS OFF) - if(CMAKE_SYSTEM_PROCESSOR MATCHES - "[Xx3456]86|^[Xx]64|^[Aa][Mm][Dd]64|^[Aa][Rr][Mm]|^aarch|^powerpc|^ppc") - if(NOT WORDS_BIGENDIAN OR - NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc|^ppc") - set(FAST_UNALIGNED_GUESS ON) + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" PROCESSOR) + + # There is no ^ in the first regex branch to allow "i" at the beginning + # so it can match "i386" to "i786", and "x86_64". + if(PROCESSOR MATCHES "[x34567]86|^x64|^amd64|^em64t") + set(FAST_UNALIGNED_GUESS ON) + + elseif(PROCESSOR MATCHES "^powerpc|^ppc") + if(WORDS_BIGENDIAN OR PROCESSOR MATCHES "64") + set(FAST_UNALIGNED_GUESS ON) + endif() + + elseif(PROCESSOR MATCHES "^arm|^aarch64|^riscv") + # On 32-bit and 64-bit ARM, GCC and Clang + # #define __ARM_FEATURE_UNALIGNED if + # unaligned access is supported. + # + # Exception: GCC at least up to 13.2.0 + # defines it even when using -mstrict-align + # so in that case this autodetection goes wrong. + # Most of the time -mstrict-align isn't used so it + # shouldn't be a common problem in practice. See: + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555 + # + # RISC-V C API Specification says that if + # __riscv_misaligned_fast is defined then + # unaligned access is known to be fast. + # + # MSVC is handled as a special case: We assume that + # 32/64-bit ARM supports fast unaligned access. + # If MSVC gets RISC-V support then this will assume + # fast unaligned access on RISC-V too. + check_c_source_compiles(" + #if !defined(__ARM_FEATURE_UNALIGNED) \ + && !defined(__riscv_misaligned_fast) \ + && !defined(_MSC_VER) + compile error + #endif + int main(void) { return 0; } + " + TUKLIB_FAST_UNALIGNED_DEFINED_BY_PREPROCESSOR) + if(TUKLIB_FAST_UNALIGNED_DEFINED_BY_PREPROCESSOR) + set(FAST_UNALIGNED_GUESS ON) endif() endif() + option(TUKLIB_FAST_UNALIGNED_ACCESS "Enable if the system supports *fast* unaligned memory access \ with 16-bit, 32-bit, and 64-bit integers." diff --git a/cmake/tuklib_large_file_support.cmake b/cmake/tuklib_large_file_support.cmake index 0800faa..4ed1d09 100644 --- a/cmake/tuklib_large_file_support.cmake +++ b/cmake/tuklib_large_file_support.cmake @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_large_file_support.cmake # @@ -8,9 +11,7 @@ # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(CheckCSourceCompiles) diff --git a/cmake/tuklib_mbstr.cmake b/cmake/tuklib_mbstr.cmake index e073be6..71e16cc 100644 --- a/cmake/tuklib_mbstr.cmake +++ b/cmake/tuklib_mbstr.cmake @@ -1,11 +1,12 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_mbstr.cmake - see tuklib_mbstr.m4 for description and comments # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(CheckSymbolExists) diff --git a/cmake/tuklib_physmem.cmake b/cmake/tuklib_physmem.cmake index f5ed888..e4888eb 100644 --- a/cmake/tuklib_physmem.cmake +++ b/cmake/tuklib_physmem.cmake @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_physmem.cmake - see tuklib_physmem.m4 for description and comments # @@ -6,9 +9,7 @@ # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(CheckCSourceCompiles) diff --git a/cmake/tuklib_progname.cmake b/cmake/tuklib_progname.cmake index d4ab006..a1f15bd 100644 --- a/cmake/tuklib_progname.cmake +++ b/cmake/tuklib_progname.cmake @@ -1,11 +1,12 @@ +# SPDX-License-Identifier: 0BSD + +############################################################################# # # tuklib_progname.cmake - see tuklib_progname.m4 for description and comments # # Author: Lasse Collin # -# This file has been put into the public domain. -# You can do whatever you want with this file. -# +############################################################################# include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake") include(CheckSymbolExists) |