1 diff -cpr ../binutils-2.23.2.orig/bfd/bfd.c bfd/bfd.c
2 *** ../binutils-2.23.2.orig/bfd/bfd.c 2013-05-14 16:39:24.681717759 +0100
3 --- bfd/bfd.c 2013-05-14 16:40:06.988718932 +0100
4 *************** CODE_FRAGMENT
10 + .enum bfd_lto_object_type
13 + . lto_non_ir_object,
20 . {* A unique identifier of the BFD *}
21 *************** CODE_FRAGMENT
24 . {* The last section on the section list. *}
25 . struct bfd_section *section_last;
27 + . {* The object-only section on the section list. *}
28 + . struct bfd_section *object_only_section;
30 . {* The number of sections. *}
31 . unsigned int section_count;
33 *************** CODE_FRAGMENT
36 . {* Set if only required symbols should be added in the link hash table for
37 . this object. Used by VMS linkers. *}
38 . unsigned int selective_search : 1;
40 + . {* LTO object type. *}
41 + . unsigned int lto_type : 2;
45 *************** bfd_demangle (bfd *abfd, const char *nam
57 + asymbol *bfd_group_signature (asection *group, asymbol **isympp);
60 + Return a pointer to the symbol used as a signature for GROUP.
64 + bfd_group_signature (asection *group, asymbol **isympp)
66 + bfd *abfd = group->owner;
67 + Elf_Internal_Shdr *ghdr;
69 + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
72 + ghdr = &elf_section_data (group)->this_hdr;
73 + if (ghdr->sh_link < elf_numsections (abfd))
75 + const struct elf_backend_data *bed = get_elf_backend_data (abfd);
76 + Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
78 + if (symhdr->sh_type == SHT_SYMTAB
79 + && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
80 + return isympp[ghdr->sh_info - 1];
84 diff -cpr ../binutils-2.23.2.orig/bfd/bfd-in2.h bfd/bfd-in2.h
85 *** ../binutils-2.23.2.orig/bfd/bfd-in2.h 2013-05-14 16:39:24.640717758 +0100
86 --- bfd/bfd-in2.h 2013-05-14 16:42:03.217722154 +0100
87 *************** struct bfd_section *bfd_create_gnu_debug
90 bfd_boolean bfd_fill_in_gnu_debuglink_section
91 (bfd *abfd, struct bfd_section *sect, const char *filename);
93 + const char *bfd_extract_object_only_section
96 /* Extracted from libbfd.c. */
98 /* Byte swapping macros for user section data. */
99 *************** extern asection std_section[4];
102 || ((SEC) == bfd_com_section_ptr) \
103 || ((SEC) == bfd_ind_section_ptr))
105 + /* GNU object-only section name. */
106 + #define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
108 /* Macros to handle insertion and deletion of a bfd's sections. These
109 only handle the list pointers, ie. do not adjust section_count,
111 *************** enum bfd_direction
117 + enum bfd_lto_object_type
127 /* A unique identifier of the BFD */
128 *************** struct bfd
131 /* The last section on the section list. */
132 struct bfd_section *section_last;
134 + /* The object-only section on the section list. */
135 + struct bfd_section *object_only_section;
137 /* The number of sections. */
138 unsigned int section_count;
140 *************** struct bfd
143 /* Set if only required symbols should be added in the link hash table for
144 this object. Used by VMS linkers. */
145 unsigned int selective_search : 1;
147 + /* LTO object type. */
148 + unsigned int lto_type : 2;
151 typedef enum bfd_error
152 *************** void bfd_emul_set_commonpagesize (const
156 char *bfd_demangle (bfd *, const char *, int);
158 + asymbol *bfd_group_signature (asection *group, asymbol **isympp);
160 /* Extracted from archive.c. */
161 symindex bfd_get_next_mapent
162 (bfd *abfd, symindex previous, carsym **sym);
163 diff -cpr ../binutils-2.23.2.orig/bfd/elf.c bfd/elf.c
164 *** ../binutils-2.23.2.orig/bfd/elf.c 2013-05-14 16:39:25.317717777 +0100
165 --- bfd/elf.c 2013-05-14 16:40:06.993718932 +0100
166 *************** static const struct bfd_elf_special_sect
169 { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
170 { STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE },
171 { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
172 + { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
173 { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
174 { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
175 { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
176 diff -cpr ../binutils-2.23.2.orig/bfd/elflink.c bfd/elflink.c
177 *** ../binutils-2.23.2.orig/bfd/elflink.c 2013-05-14 16:39:25.280717776 +0100
178 --- bfd/elflink.c 2013-05-14 16:40:06.997718932 +0100
179 *************** elf_link_add_archive_symbols (bfd *abfd,
182 something wrong with the archive. */
183 if (element->archive_pass != 0)
185 + /* Don't load the IR archive member twice. */
186 + if (element->lto_type == lto_ir_object)
188 bfd_set_error (bfd_error_bad_value);
191 diff -cpr ../binutils-2.23.2.orig/bfd/format.c bfd/format.c
192 *** ../binutils-2.23.2.orig/bfd/format.c 2013-05-14 16:39:24.265717748 +0100
193 --- bfd/format.c 2013-05-14 16:40:07.006718933 +0100
194 *************** bfd_check_format (bfd *abfd, bfd_format
197 return bfd_check_format_matches (abfd, format, NULL);
200 + /* Set lto_type in ABFD. */
203 + bfd_set_lto_type (bfd *abfd)
205 + if (abfd->format == bfd_object
206 + && abfd->lto_type == lto_non_object
207 + && (abfd->flags & (DYNAMIC | EXEC_P)) == 0)
210 + enum bfd_lto_object_type type = lto_non_ir_object;
211 + for (sec = abfd->sections; sec != NULL; sec = sec->next)
213 + if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0)
215 + type = lto_mixed_object;
216 + abfd->object_only_section = sec;
219 + else if (type != lto_ir_object
220 + && strncmp (sec->name, ".gnu.lto_", 9) == 0)
221 + type = lto_ir_object;
223 + abfd->lto_type = type;
230 *************** bfd_check_format_matches (bfd *abfd, bfd
234 if (abfd->format != bfd_unknown)
235 ! return abfd->format == format;
237 if (matching != NULL || *bfd_associated_vector != NULL)
242 if (abfd->format != bfd_unknown)
244 ! bfd_set_lto_type (abfd);
245 ! return abfd->format == format;
248 if (matching != NULL || *bfd_associated_vector != NULL)
250 *************** bfd_check_format_matches (bfd *abfd, bfd
255 free (matching_vector);
257 + bfd_set_lto_type (abfd);
260 /* File position has moved, BTW. */
262 diff -cpr ../binutils-2.23.2.orig/bfd/opncls.c bfd/opncls.c
263 *** ../binutils-2.23.2.orig/bfd/opncls.c 2013-05-14 16:39:23.701717732 +0100
264 --- bfd/opncls.c 2013-05-14 16:40:07.008718933 +0100
265 *************** bfd_fill_in_gnu_debuglink_section (bfd *
274 + bfd_extract_object_only_section
277 + const char *bfd_extract_object_only_section
282 + Takes a @var{ABFD} and extract the .gnu_object_only section into
286 + The name of the temporary file is returned if all is ok.
287 + Otherwise <<NULL>> is returned and bfd_error is set.
291 + bfd_extract_object_only_section (bfd *abfd)
293 + asection *sec = abfd->object_only_section;
296 + bfd_byte *memhunk = NULL;
298 + bfd_error_type err;
300 + /* Get a temporary object-only file. */
301 + name = make_temp_file (".obj-only.o");
303 + /* Open the object-only file. */
304 + file = real_fopen (name, FOPEN_WB);
305 + if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
307 + err = bfd_get_error ();
313 + bfd_set_error (err);
319 + while (off != size)
321 + size_t written, nwrite = size - off;
323 + written = fwrite (memhunk + off, 1, nwrite, file);
324 + if (written < nwrite && ferror (file))
326 + err = bfd_error_system_call;
337 diff -cpr ../binutils-2.23.2.orig/bfd/plugin.c bfd/plugin.c
338 *** ../binutils-2.23.2.orig/bfd/plugin.c 2013-05-14 16:39:25.137717772 +0100
339 --- bfd/plugin.c 2013-05-14 16:40:07.010718933 +0100
340 *************** register_claim_file (ld_plugin_claim_fil
346 + static asection bfd_plugin_fake_text_section
347 + = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, 0, ".text", 0);
348 + static asection bfd_plugin_fake_common_section
349 + = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, SEC_IS_COMMON, 0,
352 + /* Get symbols from object only section. */
355 + bfd_plugin_get_symbols_in_object_only (bfd *abfd)
357 + struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
358 + const char *object_only_file;
361 + long object_only_nsyms, added_nsyms, i;
362 + asymbol **object_only_syms, **added_syms;
364 + plugin_data->object_only_syms = NULL;
365 + plugin_data->object_only_nsyms = 0;
367 + if (abfd->sections == NULL && abfd->my_archive == NULL)
369 + nbfd = bfd_openr (abfd->filename, NULL);
370 + if (nbfd == NULL || !bfd_check_format (nbfd, bfd_object))
372 + (*_bfd_error_handler)
373 + (_("%s: failed to open to extract object only section: %s"),
374 + abfd->filename, bfd_errmsg (bfd_get_error ()));
381 + if (!bfd_check_format (abfd, bfd_object))
383 + (*_bfd_error_handler)
384 + (_("%B: invalid file to extract object only section: %s"),
385 + abfd, bfd_errmsg (bfd_get_error ()));
391 + if (nbfd->lto_type == lto_mixed_object
392 + && (nbfd->flags & HAS_SYMS) != 0)
394 + object_only_file = bfd_extract_object_only_section (nbfd);
395 + if (object_only_file == NULL)
396 + (*_bfd_error_handler)
397 + (_("%B: failed to extract object only section: %s"),
398 + abfd, bfd_errmsg (bfd_get_error ()));
401 + object_only_file = NULL;
403 + /* Close the new bfd we just opened. */
407 + /* Return if there is no object only section or there is no
408 + symbol in object only section. */
409 + if (!object_only_file)
412 + /* Open the file containing object only section. */
413 + nbfd = bfd_openr (object_only_file, NULL);
414 + if (!bfd_check_format (nbfd, bfd_object))
416 + (*_bfd_error_handler)
417 + (_("%B: failed to open object only section: %s"),
418 + abfd, bfd_errmsg (bfd_get_error ()));
422 + storage = bfd_get_symtab_upper_bound (nbfd);
426 + (*_bfd_error_handler)
427 + (_("%B: failed to get symbol table in object only section: %s"),
428 + abfd, bfd_errmsg (bfd_get_error ()));
433 + object_only_syms = (asymbol **) bfd_malloc (storage);
434 + object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms);
436 + /* FIXME: We waste some spaces if not all symbols are copied. */
437 + added_syms = (asymbol **) bfd_alloc (abfd, storage);
440 + /* Copy only global symbols from object only section. */
441 + for (i = 0; i < object_only_nsyms; i++)
443 + asection *sec = object_only_syms[i]->section;
444 + flagword flags = object_only_syms[i]->flags;
447 + if (bfd_is_com_section (sec))
448 + sec = &bfd_plugin_fake_common_section;
449 + else if (bfd_is_und_section (sec))
451 + else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
452 + sec = &bfd_plugin_fake_text_section;
456 + s = bfd_alloc (abfd, sizeof (asymbol));
458 + added_syms[added_nsyms++] = s;
462 + s->name = xstrdup (object_only_syms[i]->name);
468 + plugin_data->object_only_syms = added_syms;
469 + plugin_data->object_only_nsyms = added_nsyms;
471 + free (object_only_syms);
474 + /* Close and remove the object only section file. */
476 + unlink (object_only_file);
479 static enum ld_plugin_status
480 add_symbols (void * handle,
482 *************** add_symbols (void * handle,
484 plugin_data->nsyms = nsyms;
485 plugin_data->syms = syms;
488 abfd->flags |= HAS_SYMS;
490 abfd->tdata.plugin_data = plugin_data;
492 plugin_data->nsyms = nsyms;
493 plugin_data->syms = syms;
495 ! bfd_plugin_get_symbols_in_object_only (abfd);
497 ! if ((nsyms + plugin_data->object_only_nsyms) != 0)
498 abfd->flags |= HAS_SYMS;
500 abfd->tdata.plugin_data = plugin_data;
501 *************** static long
503 bfd_plugin_get_symtab_upper_bound (bfd *abfd)
505 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
506 ! long nsyms = plugin_data->nsyms;
508 BFD_ASSERT (nsyms >= 0);
511 bfd_plugin_get_symtab_upper_bound (bfd *abfd)
513 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
514 ! /* Add symbols from object only section. */
515 ! long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms;
517 BFD_ASSERT (nsyms >= 0);
519 *************** bfd_plugin_canonicalize_symtab (bfd *abf
521 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
522 long nsyms = plugin_data->nsyms;
523 const struct ld_plugin_symbol *syms = plugin_data->syms;
524 ! static asection fake_section;
525 ! static asection fake_common_section;
528 ! fake_section.name = ".text";
529 ! fake_common_section.flags = SEC_IS_COMMON;
531 for (i = 0; i < nsyms; i++)
534 struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
535 long nsyms = plugin_data->nsyms;
536 const struct ld_plugin_symbol *syms = plugin_data->syms;
539 for (i = 0; i < nsyms; i++)
541 *************** bfd_plugin_canonicalize_symtab (bfd *abf
543 s->name = syms[i].name;
545 s->flags = convert_flags (&syms[i]);
549 ! s->section = &fake_common_section;
554 s->name = syms[i].name;
556 s->flags = convert_flags (&syms[i]);
561 ! s->section = &bfd_plugin_fake_common_section;
565 *************** bfd_plugin_canonicalize_symtab (bfd *abf
570 ! s->section = &fake_section;
576 - s->udata.p = (void *) &syms[i];
586 ! s->section = &bfd_plugin_fake_text_section;
593 + /* Copy symbols from object only section. */
594 + nsyms += plugin_data->object_only_nsyms;
595 + for (j = 0; j < plugin_data->object_only_nsyms; j++, i++)
596 + alocation[i] = plugin_data->object_only_syms[j];
601 diff -cpr ../binutils-2.23.2.orig/bfd/plugin.h bfd/plugin.h
602 *** ../binutils-2.23.2.orig/bfd/plugin.h 2013-05-14 16:39:25.481717782 +0100
603 --- bfd/plugin.h 2013-05-14 16:40:07.010718933 +0100
604 *************** typedef struct plugin_data_struct
609 const struct ld_plugin_symbol *syms;
610 + int object_only_nsyms;
611 + asymbol **object_only_syms;
615 diff -cpr ../binutils-2.23.2.orig/bfd/section.c bfd/section.c
616 *** ../binutils-2.23.2.orig/bfd/section.c 2013-05-14 16:39:26.180717801 +0100
617 --- bfd/section.c 2013-05-14 16:43:06.082723897 +0100
618 *************** CODE_FRAGMENT
621 . || ((SEC) == bfd_com_section_ptr) \
622 . || ((SEC) == bfd_ind_section_ptr))
624 + .{* GNU object-only section name. *}
625 + .#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
627 .{* Macros to handle insertion and deletion of a bfd's sections. These
628 . only handle the list pointers, ie. do not adjust section_count,
629 . target_index etc. *}
630 diff -cpr ../binutils-2.23.2.orig/binutils/objcopy.c binutils/objcopy.c
631 *** ../binutils-2.23.2.orig/binutils/objcopy.c 2013-05-14 16:39:36.214718079 +0100
632 --- binutils/objcopy.c 2013-05-14 16:45:04.631727183 +0100
633 *************** is_specified_symbol (const char *name, h
635 return htab_find (htab, name) != NULL;
638 - /* Return a pointer to the symbol used as a signature for GROUP. */
641 - group_signature (asection *group)
643 - bfd *abfd = group->owner;
644 - Elf_Internal_Shdr *ghdr;
646 - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
649 - ghdr = &elf_section_data (group)->this_hdr;
650 - if (ghdr->sh_link < elf_numsections (abfd))
652 - const struct elf_backend_data *bed = get_elf_backend_data (abfd);
653 - Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
655 - if (symhdr->sh_type == SHT_SYMTAB
656 - && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
657 - return isympp[ghdr->sh_info - 1];
662 /* Return TRUE if the section is a DWO section. */
666 *************** is_strip_section (bfd *abfd ATTRIBUTE_UN
669 If we are going to strip the group signature symbol, then
670 strip the group section too. */
671 ! gsym = group_signature (sec);
677 If we are going to strip the group signature symbol, then
678 strip the group section too. */
679 ! gsym = bfd_group_signature (sec, isympp);
683 *************** setup_section (bfd *ibfd, sec_ptr isecti
686 if ((isection->flags & SEC_GROUP) != 0)
688 ! asymbol *gsym = group_signature (isection);
694 if ((isection->flags & SEC_GROUP) != 0)
696 ! asymbol *gsym = bfd_group_signature (isection, isympp);
700 diff -cpr ../binutils-2.23.2.orig/binutils/readelf.c binutils/readelf.c
701 *** ../binutils-2.23.2.orig/binutils/readelf.c 2013-05-14 16:39:35.668718064 +0100
702 --- binutils/readelf.c 2013-05-14 16:40:07.022718933 +0100
703 *************** get_section_type_name (unsigned int sh_t
706 case 0x7ffffffd: return "AUXILIARY";
707 case 0x7fffffff: return "FILTER";
708 case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
709 + case SHT_GNU_OBJECT_ONLY: return "GNU_OBJECT_ONLY";
712 if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
713 diff -cpr ../binutils-2.23.2.orig/include/bfdlink.h include/bfdlink.h
714 *** ../binutils-2.23.2.orig/include/bfdlink.h 2013-05-14 16:39:19.745717623 +0100
715 --- include/bfdlink.h 2013-05-14 16:40:07.023718933 +0100
716 *************** struct bfd_link_info
719 /* TRUE if ok to have multiple definition. */
720 unsigned int allow_multiple_definition: 1;
722 + /* TRUE if .gnu_object_only section should be created. */
723 + unsigned int emit_gnu_object_only: 1;
725 + /* TRUE if .gnu_object_only section is being created. */
726 + unsigned int emitting_gnu_object_only: 1;
728 /* TRUE if ok to have version with no definition. */
729 unsigned int allow_undefined_version: 1;
731 diff -cpr ../binutils-2.23.2.orig/include/elf/common.h include/elf/common.h
732 *** ../binutils-2.23.2.orig/include/elf/common.h 2013-05-14 16:39:19.628717619 +0100
733 --- include/elf/common.h 2013-05-14 16:40:07.023718933 +0100
737 #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
738 #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
739 #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
740 + #define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */
742 /* The next three section types are defined by Solaris, and are named
743 SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
744 diff -cpr ../binutils-2.23.2.orig/ld/emultempl/alphaelf.em ld/emultempl/alphaelf.em
745 *** ../binutils-2.23.2.orig/ld/emultempl/alphaelf.em 2013-05-14 16:39:37.461718114 +0100
746 --- ld/emultempl/alphaelf.em 2013-05-14 16:40:07.030718933 +0100
747 *************** alpha_finish (void)
750 elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
758 elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
760 ! gld${EMULATION_NAME}_finish ();
764 diff -cpr ../binutils-2.23.2.orig/ld/emultempl/armelf.em ld/emultempl/armelf.em
765 *** ../binutils-2.23.2.orig/ld/emultempl/armelf.em 2013-05-14 16:39:37.458718114 +0100
766 --- ld/emultempl/armelf.em 2013-05-14 16:40:07.033718933 +0100
767 *************** gld${EMULATION_NAME}_after_allocation (v
772 ! gld${EMULATION_NAME}_finish (void)
774 struct bfd_link_hash_entry * h;
782 struct bfd_link_hash_entry * h;
784 *************** gld${EMULATION_NAME}_finish (void)
791 if (thumb_entry_symbol)
797 ! gld${EMULATION_NAME}_finish ();
799 if (thumb_entry_symbol)
801 *************** LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=
803 LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
805 # Call the extra arm-elf function
806 ! LDEMUL_FINISH=gld${EMULATION_NAME}_finish
808 LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
810 # Call the extra arm-elf function
811 ! LDEMUL_FINISH=arm_finish
812 diff -cpr ../binutils-2.23.2.orig/ld/emultempl/elf32.em ld/emultempl/elf32.em
813 *** ../binutils-2.23.2.orig/ld/emultempl/elf32.em 2013-05-14 16:39:37.465718114 +0100
814 --- ld/emultempl/elf32.em 2013-05-14 16:40:07.035718933 +0100
815 *************** static void gld${EMULATION_NAME}_before_
818 static void gld${EMULATION_NAME}_after_allocation (void);
819 static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan
820 (asection *, const char *, int);
821 + static void gld${EMULATION_NAME}_finish (void);
824 if [ "x${USE_LIBPATH}" = xyes ] ; then
825 *************** output_rel_find (asection *sec, int isdy
831 + static int orphan_init_done = 0;
833 /* Place an orphan section. We use this to put random SHF_ALLOC
834 sections in the right segment. */
836 *************** gld${EMULATION_NAME}_place_orphan (asect
841 ! static struct orphan_save hold[] =
844 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
849 ! static struct orphan_save orig_hold[] =
852 SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
853 *************** gld${EMULATION_NAME}_place_orphan (asect
859 + static struct orphan_save hold[ARRAY_SIZE (orig_hold)];
860 enum orphan_save_index
863 *************** gld${EMULATION_NAME}_place_orphan (asect
868 - static int orphan_init_done = 0;
869 struct orphan_save *place;
870 lang_output_section_statement_type *after;
871 lang_output_section_statement_type *os;
873 *************** gld${EMULATION_NAME}_place_orphan (asect
876 if (!orphan_init_done)
878 ! struct orphan_save *ho;
880 for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
881 if (ho->name != NULL)
883 ho->os = lang_output_section_find (ho->name);
884 if (ho->os != NULL && ho->os->flags == 0)
885 ho->os->flags = ho->flags;
887 orphan_init_done = 1;
892 if (!orphan_init_done)
894 ! struct orphan_save *ho, *horig;
896 for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
897 + for (ho = hold, horig = orig_hold;
898 + ho < hold + ARRAY_SIZE (hold);
902 + if (ho->name != NULL)
903 if (ho->name != NULL)
905 ho->os = lang_output_section_find (ho->name);
906 if (ho->os != NULL && ho->os->flags == 0)
907 ho->os->flags = ho->flags;
910 orphan_init_done = 1;
913 *************** gld${EMULATION_NAME}_place_orphan (asect
921 + /* Final emulation specific call. */
924 + gld${EMULATION_NAME}_finish (void)
927 + if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then
929 + /* Support the object-only output. */
930 + if (link_info.emit_gnu_object_only)
931 + orphan_init_done = 0;
940 if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then
943 *************** struct ld_emulation_xfer_struct ld_${EMU
945 ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
948 ! ${LDEMUL_FINISH-finish_default},
949 ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
950 ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-gld${EMULATION_NAME}_open_dynamic_archive},
951 ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
953 ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
956 ! ${LDEMUL_FINISH-gld${EMULATION_NAME}_finish},
957 ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
958 ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-gld${EMULATION_NAME}_open_dynamic_archive},
959 ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
960 diff -cpr ../binutils-2.23.2.orig/ld/emultempl/ppc64elf.em ld/emultempl/ppc64elf.em
961 *** ../binutils-2.23.2.orig/ld/emultempl/ppc64elf.em 2013-05-14 16:39:37.454718113 +0100
962 --- ld/emultempl/ppc64elf.em 2013-05-14 16:40:07.044718934 +0100
963 *************** gld${EMULATION_NAME}_after_allocation (v
965 /* Final emulation specific call. */
968 ! gld${EMULATION_NAME}_finish (void)
970 /* e_entry on PowerPC64 points to the function descriptor for
971 _start. If _start is missing, default to the first function
973 /* Final emulation specific call. */
978 /* e_entry on PowerPC64 points to the function descriptor for
979 _start. If _start is missing, default to the first function
980 *************** gld${EMULATION_NAME}_finish (void)
984 ppc64_elf_restore_symbols (&link_info);
992 ppc64_elf_restore_symbols (&link_info);
993 ! gld${EMULATION_NAME}_finish ();
997 *************** PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
1000 LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation
1001 LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
1002 ! LDEMUL_FINISH=gld${EMULATION_NAME}_finish
1003 LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=ppc_create_output_section_statements
1004 LDEMUL_NEW_VERS_PATTERN=gld${EMULATION_NAME}_new_vers_pattern
1007 LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation
1008 LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
1009 ! LDEMUL_FINISH=ppc_finish
1010 LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=ppc_create_output_section_statements
1011 LDEMUL_NEW_VERS_PATTERN=gld${EMULATION_NAME}_new_vers_pattern
1012 diff -cpr ../binutils-2.23.2.orig/ld/emultempl/spuelf.em ld/emultempl/spuelf.em
1013 *** ../binutils-2.23.2.orig/ld/emultempl/spuelf.em 2013-05-14 16:39:37.453718113 +0100
1014 --- ld/emultempl/spuelf.em 2013-05-14 16:40:07.045718934 +0100
1015 *************** spu_elf_relink (void)
1017 /* Final emulation specific call. */
1020 ! gld${EMULATION_NAME}_finish (void)
1022 if (is_spu_target ())
1025 /* Final emulation specific call. */
1030 if (is_spu_target ())
1032 *************** gld${EMULATION_NAME}_finish (void)
1034 einfo ("%P: --auto-overlay ignored with zero local store range\n");
1037 ! finish_default ();
1042 einfo ("%P: --auto-overlay ignored with zero local store range\n");
1045 ! gld${EMULATION_NAME}_finish ();
1049 *************** PARSE_AND_LIST_ARGS_CASES='
1052 LDEMUL_AFTER_OPEN=spu_after_open
1053 LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
1054 ! LDEMUL_FINISH=gld${EMULATION_NAME}_finish
1055 LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
1058 LDEMUL_AFTER_OPEN=spu_after_open
1059 LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
1060 ! LDEMUL_FINISH=spu_finish
1061 LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
1062 diff -cpr ../binutils-2.23.2.orig/ld/ldfile.c ld/ldfile.c
1063 *** ../binutils-2.23.2.orig/ld/ldfile.c 2013-05-14 16:39:37.164718105 +0100
1064 --- ld/ldfile.c 2013-05-14 16:40:07.046718934 +0100
1065 *************** success:
1068 plugin_maybe_claim (&file, entry);
1072 #endif /* ENABLE_PLUGINS */
1073 + cmdline_check_object_only_section (entry->the_bfd, FALSE);
1075 /* It opened OK, the format checked out, and the plugins have had
1076 their chance to claim it, so this is success. */
1077 diff -cpr ../binutils-2.23.2.orig/ld/ldlang.c ld/ldlang.c
1078 *** ../binutils-2.23.2.orig/ld/ldlang.c 2013-05-14 16:39:39.704718176 +0100
1079 --- ld/ldlang.c 2013-05-14 17:03:54.030758491 +0100
1086 + #include "ldwrite.h"
1087 #include "fnmatch.h"
1088 #include "demangle.h"
1089 #include "hashtab.h"
1094 #endif /* ENABLE_PLUGINS */
1096 + /* FIXME: Put it here to avoid NAME conflict from ldgram.h. */
1097 + #include "elf-bfd.h"
1100 #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
1102 *************** static struct bfd_hash_table lang_define
1105 static lang_statement_list_type *stat_save[10];
1106 static lang_statement_list_type **stat_save_ptr = &stat_save[0];
1107 static struct unique_sections *unique_section_list;
1108 + static cmdline_list_type cmdline_object_only_file_list;
1109 + static cmdline_list_type cmdline_object_only_archive_list;
1110 + static cmdline_list_type cmdline_temp_object_only_list;
1112 /* Forward declarations. */
1113 static void exp_init_os (etree_type *);
1114 *************** static void lang_record_phdrs (void);
1117 static void lang_do_version_exports_section (void);
1118 static void lang_finalize_version_expr_head
1119 (struct bfd_elf_version_expr_head *);
1120 + static void cmdline_lists_init (void);
1121 + static void cmdline_get_object_only_input_files (void);
1122 + static void print_cmdline_list (cmdline_union_type *);
1123 + static bfd_boolean cmdline_on_object_only_archive_list_p (bfd *);
1125 /* Exported variables. */
1126 const char *output_target;
1127 *************** output_section_statement_table_free (voi
1129 /* Build enough state so that the parser can build its tree. */
1134 ! obstack_begin (&stat_obstack, 1000);
1136 stat_ptr = &statement_list;
1138 output_section_statement_table_init ();
1140 lang_list_init (stat_ptr);
1142 lang_list_init (&input_file_chain);
1144 /* Build enough state so that the parser can build its tree. */
1147 ! lang_init (bfd_boolean object_only)
1150 ! obstack_begin (&stat_obstack, 1000);
1152 stat_ptr = &statement_list;
1154 output_section_statement_table_init ();
1156 + cmdline_lists_init ();
1158 lang_list_init (stat_ptr);
1160 lang_list_init (&input_file_chain);
1161 *************** lang_init (void)
1163 simpler to re-use working machinery than using a linked list in terms
1164 of code-complexity here in ld, besides the initialization which just
1165 looks like other code here. */
1166 ! if (!bfd_hash_table_init_n (&lang_definedness_table,
1167 ! lang_definedness_newfunc,
1168 ! sizeof (struct lang_definedness_hash_entry),
1170 einfo (_("%P%F: can not create hash table: %E\n"));
1174 simpler to re-use working machinery than using a linked list in terms
1175 of code-complexity here in ld, besides the initialization which just
1176 looks like other code here. */
1178 ! && !bfd_hash_table_init_n (&lang_definedness_table,
1179 ! lang_definedness_newfunc,
1180 ! sizeof (struct lang_definedness_hash_entry),
1182 einfo (_("%P%F: can not create hash table: %E\n"));
1185 *************** load_symbols (lang_input_statement_type
1191 + if (link_info.emitting_gnu_object_only)
1193 + if (!cmdline_on_object_only_archive_list_p (member))
1198 if (!(*link_info.callbacks
1199 ->add_archive_element) (&link_info, member,
1200 *************** lang_process (void)
1203 open_input_bfds (statement_list.head, OPEN_BFD_RESCAN);
1207 #endif /* ENABLE_PLUGINS */
1208 + if (link_info.relocatable)
1210 + /* Check if .gnu_object_only section should be created. */
1215 + for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link_next)
1217 + object_type |= 1 << p->lto_type;
1218 + if ((object_type & (1 << lto_mixed_object)) != 0
1220 + & (1 << lto_non_ir_object
1221 + | 1 << lto_ir_object))
1222 + == (1 << lto_non_ir_object | 1 << lto_ir_object)))
1224 + link_info.emit_gnu_object_only = TRUE;
1230 + && (cmdline_object_only_file_list.head
1231 + || cmdline_object_only_archive_list.head))
1233 + print_cmdline_list (cmdline_object_only_file_list.head);
1234 + print_cmdline_list (cmdline_object_only_archive_list.head);
1238 link_info.gc_sym_list = &entry_symbol;
1239 if (entry_symbol.name == NULL)
1240 *************** lang_ld_feature (char *str)
1248 + cmdline_lists_init (void)
1250 + cmdline_object_only_file_list.tail
1251 + = &cmdline_object_only_file_list.head;
1252 + cmdline_object_only_archive_list.tail
1253 + = &cmdline_object_only_archive_list.head;
1254 + cmdline_temp_object_only_list.tail
1255 + = &cmdline_temp_object_only_list.head;
1258 + /* Allocate an item with TYPE and DATA. */
1260 + static cmdline_union_type *
1261 + cmdline_list_new (cmdline_enum_type type, void *data)
1263 + cmdline_union_type *new_opt;
1265 + new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
1266 + new_opt->header.type = type;
1271 + case cmdline_is_file_enum:
1272 + new_opt->file.filename = (const char *) data;
1274 + case cmdline_is_bfd_enum:
1275 + new_opt->abfd.abfd = (bfd *) data;
1281 + /* Append an item with TYPE and DATA to LIST. */
1284 + cmdline_list_append (cmdline_list_type *list, cmdline_enum_type type,
1287 + cmdline_union_type *new_opt = cmdline_list_new (type, data);
1288 + new_opt->header.next = NULL;
1289 + *list->tail = new_opt;
1290 + list->tail = &new_opt->header.next;
1294 + print_cmdline_list (cmdline_union_type *c)
1296 + for (; c != NULL; c = c->header.next)
1297 + switch (c->header.type)
1301 + case cmdline_is_file_enum:
1302 + info_msg (" %s", c->file.filename);
1304 + case cmdline_is_bfd_enum:
1305 + info_msg (" [%B]", c->abfd.abfd);
1312 + /* Return TRUE if ABFD is on cmdline_object_only_archive_list. */
1314 + static bfd_boolean
1315 + cmdline_on_object_only_archive_list_p (bfd *abfd)
1317 + cmdline_union_type *c, *next;
1318 + bfd *archive, *obfd, *oarchive;
1319 + ufile_ptr origin = abfd->origin;
1321 + archive = bfd_my_archive (abfd);
1322 + for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
1324 + if (c->header.type != cmdline_is_bfd_enum)
1327 + next = c->header.next;
1328 + obfd = c->abfd.abfd;
1329 + oarchive = bfd_my_archive (obfd);
1331 + /* The list is grouped by archive file name and sorted by member
1333 + if (strcmp (archive->filename, oarchive->filename) != 0)
1336 + if (origin == obfd->origin)
1338 + else if (origin < obfd->origin)
1345 + /* Append an item with TYPE and DATA to cmdline_object_only_file_list
1346 + or cmdline_object_only_archive_list if needed. */
1349 + cmdline_object_only_list_append (cmdline_enum_type type, void *data)
1351 + cmdline_union_type *c;
1352 + cmdline_union_type *new_opt, *next, **prev;
1353 + bfd *abfd, *archive;
1354 + bfd *obfd, *oarchive;
1355 + bfd *nbfd, *narchive;
1356 + ufile_ptr origin, norigin;
1358 + /* Put it on cmdline_object_only_file_list if it isn't an archive
1364 + case cmdline_is_bfd_enum:
1365 + abfd = (bfd *) data;
1366 + archive = bfd_my_archive (abfd);
1369 + case cmdline_is_file_enum:
1370 + cmdline_list_append (&cmdline_object_only_file_list, type, data);
1374 + /* Put archive member on cmdline_object_only_archive_list and sort
1375 + the list by archive name and archive member origin. */
1376 + new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
1377 + new_opt->header.type = cmdline_is_bfd_enum;
1378 + new_opt->header.next = NULL;
1379 + new_opt->abfd.abfd = (bfd *) data;
1381 + c = cmdline_object_only_archive_list.head;
1384 + cmdline_object_only_archive_list.head = new_opt;
1385 + cmdline_object_only_archive_list.tail = &new_opt->header.next;
1390 + origin = abfd->origin;
1391 + for (; c != NULL; c = next)
1393 + if (c->header.type != cmdline_is_bfd_enum)
1396 + next = c->header.next;
1398 + obfd = c->abfd.abfd;
1399 + oarchive = bfd_my_archive (obfd);
1401 + if (strcmp (archive->filename, oarchive->filename) == 0)
1403 + bfd_boolean after;
1405 + if (origin < obfd->origin)
1407 + /* Insert it before the current. */
1408 + new_opt->header.next = c;
1412 + cmdline_object_only_archive_list.head = new_opt;
1418 + /* Check origin. */
1421 + if (next->header.type != cmdline_is_bfd_enum)
1424 + nbfd = next->abfd.abfd;
1425 + norigin = nbfd->origin;
1426 + if (origin > norigin)
1428 + /* Insert it after NEXT. */
1432 + narchive = bfd_my_archive (nbfd);
1433 + if (strcmp (archive->filename, narchive->filename) != 0)
1435 + /* Insert it befor NEXT. */
1441 + next = next->header.next;
1444 + if (after && next)
1447 + next = next->header.next;
1450 + if (*cmdline_object_only_archive_list.tail == c->header.next)
1451 + cmdline_object_only_archive_list.tail
1452 + = &new_opt->header.next;
1454 + prev = &c->header.next;
1455 + new_opt->header.next = next;
1460 + prev = &c->header.next;
1463 + *cmdline_object_only_archive_list.tail = new_opt;
1464 + cmdline_object_only_archive_list.tail = &new_opt->header.next;
1469 + cmdline_get_object_only_input_files (void)
1471 + cmdline_union_type *c, *next;
1472 + bfd *abfd, *archive;
1473 + bfd *nbfd, *narchive;
1475 + /* Add files first. */
1476 + for (c = cmdline_object_only_file_list.head;
1477 + c != NULL; c = c->header.next)
1478 + switch (c->header.type)
1482 + case cmdline_is_file_enum:
1483 + lang_add_input_file (c->file.filename,
1484 + lang_input_file_is_file_enum, NULL);
1486 + case cmdline_is_bfd_enum:
1487 + abfd = c->abfd.abfd;
1488 + if (bfd_my_archive (abfd))
1490 + lang_add_input_file (abfd->filename,
1491 + lang_input_file_is_file_enum, NULL);
1495 + /* Add archive members next. */
1496 + for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
1498 + if (c->header.type != cmdline_is_bfd_enum)
1501 + next = c->header.next;
1503 + abfd = c->abfd.abfd;
1504 + archive = bfd_my_archive (abfd);
1506 + /* Add the first archive of the archive member group. */
1507 + lang_add_input_file (archive->filename,
1508 + lang_input_file_is_file_enum, NULL);
1510 + /* Skip the rest members in the archive member group. */
1516 + if (next->header.type != cmdline_is_bfd_enum)
1519 + next = next->header.next;
1522 + nbfd = next->abfd.abfd;
1523 + narchive = bfd_my_archive (nbfd);
1525 + while (strcmp (archive->filename, narchive->filename) == 0);
1529 + struct cmdline_arg
1536 + /* Create a section in OBFD with the same
1537 + name and attributes as ISECTION in IBFD. */
1540 + setup_section (bfd *ibfd, sec_ptr isection, void *p)
1542 + struct cmdline_arg *arg = (struct cmdline_arg *) p;
1543 + bfd *obfd = arg->obfd;
1544 + asymbol **isympp = arg->isympp;
1545 + const char *name = isection->name;
1549 + /* Skip the object-only section. */
1550 + if (ibfd->object_only_section == isection)
1553 + /* If we have already failed earlier on, do not keep on generating
1554 + complaints now. */
1558 + osection = bfd_make_section_anyway_with_flags (obfd, name,
1561 + if (osection == NULL)
1563 + err = _("failed to create output section");
1567 + osection->size = isection->size;
1568 + osection->vma = isection->vma;
1569 + osection->lma = isection->lma;
1570 + osection->alignment_power = isection->alignment_power;
1572 + /* Copy merge entity size. */
1573 + osection->entsize = isection->entsize;
1575 + /* This used to be mangle_section; we do here to avoid using
1576 + bfd_get_section_by_name since some formats allow multiple
1577 + sections with the same name. */
1578 + isection->output_section = osection;
1579 + isection->output_offset = 0;
1581 + if ((isection->flags & SEC_GROUP) != 0)
1583 + asymbol *gsym = bfd_group_signature (isection, isympp);
1587 + gsym->flags |= BSF_KEEP;
1588 + if (ibfd->xvec->flavour == bfd_target_elf_flavour)
1589 + elf_group_id (isection) = gsym;
1593 + /* Allow the BFD backend to copy any private data it understands
1594 + from the input section to the output section. */
1595 + if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
1597 + err = _("failed to copy private data");
1601 + /* All went well. */
1606 + einfo (_("%P%F: setup_section: %s: %s\n"), err, name);
1609 + /* Copy the data of input section ISECTION of IBFD
1610 + to an output section with the same name in OBFD.
1611 + If stripping then don't copy any relocation info. */
1614 + copy_section (bfd *ibfd, sec_ptr isection, void *p)
1616 + struct cmdline_arg *arg = (struct cmdline_arg *) p;
1617 + bfd *obfd = arg->obfd;
1618 + asymbol **isympp = arg->isympp;
1622 + bfd_size_type size;
1627 + /* Skip the object-only section. */
1628 + if (ibfd->object_only_section == isection)
1631 + /* If we have already failed earlier on, do not keep on generating
1632 + complaints now. */
1636 + flags = bfd_get_section_flags (ibfd, isection);
1637 + if ((flags & SEC_GROUP) != 0)
1640 + osection = isection->output_section;
1641 + size = bfd_get_section_size (isection);
1643 + if (size == 0 || osection == 0)
1646 + relsize = bfd_get_reloc_upper_bound (ibfd, isection);
1650 + /* Do not complain if the target does not support relocations. */
1652 + && bfd_get_error () == bfd_error_invalid_operation)
1656 + err = bfd_errmsg (bfd_get_error ());
1662 + bfd_set_reloc (obfd, osection, NULL, 0);
1665 + relpp = (arelent **) xmalloc (relsize);
1666 + relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
1669 + err = _("relocation count is negative");
1673 + bfd_set_reloc (obfd, osection,
1674 + relcount == 0 ? NULL : relpp, relcount);
1675 + if (relcount == 0)
1679 + if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS)
1681 + bfd_byte *memhunk = NULL;
1683 + if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
1685 + err = bfd_errmsg (bfd_get_error ());
1689 + if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
1691 + err = bfd_errmsg (bfd_get_error ());
1697 + /* All went well. */
1701 + einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name);
1703 + /* Open the temporary bfd created in the same directory as PATH. */
1706 + cmdline_fopen_temp (const char *path, const char *target,
1709 + #define template "ldXXXXXX"
1710 + const char *slash = strrchr (path, '/');
1715 + #ifdef HAVE_DOS_BASED_FILE_SYSTEM
1717 + /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
1718 + char *bslash = strrchr (path, '\\');
1720 + if (slash == NULL || (bslash != NULL && bslash > slash))
1722 + if (slash == NULL && path[0] != '\0' && path[1] == ':')
1727 + if (slash != (char *) NULL)
1729 + len = slash - path;
1730 + tmpname = (char *) xmalloc (len + sizeof (template) + 2);
1731 + memcpy (tmpname, path, len);
1733 + #ifdef HAVE_DOS_BASED_FILE_SYSTEM
1734 + /* If tmpname is "X:", appending a slash will make it a root
1735 + directory on drive X, which is NOT the same as the current
1736 + directory on drive X. */
1737 + if (len == 2 && tmpname[1] == ':')
1738 + tmpname[len++] = '.';
1740 + tmpname[len++] = '/';
1744 + tmpname = (char *) xmalloc (sizeof (template));
1748 + memcpy (tmpname + len, template, sizeof (template));
1751 + #ifdef HAVE_MKSTEMP
1752 + fd = mkstemp (tmpname);
1754 + tmpname = mktemp (tmpname);
1755 + if (tmpname == NULL)
1757 + fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
1761 + return bfd_fopen (tmpname, target, mode, fd);
1764 + /* Add the object-only section. */
1767 + cmdline_add_object_only_section (bfd_byte *contents, size_t size)
1771 + enum bfd_architecture iarch;
1772 + unsigned int imach;
1775 + asymbol **isympp = NULL;
1776 + asymbol **osympp = NULL;
1777 + bfd *obfd = NULL, *ibfd;
1786 + const char *ofilename = NULL;
1789 + ibfd = bfd_openr (output_filename, output_target);
1792 + err = bfd_errmsg (bfd_get_error ());
1796 + if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
1798 + err = bfd_errmsg (bfd_get_error ());
1802 + obfd = cmdline_fopen_temp (output_filename, output_target, "w");
1805 + err = bfd_errmsg (bfd_get_error ());
1808 + ofilename = bfd_get_filename (obfd);
1810 + if (!bfd_set_format (obfd, bfd_object))
1812 + err = bfd_errmsg (bfd_get_error ());
1816 + /* Copy the start address, flags and architecture of input file to
1818 + flags = bfd_get_file_flags (ibfd);
1819 + start = bfd_get_start_address (ibfd);
1820 + iarch = bfd_get_arch (ibfd);
1821 + imach = bfd_get_mach (ibfd);
1822 + if (!bfd_set_start_address (obfd, start)
1823 + || !bfd_set_file_flags (obfd, flags)
1824 + || !bfd_set_arch_mach (obfd, iarch, imach))
1826 + err = bfd_errmsg (bfd_get_error ());
1830 + symsize = bfd_get_symtab_upper_bound (ibfd);
1833 + err = bfd_errmsg (bfd_get_error ());
1837 + isympp = (asymbol **) xmalloc (symsize);
1838 + symcount = bfd_canonicalize_symtab (ibfd, isympp);
1841 + err = bfd_errmsg (bfd_get_error ());
1846 + arg.isympp = isympp;
1849 + /* BFD mandates that all output sections be created and sizes set before
1850 + any output is done. Thus, we traverse all sections multiple times. */
1851 + bfd_map_over_sections (ibfd, setup_section, &arg);
1855 + err = _("error setting up sections");
1859 + /* Allow the BFD backend to copy any private data it understands
1860 + from the input section to the output section. */
1861 + if (! bfd_copy_private_header_data (ibfd, obfd))
1863 + err = _("error copying private header data");
1867 + /* Create the object-only section. */
1868 + sec = bfd_make_section_with_flags (obfd,
1869 + GNU_OBJECT_ONLY_SECTION_NAME,
1873 + | SEC_LINKER_CREATED));
1876 + err = _("can't create object-only section");
1880 + if (! bfd_set_section_size (obfd, sec, size))
1882 + err = _("can't set object-only section size");
1886 + if (ibfd->object_only_section)
1888 + /* Filter out the object-only section symbol. */
1889 + long src_count = 0, dst_count = 0;
1890 + asymbol **from, **to;
1892 + osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *));
1895 + for (; src_count < symcount; src_count++)
1897 + asymbol *sym = from[src_count];
1898 + if (bfd_get_section (sym) != ibfd->object_only_section)
1899 + to[dst_count++] = sym;
1901 + to[dst_count] = NULL;
1902 + symcount = dst_count;
1903 + bfd_set_symtab (obfd, osympp, symcount);
1906 + bfd_set_symtab (obfd, isympp, symcount);
1908 + /* This has to happen after the symbol table has been set. */
1909 + bfd_map_over_sections (ibfd, copy_section, &arg);
1913 + err = _("error copying sections");
1917 + /* Copy the object-only section to the output. */
1918 + if (! bfd_set_section_contents (obfd, sec, contents, 0, size))
1920 + err = _("error adding object-only section");
1924 + /* Allow the BFD backend to copy any private data it understands
1925 + from the input BFD to the output BFD. This is done last to
1926 + permit the routine to look at the filtered symbol table, which is
1927 + important for the ECOFF code at least. */
1928 + if (! bfd_copy_private_bfd_data (ibfd, obfd))
1930 + err = _("error copying private BFD data");
1934 + if (!bfd_close (obfd))
1936 + unlink (ofilename);
1937 + einfo (_("%P%F: failed to finish output with object-only section\n"));
1940 + /* Must be freed after bfd_close (). */
1945 + if (rename (ofilename, output_filename))
1947 + unlink (ofilename);
1948 + einfo (_("%P%F: failed to rename output with object-only section\n"));
1961 + unlink (ofilename);
1962 + einfo (_("%P%F: failed to add object-only section: %s\n"), err);
1965 + /* Emit the final output with object-only section. */
1968 + cmdline_emit_object_only_section (void)
1970 + const char *saved_output_filename = output_filename;
1973 + bfd_byte *contents;
1976 + /* Get a temporary object-only file. */
1977 + output_filename = make_temp_file (".obj-only.o");
1979 + had_output_filename = FALSE;
1980 + link_info.input_bfds = NULL;
1981 + link_info.input_bfds_tail = &link_info.input_bfds;
1985 + ld_parse_linker_script ();
1987 + /* Set up the object-only output. */
1990 + /* Open the object-only file for output. */
1991 + lang_for_each_statement (ldlang_open_output);
1993 + ldemul_create_output_section_statements ();
1995 + if (!bfd_section_already_linked_table_init ())
1996 + einfo (_("%P%F: Failed to create hash table\n"));
1998 + /* Call cmdline_on_object_only_archive_list_p to check which member
1999 + should be loaded. */
2000 + input_flags.whole_archive = TRUE;
2002 + /* Set it to avoid adding more to cmdline lists. */
2003 + link_info.emitting_gnu_object_only = TRUE;
2005 + cmdline_get_object_only_input_files ();
2007 + open_input_bfds (statement_list.head, FALSE);
2009 + ldemul_after_open ();
2011 + bfd_section_already_linked_table_free ();
2013 + /* Make sure that we're not mixing architectures. We call this
2014 + after all the input files have been opened, but before we do any
2015 + other processing, so that any operations merge_private_bfd_data
2016 + does on the output file will be known during the rest of the
2020 + /* Size up the common data. */
2023 + /* Update wild statements. */
2024 + update_wild_statements (statement_list.head);
2026 + /* Run through the contours of the script and attach input sections
2027 + to the correct output sections. */
2028 + map_input_to_output_sections (statement_list.head, NULL, NULL);
2030 + /* Find any sections not attached explicitly and handle them. */
2031 + lang_place_orphans ();
2033 + /* Do anything special before sizing sections. This is where ELF
2034 + and other back-ends size dynamic sections. */
2035 + ldemul_before_allocation ();
2037 + /* Size up the sections. */
2038 + lang_size_sections (NULL, ! RELAXATION_ENABLED);
2040 + /* See if anything special should be done now we know how big
2041 + everything is. This is where relaxation is done. */
2042 + ldemul_after_allocation ();
2046 + /* Make sure that the section addresses make sense. */
2047 + if (command_line.check_section_addresses)
2048 + lang_check_section_addresses ();
2056 + if (! bfd_close (link_info.output_bfd))
2057 + einfo (_("%P%F:%s: final close failed on object-only output: %E\n"),
2060 + /* Read in the object-only file. */
2061 + fd = open (output_filename, O_RDONLY | O_BINARY);
2064 + bfd_set_error (bfd_error_system_call);
2065 + einfo (_("%P%F:%s: cannot open object-only output: %E"),
2069 + /* Get the object-only file size. */
2070 + if (fstat (fd, &st) != 0)
2072 + bfd_set_error (bfd_error_system_call);
2073 + einfo (_("%P%F:%s: cannot stat object-only output: %E"),
2077 + size = st.st_size;
2079 + contents = (bfd_byte *) xmalloc (size);
2080 + while (off != size)
2084 + got = read (fd, contents + off, size - off);
2087 + bfd_set_error (bfd_error_system_call);
2088 + einfo (_("%P%F:%s: read failed on object-only output: %E"),
2097 + /* Remove the temporary object-only file. */
2098 + unlink (output_filename);
2100 + output_filename = saved_output_filename;
2102 + cmdline_add_object_only_section (contents, size);
2107 + /* Extract the object-only section. */
2109 + static const char *
2110 + cmdline_extract_object_only_section (bfd *abfd)
2112 + const char *name = bfd_extract_object_only_section (abfd);
2115 + einfo (_("%P%F: cannot extract object-only section from %B: %E"),
2118 + /* It should be removed after it is done. */
2119 + cmdline_list_append (&cmdline_temp_object_only_list,
2120 + cmdline_is_file_enum, (void *) name);
2125 + /* Check and handle the object-only section. */
2128 + cmdline_check_object_only_section (bfd *abfd, bfd_boolean lto)
2130 + const char *filename;
2132 + if (link_info.emitting_gnu_object_only
2133 + || abfd->format != bfd_object)
2138 + /* For LTO link, we only need to extract object-only section
2139 + from the mixed object, add it to input, and put it on LTO
2140 + claimed output. */
2141 + switch (abfd->lto_type)
2145 + case lto_mixed_object:
2146 + filename = cmdline_extract_object_only_section (abfd);
2147 + lang_add_input_file (filename,
2148 + lang_input_file_is_file_enum, NULL);
2150 + case lto_non_ir_object:
2151 + case lto_ir_object:
2155 + else if (link_info.relocatable)
2157 + /* For non-LTO relocatable link, we need to append non-IR object
2158 + file and the object file in object-only section to the object
2160 + switch (abfd->lto_type)
2164 + case lto_mixed_object:
2165 + filename = cmdline_extract_object_only_section (abfd);
2166 + cmdline_object_only_list_append (cmdline_is_file_enum,
2167 + (void *) filename);
2169 + case lto_non_ir_object:
2170 + cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd);
2172 + case lto_ir_object:
2178 + /* Remove temporary object-only files. */
2181 + cmdline_remove_object_only_files (void)
2183 + cmdline_union_type *c;
2185 + #ifdef ENABLE_PLUGINS
2186 + if (plugin_save_temps)
2190 + c = cmdline_temp_object_only_list.head;
2191 + for (; c != NULL; c = c->header.next)
2192 + switch (c->header.type)
2196 + case cmdline_is_file_enum:
2197 + unlink (c->file.filename);
2204 diff -cpr ../binutils-2.23.2.orig/ld/ldlang.h ld/ldlang.h
2205 *** ../binutils-2.23.2.orig/ld/ldlang.h 2013-05-14 16:39:36.861718097 +0100
2206 --- ld/ldlang.h 2013-05-14 16:40:07.053718934 +0100
2207 *************** extern lang_statement_list_type input_fi
2209 extern int lang_statement_iteration;
2211 extern void lang_init
2213 extern void lang_finish
2215 extern lang_memory_region_type * lang_memory_region_lookup
2217 extern int lang_statement_iteration;
2219 extern void lang_init
2221 extern void lang_finish
2223 extern lang_memory_region_type * lang_memory_region_lookup
2224 *************** ldlang_override_segment_assignment
2228 lang_ld_feature (char *);
2232 + cmdline_is_file_enum,
2233 + cmdline_is_bfd_enum
2234 + } cmdline_enum_type;
2236 + typedef struct cmdline_header_struct
2238 + union cmdline_union *next;
2239 + cmdline_enum_type type;
2240 + } cmdline_header_type;
2242 + typedef struct cmdline_file_struct
2244 + cmdline_header_type header;
2245 + const char *filename;
2246 + } cmdline_file_type;
2248 + typedef struct cmdline_bfd_struct
2250 + cmdline_header_type header;
2252 + } cmdline_bfd_type;
2254 + typedef union cmdline_union
2256 + cmdline_header_type header;
2257 + cmdline_file_type file;
2258 + cmdline_bfd_type abfd;
2259 + } cmdline_union_type;
2261 + typedef struct cmdline_list
2263 + cmdline_union_type *head;
2264 + cmdline_union_type **tail;
2265 + } cmdline_list_type;
2267 + extern void cmdline_emit_object_only_section (void);
2268 + extern void cmdline_check_object_only_section (bfd *, bfd_boolean);
2269 + extern void cmdline_remove_object_only_files (void);
2272 diff -cpr ../binutils-2.23.2.orig/ld/ldlex.h ld/ldlex.h
2273 *** ../binutils-2.23.2.orig/ld/ldlex.h 2013-05-14 16:39:39.789718178 +0100
2274 --- ld/ldlex.h 2013-05-14 16:47:18.651730898 +0100
2275 *************** enum option_values
2278 #ifdef ENABLE_PLUGINS
2281 + OPTION_PLUGIN_SAVE_TEMPS,
2282 #endif /* ENABLE_PLUGINS */
2283 OPTION_DEFAULT_SCRIPT,
2284 OPTION_PRINT_OUTPUT_FORMAT,
2285 diff -cpr ../binutils-2.23.2.orig/ld/ldmain.c ld/ldmain.c
2286 *** ../binutils-2.23.2.orig/ld/ldmain.c 2013-05-14 16:39:36.862718097 +0100
2287 --- ld/ldmain.c 2013-05-14 16:40:07.055718934 +0100
2288 *************** main (int argc, char **argv)
2292 xatexit (ld_cleanup);
2294 + /* Remove temporary object-only files. */
2295 + xatexit (cmdline_remove_object_only_files);
2297 /* Set up the sysroot directory. */
2298 ld_sysroot = get_sysroot (argc, argv);
2300 *************** main (int argc, char **argv)
2302 default_target = ldemul_choose_target (argc, argv);
2303 config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
2304 config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
2306 ldemul_before_parse ();
2307 lang_has_input_file = FALSE;
2308 parse_args (argc, argv);
2310 default_target = ldemul_choose_target (argc, argv);
2311 config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
2312 config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
2313 ! lang_init (FALSE);
2314 ldemul_before_parse ();
2315 lang_has_input_file = FALSE;
2316 parse_args (argc, argv);
2317 *************** main (int argc, char **argv)
2320 ldemul_set_symbols ();
2322 ! /* If we have not already opened and parsed a linker script,
2323 ! try the default script from command line first. */
2324 ! if (saved_script_handle == NULL
2325 ! && command_line.default_script != NULL)
2327 ! ldfile_open_command_file (command_line.default_script);
2328 ! parser_input = input_script;
2332 ! /* If we have not already opened and parsed a linker script
2333 ! read the emulation's appropriate default script. */
2334 ! if (saved_script_handle == NULL)
2337 ! char *s = ldemul_get_script (&isfile);
2340 ! ldfile_open_default_command_file (s);
2344 ! lex_redirect (s, _("built in linker script"), 1);
2346 ! parser_input = input_script;
2348 ! lex_string = NULL;
2355 ldemul_set_symbols ();
2357 ! ld_parse_linker_script ();
2361 *************** main (int argc, char **argv)
2364 if (! bfd_close (link_info.output_bfd))
2365 einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd);
2367 + link_info.output_bfd = NULL;
2369 /* If the --force-exe-suffix is enabled, and we're making an
2370 executable file and it doesn't end in .exe, copy it to one
2372 *************** main (int argc, char **argv)
2378 + if (link_info.emit_gnu_object_only)
2379 + cmdline_emit_object_only_section ();
2381 END_PROGRESS (program_name);
2384 *************** add_archive_element (struct bfd_link_inf
2391 #endif /* ENABLE_PLUGINS */
2392 + cmdline_check_object_only_section (input->the_bfd, FALSE);
2394 ldlang_add_file (input);
2396 *************** warning_callback (struct bfd_link_info *
2398 einfo ("%P: %s%s\n", _("warning: "), warning);
2399 else if (symbol == NULL)
2400 einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
2403 struct warning_callback_info cinfo;
2406 einfo ("%P: %s%s\n", _("warning: "), warning);
2407 else if (symbol == NULL)
2408 einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
2409 ! else if ((abfd->flags & BFD_PLUGIN) == 0)
2411 struct warning_callback_info cinfo;
2413 *************** notice (struct bfd_link_info *info,
2420 + /* Parse the linker script. */
2423 + ld_parse_linker_script ()
2425 + /* If we have not already opened and parsed a linker script,
2426 + try the default script from command line first. */
2427 + if (saved_script_handle == NULL
2428 + && command_line.default_script != NULL)
2430 + ldfile_open_command_file (command_line.default_script);
2431 + parser_input = input_script;
2435 + /* If we have not already opened and parsed a linker script
2436 + read the emulation's appropriate default script. */
2437 + if (saved_script_handle == NULL)
2440 + char *s = ldemul_get_script (&isfile);
2443 + ldfile_open_default_command_file (s);
2447 + lex_redirect (s, _("built in linker script"), 1);
2449 + parser_input = input_script;
2451 + lex_string = NULL;
2454 diff -cpr ../binutils-2.23.2.orig/ld/ldmain.h ld/ldmain.h
2455 *** ../binutils-2.23.2.orig/ld/ldmain.h 2013-05-14 16:39:39.810718179 +0100
2456 --- ld/ldmain.h 2013-05-14 16:40:07.055718934 +0100
2457 *************** extern void add_ysym (const char *);
2460 extern void add_ignoresym (struct bfd_link_info *, const char *);
2461 extern void add_keepsyms_file (const char *);
2463 + extern void ld_parse_linker_script (void);
2466 diff -cpr ../binutils-2.23.2.orig/ld/lexsup.c ld/lexsup.c
2467 *** ../binutils-2.23.2.orig/ld/lexsup.c 2013-05-14 16:39:36.709718093 +0100
2468 --- ld/lexsup.c 2013-05-14 16:40:07.058718934 +0100
2469 *************** static const struct ld_option ld_options
2472 '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
2473 { {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
2474 '\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH },
2475 + { {"plugin-save-temps", no_argument, NULL, OPTION_PLUGIN_SAVE_TEMPS},
2476 + '\0', NULL, N_("Store plugin intermediate files permanently"),
2478 { {"flto", optional_argument, NULL, OPTION_IGNORE},
2479 '\0', NULL, N_("Ignored for GCC LTO option compatibility"),
2481 *************** parse_args (unsigned argc, char **argv)
2484 if (plugin_opt_plugin_arg (optarg))
2485 einfo(_("%P%F: bad -plugin-opt option\n"));
2487 + case OPTION_PLUGIN_SAVE_TEMPS:
2488 + plugin_save_temps = TRUE;
2490 #endif /* ENABLE_PLUGINS */
2492 link_info.emitrelocations = TRUE;
2493 diff -cpr ../binutils-2.23.2.orig/ld/plugin.c ld/plugin.c
2494 *** ../binutils-2.23.2.orig/ld/plugin.c 2013-05-14 16:39:37.435718113 +0100
2495 --- ld/plugin.c 2013-05-14 16:48:59.039733681 +0100
2499 /* Report plugin symbols. */
2500 bfd_boolean report_plugin_symbols;
2502 + /* Store plugin intermediate files permanently. */
2503 + bfd_boolean plugin_save_temps;
2505 /* The suffix to append to the name of the real (claimed) object file
2506 when generating a dummy BFD to hold the IR symbols sent from the
2507 plugin. For cosmetic use only; appears in maps, crefs etc. */
2508 *************** plugin_opt_plugin_arg (const char *arg)
2512 return set_plugin_error (_("<no plugin>"));
2514 + /* Ignore -pass-through= from GCC driver. */
2518 + for (p = arg + 1; p; p++)
2521 + if (strncmp (p, "pass-through=", 13) == 0)
2525 newarg = xmalloc (sizeof *newarg);
2527 newarg->next = NULL;
2528 *************** plugin_maybe_claim (struct ld_plugin_inp
2534 + /* Check object only section. */
2535 + cmdline_check_object_only_section (entry->the_bfd, TRUE);
2537 /* Discard the real file's BFD and substitute the dummy one. */
2539 /* BFD archive handling caches elements so we can't call
2540 *************** plugin_call_cleanup (void)
2543 if (curplug->cleanup_handler && !curplug->cleanup_done)
2545 ! enum ld_plugin_status rv;
2546 ! curplug->cleanup_done = TRUE;
2547 ! called_plugin = curplug;
2548 ! rv = (*curplug->cleanup_handler) ();
2549 ! called_plugin = NULL;
2550 ! if (rv != LDPS_OK)
2551 ! info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
2552 ! curplug->name, rv);
2553 dlclose (curplug->dlhandle);
2555 curplug = curplug->next;
2558 if (curplug->cleanup_handler && !curplug->cleanup_done)
2560 ! if (!plugin_save_temps)
2562 ! enum ld_plugin_status rv;
2563 ! curplug->cleanup_done = TRUE;
2564 ! called_plugin = curplug;
2565 ! rv = (*curplug->cleanup_handler) ();
2566 ! called_plugin = NULL;
2567 ! if (rv != LDPS_OK)
2568 ! info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
2569 ! curplug->name, rv);
2571 dlclose (curplug->dlhandle);
2573 curplug = curplug->next;
2574 diff -cpr ../binutils-2.23.2.orig/ld/plugin.h ld/plugin.h
2575 *** ../binutils-2.23.2.orig/ld/plugin.h 2013-05-14 16:39:39.705718176 +0100
2576 --- ld/plugin.h 2013-05-14 16:40:07.059718934 +0100
2580 /* Report plugin symbols. */
2581 extern bfd_boolean report_plugin_symbols;
2583 + /* Store plugin intermediate files permanently. */
2584 + extern bfd_boolean plugin_save_temps;
2586 /* Set at all symbols read time, to avoid recursively offering the plugin
2587 its own newly-added input files and libs to claim. */
2588 extern bfd_boolean no_more_claiming;
2589 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/armbpabi.sc ld/scripttempl/armbpabi.sc
2590 *** ../binutils-2.23.2.orig/ld/scripttempl/armbpabi.sc 2013-05-14 16:39:39.758718177 +0100
2591 --- ld/scripttempl/armbpabi.sc 2013-05-14 16:54:15.657742458 +0100
2592 *************** INTERP=".interp 0 : { *(.interp) }
2594 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
2595 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2596 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2597 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2598 if test -z "${NO_SMALL_DATA}"; then
2599 SBSS=".sbss ${RELOCATING-0} :
2602 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
2603 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2604 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2605 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2606 if test -z "${NO_SMALL_DATA}"; then
2607 SBSS=".sbss ${RELOCATING-0} :
2609 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/elf32sh-symbian.sc ld/scripttempl/elf32sh-symbian.sc
2610 *** ../binutils-2.23.2.orig/ld/scripttempl/elf32sh-symbian.sc 2013-05-14 16:39:39.759718177 +0100
2611 --- ld/scripttempl/elf32sh-symbian.sc 2013-05-14 16:40:07.062718934 +0100
2614 PLT=".plt : { *(.plt) } :dynamic :dyn"
2615 DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn"
2616 RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2617 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) }"
2618 test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
2619 INIT_ARRAY=".init_array ${RELOCATING-0} :
2622 PLT=".plt : { *(.plt) } :dynamic :dyn"
2623 DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn"
2624 RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2625 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) *(.gnu_object_only) }"
2626 test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
2627 INIT_ARRAY=".init_array ${RELOCATING-0} :
2629 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/elf64hppa.sc ld/scripttempl/elf64hppa.sc
2630 *** ../binutils-2.23.2.orig/ld/scripttempl/elf64hppa.sc 2013-05-14 16:39:39.733718177 +0100
2631 --- ld/scripttempl/elf64hppa.sc 2013-05-14 16:55:16.076744133 +0100
2634 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2635 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2636 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.*) }"
2637 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2638 if test -z "${NO_SMALL_DATA}"; then
2639 SBSS=".sbss ${RELOCATING-0} :
2642 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2643 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2644 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.*) }"
2645 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2646 if test -z "${NO_SMALL_DATA}"; then
2647 SBSS=".sbss ${RELOCATING-0} :
2649 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/elf.sc ld/scripttempl/elf.sc
2650 *** ../binutils-2.23.2.orig/ld/scripttempl/elf.sc 2013-05-14 16:39:39.755718177 +0100
2651 --- ld/scripttempl/elf.sc 2013-05-14 16:54:44.618743261 +0100
2652 *************** RELA_IPLT=".rela.iplt ${RELOCATING-0}
2654 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2655 RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
2656 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.*) }"
2657 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2658 if test -z "${NO_SMALL_DATA}"; then
2659 SBSS=".${SBSS_NAME} ${RELOCATING-0} :
2662 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2663 RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
2664 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.*) }"
2665 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2666 if test -z "${NO_SMALL_DATA}"; then
2667 SBSS=".${SBSS_NAME} ${RELOCATING-0} :
2669 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/elfxtensa.sc ld/scripttempl/elfxtensa.sc
2670 *** ../binutils-2.23.2.orig/ld/scripttempl/elfxtensa.sc 2013-05-14 16:39:39.754718177 +0100
2671 --- ld/scripttempl/elfxtensa.sc 2013-05-14 16:55:44.908744932 +0100
2674 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2675 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2676 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.*) }"
2677 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2678 INIT_LIT=".init.literal 0 : { *(.init.literal) }"
2679 INIT=".init 0 : { *(.init) }"
2680 FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
2682 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2683 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2684 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.*) }"
2685 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2686 INIT_LIT=".init.literal 0 : { *(.init.literal) }"
2687 INIT=".init 0 : { *(.init) }"
2688 FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
2689 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/mep.sc ld/scripttempl/mep.sc
2690 *** ../binutils-2.23.2.orig/ld/scripttempl/mep.sc 2013-05-14 16:39:39.755718177 +0100
2691 --- ld/scripttempl/mep.sc 2013-05-14 16:56:08.605745589 +0100
2694 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2695 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2696 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2697 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
2698 if test -z "${NO_SMALL_DATA}"; then
2699 SBSS=".sbss ${RELOCATING-0} :
2702 DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
2703 RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
2704 DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
2705 ! DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
2706 if test -z "${NO_SMALL_DATA}"; then
2707 SBSS=".sbss ${RELOCATING-0} :
2709 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/pep.sc ld/scripttempl/pep.sc
2710 *** ../binutils-2.23.2.orig/ld/scripttempl/pep.sc 2013-05-14 16:39:39.755718177 +0100
2711 --- ld/scripttempl/pep.sc 2013-05-14 16:40:07.064718934 +0100
2712 *************** SECTIONS
2716 ${RELOCATING+ *(.note.GNU-stack)}
2717 ${RELOCATING+ *(.gnu.lto_*)}
2718 + ${RELOCATING+ *(.gnu_object_only)}
2721 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
2722 diff -cpr ../binutils-2.23.2.orig/ld/scripttempl/pe.sc ld/scripttempl/pe.sc
2723 *** ../binutils-2.23.2.orig/ld/scripttempl/pe.sc 2013-05-14 16:39:39.758718177 +0100
2724 --- ld/scripttempl/pe.sc 2013-05-14 16:40:07.064718934 +0100
2725 *************** SECTIONS
2729 ${RELOCATING+ *(.note.GNU-stack)}
2730 ${RELOCATING+ *(.gnu.lto_*)}
2731 + ${RELOCATING+ *(.gnu_object_only)}
2734 .idata ${RELOCATING+BLOCK(__section_alignment__)} :