ldso: Make truly self relocatable

On Linux the linker can now be loaded at arbitrary addresses, this became
necessary for newer kernel versions. The 'linux_arm' target is not supported.

Issue #1728
This commit is contained in:
Sebastian Sumpf
2015-11-26 10:30:23 +01:00
committed by Christian Helmuth
parent e74b53d5dd
commit 41b9f6bd03
13 changed files with 144 additions and 31 deletions

View File

@@ -20,12 +20,14 @@
/*
* We cannot just include <semaphore.h> and <pthread.h> here
* because this would impy the nested inclusion of a myriad
* because this would imply the nested inclusion of a myriad
* of Linux types and would pollute the namespace for everyone
* who includes this header file. We want to cleanly separate
* Genode from POSIX.
*/
extern Genode::addr_t _context_area_start;
namespace Genode {
/**
@@ -129,10 +131,11 @@ namespace Genode {
* Thread-context area configuration.
*
* Please update platform-specific files after changing these
* values, e.g., 'base-linux/src/platform/context_area.*.ld'.
* functions, e.g., 'base-linux/src/ld/context_area.*.ld'.
*/
static constexpr addr_t context_area_virtual_base() {
return 0x40000000UL; }
static addr_t context_area_virtual_base() {
return align_addr((addr_t)&_context_area_start, 20); }
static constexpr addr_t context_area_virtual_size() {
return 0x10000000UL; }

View File

@@ -20,6 +20,9 @@ SECTIONS
{
. = 0x40000000;
_context_area_start = .;
.context_area : { . += 0x10000000; } : context_area
_context_area_end = .;
/*
* Since Linux loads ldso page aligned, we align the context area after
* loading to a 1 MiB boundary, therefore we reserve one MiB more here.
*/
.context_area : { . += 0x10100000; } : context_area
}

View File

@@ -16,5 +16,4 @@ SECTIONS
. = 0x40000000;
_context_area_start = .;
.context_area : { . += 0x10000000; }
_context_area_end = .;
}

View File

@@ -19,6 +19,12 @@
extern "C" int raw_write_str(const char *str);
/**
* Define context area
*/
Genode::addr_t _context_area_start;
enum { verbose_atexit = false };