Seems GNU ld is a bit stupid in this regard
Apply to all archs incase this is repeated so far
only seen on ARM64
Fixesncroxon/gnu-efi#47
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
* Similar to ARM32, this triggers a GNU AS section parameters warning if called reloc
* This breaks IA32 objcopy due to .reloc lookup
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Currently on x64 we manually build a dummy .reloc table entry by using a
symbol in .text and subtracting its address from another symbol that's
inside the .reloc section. On ia32 we just use its location. In either
case, if the linker puts either section in a location we're not
expecting, the .reloc table winds up having invalid values, and the PE
loader will fail to load the binary.
This changes it to be two symbols that are both in .text, making the
result unrelated to the section order or location.
It's not clear to me that these .reloc entries are actually necessary at
all, but I'm going to leave them in place for now, in case they are.
Ref: rhboot/gnu-efi@9fb55dee2b
Co-authored-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
* Force code to be at known dest of 4096
* Move _start into .text
* Load the _start symbol address and then minus 4096 to get the load
address
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
* Always use objcopy -O (--target doesn't make sense)
and isn't available on freebsd
* No efi-bsdrv target (but has efi-app)(bug in binutils??)
* Sync linker scripts (all features are supported)
* Use clang as HOSTCC (there is no default gcc)
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
* Doesn't seem to like nocombreloc
* i686 doesn't have the efi-app-ia32 target (bug in binutils??)
* Set float manually on ARM32 due to generic toolchain
* Ensure _DYNAMIC symbol exists
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
The RISCV64 toolchain does not support 16-bit variable relocation from assembly,
and even if it did support relocations, it would not properly set the subsystem
from --defsym. So we add an extra step on RISCV64, post objcopy, to set the field
manually (using dd and /bin/echo to output the relevant byte, as GNU Make's echo
does not support -ne).
Closesncroxon/gnu-efi#27.
Signed-off-by: Pete Batard <pete@akeo.ie>
This is similar to using automake's silent rules and, just as with automake,
can be disabled by invoking 'make V=1'.
Signed-off-by: Pete Batard <pete@akeo.ie>
* Add efi_machine_type_name and gnu_efi_arch from fwupd-efi
* Add gnu_efi_default_is_objcopy so downstreams know if the crt0 goes objcopy
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This was hopefully just a typo that has been cargo-culted around the codebase.
It certainly confuses the Red Hat license checker and makes the code copyright
clear.
This makes our "make clean" commands show what they've /removed/, rather
than what the shell code that will be run is.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
While binutils 2.25 incorrectly changed the page size
to 64K, the second part of that fix prevents the bug
anyways
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Binutils 2.41 now supports efi-app-loongarch64, so to use this we must add a
dummy reloc section and remove the PE header definition from crt0 as this will
conflict with the version added by objcopy
Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
Sometimes ld emits relocs such as R_RISCV_64 for unwind symbols
these don't need to be handled yet so just can be skipped otherwise
the binary will never load
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
(un-needed in PE)
- Correct section & file alignment
- Correct image size
Builds correctly but untested
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
(un-needed in PE)
- Correct section & file alignment
- Correct image size
- rename .reloc to .areloc within ELF
as only on ARM32 does this name cause
it to be marked as REL and subsequently
mistakenly added to RELSZ
Builds correctly & tested working in QEMU
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>