diff options
author | Nick Clifton <nickc@redhat.com> | 2017-06-28 14:52:12 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-06-28 14:52:12 +0100 |
commit | 88305e1b9f4592a2ab129015ce409fcc16613ebb (patch) | |
tree | b5d5a5cfc8e893ba455d66ba5008474e43091ff0 /binutils/readelf.c | |
parent | 65a55fbbd949868f7df3c65d39eb8d4455515132 (diff) | |
download | gdb-88305e1b9f4592a2ab129015ce409fcc16613ebb.zip gdb-88305e1b9f4592a2ab129015ce409fcc16613ebb.tar.gz gdb-88305e1b9f4592a2ab129015ce409fcc16613ebb.tar.bz2 |
Add support for version 2 of the GNU Build Attribute note specification.
* objcopy.c (merge_gnu_build_notes): Add support for version 2 notes.
* readelf.c (print_gnu_build_attribute_name): Likewise.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 22 |
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); |