Discussion:
[ipxe-devel] elf2efi32: Unrecognised relocation type 3
Heinrich Schuchardt
2018-03-27 09:53:08 UTC
Permalink
Hello Michael,

building iPXE on 32bit arm fails:

$ make V=1 bin-arm32-efi/snp.efi EMBED=config/local/chain.ipxe
./util/elf2efi32 --subsystem=10 bin-arm32-efi/snp.efi.tmp
bin-arm32-efi/snp.efi
Unrecognised relocation type 3
Makefile.efi:25: recipe for target 'bin-arm32-efi/snp.efi' failed
make: *** [bin-arm32-efi/snp.efi] Error 1

$ gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

$ ld --version
GNU ld (GNU Binutils for Debian) 2.28

This should be the relevant relocation types:
#define R_ARM_REL32 3 /* PC relative 32 bit */

In util/elf2efi.c you skip many PC-relative relocations.
Should R_ARM_REL32 be added to this list?

Best regards

Heinrich Schuchardt
Heinrich Schuchardt
2018-03-27 17:07:38 UTC
Permalink
The relocation type R_ARM_REL32 is generated when building
bin-arm32-efi/snp.efi using gcc 6.3 and ld 2.28.

R_ARM_REL32 is a program counter (PC) relative 32 bit relocation so we can
ignore it like all other PC relative relocations.

Signed-off-by: Heinrich Schuchardt <***@gmx.de>
---
src/util/elf2efi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index e8e6c523..6718df77 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -631,6 +631,7 @@ static void process_reloc ( struct elf_file *elf, const Elf_Shdr *shdr,
break;
case ELF_MREL ( EM_386, R_386_PC32 ) :
case ELF_MREL ( EM_ARM, R_ARM_CALL ) :
+ case ELF_MREL ( EM_ARM, R_ARM_REL32 ) :
case ELF_MREL ( EM_ARM, R_ARM_THM_PC22 ) :
case ELF_MREL ( EM_ARM, R_ARM_THM_JUMP24 ) :
case ELF_MREL ( EM_ARM, R_ARM_V4BX ):
--
2.11.0
Michael Brown
2018-03-28 16:58:53 UTC
Permalink
Post by Heinrich Schuchardt
The relocation type R_ARM_REL32 is generated when building
bin-arm32-efi/snp.efi using gcc 6.3 and ld 2.28.
R_ARM_REL32 is a program counter (PC) relative 32 bit relocation so we can
ignore it like all other PC relative relocations.
Applied; thank you!

http://git.ipxe.org/ipxe.git/commitdiff/8c17ee115

Michael

Loading...