1 diff -rup binutils-2.25.orig/bfd/bfd.c binutils-2.25/bfd/bfd.c
2 --- binutils-2.25.orig/bfd/bfd.c 2014-12-24 10:46:27.893435026 +0000
3 +++ binutils-2.25/bfd/bfd.c 2014-12-24 10:48:25.666096395 +0000
4 @@ -44,6 +44,14 @@ CODE_FRAGMENT
8 +.enum bfd_lto_object_type
18 . {* The filename the application opened the BFD with. *}
19 @@ -221,6 +229,9 @@ CODE_FRAGMENT
20 . {* The last section on the section list. *}
21 . struct bfd_section *section_last;
23 +. {* The object-only section on the section list. *}
24 +. struct bfd_section *object_only_section;
26 . {* The number of sections. *}
27 . unsigned int section_count;
29 @@ -310,6 +321,9 @@ CODE_FRAGMENT
30 . struct objalloc *, but we use void * to avoid requiring the inclusion
34 +. {* LTO object type. *}
35 +. unsigned int lto_type : 2;
38 .{* See note beside bfd_set_section_userdata. *}
39 @@ -1923,3 +1937,36 @@ bfd_demangle (bfd *abfd, const char *nam
49 + asymbol *bfd_group_signature (asection *group, asymbol **isympp);
52 + Return a pointer to the symbol used as a signature for GROUP.
56 +bfd_group_signature (asection *group, asymbol **isympp)
58 + bfd *abfd = group->owner;
59 + Elf_Internal_Shdr *ghdr;
61 + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
64 + ghdr = &elf_section_data (group)->this_hdr;
65 + if (ghdr->sh_link < elf_numsections (abfd))
67 + const struct elf_backend_data *bed = get_elf_backend_data (abfd);
68 + Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
70 + if (symhdr->sh_type == SHT_SYMTAB
71 + && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
72 + return isympp[ghdr->sh_info - 1];
76 Only in binutils-2.25/bfd: bfd.c.orig
77 Only in binutils-2.25/bfd: bfd.c.rej
78 diff -rup binutils-2.25.orig/bfd/bfd-in2.h binutils-2.25/bfd/bfd-in2.h
79 --- binutils-2.25.orig/bfd/bfd-in2.h 2014-12-24 10:46:27.890435009 +0000
80 +++ binutils-2.25/bfd/bfd-in2.h 2014-12-24 10:54:21.498104097 +0000
81 @@ -1078,6 +1078,9 @@ struct bfd_section *bfd_create_gnu_debug
82 bfd_boolean bfd_fill_in_gnu_debuglink_section
83 (bfd *abfd, struct bfd_section *sect, const char *filename);
85 +const char *bfd_extract_object_only_section
88 /* Extracted from libbfd.c. */
90 /* Byte swapping macros for user section data. */
91 @@ -1650,6 +1653,9 @@ extern asection _bfd_std_section[4];
92 || ((SEC) == bfd_com_section_ptr) \
93 || ((SEC) == bfd_ind_section_ptr))
95 +/* GNU object-only section name. */
96 +#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
98 /* Macros to handle insertion and deletion of a bfd's sections. These
99 only handle the list pointers, ie. do not adjust section_count,
101 @@ -6269,6 +6275,14 @@ enum bfd_direction
105 +enum bfd_lto_object_type
115 /* The filename the application opened the BFD with. */
116 @@ -6446,6 +6460,9 @@ struct bfd
117 /* The last section on the section list. */
118 struct bfd_section *section_last;
120 + /* The object-only section on the section list. */
121 + struct bfd_section *object_only_section;
123 /* The number of sections. */
124 unsigned int section_count;
126 @@ -6535,6 +6552,9 @@ struct bfd
127 struct objalloc *, but we use void * to avoid requiring the inclusion
131 + /* LTO object type. */
132 + unsigned int lto_type : 2;
135 /* See note beside bfd_set_section_userdata. */
136 @@ -6747,6 +6767,8 @@ void bfd_emul_set_commonpagesize (const
138 char *bfd_demangle (bfd *, const char *, int);
140 +asymbol *bfd_group_signature (asection *group, asymbol **isympp);
142 /* Extracted from archive.c. */
143 symindex bfd_get_next_mapent
144 (bfd *abfd, symindex previous, carsym **sym);
145 Only in binutils-2.25/bfd: bfd-in2.h.orig
146 Only in binutils-2.25/bfd: bfd-in2.h.rej
147 diff -rup binutils-2.25.orig/bfd/elf.c binutils-2.25/bfd/elf.c
148 --- binutils-2.25.orig/bfd/elf.c 2014-12-24 10:46:27.884434975 +0000
149 +++ binutils-2.25/bfd/elf.c 2014-12-24 10:47:06.954654379 +0000
150 @@ -2208,6 +2208,7 @@ static const struct bfd_elf_special_sect
151 { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
152 { STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE },
153 { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
154 + { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
155 { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
156 { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
157 { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
158 diff -rup binutils-2.25.orig/bfd/format.c binutils-2.25/bfd/format.c
159 --- binutils-2.25.orig/bfd/format.c 2014-12-24 10:46:27.897435048 +0000
160 +++ binutils-2.25/bfd/format.c 2014-12-24 10:47:06.961654419 +0000
161 @@ -94,6 +94,33 @@ bfd_check_format (bfd *abfd, bfd_format
162 return bfd_check_format_matches (abfd, format, NULL);
165 +/* Set lto_type in ABFD. */
168 +bfd_set_lto_type (bfd *abfd)
170 + if (abfd->format == bfd_object
171 + && abfd->lto_type == lto_non_object
172 + && (abfd->flags & (DYNAMIC | EXEC_P)) == 0)
175 + enum bfd_lto_object_type type = lto_non_ir_object;
176 + for (sec = abfd->sections; sec != NULL; sec = sec->next)
178 + if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0)
180 + type = lto_mixed_object;
181 + abfd->object_only_section = sec;
184 + else if (type != lto_ir_object
185 + && strncmp (sec->name, ".gnu.lto_", 9) == 0)
186 + type = lto_ir_object;
188 + abfd->lto_type = type;
195 @@ -221,7 +248,10 @@ bfd_check_format_matches (bfd *abfd, bfd
198 if (abfd->format != bfd_unknown)
199 - return abfd->format == format;
201 + bfd_set_lto_type (abfd);
202 + return abfd->format == format;
205 if (matching != NULL || *bfd_associated_vector != NULL)
207 @@ -449,6 +479,9 @@ bfd_check_format_matches (bfd *abfd, bfd
209 free (matching_vector);
211 + bfd_set_lto_type (abfd);
214 /* File position has moved, BTW. */
217 Only in binutils-2.25/bfd: format.c.orig
218 diff -rup binutils-2.25.orig/bfd/opncls.c binutils-2.25/bfd/opncls.c
219 --- binutils-2.25.orig/bfd/opncls.c 2014-12-24 10:46:27.903435082 +0000
220 +++ binutils-2.25/bfd/opncls.c 2014-12-24 10:47:06.962654424 +0000
221 @@ -1711,3 +1711,69 @@ bfd_fill_in_gnu_debuglink_section (bfd *
228 + bfd_extract_object_only_section
231 + const char *bfd_extract_object_only_section
236 + Takes a @var{ABFD} and extract the .gnu_object_only section into
240 + The name of the temporary file is returned if all is ok.
241 + Otherwise <<NULL>> is returned and bfd_error is set.
245 +bfd_extract_object_only_section (bfd *abfd)
247 + asection *sec = abfd->object_only_section;
250 + bfd_byte *memhunk = NULL;
252 + bfd_error_type err;
254 + /* Get a temporary object-only file. */
255 + name = make_temp_file (".obj-only.o");
257 + /* Open the object-only file. */
258 + file = real_fopen (name, FOPEN_WB);
259 + if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
261 + err = bfd_get_error ();
267 + bfd_set_error (err);
273 + while (off != size)
275 + size_t written, nwrite = size - off;
277 + written = fwrite (memhunk + off, 1, nwrite, file);
278 + if (written < nwrite && ferror (file))
280 + err = bfd_error_system_call;
291 Only in binutils-2.25/bfd: opncls.c.orig
292 diff -rup binutils-2.25.orig/bfd/plugin.c binutils-2.25/bfd/plugin.c
293 --- binutils-2.25.orig/bfd/plugin.c 2014-12-24 10:46:27.898435054 +0000
294 +++ binutils-2.25/bfd/plugin.c 2014-12-24 10:47:06.963654430 +0000
295 @@ -129,6 +129,139 @@ register_claim_file (ld_plugin_claim_fil
299 +static asection bfd_plugin_fake_text_section
300 + = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, 0, ".text", 0);
301 +static asection bfd_plugin_fake_common_section
302 + = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, SEC_IS_COMMON, 0,
305 +/* Get symbols from object only section. */
308 +bfd_plugin_get_symbols_in_object_only (bfd *abfd)
310 + struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
311 + const char *object_only_file;
314 + long object_only_nsyms, added_nsyms, i;
315 + asymbol **object_only_syms, **added_syms;
317 + plugin_data->object_only_syms = NULL;
318 + plugin_data->object_only_nsyms = 0;
320 + if (abfd->sections == NULL && abfd->my_archive == NULL)
322 + nbfd = bfd_openr (abfd->filename, NULL);
323 + if (nbfd == NULL || !bfd_check_format (nbfd, bfd_object))
325 + (*_bfd_error_handler)
326 + (_("%s: failed to open to extract object only section: %s"),
327 + abfd->filename, bfd_errmsg (bfd_get_error ()));
334 + if (!bfd_check_format (abfd, bfd_object))
336 + (*_bfd_error_handler)
337 + (_("%B: invalid file to extract object only section: %s"),
338 + abfd, bfd_errmsg (bfd_get_error ()));
344 + if (nbfd->lto_type == lto_mixed_object
345 + && (nbfd->flags & HAS_SYMS) != 0)
347 + object_only_file = bfd_extract_object_only_section (nbfd);
348 + if (object_only_file == NULL)
349 + (*_bfd_error_handler)
350 + (_("%B: failed to extract object only section: %s"),
351 + abfd, bfd_errmsg (bfd_get_error ()));
354 + object_only_file = NULL;
356 + /* Close the new bfd we just opened. */
360 + /* Return if there is no object only section or there is no
361 + symbol in object only section. */
362 + if (!object_only_file)
365 + /* Open the file containing object only section. */
366 + nbfd = bfd_openr (object_only_file, NULL);
367 + if (!bfd_check_format (nbfd, bfd_object))
369 + (*_bfd_error_handler)
370 + (_("%B: failed to open object only section: %s"),
371 + abfd, bfd_errmsg (bfd_get_error ()));
375 + storage = bfd_get_symtab_upper_bound (nbfd);
379 + (*_bfd_error_handler)
380 + (_("%B: failed to get symbol table in object only section: %s"),
381 + abfd, bfd_errmsg (bfd_get_error ()));
386 + object_only_syms = (asymbol **) bfd_malloc (storage);
387 + object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms);
389 + /* FIXME: We waste some spaces if not all symbols are copied. */
390 + added_syms = (asymbol **) bfd_alloc (abfd, storage);
393 + /* Copy only global symbols from object only section. */
394 + for (i = 0; i < object_only_nsyms; i++)
396 + asection *sec = object_only_syms[i]->section;
397 + flagword flags = object_only_syms[i]->flags;
400 + if (bfd_is_com_section (sec))
401 + sec = &bfd_plugin_fake_common_section;
402 + else if (bfd_is_und_section (sec))
404 + else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
405 + sec = &bfd_plugin_fake_text_section;
409 + s = bfd_alloc (abfd, sizeof (asymbol));
411 + added_syms[added_nsyms++] = s;
415 + s->name = xstrdup (object_only_syms[i]->name);
421 + plugin_data->object_only_syms = added_syms;
422 + plugin_data->object_only_nsyms = added_nsyms;
424 + free (object_only_syms);
427 + /* Close and remove the object only section file. */
429 + unlink (object_only_file);
432 static enum ld_plugin_status
433 add_symbols (void * handle,
435 @@ -141,7 +274,9 @@ add_symbols (void * handle,
436 plugin_data->nsyms = nsyms;
437 plugin_data->syms = syms;
440 + bfd_plugin_get_symbols_in_object_only (abfd);
442 + if ((nsyms + plugin_data->object_only_nsyms) != 0)
443 abfd->flags |= HAS_SYMS;
445 abfd->tdata.plugin_data = plugin_data;
446 @@ -390,7 +525,8 @@ static long
447 bfd_plugin_get_symtab_upper_bound (bfd *abfd)
449 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
450 - long nsyms = plugin_data->nsyms;
451 + /* Add symbols from object only section. */
452 + long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms;
454 BFD_ASSERT (nsyms >= 0);
456 @@ -424,12 +560,7 @@ bfd_plugin_canonicalize_symtab (bfd *abf
457 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
458 long nsyms = plugin_data->nsyms;
459 const struct ld_plugin_symbol *syms = plugin_data->syms;
460 - static asection fake_section;
461 - static asection fake_common_section;
464 - fake_section.name = ".text";
465 - fake_common_section.flags = SEC_IS_COMMON;
468 for (i = 0; i < nsyms; i++)
470 @@ -442,10 +573,11 @@ bfd_plugin_canonicalize_symtab (bfd *abf
471 s->name = syms[i].name;
473 s->flags = convert_flags (&syms[i]);
478 - s->section = &fake_common_section;
479 + s->section = &bfd_plugin_fake_common_section;
483 @@ -453,15 +585,18 @@ bfd_plugin_canonicalize_symtab (bfd *abf
487 - s->section = &fake_section;
488 + s->section = &bfd_plugin_fake_text_section;
494 - s->udata.p = (void *) &syms[i];
497 + /* Copy symbols from object only section. */
498 + nsyms += plugin_data->object_only_nsyms;
499 + for (j = 0; j < plugin_data->object_only_nsyms; j++, i++)
500 + alocation[i] = plugin_data->object_only_syms[j];
505 Only in binutils-2.25/bfd: plugin.c.orig
506 diff -rup binutils-2.25.orig/bfd/plugin.h binutils-2.25/bfd/plugin.h
507 --- binutils-2.25.orig/bfd/plugin.h 2014-12-24 10:46:27.894435031 +0000
508 +++ binutils-2.25/bfd/plugin.h 2014-12-24 10:47:06.964654436 +0000
509 @@ -30,6 +30,8 @@ typedef struct plugin_data_struct
512 const struct ld_plugin_symbol *syms;
513 + int object_only_nsyms;
514 + asymbol **object_only_syms;
518 diff -rup binutils-2.25.orig/bfd/section.c binutils-2.25/bfd/section.c
519 --- binutils-2.25.orig/bfd/section.c 2014-12-24 10:46:27.882434964 +0000
520 +++ binutils-2.25/bfd/section.c 2014-12-24 10:47:07.163655553 +0000
521 @@ -595,6 +595,9 @@ CODE_FRAGMENT
522 . || ((SEC) == bfd_com_section_ptr) \
523 . || ((SEC) == bfd_ind_section_ptr))
525 +.{* GNU object-only section name. *}
526 +.#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
528 .{* Macros to handle insertion and deletion of a bfd's sections. These
529 . only handle the list pointers, ie. do not adjust section_count,
530 . target_index etc. *}
531 Only in binutils-2.25/bfd: section.c.orig
532 diff -rup binutils-2.25.orig/binutils/objcopy.c binutils-2.25/binutils/objcopy.c
533 --- binutils-2.25.orig/binutils/objcopy.c 2014-12-24 10:46:27.917435160 +0000
534 +++ binutils-2.25/binutils/objcopy.c 2014-12-24 10:47:07.165655564 +0000
535 @@ -1009,30 +1009,6 @@ is_specified_symbol (const char *name, h
536 return htab_find (htab, name) != NULL;
539 -/* Return a pointer to the symbol used as a signature for GROUP. */
542 -group_signature (asection *group)
544 - bfd *abfd = group->owner;
545 - Elf_Internal_Shdr *ghdr;
547 - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
550 - ghdr = &elf_section_data (group)->this_hdr;
551 - if (ghdr->sh_link < elf_numsections (abfd))
553 - const struct elf_backend_data *bed = get_elf_backend_data (abfd);
554 - Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
556 - if (symhdr->sh_type == SHT_SYMTAB
557 - && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
558 - return isympp[ghdr->sh_info - 1];
563 /* Return TRUE if the section is a DWO section. */
566 @@ -1114,7 +1090,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UN
568 If we are going to strip the group signature symbol, then
569 strip the group section too. */
570 - gsym = group_signature (sec);
571 + gsym = bfd_group_signature (sec, isympp);
575 @@ -2823,7 +2799,7 @@ setup_section (bfd *ibfd, sec_ptr isecti
577 if ((isection->flags & SEC_GROUP) != 0)
579 - asymbol *gsym = group_signature (isection);
580 + asymbol *gsym = bfd_group_signature (isection, isympp);
584 Only in binutils-2.25/binutils: objcopy.c.orig
585 diff -rup binutils-2.25.orig/binutils/readelf.c binutils-2.25/binutils/readelf.c
586 --- binutils-2.25.orig/binutils/readelf.c 2014-12-24 10:46:27.916435155 +0000
587 +++ binutils-2.25/binutils/readelf.c 2014-12-24 10:47:07.170655592 +0000
588 @@ -3624,6 +3624,7 @@ get_section_type_name (unsigned int sh_t
589 case 0x7ffffffd: return "AUXILIARY";
590 case 0x7fffffff: return "FILTER";
591 case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
592 + case SHT_GNU_OBJECT_ONLY: return "GNU_OBJECT_ONLY";
595 if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
596 Only in binutils-2.25/binutils: readelf.c.orig
597 diff -rup binutils-2.25.orig/include/bfdlink.h binutils-2.25/include/bfdlink.h
598 --- binutils-2.25.orig/include/bfdlink.h 2014-12-24 10:46:27.704433964 +0000
599 +++ binutils-2.25/include/bfdlink.h 2014-12-24 10:47:07.170655592 +0000
600 @@ -389,6 +389,12 @@ struct bfd_link_info
601 /* TRUE if ok to have multiple definition. */
602 unsigned int allow_multiple_definition: 1;
604 + /* TRUE if .gnu_object_only section should be created. */
605 + unsigned int emit_gnu_object_only: 1;
607 + /* TRUE if .gnu_object_only section is being created. */
608 + unsigned int emitting_gnu_object_only: 1;
610 /* TRUE if ok to have version with no definition. */
611 unsigned int allow_undefined_version: 1;
613 Only in binutils-2.25/include: bfdlink.h.orig
614 diff -rup binutils-2.25.orig/include/elf/common.h binutils-2.25/include/elf/common.h
615 --- binutils-2.25.orig/include/elf/common.h 2014-12-24 10:46:27.698433930 +0000
616 +++ binutils-2.25/include/elf/common.h 2014-12-24 10:47:07.171655598 +0000
618 #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
619 #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
620 #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
621 +#define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */
623 /* The next three section types are defined by Solaris, and are named
624 SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
625 diff -rup binutils-2.25.orig/ld/emultempl/alphaelf.em binutils-2.25/ld/emultempl/alphaelf.em
626 --- binutils-2.25.orig/ld/emultempl/alphaelf.em 2014-12-24 10:46:27.717434037 +0000
627 +++ binutils-2.25/ld/emultempl/alphaelf.em 2014-12-24 10:47:07.172655604 +0000
628 @@ -100,7 +100,7 @@ alpha_finish (void)
630 elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
633 + gld${EMULATION_NAME}_finish ();
637 diff -rup binutils-2.25.orig/ld/emultempl/armelf.em binutils-2.25/ld/emultempl/armelf.em
638 --- binutils-2.25.orig/ld/emultempl/armelf.em 2014-12-24 10:46:27.718434043 +0000
639 +++ binutils-2.25/ld/emultempl/armelf.em 2014-12-24 10:47:07.172655604 +0000
640 @@ -370,7 +370,7 @@ gld${EMULATION_NAME}_after_allocation (v
644 -gld${EMULATION_NAME}_finish (void)
647 struct bfd_link_hash_entry * h;
649 @@ -393,7 +393,7 @@ gld${EMULATION_NAME}_finish (void)
654 + gld${EMULATION_NAME}_finish ();
656 if (thumb_entry_symbol)
658 @@ -702,4 +702,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=
659 LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
661 # Call the extra arm-elf function
662 -LDEMUL_FINISH=gld${EMULATION_NAME}_finish
663 +LDEMUL_FINISH=arm_finish
664 Only in binutils-2.25/ld/emultempl: armelf.em.orig
665 diff -rup binutils-2.25.orig/ld/emultempl/elf32.em binutils-2.25/ld/emultempl/elf32.em
666 --- binutils-2.25.orig/ld/emultempl/elf32.em 2014-12-24 10:46:27.717434037 +0000
667 +++ binutils-2.25/ld/emultempl/elf32.em 2014-12-24 10:47:07.174655615 +0000
668 @@ -65,6 +65,7 @@ static void gld${EMULATION_NAME}_before_
669 static void gld${EMULATION_NAME}_after_allocation (void);
670 static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan
671 (asection *, const char *, int);
672 +static void gld${EMULATION_NAME}_finish (void);
675 if [ "x${USE_LIBPATH}" = xyes ] ; then
676 @@ -1730,6 +1731,8 @@ output_rel_find (asection *sec, int isdy
680 +static int orphan_init_done = 0;
682 /* Place an orphan section. We use this to put random SHF_ALLOC
683 sections in the right segment. */
685 @@ -1738,7 +1741,7 @@ gld${EMULATION_NAME}_place_orphan (asect
689 - static struct orphan_save hold[] =
690 + static struct orphan_save orig_hold[] =
693 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
694 @@ -1768,6 +1771,7 @@ gld${EMULATION_NAME}_place_orphan (asect
698 + static struct orphan_save hold[ARRAY_SIZE (orig_hold)];
699 enum orphan_save_index
702 @@ -1780,7 +1784,6 @@ gld${EMULATION_NAME}_place_orphan (asect
706 - static int orphan_init_done = 0;
707 struct orphan_save *place;
708 lang_output_section_statement_type *after;
709 lang_output_section_statement_type *os;
710 @@ -1857,15 +1860,22 @@ gld${EMULATION_NAME}_place_orphan (asect
712 if (!orphan_init_done)
714 - struct orphan_save *ho;
715 + struct orphan_save *ho, *horig;
717 for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
718 + for (ho = hold, horig = orig_hold;
719 + ho < hold + ARRAY_SIZE (hold);
723 + if (ho->name != NULL)
724 if (ho->name != NULL)
726 ho->os = lang_output_section_find (ho->name);
727 if (ho->os != NULL && ho->os->flags == 0)
728 ho->os->flags = ho->flags;
731 orphan_init_done = 1;
734 @@ -1937,6 +1947,27 @@ gld${EMULATION_NAME}_place_orphan (asect
740 +/* Final emulation specific call. */
743 +gld${EMULATION_NAME}_finish (void)
746 +if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then
748 + /* Support the object-only output. */
749 + if (link_info.emit_gnu_object_only)
750 + orphan_init_done = 0;
759 if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then
762 @@ -2505,7 +2536,7 @@ struct ld_emulation_xfer_struct ld_${EMU
763 ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
766 - ${LDEMUL_FINISH-finish_default},
767 + ${LDEMUL_FINISH-gld${EMULATION_NAME}_finish},
768 ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
769 ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-gld${EMULATION_NAME}_open_dynamic_archive},
770 ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
771 Only in binutils-2.25/ld/emultempl: elf32.em.orig
772 diff -rup binutils-2.25.orig/ld/emultempl/ppc64elf.em binutils-2.25/ld/emultempl/ppc64elf.em
773 --- binutils-2.25.orig/ld/emultempl/ppc64elf.em 2014-12-24 10:46:27.717434037 +0000
774 +++ binutils-2.25/ld/emultempl/ppc64elf.em 2014-12-24 10:47:07.174655615 +0000
775 @@ -522,7 +522,7 @@ gld${EMULATION_NAME}_after_allocation (v
776 /* Final emulation specific call. */
779 -gld${EMULATION_NAME}_finish (void)
783 char *line, *endline;
784 @@ -554,7 +554,7 @@ gld${EMULATION_NAME}_finish (void)
787 ppc64_elf_restore_symbols (&link_info);
789 + gld${EMULATION_NAME}_finish ();
793 @@ -876,6 +876,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
795 LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation
796 LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
797 -LDEMUL_FINISH=gld${EMULATION_NAME}_finish
798 +LDEMUL_FINISH=ppc_finish
799 LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=ppc_create_output_section_statements
800 LDEMUL_NEW_VERS_PATTERN=gld${EMULATION_NAME}_new_vers_pattern
801 Only in binutils-2.25/ld/emultempl: ppc64elf.em.orig
802 diff -rup binutils-2.25.orig/ld/emultempl/spuelf.em binutils-2.25/ld/emultempl/spuelf.em
803 --- binutils-2.25.orig/ld/emultempl/spuelf.em 2014-12-24 10:46:27.716434032 +0000
804 +++ binutils-2.25/ld/emultempl/spuelf.em 2014-12-24 10:47:07.175655620 +0000
805 @@ -416,7 +416,7 @@ spu_elf_relink (void)
806 /* Final emulation specific call. */
809 -gld${EMULATION_NAME}_finish (void)
812 if (is_spu_target ())
814 @@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void)
815 einfo ("%P: --auto-overlay ignored with zero local store range\n");
819 + gld${EMULATION_NAME}_finish ();
823 @@ -832,5 +832,5 @@ PARSE_AND_LIST_ARGS_CASES='
825 LDEMUL_AFTER_OPEN=spu_after_open
826 LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
827 -LDEMUL_FINISH=gld${EMULATION_NAME}_finish
828 +LDEMUL_FINISH=spu_finish
829 LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
830 diff -rup binutils-2.25.orig/ld/ldfile.c binutils-2.25/ld/ldfile.c
831 --- binutils-2.25.orig/ld/ldfile.c 2014-12-24 10:46:27.708433987 +0000
832 +++ binutils-2.25/ld/ldfile.c 2014-12-24 10:57:43.021241971 +0000
833 @@ -317,7 +317,9 @@ success:
834 plugin_maybe_claim (&file, entry);
838 #endif /* ENABLE_PLUGINS */
839 + cmdline_check_object_only_section (entry->the_bfd, FALSE);
841 /* It opened OK, the format checked out, and the plugins have had
842 their chance to claim it, so this is success. */
843 Only in binutils-2.25/ld: ldfile.c.orig
844 diff -rup binutils-2.25.orig/ld/ldlang.c binutils-2.25/ld/ldlang.c
845 --- binutils-2.25.orig/ld/ldlang.c 2014-12-24 10:46:27.712434009 +0000
846 +++ binutils-2.25/ld/ldlang.c 2014-12-24 11:00:13.328090658 +0000
851 +#include "ldwrite.h"
853 #include "demangle.h"
857 #endif /* ENABLE_PLUGINS */
859 +/* FIXME: Put it here to avoid NAME conflict from ldgram.h. */
860 +#include "elf-bfd.h"
863 #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
865 @@ -69,6 +73,9 @@ static lang_statement_list_type *stat_sa
866 static lang_statement_list_type **stat_save_ptr = &stat_save[0];
867 static struct unique_sections *unique_section_list;
868 static struct asneeded_minfo *asneeded_list_head;
869 +static cmdline_list_type cmdline_object_only_file_list;
870 +static cmdline_list_type cmdline_object_only_archive_list;
871 +static cmdline_list_type cmdline_temp_object_only_list;
873 /* Forward declarations. */
874 static void exp_init_os (etree_type *);
875 @@ -88,6 +95,10 @@ static void lang_record_phdrs (void);
876 static void lang_do_version_exports_section (void);
877 static void lang_finalize_version_expr_head
878 (struct bfd_elf_version_expr_head *);
879 +static void cmdline_lists_init (void);
880 +static void cmdline_get_object_only_input_files (void);
881 +static void print_cmdline_list (cmdline_union_type *);
882 +static bfd_boolean cmdline_on_object_only_archive_list_p (bfd *);
884 /* Exported variables. */
885 const char *output_target;
886 @@ -1221,14 +1232,17 @@ output_section_statement_table_free (voi
887 /* Build enough state so that the parser can build its tree. */
891 +lang_init (bfd_boolean object_only)
893 - obstack_begin (&stat_obstack, 1000);
895 + obstack_begin (&stat_obstack, 1000);
897 stat_ptr = &statement_list;
899 output_section_statement_table_init ();
901 + cmdline_lists_init ();
903 lang_list_init (stat_ptr);
905 lang_list_init (&input_file_chain);
906 @@ -1243,10 +1257,11 @@ lang_init (void)
908 /* The value "13" is ad-hoc, somewhat related to the expected number of
909 assignments in a linker script. */
910 - if (!bfd_hash_table_init_n (&lang_definedness_table,
911 - lang_definedness_newfunc,
912 - sizeof (struct lang_definedness_hash_entry),
915 + && !bfd_hash_table_init_n (&lang_definedness_table,
916 + lang_definedness_newfunc,
917 + sizeof (struct lang_definedness_hash_entry),
919 einfo (_("%P%F: can not create hash table: %E\n"));
921 asneeded_list_head = NULL;
922 @@ -2839,6 +2854,12 @@ load_symbols (lang_input_statement_type
926 + if (link_info.emitting_gnu_object_only)
928 + if (!cmdline_on_object_only_archive_list_p (member))
933 if (!(*link_info.callbacks
934 ->add_archive_element) (&link_info, member,
935 @@ -6740,7 +6761,37 @@ lang_process (void)
936 open_input_bfds (statement_list.head, OPEN_BFD_RESCAN);
940 #endif /* ENABLE_PLUGINS */
941 + if (link_info.relocatable)
943 + /* Check if .gnu_object_only section should be created. */
948 + for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link.next)
950 + object_type |= 1 << p->lto_type;
951 + if ((object_type & (1 << lto_mixed_object)) != 0
953 + & (1 << lto_non_ir_object
954 + | 1 << lto_ir_object))
955 + == (1 << lto_non_ir_object | 1 << lto_ir_object)))
957 + link_info.emit_gnu_object_only = TRUE;
963 + && (cmdline_object_only_file_list.head
964 + || cmdline_object_only_archive_list.head))
966 + print_cmdline_list (cmdline_object_only_file_list.head);
967 + print_cmdline_list (cmdline_object_only_archive_list.head);
971 link_info.gc_sym_list = &entry_symbol;
972 if (entry_symbol.name == NULL)
973 @@ -8142,3 +8193,961 @@ lang_ld_feature (char *str)
979 +cmdline_lists_init (void)
981 + cmdline_object_only_file_list.tail
982 + = &cmdline_object_only_file_list.head;
983 + cmdline_object_only_archive_list.tail
984 + = &cmdline_object_only_archive_list.head;
985 + cmdline_temp_object_only_list.tail
986 + = &cmdline_temp_object_only_list.head;
989 +/* Allocate an item with TYPE and DATA. */
991 +static cmdline_union_type *
992 +cmdline_list_new (cmdline_enum_type type, void *data)
994 + cmdline_union_type *new_opt;
996 + new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
997 + new_opt->header.type = type;
1002 + case cmdline_is_file_enum:
1003 + new_opt->file.filename = (const char *) data;
1005 + case cmdline_is_bfd_enum:
1006 + new_opt->abfd.abfd = (bfd *) data;
1012 +/* Append an item with TYPE and DATA to LIST. */
1015 +cmdline_list_append (cmdline_list_type *list, cmdline_enum_type type,
1018 + cmdline_union_type *new_opt = cmdline_list_new (type, data);
1019 + new_opt->header.next = NULL;
1020 + *list->tail = new_opt;
1021 + list->tail = &new_opt->header.next;
1025 +print_cmdline_list (cmdline_union_type *c)
1027 + for (; c != NULL; c = c->header.next)
1028 + switch (c->header.type)
1032 + case cmdline_is_file_enum:
1033 + info_msg (" %s", c->file.filename);
1035 + case cmdline_is_bfd_enum:
1036 + info_msg (" [%B]", c->abfd.abfd);
1043 +/* Return TRUE if ABFD is on cmdline_object_only_archive_list. */
1046 +cmdline_on_object_only_archive_list_p (bfd *abfd)
1048 + cmdline_union_type *c, *next;
1049 + bfd *archive, *obfd, *oarchive;
1050 + ufile_ptr origin = abfd->origin;
1052 + archive = bfd_my_archive (abfd);
1053 + for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
1055 + if (c->header.type != cmdline_is_bfd_enum)
1058 + next = c->header.next;
1059 + obfd = c->abfd.abfd;
1060 + oarchive = bfd_my_archive (obfd);
1062 + /* The list is grouped by archive file name and sorted by member
1064 + if (strcmp (archive->filename, oarchive->filename) != 0)
1067 + if (origin == obfd->origin)
1069 + else if (origin < obfd->origin)
1076 +/* Append an item with TYPE and DATA to cmdline_object_only_file_list
1077 + or cmdline_object_only_archive_list if needed. */
1080 +cmdline_object_only_list_append (cmdline_enum_type type, void *data)
1082 + cmdline_union_type *c;
1083 + cmdline_union_type *new_opt, *next, **prev;
1084 + bfd *abfd, *archive;
1085 + bfd *obfd, *oarchive;
1086 + bfd *nbfd, *narchive;
1087 + ufile_ptr origin, norigin;
1089 + /* Put it on cmdline_object_only_file_list if it isn't an archive
1095 + case cmdline_is_bfd_enum:
1096 + abfd = (bfd *) data;
1097 + archive = bfd_my_archive (abfd);
1100 + case cmdline_is_file_enum:
1101 + cmdline_list_append (&cmdline_object_only_file_list, type, data);
1105 + /* Put archive member on cmdline_object_only_archive_list and sort
1106 + the list by archive name and archive member origin. */
1107 + new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
1108 + new_opt->header.type = cmdline_is_bfd_enum;
1109 + new_opt->header.next = NULL;
1110 + new_opt->abfd.abfd = (bfd *) data;
1112 + c = cmdline_object_only_archive_list.head;
1115 + cmdline_object_only_archive_list.head = new_opt;
1116 + cmdline_object_only_archive_list.tail = &new_opt->header.next;
1121 + origin = abfd->origin;
1122 + for (; c != NULL; c = next)
1124 + if (c->header.type != cmdline_is_bfd_enum)
1127 + next = c->header.next;
1129 + obfd = c->abfd.abfd;
1130 + oarchive = bfd_my_archive (obfd);
1132 + if (strcmp (archive->filename, oarchive->filename) == 0)
1134 + bfd_boolean after;
1136 + if (origin < obfd->origin)
1138 + /* Insert it before the current. */
1139 + new_opt->header.next = c;
1143 + cmdline_object_only_archive_list.head = new_opt;
1149 + /* Check origin. */
1152 + if (next->header.type != cmdline_is_bfd_enum)
1155 + nbfd = next->abfd.abfd;
1156 + norigin = nbfd->origin;
1157 + if (origin > norigin)
1159 + /* Insert it after NEXT. */
1163 + narchive = bfd_my_archive (nbfd);
1164 + if (strcmp (archive->filename, narchive->filename) != 0)
1166 + /* Insert it befor NEXT. */
1172 + next = next->header.next;
1175 + if (after && next)
1178 + next = next->header.next;
1181 + if (*cmdline_object_only_archive_list.tail == c->header.next)
1182 + cmdline_object_only_archive_list.tail
1183 + = &new_opt->header.next;
1185 + prev = &c->header.next;
1186 + new_opt->header.next = next;
1191 + prev = &c->header.next;
1194 + *cmdline_object_only_archive_list.tail = new_opt;
1195 + cmdline_object_only_archive_list.tail = &new_opt->header.next;
1200 +cmdline_get_object_only_input_files (void)
1202 + cmdline_union_type *c, *next;
1203 + bfd *abfd, *archive;
1204 + bfd *nbfd, *narchive;
1206 + /* Add files first. */
1207 + for (c = cmdline_object_only_file_list.head;
1208 + c != NULL; c = c->header.next)
1209 + switch (c->header.type)
1213 + case cmdline_is_file_enum:
1214 + lang_add_input_file (c->file.filename,
1215 + lang_input_file_is_file_enum, NULL);
1217 + case cmdline_is_bfd_enum:
1218 + abfd = c->abfd.abfd;
1219 + if (bfd_my_archive (abfd))
1221 + lang_add_input_file (abfd->filename,
1222 + lang_input_file_is_file_enum, NULL);
1226 + /* Add archive members next. */
1227 + for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
1229 + if (c->header.type != cmdline_is_bfd_enum)
1232 + next = c->header.next;
1234 + abfd = c->abfd.abfd;
1235 + archive = bfd_my_archive (abfd);
1237 + /* Add the first archive of the archive member group. */
1238 + lang_add_input_file (archive->filename,
1239 + lang_input_file_is_file_enum, NULL);
1241 + /* Skip the rest members in the archive member group. */
1247 + if (next->header.type != cmdline_is_bfd_enum)
1250 + next = next->header.next;
1253 + nbfd = next->abfd.abfd;
1254 + narchive = bfd_my_archive (nbfd);
1256 + while (strcmp (archive->filename, narchive->filename) == 0);
1267 +/* Create a section in OBFD with the same
1268 + name and attributes as ISECTION in IBFD. */
1271 +setup_section (bfd *ibfd, sec_ptr isection, void *p)
1273 + struct cmdline_arg *arg = (struct cmdline_arg *) p;
1274 + bfd *obfd = arg->obfd;
1275 + asymbol **isympp = arg->isympp;
1276 + const char *name = isection->name;
1280 + /* Skip the object-only section. */
1281 + if (ibfd->object_only_section == isection)
1284 + /* If we have already failed earlier on, do not keep on generating
1285 + complaints now. */
1289 + osection = bfd_make_section_anyway_with_flags (obfd, name,
1292 + if (osection == NULL)
1294 + err = _("failed to create output section");
1298 + osection->size = isection->size;
1299 + osection->vma = isection->vma;
1300 + osection->lma = isection->lma;
1301 + osection->alignment_power = isection->alignment_power;
1303 + /* Copy merge entity size. */
1304 + osection->entsize = isection->entsize;
1306 + /* This used to be mangle_section; we do here to avoid using
1307 + bfd_get_section_by_name since some formats allow multiple
1308 + sections with the same name. */
1309 + isection->output_section = osection;
1310 + isection->output_offset = 0;
1312 + if ((isection->flags & SEC_GROUP) != 0)
1314 + asymbol *gsym = bfd_group_signature (isection, isympp);
1318 + gsym->flags |= BSF_KEEP;
1319 + if (ibfd->xvec->flavour == bfd_target_elf_flavour)
1320 + elf_group_id (isection) = gsym;
1324 + /* Allow the BFD backend to copy any private data it understands
1325 + from the input section to the output section. */
1326 + if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
1328 + err = _("failed to copy private data");
1332 + /* All went well. */
1337 + einfo (_("%P%F: setup_section: %s: %s\n"), err, name);
1340 +/* Copy the data of input section ISECTION of IBFD
1341 + to an output section with the same name in OBFD.
1342 + If stripping then don't copy any relocation info. */
1345 +copy_section (bfd *ibfd, sec_ptr isection, void *p)
1347 + struct cmdline_arg *arg = (struct cmdline_arg *) p;
1348 + bfd *obfd = arg->obfd;
1349 + asymbol **isympp = arg->isympp;
1353 + bfd_size_type size;
1358 + /* Skip the object-only section. */
1359 + if (ibfd->object_only_section == isection)
1362 + /* If we have already failed earlier on, do not keep on generating
1363 + complaints now. */
1367 + flags = bfd_get_section_flags (ibfd, isection);
1368 + if ((flags & SEC_GROUP) != 0)
1371 + osection = isection->output_section;
1372 + size = bfd_get_section_size (isection);
1374 + if (size == 0 || osection == 0)
1377 + relsize = bfd_get_reloc_upper_bound (ibfd, isection);
1381 + /* Do not complain if the target does not support relocations. */
1383 + && bfd_get_error () == bfd_error_invalid_operation)
1387 + err = bfd_errmsg (bfd_get_error ());
1393 + bfd_set_reloc (obfd, osection, NULL, 0);
1396 + relpp = (arelent **) xmalloc (relsize);
1397 + relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
1400 + err = _("relocation count is negative");
1404 + bfd_set_reloc (obfd, osection,
1405 + relcount == 0 ? NULL : relpp, relcount);
1406 + if (relcount == 0)
1410 + if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS)
1412 + bfd_byte *memhunk = NULL;
1414 + if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
1416 + err = bfd_errmsg (bfd_get_error ());
1420 + if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
1422 + err = bfd_errmsg (bfd_get_error ());
1428 + /* All went well. */
1432 + einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name);
1434 +/* Open the temporary bfd created in the same directory as PATH. */
1437 +cmdline_fopen_temp (const char *path, const char *target,
1440 +#define template "ldXXXXXX"
1441 + const char *slash = strrchr (path, '/');
1446 +#ifdef HAVE_DOS_BASED_FILE_SYSTEM
1448 + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
1449 + char *bslash = strrchr (path, '\\');
1451 + if (slash == NULL || (bslash != NULL && bslash > slash))
1453 + if (slash == NULL && path[0] != '\0' && path[1] == ':')
1458 + if (slash != (char *) NULL)
1460 + len = slash - path;
1461 + tmpname = (char *) xmalloc (len + sizeof (template) + 2);
1462 + memcpy (tmpname, path, len);
1464 +#ifdef HAVE_DOS_BASED_FILE_SYSTEM
1465 + /* If tmpname is "X:", appending a slash will make it a root
1466 + directory on drive X, which is NOT the same as the current
1467 + directory on drive X. */
1468 + if (len == 2 && tmpname[1] == ':')
1469 + tmpname[len++] = '.';
1471 + tmpname[len++] = '/';
1475 + tmpname = (char *) xmalloc (sizeof (template));
1479 + memcpy (tmpname + len, template, sizeof (template));
1482 +#ifdef HAVE_MKSTEMP
1483 + fd = mkstemp (tmpname);
1485 + tmpname = mktemp (tmpname);
1486 + if (tmpname == NULL)
1488 + fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
1492 + return bfd_fopen (tmpname, target, mode, fd);
1495 +/* Add the object-only section. */
1498 +cmdline_add_object_only_section (bfd_byte *contents, size_t size)
1502 + enum bfd_architecture iarch;
1503 + unsigned int imach;
1506 + asymbol **isympp = NULL;
1507 + asymbol **osympp = NULL;
1508 + bfd *obfd = NULL, *ibfd;
1517 + const char *ofilename = NULL;
1520 + ibfd = bfd_openr (output_filename, output_target);
1523 + err = bfd_errmsg (bfd_get_error ());
1527 + if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
1529 + err = bfd_errmsg (bfd_get_error ());
1533 + obfd = cmdline_fopen_temp (output_filename, output_target, "w");
1536 + err = bfd_errmsg (bfd_get_error ());
1539 + ofilename = bfd_get_filename (obfd);
1541 + if (!bfd_set_format (obfd, bfd_object))
1543 + err = bfd_errmsg (bfd_get_error ());
1547 + /* Copy the start address, flags and architecture of input file to
1549 + flags = bfd_get_file_flags (ibfd);
1550 + start = bfd_get_start_address (ibfd);
1551 + iarch = bfd_get_arch (ibfd);
1552 + imach = bfd_get_mach (ibfd);
1553 + if (!bfd_set_start_address (obfd, start)
1554 + || !bfd_set_file_flags (obfd, flags)
1555 + || !bfd_set_arch_mach (obfd, iarch, imach))
1557 + err = bfd_errmsg (bfd_get_error ());
1561 + symsize = bfd_get_symtab_upper_bound (ibfd);
1564 + err = bfd_errmsg (bfd_get_error ());
1568 + isympp = (asymbol **) xmalloc (symsize);
1569 + symcount = bfd_canonicalize_symtab (ibfd, isympp);
1572 + err = bfd_errmsg (bfd_get_error ());
1577 + arg.isympp = isympp;
1580 + /* BFD mandates that all output sections be created and sizes set before
1581 + any output is done. Thus, we traverse all sections multiple times. */
1582 + bfd_map_over_sections (ibfd, setup_section, &arg);
1586 + err = _("error setting up sections");
1590 + /* Allow the BFD backend to copy any private data it understands
1591 + from the input section to the output section. */
1592 + if (! bfd_copy_private_header_data (ibfd, obfd))
1594 + err = _("error copying private header data");
1598 + /* Create the object-only section. */
1599 + sec = bfd_make_section_with_flags (obfd,
1600 + GNU_OBJECT_ONLY_SECTION_NAME,
1604 + | SEC_LINKER_CREATED));
1607 + err = _("can't create object-only section");
1611 + if (! bfd_set_section_size (obfd, sec, size))
1613 + err = _("can't set object-only section size");
1617 + if (ibfd->object_only_section)
1619 + /* Filter out the object-only section symbol. */
1620 + long src_count = 0, dst_count = 0;
1621 + asymbol **from, **to;
1623 + osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *));
1626 + for (; src_count < symcount; src_count++)
1628 + asymbol *sym = from[src_count];
1629 + if (bfd_get_section (sym) != ibfd->object_only_section)
1630 + to[dst_count++] = sym;
1632 + to[dst_count] = NULL;
1633 + symcount = dst_count;
1634 + bfd_set_symtab (obfd, osympp, symcount);
1637 + bfd_set_symtab (obfd, isympp, symcount);
1639 + /* This has to happen after the symbol table has been set. */
1640 + bfd_map_over_sections (ibfd, copy_section, &arg);
1644 + err = _("error copying sections");
1648 + /* Copy the object-only section to the output. */
1649 + if (! bfd_set_section_contents (obfd, sec, contents, 0, size))
1651 + err = _("error adding object-only section");
1655 + /* Allow the BFD backend to copy any private data it understands
1656 + from the input BFD to the output BFD. This is done last to
1657 + permit the routine to look at the filtered symbol table, which is
1658 + important for the ECOFF code at least. */
1659 + if (! bfd_copy_private_bfd_data (ibfd, obfd))
1661 + err = _("error copying private BFD data");
1665 + if (!bfd_close (obfd))
1667 + unlink (ofilename);
1668 + einfo (_("%P%F: failed to finish output with object-only section\n"));
1671 + /* Must be freed after bfd_close (). */
1676 + if (rename (ofilename, output_filename))
1678 + unlink (ofilename);
1679 + einfo (_("%P%F: failed to rename output with object-only section\n"));
1692 + unlink (ofilename);
1693 + einfo (_("%P%F: failed to add object-only section: %s\n"), err);
1696 +/* Emit the final output with object-only section. */
1699 +cmdline_emit_object_only_section (void)
1701 + const char *saved_output_filename = output_filename;
1704 + bfd_byte *contents;
1707 + /* Get a temporary object-only file. */
1708 + output_filename = make_temp_file (".obj-only.o");
1710 + had_output_filename = FALSE;
1711 + link_info.input_bfds = NULL;
1712 + link_info.input_bfds_tail = &link_info.input_bfds;
1716 + ld_parse_linker_script ();
1718 + /* Set up the object-only output. */
1721 + /* Open the object-only file for output. */
1722 + lang_for_each_statement (ldlang_open_output);
1724 + ldemul_create_output_section_statements ();
1726 + if (!bfd_section_already_linked_table_init ())
1727 + einfo (_("%P%F: Failed to create hash table\n"));
1729 + /* Call cmdline_on_object_only_archive_list_p to check which member
1730 + should be loaded. */
1731 + input_flags.whole_archive = TRUE;
1733 + /* Set it to avoid adding more to cmdline lists. */
1734 + link_info.emitting_gnu_object_only = TRUE;
1736 + cmdline_get_object_only_input_files ();
1738 + open_input_bfds (statement_list.head, FALSE);
1740 + ldemul_after_open ();
1742 + bfd_section_already_linked_table_free ();
1744 + /* Make sure that we're not mixing architectures. We call this
1745 + after all the input files have been opened, but before we do any
1746 + other processing, so that any operations merge_private_bfd_data
1747 + does on the output file will be known during the rest of the
1751 + /* Size up the common data. */
1754 + /* Update wild statements. */
1755 + update_wild_statements (statement_list.head);
1757 + /* Run through the contours of the script and attach input sections
1758 + to the correct output sections. */
1759 + map_input_to_output_sections (statement_list.head, NULL, NULL);
1761 + /* Find any sections not attached explicitly and handle them. */
1762 + lang_place_orphans ();
1764 + /* Do anything special before sizing sections. This is where ELF
1765 + and other back-ends size dynamic sections. */
1766 + ldemul_before_allocation ();
1768 + /* Size up the sections. */
1769 + lang_size_sections (NULL, ! RELAXATION_ENABLED);
1771 + /* See if anything special should be done now we know how big
1772 + everything is. This is where relaxation is done. */
1773 + ldemul_after_allocation ();
1777 + /* Make sure that the section addresses make sense. */
1778 + if (command_line.check_section_addresses)
1779 + lang_check_section_addresses ();
1787 + if (! bfd_close (link_info.output_bfd))
1788 + einfo (_("%P%F:%s: final close failed on object-only output: %E\n"),
1791 + /* Read in the object-only file. */
1792 + fd = open (output_filename, O_RDONLY | O_BINARY);
1795 + bfd_set_error (bfd_error_system_call);
1796 + einfo (_("%P%F:%s: cannot open object-only output: %E"),
1800 + /* Get the object-only file size. */
1801 + if (fstat (fd, &st) != 0)
1803 + bfd_set_error (bfd_error_system_call);
1804 + einfo (_("%P%F:%s: cannot stat object-only output: %E"),
1808 + size = st.st_size;
1810 + contents = (bfd_byte *) xmalloc (size);
1811 + while (off != size)
1815 + got = read (fd, contents + off, size - off);
1818 + bfd_set_error (bfd_error_system_call);
1819 + einfo (_("%P%F:%s: read failed on object-only output: %E"),
1828 + /* Remove the temporary object-only file. */
1829 + unlink (output_filename);
1831 + output_filename = saved_output_filename;
1833 + cmdline_add_object_only_section (contents, size);
1838 +/* Extract the object-only section. */
1840 +static const char *
1841 +cmdline_extract_object_only_section (bfd *abfd)
1843 + const char *name = bfd_extract_object_only_section (abfd);
1846 + einfo (_("%P%F: cannot extract object-only section from %B: %E"),
1849 + /* It should be removed after it is done. */
1850 + cmdline_list_append (&cmdline_temp_object_only_list,
1851 + cmdline_is_file_enum, (void *) name);
1856 +/* Check and handle the object-only section. */
1859 +cmdline_check_object_only_section (bfd *abfd, bfd_boolean lto)
1861 + const char *filename;
1863 + if (link_info.emitting_gnu_object_only
1864 + || abfd->format != bfd_object)
1869 + /* For LTO link, we only need to extract object-only section
1870 + from the mixed object, add it to input, and put it on LTO
1871 + claimed output. */
1872 + switch (abfd->lto_type)
1876 + case lto_mixed_object:
1877 + filename = cmdline_extract_object_only_section (abfd);
1878 + lang_add_input_file (filename,
1879 + lang_input_file_is_file_enum, NULL);
1881 + case lto_non_ir_object:
1882 + case lto_ir_object:
1886 + else if (link_info.relocatable)
1888 + /* For non-LTO relocatable link, we need to append non-IR object
1889 + file and the object file in object-only section to the object
1891 + switch (abfd->lto_type)
1895 + case lto_mixed_object:
1896 + filename = cmdline_extract_object_only_section (abfd);
1897 + cmdline_object_only_list_append (cmdline_is_file_enum,
1898 + (void *) filename);
1900 + case lto_non_ir_object:
1901 + cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd);
1903 + case lto_ir_object:
1909 +/* Remove temporary object-only files. */
1912 +cmdline_remove_object_only_files (void)
1914 + cmdline_union_type *c;
1916 +#ifdef ENABLE_PLUGINS
1917 + if (plugin_save_temps)
1921 + c = cmdline_temp_object_only_list.head;
1922 + for (; c != NULL; c = c->header.next)
1923 + switch (c->header.type)
1927 + case cmdline_is_file_enum:
1928 + unlink (c->file.filename);
1935 Only in binutils-2.25/ld: ldlang.c.orig
1936 Only in binutils-2.25/ld: ldlang.c.rej
1937 diff -rup binutils-2.25.orig/ld/ldlang.h binutils-2.25/ld/ldlang.h
1938 --- binutils-2.25.orig/ld/ldlang.h 2014-12-24 10:46:27.718434043 +0000
1939 +++ binutils-2.25/ld/ldlang.h 2014-12-24 10:47:07.181655654 +0000
1940 @@ -523,7 +523,7 @@ extern struct asneeded_minfo **asneeded_
1941 extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
1943 extern void lang_init
1946 extern void lang_finish
1948 extern lang_memory_region_type * lang_memory_region_lookup
1949 @@ -698,4 +698,45 @@ ldlang_override_segment_assignment
1951 lang_ld_feature (char *);
1955 + cmdline_is_file_enum,
1956 + cmdline_is_bfd_enum
1957 +} cmdline_enum_type;
1959 +typedef struct cmdline_header_struct
1961 + union cmdline_union *next;
1962 + cmdline_enum_type type;
1963 +} cmdline_header_type;
1965 +typedef struct cmdline_file_struct
1967 + cmdline_header_type header;
1968 + const char *filename;
1969 +} cmdline_file_type;
1971 +typedef struct cmdline_bfd_struct
1973 + cmdline_header_type header;
1975 +} cmdline_bfd_type;
1977 +typedef union cmdline_union
1979 + cmdline_header_type header;
1980 + cmdline_file_type file;
1981 + cmdline_bfd_type abfd;
1982 +} cmdline_union_type;
1984 +typedef struct cmdline_list
1986 + cmdline_union_type *head;
1987 + cmdline_union_type **tail;
1988 +} cmdline_list_type;
1990 +extern void cmdline_emit_object_only_section (void);
1991 +extern void cmdline_check_object_only_section (bfd *, bfd_boolean);
1992 +extern void cmdline_remove_object_only_files (void);
1995 Only in binutils-2.25/ld: ldlang.h.orig
1996 diff -rup binutils-2.25.orig/ld/ldlex.h binutils-2.25/ld/ldlex.h
1997 --- binutils-2.25.orig/ld/ldlex.h 2014-12-24 10:46:27.720434054 +0000
1998 +++ binutils-2.25/ld/ldlex.h 2014-12-24 10:47:07.181655654 +0000
1999 @@ -133,6 +133,7 @@ enum option_values
2000 #ifdef ENABLE_PLUGINS
2003 + OPTION_PLUGIN_SAVE_TEMPS,
2004 #endif /* ENABLE_PLUGINS */
2005 OPTION_DEFAULT_SCRIPT,
2006 OPTION_PRINT_OUTPUT_FORMAT,
2007 diff -rup binutils-2.25.orig/ld/ldmain.c binutils-2.25/ld/ldmain.c
2008 --- binutils-2.25.orig/ld/ldmain.c 2014-12-24 10:46:27.715434026 +0000
2009 +++ binutils-2.25/ld/ldmain.c 2014-12-24 11:02:55.443006018 +0000
2010 @@ -220,6 +220,9 @@ main (int argc, char **argv)
2012 xatexit (ld_cleanup);
2014 + /* Remove temporary object-only files. */
2015 + xatexit (cmdline_remove_object_only_files);
2017 /* Set up the sysroot directory. */
2018 ld_sysroot = get_sysroot (argc, argv);
2020 @@ -296,7 +299,7 @@ main (int argc, char **argv)
2021 default_target = ldemul_choose_target (argc, argv);
2022 config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
2023 config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
2025 + lang_init (FALSE);
2026 ldemul_before_parse ();
2027 lang_has_input_file = FALSE;
2028 parse_args (argc, argv);
2029 @@ -311,34 +314,7 @@ main (int argc, char **argv)
2031 ldemul_set_symbols ();
2033 - /* If we have not already opened and parsed a linker script,
2034 - try the default script from command line first. */
2035 - if (saved_script_handle == NULL
2036 - && command_line.default_script != NULL)
2038 - ldfile_open_command_file (command_line.default_script);
2039 - parser_input = input_script;
2043 - /* If we have not already opened and parsed a linker script
2044 - read the emulation's appropriate default script. */
2045 - if (saved_script_handle == NULL)
2048 - char *s = ldemul_get_script (&isfile);
2051 - ldfile_open_default_command_file (s);
2055 - lex_redirect (s, _("built in linker script"), 1);
2057 - parser_input = input_script;
2059 - lex_string = NULL;
2061 + ld_parse_linker_script ();
2065 @@ -459,6 +435,8 @@ main (int argc, char **argv)
2066 if (! bfd_close (link_info.output_bfd))
2067 einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd);
2069 + link_info.output_bfd = NULL;
2071 /* If the --force-exe-suffix is enabled, and we're making an
2072 executable file and it doesn't end in .exe, copy it to one
2074 @@ -505,6 +483,9 @@ main (int argc, char **argv)
2078 + if (link_info.emit_gnu_object_only)
2079 + cmdline_emit_object_only_section ();
2081 END_PROGRESS (program_name);
2084 @@ -814,7 +795,9 @@ add_archive_element (struct bfd_link_inf
2089 #endif /* ENABLE_PLUGINS */
2090 + cmdline_check_object_only_section (input->the_bfd, FALSE);
2092 ldlang_add_file (input);
2094 @@ -1207,7 +1190,8 @@ warning_callback (struct bfd_link_info *
2095 einfo ("%P: %s%s\n", _("warning: "), warning);
2096 else if (symbol == NULL)
2097 einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
2098 - else if (! symbol_warning (warning, symbol, abfd))
2099 + else if (((abfd->flags & BFD_PLUGIN) == 0)
2100 + && ! symbol_warning (warning, symbol, abfd))
2103 /* Search all input files for a reference to SYMBOL. */
2104 @@ -1493,3 +1477,38 @@ notice (struct bfd_link_info *info,
2109 +/* Parse the linker script. */
2112 +ld_parse_linker_script ()
2114 + /* If we have not already opened and parsed a linker script,
2115 + try the default script from command line first. */
2116 + if (saved_script_handle == NULL
2117 + && command_line.default_script != NULL)
2119 + ldfile_open_command_file (command_line.default_script);
2120 + parser_input = input_script;
2124 + /* If we have not already opened and parsed a linker script
2125 + read the emulation's appropriate default script. */
2126 + if (saved_script_handle == NULL)
2129 + char *s = ldemul_get_script (&isfile);
2132 + ldfile_open_default_command_file (s);
2136 + lex_redirect (s, _("built in linker script"), 1);
2138 + parser_input = input_script;
2140 + lex_string = NULL;
2143 Only in binutils-2.25/ld: ldmain.c.orig
2144 Only in binutils-2.25/ld: ldmain.c.rej
2145 diff -rup binutils-2.25.orig/ld/ldmain.h binutils-2.25/ld/ldmain.h
2146 --- binutils-2.25.orig/ld/ldmain.h 2014-12-24 10:46:27.715434026 +0000
2147 +++ binutils-2.25/ld/ldmain.h 2014-12-24 10:47:07.183655665 +0000
2148 @@ -59,4 +59,6 @@ extern void add_wrap (const char *);
2149 extern void add_ignoresym (struct bfd_link_info *, const char *);
2150 extern void add_keepsyms_file (const char *);
2152 +extern void ld_parse_linker_script (void);
2155 Only in binutils-2.25/ld: ldmain.h.orig
2156 diff -rup binutils-2.25.orig/ld/lexsup.c binutils-2.25/ld/lexsup.c
2157 --- binutils-2.25.orig/ld/lexsup.c 2014-12-24 10:46:27.870434896 +0000
2158 +++ binutils-2.25/ld/lexsup.c 2014-12-24 10:47:07.184655671 +0000
2159 @@ -166,6 +166,9 @@ static const struct ld_option ld_options
2160 '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
2161 { {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
2162 '\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH },
2163 + { {"plugin-save-temps", no_argument, NULL, OPTION_PLUGIN_SAVE_TEMPS},
2164 + '\0', NULL, N_("Store plugin intermediate files permanently"),
2166 { {"flto", optional_argument, NULL, OPTION_IGNORE},
2167 '\0', NULL, N_("Ignored for GCC LTO option compatibility"),
2169 @@ -978,6 +981,9 @@ parse_args (unsigned argc, char **argv)
2170 if (plugin_opt_plugin_arg (optarg))
2171 einfo(_("%P%F: bad -plugin-opt option\n"));
2173 + case OPTION_PLUGIN_SAVE_TEMPS:
2174 + plugin_save_temps = TRUE;
2176 #endif /* ENABLE_PLUGINS */
2178 link_info.emitrelocations = TRUE;
2179 Only in binutils-2.25/ld: lexsup.c.orig
2180 diff -rup binutils-2.25.orig/ld/plugin.c binutils-2.25/ld/plugin.c
2181 --- binutils-2.25.orig/ld/plugin.c 2014-12-24 10:46:27.719434048 +0000
2182 +++ binutils-2.25/ld/plugin.c 2014-12-24 10:47:07.185655677 +0000
2184 /* Report plugin symbols. */
2185 bfd_boolean report_plugin_symbols;
2187 +/* Store plugin intermediate files permanently. */
2188 +bfd_boolean plugin_save_temps;
2190 /* The suffix to append to the name of the real (claimed) object file
2191 when generating a dummy BFD to hold the IR symbols sent from the
2192 plugin. For cosmetic use only; appears in maps, crefs etc. */
2193 @@ -229,6 +232,17 @@ plugin_opt_plugin_arg (const char *arg)
2197 + /* Ignore -pass-through= from GCC driver. */
2201 + for (p = arg + 1; p; p++)
2204 + if (strncmp (p, "pass-through=", 13) == 0)
2208 newarg = xmalloc (sizeof *newarg);
2210 newarg->next = NULL;
2211 @@ -882,6 +896,9 @@ plugin_maybe_claim (struct ld_plugin_inp
2215 + /* Check object only section. */
2216 + cmdline_check_object_only_section (entry->the_bfd, TRUE);
2218 /* Discard the real file's BFD and substitute the dummy one. */
2220 /* BFD archive handling caches elements so we can't call
2221 @@ -935,14 +952,17 @@ plugin_call_cleanup (void)
2223 if (curplug->cleanup_handler && !curplug->cleanup_done)
2225 - enum ld_plugin_status rv;
2226 - curplug->cleanup_done = TRUE;
2227 - called_plugin = curplug;
2228 - rv = (*curplug->cleanup_handler) ();
2229 - called_plugin = NULL;
2230 - if (rv != LDPS_OK)
2231 - info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
2232 - curplug->name, rv);
2233 + if (!plugin_save_temps)
2235 + enum ld_plugin_status rv;
2236 + curplug->cleanup_done = TRUE;
2237 + called_plugin = curplug;
2238 + rv = (*curplug->cleanup_handler) ();
2239 + called_plugin = NULL;
2240 + if (rv != LDPS_OK)
2241 + info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
2242 + curplug->name, rv);
2244 dlclose (curplug->dlhandle);
2246 curplug = curplug->next;
2247 Only in binutils-2.25/ld: plugin.c.orig
2248 diff -rup binutils-2.25.orig/ld/plugin.h binutils-2.25/ld/plugin.h
2249 --- binutils-2.25.orig/ld/plugin.h 2014-12-24 10:46:27.718434043 +0000
2250 +++ binutils-2.25/ld/plugin.h 2014-12-24 10:47:07.185655677 +0000
2252 /* Report plugin symbols. */
2253 extern bfd_boolean report_plugin_symbols;
2255 +/* Store plugin intermediate files permanently. */
2256 +extern bfd_boolean plugin_save_temps;
2258 /* Set at all symbols read time, to avoid recursively offering the plugin
2259 its own newly-added input files and libs to claim. */
2260 extern bfd_boolean no_more_claiming;
2261 diff -rup binutils-2.25.orig/ld/scripttempl/armbpabi.sc binutils-2.25/ld/scripttempl/armbpabi.sc
2262 --- binutils-2.25.orig/ld/scripttempl/armbpabi.sc 2014-12-24 10:46:27.709433992 +0000
2263 +++ binutils-2.25/ld/scripttempl/armbpabi.sc 2014-12-24 10:47:07.400656884 +0000
2264 @@ -36,7 +36,7 @@ INTERP=".interp 0 : { *(.interp) }
2265 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
2266 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2267 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2268 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2269 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2270 if test -z "${NO_SMALL_DATA}"; then
2271 SBSS=".sbss ${RELOCATING-0} :
2273 Only in binutils-2.25/ld/scripttempl: armbpabi.sc.orig
2274 diff -rup binutils-2.25.orig/ld/scripttempl/elf32sh-symbian.sc binutils-2.25/ld/scripttempl/elf32sh-symbian.sc
2275 --- binutils-2.25.orig/ld/scripttempl/elf32sh-symbian.sc 2014-12-24 10:46:27.709433992 +0000
2276 +++ binutils-2.25/ld/scripttempl/elf32sh-symbian.sc 2014-12-24 10:47:07.401656890 +0000
2277 @@ -88,7 +88,7 @@ fi
2278 PLT=".plt : { *(.plt) } :dynamic :dyn"
2279 DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn"
2280 RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2281 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) }"
2282 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) *(.gnu_object_only) }"
2283 test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
2284 INIT_ARRAY=".init_array ${RELOCATING-0} :
2286 Only in binutils-2.25/ld/scripttempl: elf32sh-symbian.sc.orig
2287 diff -rup binutils-2.25.orig/ld/scripttempl/elf64hppa.sc binutils-2.25/ld/scripttempl/elf64hppa.sc
2288 --- binutils-2.25.orig/ld/scripttempl/elf64hppa.sc 2014-12-24 10:46:27.711434003 +0000
2289 +++ binutils-2.25/ld/scripttempl/elf64hppa.sc 2014-12-24 10:47:07.401656890 +0000
2290 @@ -132,7 +132,7 @@ fi
2291 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2292 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2293 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
2294 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2295 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2296 if test -z "${NO_SMALL_DATA}"; then
2297 SBSS=".sbss ${RELOCATING-0} :
2299 Only in binutils-2.25/ld/scripttempl: elf64hppa.sc.orig
2300 diff -rup binutils-2.25.orig/ld/scripttempl/elf.sc binutils-2.25/ld/scripttempl/elf.sc
2301 --- binutils-2.25.orig/ld/scripttempl/elf.sc 2014-12-24 10:46:27.709433992 +0000
2302 +++ binutils-2.25/ld/scripttempl/elf.sc 2014-12-24 10:47:07.402656895 +0000
2303 @@ -165,7 +165,7 @@ RELA_IPLT=".rela.iplt ${RELOCATING-0}
2304 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2305 RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
2306 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
2307 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2308 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2309 if test -z "${NO_SMALL_DATA}"; then
2310 SBSS=".${SBSS_NAME} ${RELOCATING-0} :
2312 Only in binutils-2.25/ld/scripttempl: elf.sc.orig
2313 diff -rup binutils-2.25.orig/ld/scripttempl/elfxtensa.sc binutils-2.25/ld/scripttempl/elfxtensa.sc
2314 --- binutils-2.25.orig/ld/scripttempl/elfxtensa.sc 2014-12-24 10:46:27.710433998 +0000
2315 +++ binutils-2.25/ld/scripttempl/elfxtensa.sc 2014-12-24 10:47:07.402656895 +0000
2316 @@ -145,7 +145,7 @@ fi
2317 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2318 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2319 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
2320 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2321 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2322 INIT_LIT=".init.literal 0 : { *(.init.literal) }"
2323 INIT=".init 0 : { *(.init) }"
2324 FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
2325 Only in binutils-2.25/ld/scripttempl: elfxtensa.sc.orig
2326 diff -rup binutils-2.25.orig/ld/scripttempl/mep.sc binutils-2.25/ld/scripttempl/mep.sc
2327 --- binutils-2.25.orig/ld/scripttempl/mep.sc 2014-12-24 10:46:27.711434003 +0000
2328 +++ binutils-2.25/ld/scripttempl/mep.sc 2014-12-24 10:47:07.403656901 +0000
2329 @@ -119,7 +119,7 @@ fi
2330 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2331 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2332 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2333 -DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2334 +DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2335 if test -z "${NO_SMALL_DATA}"; then
2336 SBSS=".sbss ${RELOCATING-0} :
2338 Only in binutils-2.25/ld/scripttempl: mep.sc.orig
2339 diff -rup binutils-2.25.orig/ld/scripttempl/pep.sc binutils-2.25/ld/scripttempl/pep.sc
2340 --- binutils-2.25.orig/ld/scripttempl/pep.sc 2014-12-24 10:46:27.709433992 +0000
2341 +++ binutils-2.25/ld/scripttempl/pep.sc 2014-12-24 10:47:07.403656901 +0000
2342 @@ -170,6 +170,7 @@ SECTIONS
2344 ${RELOCATING+ *(.note.GNU-stack)}
2345 ${RELOCATING+ *(.gnu.lto_*)}
2346 + ${RELOCATING+ *(.gnu_object_only)}
2349 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
2350 Only in binutils-2.25/ld/scripttempl: pep.sc.orig
2351 diff -rup binutils-2.25.orig/ld/scripttempl/pe.sc binutils-2.25/ld/scripttempl/pe.sc
2352 --- binutils-2.25.orig/ld/scripttempl/pe.sc 2014-12-24 10:46:27.711434003 +0000
2353 +++ binutils-2.25/ld/scripttempl/pe.sc 2014-12-24 10:47:07.404656906 +0000
2354 @@ -165,6 +165,7 @@ SECTIONS
2356 ${RELOCATING+ *(.note.GNU-stack)}
2357 ${RELOCATING+ *(.gnu.lto_*)}
2358 + ${RELOCATING+ *(.gnu_object_only)}
2361 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
2362 Only in binutils-2.25/ld/scripttempl: pe.sc.orig