1cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath/* Initialization of S/390 specific backend library. 2ed9d2cad539eef89abac0490bbcbf647758905e3Jan Kratochvil Copyright (C) 2005, 2006, 2013 Red Hat, Inc. 3de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard This file is part of elfutils. 4361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper 5de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard This file is free software; you can redistribute it and/or modify 6de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard it under the terms of either 7361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper 8de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard * the GNU Lesser General Public License as published by the Free 9de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard Software Foundation; either version 3 of the License, or (at 10de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard your option) any later version 11de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 12de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard or 13de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 14de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard * the GNU General Public License as published by the Free 15de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard Software Foundation; either version 2 of the License, or (at 16de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard your option) any later version 17de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 18de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard or both in parallel, as here. 19de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 20de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard elfutils is distributed in the hope that it will be useful, but 21361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper WITHOUT ANY WARRANTY; without even the implied warranty of 22361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper General Public License for more details. 24361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper 25de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard You should have received copies of the GNU General Public License and 26de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard the GNU Lesser General Public License along with this program. If 27de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard not, see <http://www.gnu.org/licenses/>. */ 28cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 29cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#ifdef HAVE_CONFIG_H 30cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath# include <config.h> 31cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#endif 32cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 33cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#define BACKEND s390_ 34cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#define RELOC_PREFIX R_390_ 35cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#include "libebl_CPU.h" 36cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 37cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath/* This defines the common reloc hooks based on arm_reloc.def. */ 38cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath#include "common-reloc.c" 39cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 40cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvilextern __typeof (s390_core_note) s390x_core_note; 41cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvil 42cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 43cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrathconst char * 44aa1c2ca808a267a5a3c372de5461c1f67f9a8869Chih-Hung Hsiehs390_init (Elf *elf __attribute__ ((unused)), 45aa1c2ca808a267a5a3c372de5461c1f67f9a8869Chih-Hung Hsieh GElf_Half machine __attribute__ ((unused)), 46aa1c2ca808a267a5a3c372de5461c1f67f9a8869Chih-Hung Hsieh Ebl *eh, 47aa1c2ca808a267a5a3c372de5461c1f67f9a8869Chih-Hung Hsieh size_t ehlen) 48cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath{ 49cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath /* Check whether the Elf_BH object has a sufficent size. */ 50cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath if (ehlen < sizeof (Ebl)) 51cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath return NULL; 52cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 53cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath /* We handle it. */ 54cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath eh->name = "IBM S/390"; 55cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath s390_init_reloc (eh); 56f47ba53e758a954c72f820e169079aa767d9f96cRoland McGrath HOOK (eh, reloc_simple_type); 57c373d850ec9ca342f4c71d5e287c8d8bf0723cd6Roland McGrath HOOK (eh, register_info); 58321327a975d245ae83d71132b9b8832448aa5400Roland McGrath HOOK (eh, return_value_location); 59cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvil if (eh->class == ELFCLASS64) 60cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvil eh->core_note = s390x_core_note; 61cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvil else 62cc84d79da3b8aaf09c785d8d24d7a41dd236528bJan Kratochvil HOOK (eh, core_note); 63ed9d2cad539eef89abac0490bbcbf647758905e3Jan Kratochvil HOOK (eh, abi_cfi); 64c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil /* gcc/config/ #define DWARF_FRAME_REGISTERS 34. 65c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil But from the gcc/config/s390/s390.h "Register usage." comment it looks as 66c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil if #32 (Argument pointer) and #33 (Condition code) are not used for 67c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil unwinding. */ 68c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil eh->frame_nregs = 32; 69c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil HOOK (eh, set_initial_registers_tid); 70c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil if (eh->class == ELFCLASS32) 71c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil HOOK (eh, normalize_pc); 72c6a41483f2986d5542c554981348f75b815ef9b1Jan Kratochvil HOOK (eh, unwind); 73cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath 7428ed895fdc303b2a793506bb1fcdd35d5fd14e70Ulrich Drepper /* Only the 64-bit format uses the incorrect hash table entry size. */ 7528ed895fdc303b2a793506bb1fcdd35d5fd14e70Ulrich Drepper if (eh->class == ELFCLASS64) 7628ed895fdc303b2a793506bb1fcdd35d5fd14e70Ulrich Drepper eh->sysvhash_entrysize = sizeof (Elf64_Xword); 7728ed895fdc303b2a793506bb1fcdd35d5fd14e70Ulrich Drepper 78cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath return MODVERSION; 79cd60ea83050d9fb48c3204005f475df460f433b6Roland McGrath} 80