[prev in list] [next in list] [prev in thread] [next in thread]
List: haiku-commits
Subject: [haiku-commits] Change in haiku[master]: ldscripts/x86: add ldscript for EFI loader
From: Gerrit <review () review ! haiku-os ! org>
Date: 2021-11-30 18:03:36
Message-ID: gerrit.1638295414000.I1091f610129f806f124d714fd9a42cf932fa1c2d () review ! haiku-os ! org
[Download RAW message or body]
From <karolyd577@gmail.com>:
karolyd577@gmail.com has uploaded this change for review. ( https://review.haiku-os.org/c/haiku/+/4746 )
Change subject: ldscripts/x86: add ldscript for EFI loader
......................................................................
ldscripts/x86: add ldscript for EFI loader
Linker script is adapted from elf_ia32_efi.lds in GNU-EFI.
see:
https://sourceforge.net/p/gnu-efi/code/ci/master/tree/gnuefi/elf_ia32_efi.lds
The only significant change is the additions of ctors.
Change-Id: I1091f610129f806f124d714fd9a42cf932fa1c2d
---
A src/system/ldscripts/x86/boot_loader_efi.ld
1 file changed, 91 insertions(+), 0 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/46/4746/1
diff --git a/src/system/ldscripts/x86/boot_loader_efi.ld b/src/system/ldscripts/x86/boot_loader_efi.ld
new file mode 100644
index 0000000..6f6ac98
--- /dev/null
+++ b/src/system/ldscripts/x86/boot_loader_efi.ld
@@ -0,0 +1,91 @@
+/* Same as elf_ia32_efi.lds, except for ctor support */
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0;
+ ImageBase = .;
+ /* .hash and/or .gnu.hash MUST come first! */
+ .hash : { *(.hash) }
+ .gnu.hash : { *(.gnu.hash) }
+ . = ALIGN(4096);
+ .text :
+ {
+ _text = .;
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+ . = ALIGN(16);
+ }
+ _etext = .;
+ _text_size = . - _text;
+ . = ALIGN(4096);
+ .sdata :
+ {
+ __ctor_list = .;
+ *(.ctors)
+ __ctor_end = .;
+ _data = .;
+ *(.got.plt)
+ *(.got)
+ *(.srodata)
+ *(.sdata)
+ *(.sbss)
+ *(.scommon)
+ }
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.sdata)
+ *(.got.plt)
+ *(.got)
+ /* the EFI loader doesn't seem to like a .bss section, so we stick
+ it all into .data: */
+ *(.sbss)
+ *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ .note.gnu.build-id : { *(.note.gnu.build-id) }
+
+ . = ALIGN(4096);
+ .dynamic : { *(.dynamic) }
+ . = ALIGN(4096);
+ .rel :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.ctors)
+ *(.rel.got)
+ *(.rel.stab)
+ *(.data.rel.ro.local)
+ *(.data.rel.local)
+ *(.data.rel.ro)
+ *(.data.rel*)
+ }
+ _edata = .;
+ _data_size = . - _etext;
+ . = ALIGN(4096);
+ .reloc : /* This is the PECOFF .reloc section! */
+ {
+ *(.reloc)
+ }
+ . = ALIGN(4096);
+ .dynsym : { *(.dynsym) }
+ . = ALIGN(4096);
+ .dynstr : { *(.dynstr) }
+ . = ALIGN(4096);
+ /DISCARD/ :
+ {
+ *(.rel.reloc)
+ *(.eh_frame)
+ *(.note.GNU-stack)
+ }
+ .comment 0 : { *(.comment) }
+}
--
To view, visit https://review.haiku-os.org/c/haiku/+/4746
To unsubscribe, or for help writing mail filters, visit https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I1091f610129f806f124d714fd9a42cf932fa1c2d
Gerrit-Change-Number: 4746
Gerrit-PatchSet: 1
Gerrit-Owner: karolyd577@gmail.com
Gerrit-MessageType: newchange
[Attachment #3 (text/html)]
<p>karolyd577@gmail.com has uploaded this change for \
<strong>review</strong>.</p><p><a \
href="https://review.haiku-os.org/c/haiku/+/4746">View Change</a></p><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;">ldscripts/x86: add \
ldscript for EFI loader<br><br>Linker script is adapted from elf_ia32_efi.lds in \
GNU-EFI.<br>see:<br>https://sourceforge.net/p/gnu-efi/code/ci/master/tree/gnuefi/elf_ia32_efi.lds<br><br>The \
only significant change is the additions of ctors.<br><br>Change-Id: \
I1091f610129f806f124d714fd9a42cf932fa1c2d<br>---<br>A \
src/system/ldscripts/x86/boot_loader_efi.ld<br>1 file changed, 91 insertions(+), 0 \
deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: \
pre-wrap;">git pull ssh://git.haiku-os.org:22/haiku refs/changes/46/4746/1</pre><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git \
a/src/system/ldscripts/x86/boot_loader_efi.ld \
b/src/system/ldscripts/x86/boot_loader_efi.ld</span><br><span>new file mode \
100644</span><br><span>index 0000000..6f6ac98</span><br><span>--- \
/dev/null</span><br><span>+++ \
b/src/system/ldscripts/x86/boot_loader_efi.ld</span><br><span>@@ -0,0 +1,91 \
@@</span><br><span style="color: hsl(120, 100%, 40%);">+/* Same as elf_ia32_efi.lds, \
except for ctor support */</span><br><span style="color: hsl(120, 100%, \
40%);">+OUTPUT_FORMAT("elf32-i386", "elf32-i386", \
"elf32-i386")</span><br><span style="color: hsl(120, 100%, \
40%);">+OUTPUT_ARCH(i386)</span><br><span style="color: hsl(120, 100%, \
40%);">+ENTRY(_start)</span><br><span style="color: hsl(120, 100%, \
40%);">+SECTIONS</span><br><span style="color: hsl(120, 100%, \
40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
0;</span><br><span style="color: hsl(120, 100%, 40%);">+ ImageBase = \
.;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* .hash and/or .gnu.hash \
MUST come first! */</span><br><span style="color: hsl(120, 100%, 40%);">+ .hash : { \
*(.hash) }</span><br><span style="color: hsl(120, 100%, 40%);">+ .gnu.hash : { \
*(.gnu.hash) }</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
ALIGN(4096);</span><br><span style="color: hsl(120, 100%, 40%);">+ .text \
:</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span \
style="color: hsl(120, 100%, 40%);">+ _text = .;</span><br><span style="color: \
hsl(120, 100%, 40%);">+ *(.text)</span><br><span style="color: hsl(120, 100%, \
40%);">+ *(.text.*)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.gnu.linkonce.t.*)</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
ALIGN(16);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span \
style="color: hsl(120, 100%, 40%);">+ _etext = .;</span><br><span style="color: \
hsl(120, 100%, 40%);">+ _text_size = . - _text;</span><br><span style="color: \
hsl(120, 100%, 40%);">+ . = ALIGN(4096);</span><br><span style="color: hsl(120, \
100%, 40%);">+ .sdata :</span><br><span style="color: hsl(120, 100%, 40%);">+ \
{</span><br><span style="color: hsl(120, 100%, 40%);">+ __ctor_list = \
.;</span><br><span style="color: hsl(120, 100%, 40%);">+ *(.ctors)</span><br><span \
style="color: hsl(120, 100%, 40%);">+ __ctor_end = .;</span><br><span style="color: \
hsl(120, 100%, 40%);">+ _data = .;</span><br><span style="color: hsl(120, 100%, \
40%);">+ *(.got.plt)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.got)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.srodata)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.sdata)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.sbss)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.scommon)</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span \
style="color: hsl(120, 100%, 40%);">+ . = ALIGN(4096);</span><br><span style="color: \
hsl(120, 100%, 40%);">+ .data :</span><br><span style="color: hsl(120, 100%, \
40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rodata*)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data1)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data.*)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.sdata)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.got.plt)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.got)</span><br><span style="color: hsl(120, 100%, 40%);">+ /* the EFI loader \
doesn't seem to like a .bss section, so we stick</span><br><span style="color: \
hsl(120, 100%, 40%);">+ it all into .data: */</span><br><span style="color: \
hsl(120, 100%, 40%);">+ *(.sbss)</span><br><span style="color: hsl(120, 100%, \
40%);">+ *(.scommon)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.dynbss)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.bss)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(COMMON)</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span \
style="color: hsl(120, 100%, 40%);">+ .note.gnu.build-id : { *(.note.gnu.build-id) \
}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: \
hsl(120, 100%, 40%);">+ . = ALIGN(4096);</span><br><span style="color: hsl(120, \
100%, 40%);">+ .dynamic : { *(.dynamic) }</span><br><span style="color: hsl(120, \
100%, 40%);">+ . = ALIGN(4096);</span><br><span style="color: hsl(120, 100%, \
40%);">+ .rel :</span><br><span style="color: hsl(120, 100%, 40%);">+ \
{</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rel.data)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rel.data.*)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rel.ctors)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rel.got)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.rel.stab)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data.rel.ro.local)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data.rel.local)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data.rel.ro)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
*(.data.rel*)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
}</span><br><span style="color: hsl(120, 100%, 40%);">+ _edata = .;</span><br><span \
style="color: hsl(120, 100%, 40%);">+ _data_size = . - _etext;</span><br><span \
style="color: hsl(120, 100%, 40%);">+ . = ALIGN(4096);</span><br><span style="color: \
hsl(120, 100%, 40%);">+ .reloc : /* This is the PECOFF .reloc section! \
*/</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span \
style="color: hsl(120, 100%, 40%);">+ *(.reloc)</span><br><span style="color: \
hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
ALIGN(4096);</span><br><span style="color: hsl(120, 100%, 40%);">+ .dynsym : { \
*(.dynsym) }</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
ALIGN(4096);</span><br><span style="color: hsl(120, 100%, 40%);">+ .dynstr : { \
*(.dynstr) }</span><br><span style="color: hsl(120, 100%, 40%);">+ . = \
ALIGN(4096);</span><br><span style="color: hsl(120, 100%, 40%);">+ /DISCARD/ \
:</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span \
style="color: hsl(120, 100%, 40%);">+ *(.rel.reloc)</span><br><span style="color: \
hsl(120, 100%, 40%);">+ *(.eh_frame)</span><br><span style="color: hsl(120, 100%, \
40%);">+ *(.note.GNU-stack)</span><br><span style="color: hsl(120, 100%, 40%);">+ \
}</span><br><span style="color: hsl(120, 100%, 40%);">+ .comment 0 : { *(.comment) \
}</span><br><span style="color: hsl(120, 100%, \
40%);">+}</span><br><span></span><br></pre><p>To view, visit <a \
href="https://review.haiku-os.org/c/haiku/+/4746">change 4746</a>. To unsubscribe, or \
for help writing mail filters, visit <a \
href="https://review.haiku-os.org/settings">settings</a>.</p><div itemscope \
itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" \
itemtype="http://schema.org/ViewAction"><link itemprop="url" \
href="https://review.haiku-os.org/c/haiku/+/4746"/><meta itemprop="name" \
content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: haiku </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: \
I1091f610129f806f124d714fd9a42cf932fa1c2d </div> <div style="display:none"> \
Gerrit-Change-Number: 4746 </div> <div style="display:none"> Gerrit-PatchSet: 1 \
</div> <div style="display:none"> Gerrit-Owner: karolyd577@gmail.com </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic