From 44b4ec740db6dafed432a411506bfd7975a221f8 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Fri, 15 Feb 2019 14:41:20 +0100 Subject: [PATCH] rmodule: Add support for R_X86_64_PLT32 The recent toolchain update also updated binutils, which has a new relocation type, introduced with commit bd7ab16b (x86-64: Generate branch with PLT32 relocation). Add support for R_X86_64_PLT32, which is handled as R_X86_64_PC32. Add comment explaining the situation. Fixes build error on x86_64. Change-Id: I81350d2728c20ac72cc865e7ba92319858352632 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/31468 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- util/cbfstool/rmodule.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/util/cbfstool/rmodule.c b/util/cbfstool/rmodule.c index 817bc604f0..80e89118e5 100644 --- a/util/cbfstool/rmodule.c +++ b/util/cbfstool/rmodule.c @@ -50,12 +50,18 @@ static int valid_reloc_amd64(Elf64_Rela *rel) type = ELF64_R_TYPE(rel->r_info); - /* Only these 5 relocations are expected to be found. */ + /* Only these 6 relocations are expected to be found. */ return (type == R_AMD64_64 || type == R_AMD64_PC64 || type == R_AMD64_32S || type == R_AMD64_32 || - type == R_AMD64_PC32); + type == R_AMD64_PC32 || + /* + * binutils 2.31 introduced R_AMD64_PLT32 for non local + * functions. As we don't care about procedure linkage + * table entries handle it as R_X86_64_PC32. + */ + type == R_AMD64_PLT32); } static int should_emit_amd64(Elf64_Rela *rel)