gcc-toolset-9-binutils/SOURCES/binutils-objcopy-version-note.patch
2021-09-09 16:58:54 +00:00

29 lines
1.3 KiB
Diff

--- binutils.orig/binutils/objcopy.c 2019-08-06 09:42:51.065854915 +0100
+++ binutils-2.30/binutils/objcopy.c 2019-08-06 09:47:36.293974283 +0100
@@ -2161,12 +2161,10 @@ merge_gnu_build_notes (bfd * abfd, asect
attribute_type_byte = version_1_seen ? 1 : 3;
val_start = attribute_type_byte + 1;
- /* The first note should be the first version note. */
- if (pnotes[0].note.namedata[attribute_type_byte] != GNU_BUILD_ATTRIBUTE_VERSION)
- {
- err = _("bad GNU build attribute notes: first note not version note");
- goto done;
- }
+ /* We used to require that the first note be a version note,
+ but this is no longer enforced. Due to the problems with
+ linking sections with the same name (eg .gnu.build.note.hot)
+ we cannot guarantee that the first note will be a version note. */
/* Now merge the notes. The rules are:
1. Preserve the ordering of the notes.
@@ -2184,7 +2182,7 @@ merge_gnu_build_notes (bfd * abfd, asect
description field of the note must be changed to contain the starting
address to which it refers.
6. Notes with the same start and end address can be deleted. */
- for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++)
+ for (pnote = pnotes; pnote < pnotes_end; pnote ++)
{
int note_type;
objcopy_internal_note * back;