1# Linker config file format
2
3This document describes format of /system/etc/ld.config.txt file. This file can be used to customize
4linker-namespace setup for dynamic executables.
5
6## Overview
7
8The configuration consists of 2 parts
91. Mappings - maps executable locations to sections
102. Sections - contains linker-namespace configuration
11
12## Mappings
13
14This part of the document maps location of an executable to a section. Here is an example
15
16The format is `dir.<section_name>=<directory>`
17
18The mappings should be defined between start of ld.config.txt and the first section.
19
20## Section
21
22Every section starts with `[section_name]` (which is used in mappings) and it defines namespaces
23configuration using set of properties described in example below.
24
25## Example
26
27```
28# The following line maps section to a dir. Binraies ran from this location will use namespaces
29# configuration specified in [example_section] below
30dir.example_section=/system/bin/example
31
32# Section starts
33[example_section]
34
35# When this flag is set to true linker will set target_sdk_version for this binary to
36# the version specified in <dirname>/.version file, where <dirname> = dirname(executable_path)
37#
38# default value is false
39enable.target.sdk.version = true
40
41# This property can be used to declare additional namespaces.Note that there is always the default
42# namespace. The default namespace is the namespace for the main executable. This list is
43# comma-separated.
44additional.namespaces = ns1
45
46# Each namespace property starts with "namespace.<namespace-name>" The following is configuration
47# for the default namespace
48
49# Is namespace isolated - the default value is false
50namespace.default.isolated = true
51
52# Default namespace search path. Note that ${LIB} here is substituted with "lib" for 32bit targets
53# and with "lib64" for 64bit ones.
54namespace.default.search.paths = /system/${LIB}:/system/other/${LIB}
55
56# ... same for asan
57namespace.default.asan.search.paths = /data/${LIB}:/data/other/${LIB}
58
59# Permitted path
60namespace.default.permitted.paths = /system/${LIB}
61
62# ... asan
63namespace.default.asan.permitted.paths = /data/${LIB}
64
65# This declares linked namespaces - comma separated list.
66namespace.default.links = ns1
67
68# For every link define list of shared libraries. This is list of the libraries accessilbe from
69# default namespace but loaded in the linked namespace.
70namespace.default.link.ns1.shared_libs = libexternal.so:libother.so
71
72# This part defines config for ns1
73namespace.ns1.isolated = true
74namespace.ns1.search.paths = /vendor/${LIB}
75namespace.ns1.asan.search.paths = /data/vendor/${LIB}
76namespace.ns1.permitted.paths = /vendor/${LIB}
77namespace.ns1.asan.permitted.paths = /data/vendor/${LIB}
78
79# and links it to default namespace
80namespace.ns.links = default
81namespace.ns.link.default.shared_libs = libc.so:libdl.so:libm.so:libstdc++.so
82```
83
84