Skip to content

Commit 4f3c590

Browse files
author
Hubert Badocha
committed
shared-libs: add description
JIRA: RTOS-664
1 parent 0d4de8c commit 4f3c590

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

shared-libs/shared-libs.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Shared libs
2+
3+
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.
4+
5+
## Usage
6+
7+
In target includes there are 3 variables connected to using shared libraries:
8+
- **LIBPHOENIX_PIC** - if libphoenix should be be built as PIC
9+
- **LIBPHOENIX_SHARED** - if shared libphoenix should be built
10+
- **HAVE_SHLIB** - defines if target supports shared libraries
11+
12+
**LIBPHOENIX_\*** flags may be overriden in project to control if it is meant to use shared libraries on not.
13+
14+
### Shared libs
15+
To compile a library as a shared include of `include $(static-lib.mk)` to `include $(shared-lib.mk)`.
16+
17+
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:
18+
- **SONAME** - library soname, defaults to $(NAME).so, to disable set to 'nothing'
19+
- **LOCAL_VERSION_SCRIPT** - version script relative to current makefile
20+
21+
### Dynamically linked executable
22+
In most cases compilation of a dynamically-linked executable is as easy as changing `include $(binary.mk)` to `include $(binary-dyn.mk)`.
23+
24+
`binary-dyn.mk` additionally allows to specify:
25+
- **DEP_LIBS_SHARED** - shared libraries from current repo needed to be compiled/installed before this component (shortcut for putting something in LIBS and DEPS)
26+
- **LIBS_SHARED** - names of the shared libs to link the binary against (without .so suffix)
27+
28+
### ldconfig
29+
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.
30+
31+
Unfortunatelly, on SPARC targets read-only fs is used and user is on their own to correctly set paths in build time.

0 commit comments

Comments
 (0)