196 lines
4.3 KiB
Diff
196 lines
4.3 KiB
Diff
From cfb0c462b822a8b611044981f0f76a73a16e61ed Mon Sep 17 00:00:00 2001
|
|
From: Jason Montleon <jmontleo@redhat.com>
|
|
Date: Mon, 24 Jun 2024 02:29:30 -0400
|
|
Subject: [PATCH 4/7] Sync elf_riscv64_efi.lds with gnu-efi
|
|
|
|
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
|
|
---
|
|
elf_riscv64_efi.lds | 134 ++++++++++++++++++++++++++------------------
|
|
1 file changed, 79 insertions(+), 55 deletions(-)
|
|
|
|
diff --git a/elf_riscv64_efi.lds b/elf_riscv64_efi.lds
|
|
index 82bf118..e2bd896 100644
|
|
--- a/elf_riscv64_efi.lds
|
|
+++ b/elf_riscv64_efi.lds
|
|
@@ -1,21 +1,37 @@
|
|
+/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */
|
|
+
|
|
OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
|
|
OUTPUT_ARCH(riscv)
|
|
ENTRY(_start)
|
|
SECTIONS
|
|
{
|
|
- .text 0x0 : {
|
|
+ . = 0;
|
|
+ ImageBase = .;
|
|
+ /* .hash and/or .gnu.hash MUST come first! */
|
|
+ .hash : { *(.hash) }
|
|
+ .gnu.hash : { *(.gnu.hash) }
|
|
+ . = ALIGN(4096);
|
|
+ .eh_frame : { *(.eh_frame) }
|
|
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
|
|
+ .gcc_except_table : { *(.gcc_except_table*) }
|
|
+ . = ALIGN(4096);
|
|
+ .text : {
|
|
_text = .;
|
|
- *(.text.head)
|
|
*(.text)
|
|
*(.text.*)
|
|
*(.gnu.linkonce.t.*)
|
|
- _evtext = .;
|
|
- . = ALIGN(4096);
|
|
+ *(.plt)
|
|
+ . = ALIGN(16);
|
|
}
|
|
_etext = .;
|
|
- _text_size = . - _text;
|
|
- _text_vsize = _evtext - _text;
|
|
-
|
|
+ _text_size = _etext - _text;
|
|
+ . = ALIGN(65536);
|
|
+ .reloc :
|
|
+ {
|
|
+ KEEP (*(.reloc))
|
|
+ }
|
|
+ . = ALIGN(4096);
|
|
+ .dynamic : { *(.dynamic) }
|
|
. = ALIGN(4096);
|
|
.data :
|
|
{
|
|
@@ -27,7 +43,32 @@ SECTIONS
|
|
*(.got.plt)
|
|
*(.got)
|
|
|
|
- *(.dynamic)
|
|
+ /*
|
|
+ * Note that these aren't the using the GNU "CONSTRUCTOR" output section
|
|
+ * command, so they don't start with a size. Because of p2align and the
|
|
+ * end/END definitions, and the fact that they're mergeable, they can also
|
|
+ * have NULLs which aren't guaranteed to be at the end.
|
|
+ */
|
|
+ . = ALIGN(16);
|
|
+ __init_array_start = .;
|
|
+ *(SORT(.init_array.*))
|
|
+ *(.init_array)
|
|
+ __init_array_end = .;
|
|
+ . = ALIGN(16);
|
|
+ __CTOR_LIST__ = .;
|
|
+ *(SORT(.ctors.*))
|
|
+ *(.ctors)
|
|
+ __CTOR_END__ = .;
|
|
+ . = ALIGN(16);
|
|
+ __DTOR_LIST__ = .;
|
|
+ *(SORT(.dtors.*))
|
|
+ *(.dtors)
|
|
+ __DTOR_END__ = .;
|
|
+ . = ALIGN(16);
|
|
+ __fini_array_start = .;
|
|
+ *(SORT(.fini_array.*))
|
|
+ *(.fini_array)
|
|
+ __fini_array_end = .;
|
|
|
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
|
it all into .data: */
|
|
@@ -36,23 +77,36 @@ SECTIONS
|
|
*(.sbss)
|
|
*(.scommon)
|
|
*(.dynbss)
|
|
- *(.bss)
|
|
+ *(.bss*)
|
|
*(COMMON)
|
|
- _evdata = .;
|
|
- . = ALIGN(4096);
|
|
+ *(.rel.local)
|
|
+ . = ALIGN(16);
|
|
+
|
|
_bss_end = .;
|
|
}
|
|
+
|
|
+ . = ALIGN(4096);
|
|
+ .rela :
|
|
+ {
|
|
+ *(.rela.text*)
|
|
+ *(.rela.data*)
|
|
+ *(.rela.got)
|
|
+ *(.rela.dyn)
|
|
+ *(.rela.stab)
|
|
+ *(.rela.init_array*)
|
|
+ *(.rela.fini_array*)
|
|
+ *(.rela.ctors*)
|
|
+ *(.rela.dtors*)
|
|
+
|
|
+ }
|
|
+ . = ALIGN(4096);
|
|
+ .rela.plt : { *(.rela.plt) }
|
|
+ . = ALIGN(4096);
|
|
+ .rodata : { *(.rodata*) }
|
|
+ . = ALIGN(512);
|
|
_edata = .;
|
|
- _data_vsize = _evdata - _data;
|
|
- _data_size = . - _data;
|
|
+ _data_size = _edata - _data;
|
|
|
|
- /*
|
|
- * Note that _sbat must be the beginning of the data, and _esbat must be the
|
|
- * end and must be before any section padding. The sbat self-check uses
|
|
- * _esbat to find the bounds of the data, and if the padding is included, the
|
|
- * CSV parser (correctly) rejects the data as having NUL values in one of the
|
|
- * required columns.
|
|
- */
|
|
. = ALIGN(4096);
|
|
.sbat :
|
|
{
|
|
@@ -67,44 +121,14 @@ SECTIONS
|
|
_sbat_vsize = _esbat - _sbat;
|
|
|
|
. = ALIGN(4096);
|
|
- .rodata :
|
|
- {
|
|
- _rodata = .;
|
|
- *(.rodata*)
|
|
- *(.srodata)
|
|
- . = ALIGN(16);
|
|
- *(.note.gnu.build-id)
|
|
- . = ALIGN(4096);
|
|
- *(.vendor_cert)
|
|
- *(.data.ident)
|
|
- . = ALIGN(4096);
|
|
- }
|
|
+ .dynsym : { *(.dynsym) }
|
|
. = ALIGN(4096);
|
|
- .rela :
|
|
- {
|
|
- *(.rela.dyn)
|
|
- *(.rela.plt)
|
|
- *(.rela.got)
|
|
- *(.rela.data)
|
|
- *(.rela.data*)
|
|
- }
|
|
+ .dynstr : { *(.dynstr) }
|
|
. = ALIGN(4096);
|
|
- .dyn :
|
|
- {
|
|
- *(.dynsym)
|
|
- *(.dynstr)
|
|
- _evrodata = .;
|
|
- . = ALIGN(4096);
|
|
- }
|
|
- _erodata = .;
|
|
- _rodata_size = . - _rodata;
|
|
- _rodata_vsize = _evrodata - _rodata;
|
|
- _alldata_size = . - _data;
|
|
-
|
|
- /DISCARD/ :
|
|
+ .note.gnu.build-id : { *(.note.gnu.build-id) }
|
|
+ .ignored.reloc :
|
|
{
|
|
- *(.rel.reloc)
|
|
- *(.eh_frame)
|
|
+ *(.rela.reloc)
|
|
*(.note.GNU-stack)
|
|
}
|
|
.comment 0 : { *(.comment) }
|
|
--
|
|
2.44.0
|
|
|