Home | History | Annotate | Download | only in linker
      1 # Linker config file format
      2 
      3 This document describes format of /system/etc/ld.config.txt file. This file can be used to customize
      4 linker-namespace setup for dynamic executables.
      5 
      6 ## Overview
      7 
      8 The configuration consists of 2 parts
      9 1. Mappings - maps executable locations to sections
     10 2. Sections - contains linker-namespace configuration
     11 
     12 ## Mappings
     13 
     14 This part of the document maps location of an executable to a section. Here is an example
     15 
     16 The format is `dir.<section_name>=<directory>`
     17 
     18 The mappings should be defined between start of ld.config.txt and the first section.
     19 
     20 ## Section
     21 
     22 Every section starts with `[section_name]` (which is used in mappings) and it defines namespaces
     23 configuration 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
     30 dir.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
     39 enable.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.
     44 additional.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
     50 namespace.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.
     54 namespace.default.search.paths = /system/${LIB}:/system/other/${LIB}
     55 
     56 # ... same for asan
     57 namespace.default.asan.search.paths = /data/${LIB}:/data/other/${LIB}
     58 
     59 # Permitted path
     60 namespace.default.permitted.paths = /system/${LIB}
     61 
     62 # ... asan
     63 namespace.default.asan.permitted.paths = /data/${LIB}
     64 
     65 # This declares linked namespaces - comma separated list.
     66 namespace.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.
     70 namespace.default.link.ns1.shared_libs = libexternal.so:libother.so
     71 
     72 # This part defines config for ns1
     73 namespace.ns1.isolated = true
     74 namespace.ns1.search.paths = /vendor/${LIB}
     75 namespace.ns1.asan.search.paths = /data/vendor/${LIB}
     76 namespace.ns1.permitted.paths = /vendor/${LIB}
     77 namespace.ns1.asan.permitted.paths = /data/vendor/${LIB}
     78 
     79 # and links it to default namespace
     80 namespace.ns.links = default
     81 namespace.ns.link.default.shared_libs = libc.so:libdl.so:libm.so:libstdc++.so
     82 ```
     83 
     84