summaryrefslogtreecommitdiff
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2025-06-19 14:42:17 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-06-24 19:32:41 +0000
commit50dc5f2f31e144283413f92521d02aa8ce2dc993 (patch)
tree619f209499f5873acf01abaf91498315637c0fe0 /BaseTools/Source
parent3f278768fab371ca2d9d2515a85894f8ee3194f9 (diff)
downloadedk2-50dc5f2f31e144283413f92521d02aa8ce2dc993.zip
edk2-50dc5f2f31e144283413f92521d02aa8ce2dc993.tar.gz
edk2-50dc5f2f31e144283413f92521d02aa8ce2dc993.tar.bz2
BaseTools/GetFw: Skip R_X86_64_NONE relocations
Building .aslc files in a module for host-based unit testing in Linux/GCC X64 environments may introduce relocations for a symbol in a shared library from lcov or asan. Update logic to not generate an error message and exit if the symbol is unknown but the relocation type is R_X86_64_NONE. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 6919e18..1859412 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -1398,6 +1398,18 @@ WriteSections64 (
SymName = (const UINT8 *)"<unknown>";
}
+ if (mEhdr->e_machine == EM_X86_64) {
+ //
+ // For x86_64, we can ignore R_X86_64_NONE relocations.
+ // They are used to indicate that the symbol is not defined
+ // in the current module, but in a shared library that may be
+ // used when building modules for inclusion in host-based unit tests.
+ //
+ if (ELF_R_TYPE(Rel->r_info) == R_X86_64_NONE) {
+ continue;
+ }
+ }
+
//
// Skip error on EM_RISCV64 and EM_LOONGARCH because no symbol name is built
// from RISC-V and LoongArch toolchain.