| // SPDX-License-Identifier: BSD-3-Clause |
| * reloc_x86_64.c - position independent x86_64 ELF shared object relocator |
| * Copyright (C) 1999 Hewlett-Packard Co. |
| * Contributed by David Mosberger <davidm@hpl.hp.com>. |
| * Copyright (C) 2005 Intel Co. |
| * Contributed by Fenghua Yu <fenghua.yu@intel.com>. |
| efi_status_t EFIAPI _relocate(long ldbase, Elf64_Dyn *dyn) |
| long relsz = 0, relent = 0; |
| for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { |
| ((unsigned long)dyn[i].d_un.d_ptr + ldbase); |
| relsz = dyn[i].d_un.d_val; |
| relent = dyn[i].d_un.d_val; |
| switch (ELF64_R_TYPE(rel->r_info)) { |
| addr = (unsigned long *)(ldbase + rel->r_offset); |
| rel = (Elf64_Rel *)((char *)rel + relent); |