-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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: linker: lld: add missing -no-pie flag #51900
cmake: linker: lld: add missing -no-pie flag #51900
Conversation
See also zephyrproject-rtos#38903 This is required when building tests for native_posix on ubuntu 22.04 using clang-14 from the normal deb repository. Signed-off-by: Christian Taedcke <[email protected]>
Hmm, I'm wondering if it's due some changes in clang or it was always broken? |
The only thing i noticed is this issue did not occur with zephyr 3.1 using the same build environment. But i don't know for sure if lld was used there (using the default zephyr config when setting |
@@ -11,6 +11,7 @@ macro(toolchain_ld_base) | |||
# TOOLCHAIN_LD_FLAGS comes from compiler/clang/target.cmake | |||
# LINKERFLAGPREFIX comes from linker/lld/target.cmake | |||
zephyr_ld_options( | |||
-no-pie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think other linkers will need this also? Maybe it should be added to compiler/clang/target.cmake instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. I basically copied it from https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/linker/ld/target_base.cmake#L14 to the same place for lld. But i think it would probably be good to align setting the "-no-pie" option for the compiler and linker in a similar way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks reasonable to me with the current macro based linker handling we have.
At some point we might we might want to align more to the compiler approach, as in #24851, but that's a different story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
See also #38903
This is required when building tests for native_posix on ubuntu 22.04 using clang-14 from the normal deb repository.
Signed-off-by: Christian Taedcke [email protected]