diff options
| author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-17 21:47:03 +0000 |
|---|---|---|
| committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-17 21:47:03 +0000 |
| commit | 91eceab07aff9da641d1dafe68bcd7344a3d8644 (patch) | |
| tree | 83ff9593f82d0e0c1e6b2c8d7d5bd3cc345bd0b0 | |
| parent | a5e4bc35cddd6a51c8828f6aa9cc31ef75c44ee9 (diff) | |
| download | busybox-w32-91eceab07aff9da641d1dafe68bcd7344a3d8644.tar.gz busybox-w32-91eceab07aff9da641d1dafe68bcd7344a3d8644.tar.bz2 busybox-w32-91eceab07aff9da641d1dafe68bcd7344a3d8644.zip | |
Elf dynamic linker stuff from Rich Felker.
git-svn-id: svn://busybox.net/trunk/busybox@14900 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | docs/busybox.net/programming.html | 35 |
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 | |||
| 376 | "LD_DEBUG=help /bin/true" for a list of commands. Learning to interpret | 376 | "LD_DEBUG=help /bin/true" for a list of commands. Learning to interpret |
| 377 | "LD_DEBUG=statistics cat /proc/self/statm" could be interesting.</p> | 377 | "LD_DEBUG=statistics cat /proc/self/statm" could be interesting.</p> |
| 378 | 378 | ||
| 379 | <p>For more on this topic, here's Rich Felker:</p> | ||
| 380 | <blockquote> | ||
| 381 | <p>Dynamic linking (without fixed load addresses) fundamentally requires | ||
| 382 | at least one dirty page per dso that uses symbols. Making calls (but | ||
| 383 | never taking the address explicitly) to functions within the same dso | ||
| 384 | does not require a dirty page by itself, but will with ELF unless you | ||
| 385 | use -Bsymbolic or hidden symbols when linking.</p> | ||
| 386 | |||
| 387 | <p>ELF uses significant additional stack space for the kernel to pass all | ||
| 388 | the ELF data structures to the newly created process image. These are | ||
| 389 | located above the argument list and environment. This normally adds 1 | ||
| 390 | dirty page to the process size.</p> | ||
| 391 | |||
| 392 | <p>The ELF dynamic linker has its own data segment, adding one or more | ||
| 393 | dirty pages. I believe it also performs relocations on itself.</p> | ||
| 394 | |||
| 395 | <p>The ELF dynamic linker makes significant dynamic allocations to manage | ||
| 396 | the global symbol table and the loaded dso's. This data is never | ||
| 397 | freed. It will be needed again if libdl is used, so unconditionally | ||
| 398 | freeing it is not possible, but normal programs do not use libdl. Of | ||
| 399 | course with glibc all programs use libdl (due to nsswitch) so the | ||
| 400 | issue was never addressed.</p> | ||
| 401 | |||
| 402 | <p>ELF also has the issue that segments are not page-aligned on disk. | ||
| 403 | This saves up to 4k on disk, but at the expense of using an additional | ||
| 404 | dirty page in most cases, due to a large portion of the first data | ||
| 405 | page being filled with a duplicate copy of the last text page.</p> | ||
| 406 | |||
| 407 | <p>The above is just a partial list of the tiny memory penalties of ELF | ||
| 408 | dynamic linking, which eventually add up to quite a bit. The smallest | ||
| 409 | I've been able to get a process down to is 8 dirty pages, and the | ||
| 410 | above factors seem to mostly account for it (but some were difficult | ||
| 411 | to measure).</p> | ||
| 412 | </blockquote> | ||
| 413 | |||
| 379 | <h2><a name="who">Who are the BusyBox developers?</a></h2> | 414 | <h2><a name="who">Who are the BusyBox developers?</a></h2> |
| 380 | 415 | ||
| 381 | <p>The following login accounts currently exist on busybox.net. (I.E. these | 416 | <p>The following login accounts currently exist on busybox.net. (I.E. these |
