Commit Graph

13 Commits

Author SHA1 Message Date
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Daniel Brondani
688d9ee9c2 ARMClang: Remove orphaned linker --list option
Setting the `armlink --list` option without other diagnostic flags is
misleading because it produces an empty file and prevents the user from
printing diagnostics to the standard output or redirecting them to
another file.

It's unclear why the flag was added when support for ARMClang was first
added by commit 7b0abaac31 (ARMClang: Add support for Clang-based ARM
compiler, 2019-05-13, v3.15.0-rc1~111^2).

Fixes: #21538
2024-11-18 13:59:16 -05:00
Lingkai Dong
509ef50a06 ARMClang: Fix regression in check for working compiler
Given the compiler to use, `CMakeFindBinUtils.cmake` automatically
determines a number of tools including linker (CMAKE_LINKER) and archiver
(CMAKE_AR) and stores them in a generated file `CMakeCCompiler.cmake` as
non-CACHE entries. The compiler-specific ARMClang.cmake then tries to
override CMAKE_LINKER and CMAKE_AR as CACHE entries.

Following the introduction of CMP0126, which is set to NEW in the test
for a working compiler, setting a CACHE entry does not replace a normal
entry of the same name anymore, resulting in a failed test due to wrong
linker and archiver.

To fix this, set CMAKE_LINKER and CMAKE_AR for ARMClang directly in
`CMakeFindBinUtils.cmake` as is done for other compilers.  Check
for them in `ARMClang.cmake` to safeguard cases when a project explicitly
includes `ARMClang.cmake` prior to compiler determination (which some
projects do to work around other problems in older CMake versions).
2021-07-14 09:45:09 -04:00
Lingkai Dong
c4941b7e66 ARMClang: Do not automatically add cpu/arch compile or link options
The compile options `--march=<arch>` and `--mcpu=<cpu>` and the
link option `--cpu=<cpu>` are automatically added by CMake based
on `CMAKE_SYSTEM_PROCESSOR` or `CMAKE_SYSTEM_ARCH`. But this is not
sufficient, because armclang also supports enabling or disabling
features using `+<feature>`:

    -mcpu=<name>[+[no]<feature>+...]

For example:

    -mcpu=cortex-a57+nocrypto+nofp+nosimd+crc

(Reference: https://developer.arm.com/documentation/dui0774/k/Compiler-Command-line-Options/-mcpu?lang=en)

The problem is, even if a project adds a flag with features it needs,
CMake still adds flags, resulting in code that is compiled with wrong
CPU features and unable to run.

Add policy `CMP0123` to not automatically add compile or link options,
and let projects set them instead.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #21173
2021-04-27 14:03:15 -04:00
Brad King
0078db3888 ARMClang: Separate cpu/arch flags from preceding flags
Suggested-by: Kim Kryger
2021-04-27 13:58:57 -04:00
Brad King
8924b60f8d Merge topic 'armclang-fixes'
3d1ed986e2 ARMClang: Fix link line generation after addition of armlink support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Osama Moharam <osama.moharam.uw@renesas.com>
Merge-request: !5211
2020-09-11 08:30:33 -04:00
Marc Chevrier
3d1ed986e2 ARMClang: Fix link line generation after addition of armlink support
Revise logic added by commit 73fb6ac82b (ARMClang: Add support for
armlink, 2020-06-02, v3.18.0-rc1~27^2).

Fixes: #21154
2020-09-10 16:33:14 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Osama Moharam
2ff68c00e0 ARMClang: Fix typo in -Xlinker flag
Fix a typo from commit ef816610be (ARMClang: allow fallback to -march
and correct setting of --cpu flags, 2020-06-03, v3.18.0-rc1~18^2).
2020-06-18 07:43:22 -04:00
Osama Moharam
ef816610be ARMClang: allow fallback to -march and correct setting of --cpu flags
allows cmake to fall back to CMAKE_SYSTEM_ARCH in case CMAKE_SYSTEM_PROCESSOR is not in armclang -mcpu=list
additionally checks if CMAKE_SYSTEM_PROCESSOR belongs to armlink --cpu=list

Fixes: #19962
2020-06-03 16:58:31 +02:00
Osama Moharam
73fb6ac82b ARMClang: Add support for armlink
sets CMAKE_LIBRARY_PATH_FLAG to '--userlibpath=' when using armlink.

Fixes: #20761
2020-06-02 11:32:32 -04:00
Ben Boeckel
32e4f236b7 ARMClang: fix policy manipulation in the compiler module
Policies have their own scoping and cannot be set within a function
without affecting callers.
2019-05-23 09:19:59 -04:00
Johan Stridkvist
7b0abaac31 ARMClang: Add support for Clang-based ARM compiler
Fixes: #18215
2019-05-14 14:59:55 -04:00