2cc0b085fb
Gentoo has slightly modified linker defaults: --hash-style=gnu This means all ELF files in system have '.gnu.hash' section but no '.hash' section. gnuefi's ldscript did not account for it and as a result one symbol 'ImageBase' did not resolve locally for elilo.so and caused 'elilo' to fail to load by ia64 EFI: Loading.: Gentoo (try new elilo) ImageAddress: pointer is outside of image ImageAddress: pointer is outside of image Those two relocations come from crt0-efi-ia64.S PE32 entry point fdescr: ``` #define IMAGE_REL_BASED_DIR64<->10 .section .reloc, "a" data4 _start_plabel // Page RVA data4 12 // Block Size (2*4+2*2) data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer ``` These refer ImageBase. The change adds '.gnu.hash' collection (follows existing '.hash' collection). Tested on IA-64 by successfully booting elilo-3.16. Bug: https://bugs.gentoo.org/575300 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
87 lines
1.5 KiB
Plaintext
87 lines
1.5 KiB
Plaintext
OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
|
|
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 :
|
|
{
|
|
_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.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) }
|
|
}
|