Chainloader: Fix runtime_init indirection symbol

pull/84/head
Andre Richter 4 years ago
parent eb69b6f861
commit 19763f8840
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -278,7 +278,7 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 0
diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 07_uart_chainloader/src/bsp/raspberrypi/link.ld
--- 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld
+++ 07_uart_chainloader/src/bsp/raspberrypi/link.ld
@@ -5,12 +5,16 @@
@@ -5,12 +5,15 @@
SECTIONS
{
@ -292,13 +292,12 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 07_uart_chainloader/s
{
- *(.text._start) *(.text*)
+ *(.text._start)
+ __runtime_init = .;
+ KEEP(*(.text.runtime_init))
+ *(.text*);
}
.rodata :
@@ -32,5 +36,14 @@
@@ -32,5 +35,16 @@
__bss_end_inclusive = . - 8;
}
@ -310,6 +309,8 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 07_uart_chainloader/s
+ /* Fill up to 8 byte, b/c relocating the binary is done in u64 chunks */
+ . = ALIGN(8);
+ __binary_end_inclusive = . - 8;
+
+ __runtime_init_reloc = runtime_init;
+
/DISCARD/ : { *(.comment*) }
}
@ -323,7 +324,7 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 07_uart_chainloader
extern "Rust" {
+ static __binary_start: UnsafeCell<u64>;
+ static __binary_end_inclusive: UnsafeCell<u64>;
+ static __runtime_init: UnsafeCell<u64>;
+ static __runtime_init_reloc: UnsafeCell<u64>;
static __bss_start: UnsafeCell<u64>;
static __bss_end_inclusive: UnsafeCell<u64>;
}
@ -367,7 +368,7 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 07_uart_chainloader
+/// The relocated address of function `runtime_init()`.
+#[inline(always)]
+pub fn relocated_runtime_init_addr() -> *const u64 {
+ unsafe { __runtime_init.get() as _ }
+ unsafe { __runtime_init_reloc.get() as _ }
+}
+
+/// Return the inclusive range spanning the relocated .bss section.

@ -12,7 +12,6 @@ SECTIONS
.text :
{
*(.text._start)
__runtime_init = .;
KEEP(*(.text.runtime_init))
*(.text*);
}
@ -45,5 +44,7 @@ SECTIONS
. = ALIGN(8);
__binary_end_inclusive = . - 8;
__runtime_init_reloc = runtime_init;
/DISCARD/ : { *(.comment*) }
}

@ -14,7 +14,7 @@ use core::{cell::UnsafeCell, ops::RangeInclusive};
extern "Rust" {
static __binary_start: UnsafeCell<u64>;
static __binary_end_inclusive: UnsafeCell<u64>;
static __runtime_init: UnsafeCell<u64>;
static __runtime_init_reloc: UnsafeCell<u64>;
static __bss_start: UnsafeCell<u64>;
static __bss_end_inclusive: UnsafeCell<u64>;
}
@ -83,7 +83,7 @@ pub fn relocated_binary_range_inclusive() -> RangeInclusive<*mut u64> {
/// The relocated address of function `runtime_init()`.
#[inline(always)]
pub fn relocated_runtime_init_addr() -> *const u64 {
unsafe { __runtime_init.get() as _ }
unsafe { __runtime_init_reloc.get() as _ }
}
/// Return the inclusive range spanning the relocated .bss section.

@ -270,7 +270,7 @@ diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 08
diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/link.ld 08_timestamps/src/bsp/raspberrypi/link.ld
--- 07_uart_chainloader/src/bsp/raspberrypi/link.ld
+++ 08_timestamps/src/bsp/raspberrypi/link.ld
@@ -5,16 +5,12 @@
@@ -5,15 +5,12 @@
SECTIONS
{
@ -283,14 +283,13 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/link.ld 08_timestamps/src/bsp/
.text :
{
- *(.text._start)
- __runtime_init = .;
- KEEP(*(.text.runtime_init))
- *(.text*);
+ *(.text._start) *(.text*)
}
.rodata :
@@ -36,14 +32,5 @@
@@ -35,16 +32,5 @@
__bss_end_inclusive = . - 8;
}
@ -302,6 +301,8 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/link.ld 08_timestamps/src/bsp/
- /* Fill up to 8 byte, b/c relocating the binary is done in u64 chunks */
- . = ALIGN(8);
- __binary_end_inclusive = . - 8;
-
- __runtime_init_reloc = runtime_init;
-
/DISCARD/ : { *(.comment*) }
}
@ -315,7 +316,7 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/memory.rs 08_timestamps/src/bs
extern "Rust" {
- static __binary_start: UnsafeCell<u64>;
- static __binary_end_inclusive: UnsafeCell<u64>;
- static __runtime_init: UnsafeCell<u64>;
- static __runtime_init_reloc: UnsafeCell<u64>;
static __bss_start: UnsafeCell<u64>;
static __bss_end_inclusive: UnsafeCell<u64>;
}
@ -358,7 +359,7 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/memory.rs 08_timestamps/src/bs
-/// The relocated address of function `runtime_init()`.
-#[inline(always)]
-pub fn relocated_runtime_init_addr() -> *const u64 {
- unsafe { __runtime_init.get() as _ }
- unsafe { __runtime_init_reloc.get() as _ }
-}
-
-/// Return the inclusive range spanning the relocated .bss section.

Loading…
Cancel
Save