|
|
869a11 |
--- binutils.orig/binutils/objcopy.c 2018-08-06 09:11:02.053503486 +0100
|
|
|
869a11 |
+++ binutils-2.30/binutils/objcopy.c 2018-08-06 09:11:23.296329566 +0100
|
|
|
869a11 |
@@ -2174,7 +2174,7 @@ merge_gnu_build_notes (bfd * abfd, asect
|
|
|
869a11 |
3. Eliminate any NT_GNU_BUILD_ATTRIBUTE_OPEN notes that have the same
|
|
|
869a11 |
full name field as the immediately preceeding note with the same type
|
|
|
869a11 |
of name and whose address ranges coincide.
|
|
|
869a11 |
- IE - it there are gaps in the coverage of the notes, then these gaps
|
|
|
869a11 |
+ IE - if there are gaps in the coverage of the notes, then these gaps
|
|
|
869a11 |
must be preserved.
|
|
|
869a11 |
4. Combine the numeric value of any NT_GNU_BUILD_ATTRIBUTE_OPEN notes
|
|
|
869a11 |
of type GNU_BUILD_ATTRIBUTE_STACK_SIZE.
|
|
|
cf4a45 |
@@ -2182,16 +2182,47 @@ merge_gnu_build_notes (bfd * abfd, asect
|
|
|
869a11 |
its description field is empty then the nearest preceeding OPEN note
|
|
|
869a11 |
with a non-empty description field must also be preserved *OR* the
|
|
|
869a11 |
description field of the note must be changed to contain the starting
|
|
|
869a11 |
- address to which it refers. */
|
|
|
869a11 |
+ address to which it refers.
|
|
|
869a11 |
+ 6. Notes with the same start and end address can be deleted. */
|
|
|
869a11 |
for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++)
|
|
|
869a11 |
{
|
|
|
869a11 |
int note_type;
|
|
|
869a11 |
objcopy_internal_note * back;
|
|
|
869a11 |
objcopy_internal_note * prev_open_with_range = NULL;
|
|
|
869a11 |
|
|
|
869a11 |
+ /* Rule 6 - delete 0-range notes. */
|
|
|
869a11 |
+ if (pnote->start == pnote->end)
|
|
|
869a11 |
+ {
|
|
|
869a11 |
+ duplicate_found = TRUE;
|
|
|
869a11 |
+ pnote->note.type = 0;
|
|
|
869a11 |
+ continue;
|
|
|
869a11 |
+ }
|
|
|
869a11 |
+
|
|
|
869a11 |
/* Rule 2 - preserve function notes. */
|
|
|
869a11 |
if (! is_open_note (pnote))
|
|
|
869a11 |
- continue;
|
|
|
869a11 |
+ {
|
|
|
869a11 |
+ int iter;
|
|
|
869a11 |
+
|
|
|
869a11 |
+ /* Check to see if there is an identical previous function note.
|
|
|
869a11 |
+ This can happen with overlays for example. */
|
|
|
869a11 |
+ for (iter = 0, back = pnote -1; back >= pnotes; back --)
|
|
|
869a11 |
+ {
|
|
|
869a11 |
+ if (back->start == pnote->start
|
|
|
869a11 |
+ && back->end == pnote->end
|
|
|
869a11 |
+ && back->note.namesz == pnote->note.namesz
|
|
|
869a11 |
+ && memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0)
|
|
|
869a11 |
+ {
|
|
|
869a11 |
+ duplicate_found = TRUE;
|
|
|
869a11 |
+ pnote->note.type = 0;
|
|
|
869a11 |
+ break;
|
|
|
869a11 |
+ }
|
|
|
869a11 |
+
|
|
|
869a11 |
+ /* Don't scan too far back however. */
|
|
|
869a11 |
+ if (iter ++ > 16)
|
|
|
869a11 |
+ break;
|
|
|
869a11 |
+ }
|
|
|
869a11 |
+ continue;
|
|
|
869a11 |
+ }
|
|
|
869a11 |
|
|
|
869a11 |
note_type = pnote->note.namedata[attribute_type_byte];
|
|
|
869a11 |
|