aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2014-12-05 21:05:33 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2014-12-05 21:05:33 +0000
commit343433dfd71925aa05cc086ad13a3aa15e7a1854 (patch)
tree53156c31222f341b20e7a6f05cd71db52f6b79d1 /binutils
parent238309aab1e49760b335262db8dbfb26ac88e69a (diff)
downloadgdb-343433dfd71925aa05cc086ad13a3aa15e7a1854.zip
gdb-343433dfd71925aa05cc086ad13a3aa15e7a1854.tar.gz
gdb-343433dfd71925aa05cc086ad13a3aa15e7a1854.tar.bz2
Add string representation of ELF e_flags for AVR.
binutils/ChangeLog: * readelf.c (decode_AVR_machine_flags): New function. (get_machine_flags): Add EM_AVR case.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c75
2 files changed, 80 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8740dd2..4e79a75 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-05 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * readelf.c (decode_AVR_machine_flags): New function.
+ (get_machine_flags): Add EM_AVR case.
+
2014-12-03 Nick Clifton <nickc@redhat.com>
PR binutils/17512
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 691f64c..4e8b9ab 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -2438,6 +2438,77 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[])
}
static void
+decode_AVR_machine_flags (unsigned e_flags, char buf[], size_t size)
+{
+ --size; /* Leave space for null terminator. */
+
+ switch (e_flags & EF_AVR_MACH)
+ {
+ case E_AVR_MACH_AVR1:
+ strncat (buf, ", avr:1", size);
+ break;
+ case E_AVR_MACH_AVR2:
+ strncat (buf, ", avr:2", size);
+ break;
+ case E_AVR_MACH_AVR25:
+ strncat (buf, ", avr:25", size);
+ break;
+ case E_AVR_MACH_AVR3:
+ strncat (buf, ", avr:3", size);
+ break;
+ case E_AVR_MACH_AVR31:
+ strncat (buf, ", avr:31", size);
+ break;
+ case E_AVR_MACH_AVR35:
+ strncat (buf, ", avr:35", size);
+ break;
+ case E_AVR_MACH_AVR4:
+ strncat (buf, ", avr:4", size);
+ break;
+ case E_AVR_MACH_AVR5:
+ strncat (buf, ", avr:5", size);
+ break;
+ case E_AVR_MACH_AVR51:
+ strncat (buf, ", avr:51", size);
+ break;
+ case E_AVR_MACH_AVR6:
+ strncat (buf, ", avr:6", size);
+ break;
+ case E_AVR_MACH_AVRTINY:
+ strncat (buf, ", avr:100", size);
+ break;
+ case E_AVR_MACH_XMEGA1:
+ strncat (buf, ", avr:101", size);
+ break;
+ case E_AVR_MACH_XMEGA2:
+ strncat (buf, ", avr:102", size);
+ break;
+ case E_AVR_MACH_XMEGA3:
+ strncat (buf, ", avr:103", size);
+ break;
+ case E_AVR_MACH_XMEGA4:
+ strncat (buf, ", avr:104", size);
+ break;
+ case E_AVR_MACH_XMEGA5:
+ strncat (buf, ", avr:105", size);
+ break;
+ case E_AVR_MACH_XMEGA6:
+ strncat (buf, ", avr:106", size);
+ break;
+ case E_AVR_MACH_XMEGA7:
+ strncat (buf, ", avr:107", size);
+ break;
+ default:
+ strncat (buf, ", avr:<unknown>", size);
+ break;
+ }
+
+ size -= strlen (buf);
+ if (e_flags & EF_AVR_LINKRELAX_PREPARED)
+ strncat (buf, ", link-relax", size);
+}
+
+static void
decode_NDS32_machine_flags (unsigned e_flags, char buf[], size_t size)
{
unsigned abi;
@@ -2658,6 +2729,10 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
decode_ARM_machine_flags (e_flags, buf);
break;
+ case EM_AVR:
+ decode_AVR_machine_flags (e_flags, buf, sizeof buf);
+ break;
+
case EM_BLACKFIN:
if (e_flags & EF_BFIN_PIC)
strcat (buf, ", PIC");