aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index edfe652..df7e8c3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -481,7 +481,7 @@ print_symbol (signed int width, const char *symbol)
if (width < 0)
{
- /* Keep the width positive. This also helps. */
+ /* Keep the width positive. This helps the code below. */
width = - width;
extra_padding = TRUE;
}
@@ -17185,7 +17185,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
const char * expected_types;
const char * name = pnote->namedata;
const char * text;
- int left;
+ signed int left;
if (name == NULL || pnote->namesz < 2)
{
@@ -17194,6 +17194,16 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
return FALSE;
}
+ left = 20;
+
+ /* Version 2 of the spec adds a "GA" prefix to the name field. */
+ if (name[0] == 'G' && name[1] == 'A')
+ {
+ printf ("GA");
+ name += 2;
+ left -= 2;
+ }
+
switch ((name_type = * name))
{
case GNU_BUILD_ATTRIBUTE_TYPE_NUMERIC:
@@ -17201,6 +17211,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
case GNU_BUILD_ATTRIBUTE_TYPE_BOOL_TRUE:
case GNU_BUILD_ATTRIBUTE_TYPE_BOOL_FALSE:
printf ("%c", * name);
+ left --;
break;
default:
error (_("unrecognised attribute type in name field: %d\n"), name_type);
@@ -17208,7 +17219,6 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
return FALSE;
}
- left = 19;
++ name;
text = NULL;
@@ -17268,6 +17278,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
else
{
static char tmpbuf [128];
+
error (_("unrecognised byte in name field: %d\n"), * name);
sprintf (tmpbuf, _("<unknown:_%d>"), * name);
text = tmpbuf;
@@ -17278,10 +17289,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
}
if (text)
- {
- printf ("%s", text);
- left -= strlen (text);
- }
+ left -= printf ("%s", text);
if (strchr (expected_types, name_type) == NULL)
warn (_("attribute does not have an expected type (%c)\n"), name_type);