sym-handling.c 746 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Architecture specific ELF symbol handling and relocation mapping.
  3. *
  4. * Copyright 2017 IBM Corp.
  5. * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License (version 2 only)
  9. * as published by the Free Software Foundation.
  10. */
  11. #include "symbol.h"
  12. #ifdef HAVE_LIBELF_SUPPORT
  13. bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
  14. {
  15. if (ehdr.e_type == ET_EXEC)
  16. return false;
  17. return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN;
  18. }
  19. void arch__adjust_sym_map_offset(GElf_Sym *sym,
  20. GElf_Shdr *shdr __maybe_unused,
  21. struct map *map)
  22. {
  23. if (map->type == MAP__FUNCTION)
  24. sym->st_value += map->start;
  25. }
  26. #endif