-
Notifications
You must be signed in to change notification settings - Fork 11
shared-libs: add description #227
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
## Usage | ||
|
||
In target includes there are 3 variables connected to using shared libraries: | ||
|
||
- **LIBPHOENIX_PIC** - if libphoenix should be built as PIC | ||
|
||
- **LIBPHOENIX_SHARED** - if shared libphoenix should be built | ||
|
||
- **HAVE_SHLIB** - defines if target supports shared libraries | ||
|
||
**LIBPHOENIX_\*** flags may be overridden in project to control if it is meant to use shared libraries on not. | ||
|
||
### Building shared library | ||
|
||
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [markdownlint] reported by reviewdog 🐶 |
||
|
||
- **SONAME** - library soname, defaults to $(NAME).so, to disable set to 'nothing' | ||
|
||
- **LOCAL_VERSION_SCRIPT** - version script relative to current makefile | ||
|
||
### 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)`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [markdownlint] reported by reviewdog 🐶 |
||
|
||
`binary-dyn.mk` additionally allows specifying: | ||
|
||
- **DEP_LIBS_SHARED** - shared libraries from current repo needed to be compiled/installed before this component (shortcut for putting something in LIBS and DEPS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [markdownlint] reported by reviewdog 🐶 |
||
|
||
- **LIBS_SHARED** - names of the shared libs to link the binary against (without .so suffix) | ||
|
||
### 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [markdownlint] reported by reviewdog 🐶 |
||
|
||
Unfortunately, on SPARC targets read-only fs is used and user is on their own to correctly set paths in build time. |
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.
[markdownlint] reported by reviewdog 🐶
MD013/line-length Line length [Expected: 120; Actual: 188]