Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Fix 'gnuarmemb' auto-detection #45386

Conversation

lescopc
Copy link

@lescopc lescopc commented May 5, 2022

without 'specs=nosys.specs', GCC fails to compile a dummy C file

Fixes #45383

without 'specs=nosys.specs', GCC fails to compile a dummy C file
Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a valid change: see #45383 (comment)

@@ -24,6 +24,7 @@ set(BINTOOLS gnu)

set(CROSS_COMPILE_TARGET arm-none-eabi)
set(SYSROOT_TARGET arm-none-eabi)
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let alone the problem that this is trying to solve does not exist when using one of the supported configurations (see #45383 (comment)), this fix is wrong because --specs=nosys.specs is only valid when using the minimal libc. When using the newlib-nano, --specs=nano.specs is used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem occurs during the toolchain auto-detection only. The minimalc/newlib-nano choice is not done yet. CMake is checking if the toolchain found is usable by trying to compile a dummy C file (empty main()). It fails because the linker does not find the '_exit()' symbol. From what I read on ARM support forum (can't get my hands on it anymore...), it is normal as the toolchain is arm-none-eabi.
This fix should be harmless during the build stage as 'CMAKE_EXE_LINKER_FLAGS_INIT' variable is no longer used. Am I wrong?
(Note this flag is used in the same manner with the llvm/CLang toolchain)

@lescopc
Copy link
Author

lescopc commented May 20, 2022

Hello,
Can you give me a feedback on this pull-request?
Thx

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 20, 2022
@github-actions github-actions bot closed this Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmake: Support building inside MinGW/MSYS environment on Windows
4 participants