mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
Update support for GNU BUILD notes so that version notes can contain extra information, and stack protection notes can contain numeric values.
* readelf.c (print_gnu_build_attribute_name): Allow stack protection notes to contain numeric values. Use a colon rather than a space to separate a string name from its values. Decode the numeric value of a stack protection note. * objcopy.c (merge_gnu_build_notes): Allow version notes to contain extra text after the protocol version number.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2017-03-21 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* readelf.c (print_gnu_build_attribute_name): Allow stack
|
||||||
|
protection notes to contain numeric values. Use a colon rather
|
||||||
|
than a space to separate a string name from its values. Decode
|
||||||
|
the numeric value of a stack protection note.
|
||||||
|
* objcopy.c (merge_gnu_build_notes): Allow version notes to
|
||||||
|
contain extra text after the protocol version number.
|
||||||
|
|
||||||
2017-03-20 Mark Wielaard <mark@klomp.org>
|
2017-03-20 Mark Wielaard <mark@klomp.org>
|
||||||
|
|
||||||
* readelf.c (process_program_headers): Move dynamic_addr check
|
* readelf.c (process_program_headers): Move dynamic_addr check
|
||||||
|
@ -1933,7 +1933,7 @@ merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pnotes[0].namedata[0] != GNU_BUILD_ATTRIBUTE_TYPE_STRING
|
if (pnotes[0].namedata[0] != GNU_BUILD_ATTRIBUTE_TYPE_STRING
|
||||||
|| strcmp (pnotes[0].namedata + 2, "1") != 0)
|
|| pnotes[0].namedata[2] != '1')
|
||||||
{
|
{
|
||||||
err = _("bad GNU build attribute notes: version note not v1");
|
err = _("bad GNU build attribute notes: version note not v1");
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -16809,7 +16809,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
|
|||||||
break;
|
break;
|
||||||
case GNU_BUILD_ATTRIBUTE_STACK_PROT:
|
case GNU_BUILD_ATTRIBUTE_STACK_PROT:
|
||||||
text = _("<stack prot>");
|
text = _("<stack prot>");
|
||||||
expected_types = "!+";
|
expected_types = "!+*";
|
||||||
++ name;
|
++ name;
|
||||||
break;
|
break;
|
||||||
case GNU_BUILD_ATTRIBUTE_RELRO:
|
case GNU_BUILD_ATTRIBUTE_RELRO:
|
||||||
@ -16850,7 +16850,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
|
|||||||
|
|
||||||
if (len > left && ! do_wide)
|
if (len > left && ! do_wide)
|
||||||
len = left;
|
len = left;
|
||||||
printf ("%.*s ", len, name);
|
printf ("%.*s:", len, name);
|
||||||
left -= len;
|
left -= len;
|
||||||
name += len;
|
name += len;
|
||||||
}
|
}
|
||||||
@ -16871,7 +16871,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strchr (expected_types, name_type) == NULL)
|
if (strchr (expected_types, name_type) == NULL)
|
||||||
warn (_("attribute does not have the expected type\n"));
|
warn (_("attribute does not have an expected type (%c)\n"), name_type);
|
||||||
|
|
||||||
if ((unsigned long)(name - pnote->namedata) > pnote->namesz)
|
if ((unsigned long)(name - pnote->namedata) > pnote->namesz)
|
||||||
{
|
{
|
||||||
@ -16891,6 +16891,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
|
|||||||
unsigned int bytes = pnote->namesz - (name - pnote->namedata);
|
unsigned int bytes = pnote->namesz - (name - pnote->namedata);
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
unsigned int shift = 0;
|
unsigned int shift = 0;
|
||||||
|
char * decoded = NULL;
|
||||||
|
|
||||||
while (bytes --)
|
while (bytes --)
|
||||||
{
|
{
|
||||||
@ -16900,34 +16901,45 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
|
|||||||
shift += 8;
|
shift += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name_attribute == GNU_BUILD_ATTRIBUTE_PIC)
|
switch (name_attribute)
|
||||||
{
|
{
|
||||||
char * pic_type = NULL;
|
case GNU_BUILD_ATTRIBUTE_PIC:
|
||||||
|
|
||||||
switch (val)
|
switch (val)
|
||||||
{
|
{
|
||||||
case 0: pic_type = "static"; break;
|
case 0: decoded = "static"; break;
|
||||||
case 1: pic_type = "pic"; break;
|
case 1: decoded = "pic"; break;
|
||||||
case 2: pic_type = "PIC"; break;
|
case 2: decoded = "PIC"; break;
|
||||||
case 3: pic_type = "pie"; break;
|
case 3: decoded = "pie"; break;
|
||||||
case 4: pic_type = "PIE"; break;
|
case 4: decoded = "PIE"; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (pic_type != NULL)
|
case GNU_BUILD_ATTRIBUTE_STACK_PROT:
|
||||||
|
switch (val)
|
||||||
{
|
{
|
||||||
if (do_wide)
|
/* Based upon the SPCT_FLAG_xxx enum values in gcc/cfgexpand.c. */
|
||||||
left -= printf ("%s", pic_type);
|
case 0: decoded = "off"; break;
|
||||||
else
|
case 1: decoded = "on"; break;
|
||||||
left -= printf ("%-.*s", left, pic_type);
|
case 2: decoded = "all"; break;
|
||||||
|
case 3: decoded = "strong"; break;
|
||||||
|
case 4: decoded = "explicit"; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (decoded != NULL)
|
||||||
|
print_symbol (-left, decoded);
|
||||||
|
else
|
||||||
|
{
|
||||||
if (do_wide)
|
if (do_wide)
|
||||||
left -= printf ("0x%lx", val);
|
left -= printf ("0x%lx", val);
|
||||||
else
|
else
|
||||||
left -= printf ("0x%-.*lx", left, val);
|
left -= printf ("0x%-.*lx", left, val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GNU_BUILD_ATTRIBUTE_TYPE_STRING:
|
case GNU_BUILD_ATTRIBUTE_TYPE_STRING:
|
||||||
left -= print_symbol (- left, name);
|
left -= print_symbol (- left, name);
|
||||||
|
Reference in New Issue
Block a user