History log of /haiku/src/system/runtime_loader/images.cpp
Revision Date Author Comments
# a21676b6 18-Feb-2022 David Karoly <karolyd577@gmail.com>

runtime_loader: adjust MAX_PAGE_SIZE for ARM

gcc generates binaries with segments aligned on 0x10000
because this is the max page size defined in bfd

This change allows runtime_loader to load ARM binaries
without complaining for unreasonable amount of space
between segments.

Change-Id: Iec345980ca7ff72786173772a6deb40f5ca0b0ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4974
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 9266cd66 29-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

extended_image_info: Add text_delta field

Needed to offset a symbol address read from the symbol table to the
actual load address.


# 8c6cb8af 26-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

runtime loader: Register extended image info with kernel

Add structure extended_image_info which extends image_info by the
fields symbol_table, symbol_hash, string_table.


# 078b88b1 21-Oct-2015 Simon South <ssouth@simonsouth.com>

runtime_loader: Randomly position only relocatable code

The use of an unreliable test for relocatability effectively broke
runtime_loader's support for non-position-independent executables, as it
would insist on randomly positioning these files' segments in memory
anyway causing the program to quickly crash.

With this change runtime_loader uses the object type specified in the
file's header to determine whether its segments can be safely relocated,
restoring support for non-PI executables.

Fixes #12427.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 368dd377 18-Oct-2014 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Fix missing include of util/kernel_cpp.h.

Due to the missing include, the builtin new and delete operators were
used in those two files instead of the ones from the include used
everywhere else in the runtime_loader.


# 44c0c4d3 03-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: add support for ELF based TLS

This patch introduces support of ELF based TLS handling with lazy allocation
and initalization of TLS block for each DSO and thread. The implementation
generally follows the official ABI except that generation counter in dtv
is in fact a pointer to Generation object that contains both generation
counter and size of the dtv. That simplified the implementation a bit, but
could be changed later. The ABI requirements regariding in memory position
of TLS block is not honoured what results in static TLS model being
unsupported. However, that should not be a problem as long as
"executables" in Haiku are in fact shared objects and optimizations which
require specific TLS block in memory layout are not possible anyway.


# 5d0a1da8 14-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: make all areas executable for old binaries

* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
* B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
the introduction of DEP and apps need it to correctly set area protection.
The latter is currently needed only to recognize stack areas and fix their
protection in compatibility mode, but may also be useful if an app wants
to use sigaltstack from POSIX API.


# 26b24237 23-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: Always map program image at random position


# bf65fc1d 09-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

vm: remove B_RANDOMIZED_IMAGE_ADDRESS address specification

This address specification is actually not needed since PIC images can be
located anywhere. Only their size is restriced but that is the compiler and
linker concern. Thanks to Alex Smith for pointing that out.


# 4cafc0ac 04-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: use long type for region delta


# 65ed4fa9 03-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

vm: implement B_RANDOMIZED_IMAGE_ADDRESS address specification

On some 64 bit architectures program and library images have to be mapped in
the lower 2 GB of the address space (due to instruction pointer relative
addressing). Address specification B_RANDOMIZED_IMAGE_ADDRESS ensures that
created area satisfies that requirement.


# 0cf91fc1 26-Feb-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: randomize position of relocatable images

Use B_RANDOMIZED_BASE for creating areas for relocatable segments.


# 12b3e8a8 28-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support x86_64 in the runtime loader.

* Added x86_64 linker script and relocation code.
* Some 64-bit safety fixes to the heap code.
* Added runtime_loader, libroot and bash to the x86_64 image. The boot
script will be launched, but will panic shortly after because fork
is broken.


# e3ac2588 25-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed runtime_loader to use elf_* typedefs over Elf32_*.

This means that it will be using ELF64 types on x86_64 rather than
ELF32. The next step for supporting x86_64 is to implement relocations.


# b6455c08 07-Aug-2011 Axel Dörfler <axeld@pinc-software.de>

* Implemented dladdr() in the runtime loader. This is like a gazillion times
faster than before.
* This also solves a TODO in dladdr(), although I did not use
get_library_symbol() as I didn't quite see how that could fit as the comment
suggested; there is now a new function get_symbol_at_address() for this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42598 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f83c5cd 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

No need to use loadAddress as delta as delta isn't used for i==0. CID3197, CID 1972 and ticket #6990.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c0241d8 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

While the functions didn't use the delta for i==0 accessing arrays at [0 - 1] can't be good.
CID 3197.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39974 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e60625b7 04-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

get_sorted_image_list(): Allow passing a NULL image argument, meaning that
all loaded images will be sorted and returned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0ef0e3cf 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Map read-only segments over-committing for the relocation. This prevents the
kernel from committing memory for all read-only segments until we're done
relocating. This allows Haiku to boot on machines with less RAM and swap
disabled. At least in qemu I could boot with 100 MB and start WebPositive.
Probably fixed #5822.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36552 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4dafcc3b 04-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Since we potentially split segments into different regions, we need to
consider that when filling in the text and data ranges of the image info.
This fixes #5361 and #5351, caused by libtracker.so not finding its own
image.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35407 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3609af39 19-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Renamed _kern_reserve_heap_address_range() to _kern_reserve_address_range(),
and added a _kern_unreserve_address_range() as well.
* The runtime loader now reserves the space needed for all its areas first
to make sure there is enough space left for all areas of a single image.
* This also fixes the final part of bug #4008.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31115 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 82db8a9e 19-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added an "unmapAddressRange" argument to the file mapping syscall. This is
the first part of making the runtime loader behave itself; it should already
make Clockwerk run okay with any number of translators (even if not all of
them will work yet).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94830eb2 20-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved most code of the heavy elf.cpp into several smaller source files.
* Some style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 368dd377989a07862be20f87c23329734b2277d8 18-Oct-2014 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Fix missing include of util/kernel_cpp.h.

Due to the missing include, the builtin new and delete operators were
used in those two files instead of the ones from the include used
everywhere else in the runtime_loader.


# 44c0c4d3d0d68c3c3db23858b1089d3cf51bdf16 03-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: add support for ELF based TLS

This patch introduces support of ELF based TLS handling with lazy allocation
and initalization of TLS block for each DSO and thread. The implementation
generally follows the official ABI except that generation counter in dtv
is in fact a pointer to Generation object that contains both generation
counter and size of the dtv. That simplified the implementation a bit, but
could be changed later. The ABI requirements regariding in memory position
of TLS block is not honoured what results in static TLS model being
unsupported. However, that should not be a problem as long as
"executables" in Haiku are in fact shared objects and optimizations which
require specific TLS block in memory layout are not possible anyway.


# 5d0a1da8bf914d4a26bba97ba40cbb36bf99ce52 14-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: make all areas executable for old binaries

* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
* B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
the introduction of DEP and apps need it to correctly set area protection.
The latter is currently needed only to recognize stack areas and fix their
protection in compatibility mode, but may also be useful if an app wants
to use sigaltstack from POSIX API.


# 26b2423794219b1fa70cc486a24787ed6a3a2921 23-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: Always map program image at random position


# bf65fc1dfe8daefa37b83d5551a85ec8fd65a8d5 09-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

vm: remove B_RANDOMIZED_IMAGE_ADDRESS address specification

This address specification is actually not needed since PIC images can be
located anywhere. Only their size is restriced but that is the compiler and
linker concern. Thanks to Alex Smith for pointing that out.


# 4cafc0acab0fecc88fa5eeafef25ca587aab59d9 04-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: use long type for region delta


# 65ed4fa908cce8864aee0905014bb802857d601d 03-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

vm: implement B_RANDOMIZED_IMAGE_ADDRESS address specification

On some 64 bit architectures program and library images have to be mapped in
the lower 2 GB of the address space (due to instruction pointer relative
addressing). Address specification B_RANDOMIZED_IMAGE_ADDRESS ensures that
created area satisfies that requirement.


# 0cf91fc14f4a183b2c252a8e276133be9895d121 26-Feb-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: randomize position of relocatable images

Use B_RANDOMIZED_BASE for creating areas for relocatable segments.


# 12b3e8a8a01e04da03da98410425695880e96347 28-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support x86_64 in the runtime loader.

* Added x86_64 linker script and relocation code.
* Some 64-bit safety fixes to the heap code.
* Added runtime_loader, libroot and bash to the x86_64 image. The boot
script will be launched, but will panic shortly after because fork
is broken.


# e3ac2588e64059e0c140504e9acc8e73b3c36fdc 25-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed runtime_loader to use elf_* typedefs over Elf32_*.

This means that it will be using ELF64 types on x86_64 rather than
ELF32. The next step for supporting x86_64 is to implement relocations.


# b6455c080b61ccff5a6c3fc6d35761ed040b6fb9 07-Aug-2011 Axel Dörfler <axeld@pinc-software.de>

* Implemented dladdr() in the runtime loader. This is like a gazillion times
faster than before.
* This also solves a TODO in dladdr(), although I did not use
get_library_symbol() as I didn't quite see how that could fit as the comment
suggested; there is now a new function get_symbol_at_address() for this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42598 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f83c5cd843d86319591dd9a996c8567f097c834 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

No need to use loadAddress as delta as delta isn't used for i==0. CID3197, CID 1972 and ticket #6990.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c0241d8b58c01aeb50dd69a683fd4786eeb3367 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

While the functions didn't use the delta for i==0 accessing arrays at [0 - 1] can't be good.
CID 3197.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39974 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e60625b70883c4de1faff59729329d31dc1a5c90 04-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

get_sorted_image_list(): Allow passing a NULL image argument, meaning that
all loaded images will be sorted and returned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0ef0e3cfa03381777a38cc9fa4db3e8b19680250 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Map read-only segments over-committing for the relocation. This prevents the
kernel from committing memory for all read-only segments until we're done
relocating. This allows Haiku to boot on machines with less RAM and swap
disabled. At least in qemu I could boot with 100 MB and start WebPositive.
Probably fixed #5822.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36552 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4dafcc3b3b2af1f9c2f5d29d24fa3dedc4dc87d0 04-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Since we potentially split segments into different regions, we need to
consider that when filling in the text and data ranges of the image info.
This fixes #5361 and #5351, caused by libtracker.so not finding its own
image.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35407 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3609af391d646e2629e70e7b214a79ed57578ffc 19-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Renamed _kern_reserve_heap_address_range() to _kern_reserve_address_range(),
and added a _kern_unreserve_address_range() as well.
* The runtime loader now reserves the space needed for all its areas first
to make sure there is enough space left for all areas of a single image.
* This also fixes the final part of bug #4008.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31115 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 82db8a9e159b60e775b4cab31d54ac40fe95de53 19-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added an "unmapAddressRange" argument to the file mapping syscall. This is
the first part of making the runtime loader behave itself; it should already
make Clockwerk run okay with any number of translators (even if not all of
them will work yet).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94830eb226ce51bd1fd0143bad2538f788883e85 20-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved most code of the heavy elf.cpp into several smaller source files.
* Some style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96