This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch 9/9] Nios II port, readelf support
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 24 Jan 2013 13:21:12 -0700
- Subject: [patch 9/9] Nios II port, readelf support
This patch includes the bits needed to make readelf know about Nios II.
-Sandra
2013-01-24 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com>
Based on patches from Altera Corporation.
binutils/
* readelf.c: Include elf/nios2.h.
(dump_relocations): Add case for EM_ALTERA_NIOS2.
(get_nios2_dynamic_type): New.
(get_dynamic_type): Add case for EM_ALTERA_NIOS2.
(is_32bit_abs_reloc): Fix EM_ALTERA_NIOS2 case.
(is_16bit_abs_reloc): Likewise.
(is_none_reloc): Add EM_ALTERA_NIOS2 and EM_NIOS32 cases.
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.590
diff -u -p -r1.590 readelf.c
--- binutils/readelf.c 10 Jan 2013 09:49:13 -0000 1.590
+++ binutils/readelf.c 22 Jan 2013 18:36:36 -0000
@@ -155,6 +155,8 @@
#include "elf/xstormy16.h"
#include "elf/xtensa.h"
+#include "elf/nios2.h"
+
#include "getopt.h"
#include "libiberty.h"
#include "safe-ctype.h"
@@ -1290,6 +1292,10 @@ dump_relocations (FILE * file,
case EM_XGATE:
rtype = elf_xgate_reloc_type (type);
break;
+
+ case EM_ALTERA_NIOS2:
+ rtype = elf_nios2_reloc_type (type);
+ break;
}
if (rtype == NULL)
@@ -1689,6 +1695,17 @@ get_tic6x_dynamic_type (unsigned long ty
}
static const char *
+get_nios2_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case DT_NIOS2_GP: return "NIOS2_GP";
+ default:
+ return NULL;
+ }
+}
+
+static const char *
get_dynamic_type (unsigned long type)
{
static char buff[64];
@@ -1802,6 +1819,9 @@ get_dynamic_type (unsigned long type)
case EM_TI_C6000:
result = get_tic6x_dynamic_type (type);
break;
+ case EM_ALTERA_NIOS2:
+ result = get_nios2_dynamic_type (type);
+ break;
default:
result = NULL;
break;
@@ -10077,6 +10097,7 @@ is_32bit_abs_reloc (unsigned int reloc_t
case EM_MT:
return reloc_type == 2; /* R_MT_32. */
case EM_ALTERA_NIOS2:
+ return reloc_type == 12; /* R_NIOS2_BFD_RELOC_32. */
case EM_NIOS32:
return reloc_type == 1; /* R_NIOS_32. */
case EM_OPENRISC:
@@ -10327,6 +10348,7 @@ is_16bit_abs_reloc (unsigned int reloc_t
case EM_MSP430:
return reloc_type == 5; /* R_MSP430_16_BYTE. */
case EM_ALTERA_NIOS2:
+ return reloc_type == 13; /* R_NIOS2_BFD_RELOC_16. */
case EM_NIOS32:
return reloc_type == 9; /* R_NIOS_16. */
case EM_TI_C6000:
@@ -10383,6 +10405,8 @@ is_none_reloc (unsigned int reloc_type)
case EM_TILEPRO: /* R_TILEPRO_NONE. */
case EM_XC16X:
case EM_C166: /* R_XC16X_NONE. */
+ case EM_ALTERA_NIOS2: /* R_NIOS2_NONE. */
+ case EM_NIOS32: /* R_NIOS_NONE. */
return reloc_type == 0;
case EM_AARCH64:
return reloc_type == 0 || reloc_type == 256;