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: Cleanup of linking flags and improving structure #8440

Open
tejlmand opened this issue Jun 18, 2018 · 1 comment
Open

cmake: Cleanup of linking flags and improving structure #8440

tejlmand opened this issue Jun 18, 2018 · 1 comment
Assignees
Labels
area: Build System Enhancement Changes/Updates/Additions to existing features

Comments

@tejlmand
Copy link
Collaborator

I have noticed that several link flags are handled by populating:
set(zephyr_lnk
${LINKERFLAGPREFIX},-Map=${PROJECT_BINARY_DIR}/${KERNEL_MAP_NAME}
-u_OffsetAbsSyms
-u_ConfigAbsSyms
${E_KERNEL_ENTRY}
${LINKERFLAGPREFIX},--start-group
${LINKERFLAGPREFIX},--whole-archive
${ZEPHYR_LIBS_PROPERTY}
${LINKERFLAGPREFIX},--no-whole-archive
kernel
${OFFSETS_O_PATH}
${LINKERFLAGPREFIX},--end-group
${LIB_INCLUDE_DIR}
-L${PROJECT_BINARY_DIR}
${TOOLCHAIN_LIBS}
)

Instead it is possible to add those flags to the module,e.g. offset / kernel and then the target which links to offset / kernel will obtain those flags through CMake dependencies.
Thus, it is not needed to maintain a separate list.
As example:
-u_OffsetAbsSyms and -u_ConfigAbsSyms are required by the offset library.
${E_KERNEL_ENTRY} ${TOOLCHAIN_LIBS} on the kernel library

@nashif nashif added Enhancement Changes/Updates/Additions to existing features area: Build System labels Jun 18, 2018
tejlmand added a commit to tejlmand/zephyr that referenced this issue Jul 4, 2018
Fixes: zephyrproject-rtos#8440

This commit move the link flag ${TOOLCHAIN_LIBS} from the global list to
zephyr_interface and -u_ConfigAbsSyms to the zephyr library in order to
give a better structure as described in zephyrproject-rtos#8440

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
tejlmand added a commit to tejlmand/zephyr that referenced this issue Jul 4, 2018
Fixes: zephyrproject-rtos#8440

This commit moves kernel from the list in <zephyr_base>/CMakeLists.txt
and place it as a link dependency when linking to zephyr_interface.

It also links kernel to offsets to ensure correct link dependencies.

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
tejlmand added a commit to tejlmand/zephyr that referenced this issue Jul 4, 2018
Fixes: zephyrproject-rtos#8440

This commit moves the link flag  -u_OffsetAbsSyms which is required
when linking to offset static library.

The library offset thus propagates the flags correctly during linking.
It also ensures knowledge about link flags is present where it
correctly belongs.

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
tejlmand added a commit to tejlmand/zephyr that referenced this issue Dec 5, 2018
Fixes: zephyrproject-rtos#8440

This commit move the link flag ${TOOLCHAIN_LIBS} from the global list to
zephyr_interface and -u_ConfigAbsSyms to the zephyr library in order to
give a better structure as described in zephyrproject-rtos#8440

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
tejlmand added a commit to tejlmand/zephyr that referenced this issue Dec 5, 2018
Fixes: zephyrproject-rtos#8440

This commit moves kernel from the list in <zephyr_base>/CMakeLists.txt
and place it as a link dependency when linking to zephyr_interface.

It also links kernel to offsets to ensure correct link dependencies.

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
tejlmand added a commit to tejlmand/zephyr that referenced this issue Dec 5, 2018
Fixes: zephyrproject-rtos#8440

This commit moves the link flag  -u_OffsetAbsSyms which is required
when linking to offset static library.

The library offset thus propagates the flags correctly during linking.
It also ensures knowledge about link flags is present where it
correctly belongs.

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
@stephanosio stephanosio moved this to In progress in Build system Jan 12, 2023
@zephyrbot
Copy link
Collaborator

Hi @tejlmand,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@tejlmand you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System Enhancement Changes/Updates/Additions to existing features
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

3 participants