Home | History | Annotate | Download | only in s390
      1 /*
      2  * This file is part of ltrace.
      3  * Copyright (C) 2013 Petr Machata, Red Hat Inc.
      4  * Copyright (C) 2004,2008,2009 Juan Cespedes
      5  *
      6  * This program is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU General Public License as
      8  * published by the Free Software Foundation; either version 2 of the
      9  * License, or (at your option) any later version.
     10  *
     11  * This program is distributed in the hope that it will be useful, but
     12  * WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU General Public License
     17  * along with this program; if not, write to the Free Software
     18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
     19  * 02110-1301 USA
     20  */
     21 
     22 #include <gelf.h>
     23 #include <stdbool.h>
     24 
     25 #include "proc.h"
     26 #include "common.h"
     27 #include "library.h"
     28 #include "trace.h"
     29 
     30 GElf_Addr
     31 arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) {
     32 	return lte->plt_addr + (ndx + 1) * 32;
     33 }
     34 
     35 void *
     36 sym2addr(struct process *proc, struct library_symbol *sym)
     37 {
     38 	return sym->enter_addr;
     39 }
     40 
     41 enum plt_status
     42 arch_elf_add_plt_entry(struct process *proc, struct ltelf *lte,
     43 		       const char *a_name, GElf_Rela *rela, size_t ndx,
     44 		       struct library_symbol **ret)
     45 {
     46 #ifdef R_390_IRELATIVE
     47 	bool irelative = GELF_R_TYPE(rela->r_info) == R_390_IRELATIVE;
     48 #else
     49 	bool irelative = false;
     50 #endif
     51 
     52 	if (irelative)
     53 		return linux_elf_add_plt_entry_irelative(proc, lte, rela,
     54 							 ndx, ret);
     55 
     56 	return PLT_DEFAULT;
     57 }
     58