This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Update readelf to know about the new ELF constants
- To: obrien at FreeBSD dot org
- Subject: Re: Update readelf to know about the new ELF constants
- From: Andreas Jaeger <aj at suse dot de>
- Date: 12 Dec 2000 18:34:18 +0100
- Cc: binutils at sources dot redhat dot com
- References: <200011271938.LAA19423@elmo.cygnus.com><20001127122028.A20242@valinux.com><20001211124837.A11175@dragon.nuxi.com>
>>>>> David O'Brien writes:
>> e_machine
>> This member's value specifies the required architecture for an
>> individual file.
> I didn't see the AMD x86-64. Should it be added also?
Yes, it should but we haven't done so since the integration of the
x86-64 patches is not yet complete.
Here's a patch for readelf.
But testing it on i386 showed the following problem:
make[3]: Entering directory `/x86-64/builds/sourceware-src/binutils/binutils'
/bin/sh ./libtool --mode=link gcc -W -Wall -g -O2 -o readelf readelf.o version.o ../libiberty/libiberty.a
gcc -W -Wall -g -O2 -o readelf readelf.o version.o ../libiberty/libiberty.a
readelf.o: In function `dump_relocations':
/cvs/binutils-ln/binutils/readelf.c:800: undefined reference to `elf_m32r_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:805: undefined reference to `elf_i386_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:809: undefined reference to `elf_m68k_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:813: undefined reference to `elf_i960_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:817: undefined reference to `elf_avr_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:824: undefined reference to `elf_sparc_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:828: undefined reference to `v850_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:832: undefined reference to `elf_d10v_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:836: undefined reference to `elf_d30v_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:840: undefined reference to `elf_sh_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:844: undefined reference to `elf_mn10300_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:848: undefined reference to `elf_mn10200_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:852: undefined reference to `elf_fr30_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:856: undefined reference to `elf_mcore_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:860: undefined reference to `elf_ppc_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:865: undefined reference to `elf_mips_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:869: undefined reference to `elf_alpha_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:873: undefined reference to `elf_arm_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:877: undefined reference to `elf_arc_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:881: undefined reference to `elf_hppa_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:885: undefined reference to `elf_pj_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:888: undefined reference to `elf_ia64_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:892: undefined reference to `elf_cris_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:896: undefined reference to `elf_i860_reloc_type'
/cvs/binutils-ln/binutils/readelf.c:900: undefined reference to `elf_x86_64_reloc_type'
collect2: ld returned 1 exit status
make[3]: *** [readelf] Error 1
This worked recently (with the last snapshot I tried).
Shall I commit the appended patch nevertheless?
Andreas
2000-12-04 Andreas Jaeger <aj@suse.de>
* readelf.c (guess_is_rela): Add EM_X86_64.
(dump_relocations): Add EM_X86_64.
(get_machine_name): Add EM_X86_64.
Include "elf/x86-64.h".
Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.82
diff -u -r1.82 readelf.c
--- readelf.c 2000/12/08 17:25:47 1.82
+++ readelf.c 2000/12/12 17:13:39
@@ -42,6 +42,7 @@
#include "elf/external.h"
#include "elf/internal.h"
#include "elf/dwarf2.h"
+#include "elf/x86-64.h"
/* The following headers use the elf/reloc-macros.h file to
automatically generate relocation recognition functions
@@ -571,6 +572,7 @@
case EM_AVR:
case EM_CRIS:
case EM_860:
+ case EM_X86_64:
return TRUE;
case EM_MMA:
@@ -893,6 +895,10 @@
case EM_860:
rtype = elf_i860_reloc_type (type);
break;
+
+ case EM_X86_64:
+ rtype = elf_x86_64_reloc_type (type);
+ break;
}
if (rtype == NULL)
@@ -1269,6 +1275,7 @@
case EM_MMIX: return "Donald Knuth's educational 64-bit processor";
case EM_HUANY: return "Harvard Universitys's machine-independent object format";
case EM_PRISM: return "SiTera Prism";
+ case EM_X86_64: return "Advanced Micro Devices X86-64";
default:
sprintf (buff, _("<unknown>: %x"), e_machine);
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj