Skip to content

Conversation

@badochov
Copy link
Contributor

JIRA: RTOS-664

@badochov badochov requested a review from Darchiv March 28, 2025 11:58
@badochov badochov force-pushed the badochov/dynamic-linker branch from 4f3c590 to 99e99c0 Compare March 28, 2025 13:36
@@ -0,0 +1,41 @@
# Shared libraries

Phoenix-RTOS supports building shared libs and dynamically-linked executables. Shared libs are support on all MMU platforms but aarch64 and on NOMMU arm. On NOMMU the FDPIC format is used.

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 188]


To compile a library as a shared include of `include $(static-lib.mk)` to `include $(shared-lib.mk)`.

In cases of simple libraries this might be enough, however building a shared library is more similar to building a binary than a static library, thus more compilation options are available. Please refer for full list to `phoenix-rtos-build/makes/shared-lib.mk`. Most importantly libraries on which the shared library depends can be specified and few shared library specific options are available:

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 396]


### Building dynamically linked executable

In most cases compilation of a dynamically-linked executable is as easy as changing `include $(binary.mk)` to `include $(binary-dyn.mk)`.

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 137]


`binary-dyn.mk` additionally allows to specify:

- **DEP_LIBS_SHARED** - shared libraries from current repo needed to be compiled/installed before this component (shortcut for putting something in LIBS and DEPS)

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 162]


### ldconfig

To create correct symlinks for shared libraries `ldconfig` needs to run at system boot. So, it has to be added to startup script on targets using shared libs.

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 158]

@badochov badochov force-pushed the badochov/dynamic-linker branch 2 times, most recently from bc7aae9 to 42207ac Compare March 28, 2025 13:46
@badochov badochov force-pushed the badochov/dynamic-linker branch from 42207ac to b7b3b30 Compare March 28, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants