Clang for X86 emits lots of R_X86_64_NONE relocations  when using
-ffunction-sections -fdata-sections. These can safely be ignored, which
means we should also not error out if these relocs do not refer to valid
symbols.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
 BaseTools/Source/C/GenFw/Elf64Convert.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 90d80a22daf2..f5d12698dd87 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -660,6 +660,14 @@ WriteSections64 (
         UINT8    *Targ;
 
         //
+        // Ignore R_X86_64_NONE relocations before the Sym check below
+        //
+        if (mEhdr->e_machine == EM_X86_64 &&
+            ELF_R_TYPE(Rel->r_info) == R_X86_64_NONE) {
+              continue;
+        }
+
+        //
         // Check section header index found in symbol table and get the section
         // header location.
         //
-- 
2.5.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to