Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,923
    • Issues 3,923
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #19962
Closed
Open
Created Nov 11, 2019 by Oscar Huang@oscarh

ARMClang: Option --cpu to armlink is problematic

I have a project with the following toochain defined:

#Cross compiling toolchain:
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER_TARGET aarch64-arm-none-eabi)
set(CMAKE_CXX_COMPILER_TARGET aarch64-arm-none-eabi)
set(CMAKE_ASM_COMPILER_TARGET aarch64-arm-none-eabi)
set(CMAKE_SYSTEM_PROCESSOR cortex-a53)
set(CMAKE_C_COMPILER armclang)
set(CMAKE_CXX_COMPILER armclang)

When run cmake, I got this error:

The C compiler
"/opt/arm/DS-5_v5.29.2/sw/ARMCompiler6.10.1/bin/armclang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/oscarh/data/temp/fooPrj/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_4a0d6/fast && /usr/bin/make -f CMakeFiles/cmTC_4a0d6.dir/build.make CMakeFiles/cmTC_4a0d6.dir/build
make[1]: Entering directory '/home/oscarh/data/temp/fooPrj/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4a0d6.dir/testCCompiler.o
/opt/arm/DS-5_v5.29.2/sw/ARMCompiler6.10.1/bin/armclang --target=arm-arm-none-eabi   -mcpu=cortex-a53    -o CMakeFiles/cmTC_4a0d6.dir/testCCompiler.o   -c /home/oscarh/data/temp/fooPrj/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_4a0d6.elf
/opt/cmake-3.16.0-rc3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4a0d6.dir/link.txt --verbose=1
/opt/arm/DS-5_v5.29.2/sw/ARMCompiler6.10.1/bin/armlink --cpu=cortex-a53    CMakeFiles/cmTC_4a0d6.dir/testCCompiler.o -o cmTC_4a0d6.elf --list cmTC_4a0d6.map
Fatal error: L3903U: Argument 'cortex-a53' not permitted for option 'cpu'.
Finished: 0 information, 0 warning, 0 error and 1 fatal error messages.
CMakeFiles/cmTC_4a0d6.dir/build.make:86: recipe for target 'cmTC_4a0d6.elf' failed

I think the problem is, cmake passed ${CMAKE_SYSTEM_PROCESSOR} directly to the --cpu option of armlink. In this case cortex-a53 is recognizable by armclang, but not by armlink. Actually, armlink cannot have --cpu at all for some targets, see this statement from armlink document:

You cannot specify targets with Armv8.4-A or later architectures on the armlink command-line. To link for such targets, you must not specify the --cpu option when invoking armlink directly

See original discussion at https://discourse.cmake.org/t/possible-bugs-with-armclang-toolchain/168

Edited Nov 12, 2019 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking