GNU Binutils with patches for OS216
Révision | 4aae6e5abddb84e1225cfd696b8fd2c6832f9fb6 (tree) |
---|---|
l'heure | 2018-08-04 01:08:11 |
Auteur | Nick Clifton <nickc@redh...> |
Commiter | Nick Clifton |
Improve objcopy's ability to merge build notes.
* objcopy.c (merge_gnu_build_notes): Delete empty notes. Merge
identical function notes.
@@ -1,3 +1,8 @@ | ||
1 | +2018-08-03 Nick Clifton <nickc@redhat.com> | |
2 | + | |
3 | + * objcopy.c (merge_gnu_build_notes): Delete empty notes. Merge | |
4 | + identical function notes. | |
5 | + | |
1 | 6 | 2018-08-01 Nick Clifton <nickc@redhat.com> |
2 | 7 | |
3 | 8 | * README-how-to-make-a-release: Add note about regenerating the |
@@ -2177,7 +2177,7 @@ merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte | ||
2177 | 2177 | 3. Eliminate any NT_GNU_BUILD_ATTRIBUTE_OPEN notes that have the same |
2178 | 2178 | full name field as the immediately preceeding note with the same type |
2179 | 2179 | of name and whose address ranges coincide. |
2180 | - IE - it there are gaps in the coverage of the notes, then these gaps | |
2180 | + IE - if there are gaps in the coverage of the notes, then these gaps | |
2181 | 2181 | must be preserved. |
2182 | 2182 | 4. Combine the numeric value of any NT_GNU_BUILD_ATTRIBUTE_OPEN notes |
2183 | 2183 | of type GNU_BUILD_ATTRIBUTE_STACK_SIZE. |
@@ -2185,16 +2185,48 @@ merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte | ||
2185 | 2185 | its description field is empty then the nearest preceeding OPEN note |
2186 | 2186 | with a non-empty description field must also be preserved *OR* the |
2187 | 2187 | description field of the note must be changed to contain the starting |
2188 | - address to which it refers. */ | |
2188 | + address to which it refers. | |
2189 | + 6. Notes with the same start and end address can be deleted. */ | |
2189 | 2190 | for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++) |
2190 | 2191 | { |
2191 | 2192 | int note_type; |
2192 | 2193 | objcopy_internal_note * back; |
2193 | 2194 | objcopy_internal_note * prev_open_with_range = NULL; |
2194 | 2195 | |
2196 | + /* Rule 6 - delete 0-range notes. */ | |
2197 | + if (pnote->start == pnote->end) | |
2198 | + { | |
2199 | + duplicate_found = TRUE; | |
2200 | + pnote->note.type = 0; | |
2201 | + continue; | |
2202 | + } | |
2203 | + | |
2195 | 2204 | /* Rule 2 - preserve function notes. */ |
2196 | 2205 | if (! is_open_note (pnote)) |
2197 | - continue; | |
2206 | + { | |
2207 | + int iter; | |
2208 | + | |
2209 | + /* Check to see if there is an identical previous function note. | |
2210 | + This can happen with overlays for example. */ | |
2211 | + for (iter = 0, back = pnote -1; back >= pnotes; back --) | |
2212 | + { | |
2213 | + if (back->start == pnote->start | |
2214 | + && back->end == pnote->end | |
2215 | + && back->note.namesz == pnote->note.namesz | |
2216 | + && memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0) | |
2217 | + { | |
2218 | + fprintf (stderr, "DUP FUNXC\n"); | |
2219 | + duplicate_found = TRUE; | |
2220 | + pnote->note.type = 0; | |
2221 | + break; | |
2222 | + } | |
2223 | + | |
2224 | + /* Don't scan too far back however. */ | |
2225 | + if (iter ++ > 16) | |
2226 | + break; | |
2227 | + } | |
2228 | + continue; | |
2229 | + } | |
2198 | 2230 | |
2199 | 2231 | note_type = pnote->note.namedata[attribute_type_byte]; |
2200 | 2232 |