aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGravatar Rob Landley <rob@landley.net>2006-04-17 21:47:03 +0000
committerGravatar Rob Landley <rob@landley.net>2006-04-17 21:47:03 +0000
commit559f7d8e92b03f961b6da3d16299e3b1a1bceaaa (patch)
tree83ff9593f82d0e0c1e6b2c8d7d5bd3cc345bd0b0 /docs
parent5c16988910f186582c4e4dd75cdd5ab5cfdeac39 (diff)
downloadbusybox-559f7d8e92b03f961b6da3d16299e3b1a1bceaaa.tar.gz
busybox-559f7d8e92b03f961b6da3d16299e3b1a1bceaaa.tar.bz2
Elf dynamic linker stuff from Rich Felker.
Diffstat (limited to 'docs')
-rw-r--r--docs/busybox.net/programming.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/busybox.net/programming.html b/docs/busybox.net/programming.html
index f5433f519..61777afb1 100644
--- a/docs/busybox.net/programming.html
+++ b/docs/busybox.net/programming.html
@@ -376,6 +376,41 @@ relocations with the environment variable "LD_DEBUG". Try
"LD_DEBUG=help /bin/true" for a list of commands. Learning to interpret
"LD_DEBUG=statistics cat /proc/self/statm" could be interesting.</p>
+<p>For more on this topic, here's Rich Felker:</p>
+<blockquote>
+<p>Dynamic linking (without fixed load addresses) fundamentally requires
+at least one dirty page per dso that uses symbols. Making calls (but
+never taking the address explicitly) to functions within the same dso
+does not require a dirty page by itself, but will with ELF unless you
+use -Bsymbolic or hidden symbols when linking.</p>
+
+<p>ELF uses significant additional stack space for the kernel to pass all
+the ELF data structures to the newly created process image. These are
+located above the argument list and environment. This normally adds 1
+dirty page to the process size.</p>
+
+<p>The ELF dynamic linker has its own data segment, adding one or more
+dirty pages. I believe it also performs relocations on itself.</p>
+
+<p>The ELF dynamic linker makes significant dynamic allocations to manage
+the global symbol table and the loaded dso's. This data is never
+freed. It will be needed again if libdl is used, so unconditionally
+freeing it is not possible, but normal programs do not use libdl. Of
+course with glibc all programs use libdl (due to nsswitch) so the
+issue was never addressed.</p>
+
+<p>ELF also has the issue that segments are not page-aligned on disk.
+This saves up to 4k on disk, but at the expense of using an additional
+dirty page in most cases, due to a large portion of the first data
+page being filled with a duplicate copy of the last text page.</p>
+
+<p>The above is just a partial list of the tiny memory penalties of ELF
+dynamic linking, which eventually add up to quite a bit. The smallest
+I've been able to get a process down to is 8 dirty pages, and the
+above factors seem to mostly account for it (but some were difficult
+to measure).</p>
+</blockquote>
+
<h2><a name="who">Who are the BusyBox developers?</a></h2>
<p>The following login accounts currently exist on busybox.net. (I.E. these