Skip to content

Commit 99e99c0

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

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

building/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ guide.
395395
2. [Toolchain](toolchain.md)
396396
3. [Building script](script.md)
397397
4. [Reference project](project.md)
398-
5. [Table of Contents](../index.md)
398+
5. [Shared libraries](shared-lib.md)
399+
6. [Table of Contents](../index.md)
399400

400401
```{toctree}
401402
:hidden:

building/shared-libs.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Shared libraries
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+
9+
- **LIBPHOENIX_PIC** - if libphoenix should be be built as PIC
10+
11+
- **LIBPHOENIX_SHARED** - if shared libphoenix should be built
12+
13+
- **HAVE_SHLIB** - defines if target supports shared libraries
14+
15+
**LIBPHOENIX_\*** flags may be overridden in project to control if it is meant to use shared libraries on not.
16+
17+
### Building shared library
18+
19+
To compile a library as a shared include of `include $(static-lib.mk)` to `include $(shared-lib.mk)`.
20+
21+
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:
22+
23+
- **SONAME** - library soname, defaults to $(NAME).so, to disable set to 'nothing'
24+
25+
- **LOCAL_VERSION_SCRIPT** - version script relative to current makefile
26+
27+
### Building dynamically linked executable
28+
29+
In most cases compilation of a dynamically-linked executable is as easy as changing `include $(binary.mk)` to `include $(binary-dyn.mk)`.
30+
31+
`binary-dyn.mk` additionally allows to specify:
32+
33+
- **DEP_LIBS_SHARED** - shared libraries from current repo needed to be compiled/installed before this component (shortcut for putting something in LIBS and DEPS)
34+
35+
- **LIBS_SHARED** - names of the shared libs to link the binary against (without .so suffix)
36+
37+
### ldconfig
38+
39+
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.
40+
41+
Unfortunately, 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)