blob: 6211ab516bbf38987a683ee1362f84636122870f [file] [log] [blame]
/* SH specific relocation handling.
Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
This program is Open Source software; you can redistribute it and/or
modify it under the terms of the Open Software License version 1.0 as
published by the Open Source Initiative.
You should have received a copy of the Open Software License along
with this program; if not, you may obtain a copy of the Open Software
License version 1.0 from http://www.opensource.org/licenses/osl.php or
by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
3001 King Ranch Road, Ukiah, CA 95482. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <elf.h>
#include <stddef.h>
#include <libebl_sh.h>
/* Return of the backend. */
const char *
sh_backend_name (void)
{
return "sh";
}
/* Determine relocation type string for SH. */
const char *
sh_reloc_type_name (int type, char *buf, size_t len)
{
static const char *map_table1[] =
{
[R_SH_NONE] = "R_SH_NONE",
[R_SH_DIR32] = "R_SH_DIR32",
[R_SH_REL32] = "R_SH_REL32",
[R_SH_DIR8WPN] = "R_SH_DIR8WPN",
[R_SH_IND12W] = "R_SH_IND12W",
[R_SH_DIR8WPL] = "R_SH_DIR8WPL",
[R_SH_DIR8WPZ] = "R_SH_DIR8WPZ",
[R_SH_DIR8BP] = "R_SH_DIR8BP",
[R_SH_DIR8W] = "R_SH_DIR8W",
[R_SH_DIR8L] = "R_SH_DIR8L",
[R_SH_SWITCH16] = "R_SH_SWITCH16",
[R_SH_SWITCH32] = "R_SH_SWITCH32",
[R_SH_USES] = "R_SH_USES",
[R_SH_COUNT] = "R_SH_COUNT",
[R_SH_ALIGN] = "R_SH_ALIGN",
[R_SH_CODE] = "R_SH_CODE",
[R_SH_DATA] = "R_SH_DATA",
[R_SH_LABEL] = "R_SH_LABEL",
[R_SH_SWITCH8] = "R_SH_SWITCH8",
[R_SH_GNU_VTINHERIT] ="R_SH_GNU_VTINHERIT",
[R_SH_GNU_VTENTRY] = "R_SH_GNU_VTENTRY"
};
static const char *map_table2[] =
{
[R_SH_TLS_GD_32] = "R_SH_TLS_GD_32",
[R_SH_TLS_LD_32] = "R_SH_TLS_LD_32",
[R_SH_TLS_LDO_32] = "R_SH_TLS_LDO_32",
[R_SH_TLS_IE_32] = "R_SH_TLS_IE_32",
[R_SH_TLS_LE_32] = "R_SH_TLS_LE_32",
[R_SH_TLS_DTPMOD32] = "R_SH_TLS_DTPMOD32",
[R_SH_TLS_DTPOFF32] = "R_SH_TLS_DTPOFF32",
[R_SH_TLS_TPOFF32] = "R_SH_TLS_TPOFF32",
[R_SH_GOT32 - R_SH_GOT32] = "R_SH_GOT32",
[R_SH_PLT32 - R_SH_GOT32] = "R_SH_PLT32",
[R_SH_COPY - R_SH_GOT32] = "R_SH_COPY",
[R_SH_GLOB_DAT - R_SH_GOT32] = "R_SH_GLOB_DAT",
[R_SH_JMP_SLOT - R_SH_GOT32] = "R_SH_JMP_SLOT",
[R_SH_RELATIVE - R_SH_GOT32] = "R_SH_RELATIVE",
[R_SH_GOTOFF - R_SH_GOT32] = "R_SH_GOTOFF",
[R_SH_GOTPC - R_SH_GOT32] = "R_SH_GOTPC"
};
if (type >= 0
&& (size_t) type < sizeof (map_table1) / sizeof (map_table1[0]))
return map_table1[type];
if ((type - R_SH_TLS_GD_32) >= 0
&& ((size_t) (type - R_SH_TLS_GD_32)
< sizeof (map_table2) / sizeof (map_table2[0])))
return map_table2[type - R_SH_TLS_GD_32];
return NULL;
}